2011-03-30 13:49:47 +00:00
|
|
|
.TH SYSCALL 1
|
|
|
|
.SH NAME
|
|
|
|
syscall \- test a system call
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B syscall
|
|
|
|
[
|
2020-09-20 12:49:12 +00:00
|
|
|
.B -os
|
2011-03-30 13:49:47 +00:00
|
|
|
]
|
|
|
|
.I entry
|
|
|
|
[
|
|
|
|
.I arg ...
|
|
|
|
]
|
|
|
|
.SH DESCRIPTION
|
|
|
|
.I Syscall
|
|
|
|
invokes the system call
|
|
|
|
.I entry
|
|
|
|
with the given arguments.
|
2020-09-20 12:49:12 +00:00
|
|
|
The return value is printed.
|
|
|
|
If an error occured, the error string is also printed.
|
|
|
|
.PP
|
|
|
|
For convenience,
|
|
|
|
.IR write (2)
|
2011-03-30 13:49:47 +00:00
|
|
|
and
|
2020-09-20 12:49:12 +00:00
|
|
|
.IR read (2)
|
|
|
|
are included in
|
|
|
|
.IR entries ,
|
|
|
|
even though they are not strictly syscalls.
|
|
|
|
.PP
|
|
|
|
.I Syscall
|
|
|
|
arguments are integer constants, strings, or the literal
|
|
|
|
.BR buf .
|
|
|
|
The literal
|
2011-03-30 13:49:47 +00:00
|
|
|
.B buf
|
2020-09-20 12:49:12 +00:00
|
|
|
refers to a writable 1 megabyte buffer.
|
|
|
|
Strings and
|
|
|
|
.B buf
|
|
|
|
are passed as pointers.
|
|
|
|
Integers are passed as values.
|
2011-03-30 13:49:47 +00:00
|
|
|
.PP
|
|
|
|
The
|
2020-09-20 12:49:12 +00:00
|
|
|
.B -o
|
|
|
|
option prints contents of the 1MB buffer.
|
|
|
|
For
|
|
|
|
.IR errstr (2)
|
2011-03-30 13:49:47 +00:00
|
|
|
and
|
2020-09-20 12:49:12 +00:00
|
|
|
.IR 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.
|
|
|
|
.PP
|
|
|
|
The
|
2011-03-30 13:49:47 +00:00
|
|
|
.B -s
|
2020-09-20 12:49:12 +00:00
|
|
|
option is similar, but interprets the data as a
|
2011-03-30 13:49:47 +00:00
|
|
|
.IR stat (5)
|
2020-09-20 12:49:12 +00:00
|
|
|
message and formats it to standard output.
|
2011-03-30 13:49:47 +00:00
|
|
|
.SH EXAMPLES
|
|
|
|
Write a string to standard output:
|
|
|
|
.IP
|
|
|
|
.EX
|
|
|
|
syscall write 1 hello 5
|
|
|
|
.EE
|
|
|
|
.PP
|
|
|
|
Print information about the file connected to standard input:
|
|
|
|
.IP
|
|
|
|
.EX
|
|
|
|
syscall -s fstat 0 buf 1024
|
|
|
|
.EE
|
|
|
|
.SH SOURCE
|
|
|
|
.B /sys/src/cmd/syscall
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
Section 2 of this manual.
|
|
|
|
.SH DIAGNOSTICS
|
|
|
|
If
|
|
|
|
.I entry
|
|
|
|
is not known to
|
|
|
|
.IR syscall ,
|
|
|
|
the exit status is
|
|
|
|
.LR unknown .
|
|
|
|
If the system call succeeds, the exit status is null;
|
|
|
|
otherwise the exit status is the string that
|
|
|
|
.IR errstr (2)
|
|
|
|
returns.
|