Perl Programming/Keywords/syscall

The syscall keyword
syscall makes a system call with the first element of the list that may have upto 14 parametres. The remaining parametres are passed altogether as arguments to the system call. If the command is unimplemented, syscall raises an exception.

All given arguments that are numeric are passed as an int. If they are not, a pointer to the string value is passed. A string literal (or other read-only strings) are not allowed as an argument, as Perl has to assume that any string pointer might be written through. If the integer arguments are not literals and have never been interpreted in a numeric context, it may be necessary to add a 0 to them to force them to look like numbers.

syscall emulates the syswrite function (or vice versa)

syscall returns whatever value returned by the called system call. On failure, <tt>-1</tt> is returned and <tt>$!</tt> (errno) is set. As some system calls can legitimately return <tt>-1</tt>, <tt>0</tt> should be assigned to <tt>$!</tt> before the call.

<tt>syscall(&SYS_pipe)</tt> returns the file number of the read end of the pipe it creates, but there is no way to retrieve the file number of the other end. This is a problem that can be avoided by using <tt>pipe</tt> instead.