3BSD/usr/man/man2/indir.2

Compare this file to the similar file:
Show the results in this format:

.TH INDIR 2 
.SH NAME
indir, syscall \- indirect system call
.SH SYNOPSIS
.BR "syscall(number, r0, r1, arg ...)" \  \  (PDP-11)
.br
.BR "syscall(number, arg, ...)" \  \  (VAX-11)
.SH DESCRIPTION
.I Syscall
performs the system call whose assembly language
interface has the specified
.I number,
register arguments
.I r0
and
.I r1
(on the PDP-11, regardless of whether the entry point really
uses them) and further arguments
.IR arg .
.PP
The r0 value of the system call is returned.
.SH DIAGNOSTICS
When the C-bit is set,
.I syscall
returns \-1 and sets the
external variable 
.I errno
(see
.IR intro (2)).
.SH BUGS
There is no way to simulate system calls
such as
.IR pipe (2),
which return values in register r1.
.SH "ASSEMBLER (PDP-11)"
(indir = 0.)
.br
.B sys indir; call
.PP
The system call at the location
.I call
is executed.
Execution resumes after the
.I indir
call.
.PP
On the PDP-11, the main purpose of
.I indir
is to allow a program to
store arguments in system calls and execute them
out of line in the data segment.
This preserves the purity of the text segment.
.PP
If
.I indir
is executed indirectly,
it is a no-op.
If the instruction at the indirect
location is not a system call,
.I indir
returns error code EINVAL;
see
.IR intro (2).