SYSCALL(1)SYSCALL(1)

NAME

syscall – test a system call

SYNOPSIS

syscall [ -os ] entry [ arg ... ]

DESCRIPTION

Syscall invokes the system call entry with the given arguments. The return value is printed. If an error occured, the error string is also printed.

For convenience, write(2) and read(2) are included in entries, even though they are not strictly syscalls.

Syscall arguments are integer constants, strings, or the literal buf. The literal buf refers to a writable 1 megabyte buffer. Strings and buf are passed as pointers. Integers are passed as values.

The -o option prints contents of the 1MB buffer. For errstr(2) and fd2path(2), the buffer is treated as a 0-terminated string. For other calls, the number of bytes printed is determined by the system call’s return value.

The -s option is similar, but interprets the data as a stat(5) message and formats it to standard output.

EXAMPLES

Write a string to standard output:

 

syscall write 1 hello 5

Print information about the file connected to standard input:

 

syscall -s fstat 0 buf 1024

SOURCE

/sys/src/cmd/syscall

SEE ALSO

Section 2 of this manual.

DIAGNOSTICS

If entry is not known to syscall, the exit status is unknown. If the system call succeeds, the exit status is null; otherwise the exit status is the string that errstr(2) returns.