INDIR(2)

NAME
indir, syscall - indirect system call

SYNOPSIS
syscall(number, r0, r1, arg ...) (PDP-11)
syscall(number, arg, ...) (VAX-11)

DESCRIPTION
Syscall performs the system call whose assembly language interface has the specified number, register arguments r0 and r1 (on the PDP-11, regardless of whether the entry point really uses them) and further arguments arg.

The r0 value of the system call is returned.

DIAGNOSTICS
When the C-bit is set, syscall returns -1 and sets the external variable errno (see intro(2)).

BUGS
There is no way to simulate system calls such as pipe(2), which return values in register r1.

ASSEMBLER (PDP-11)
(indir = 0.)
sys indir; call

The system call at the location call is executed. Execution resumes after the indir call.

On the PDP-11, the main purpose of 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.

If indir is executed indirectly, it is a no-op. If the instruction at the indirect location is not a system call, indir returns error code EINVAL; see intro(2).