Next: , Previous: , Up: UNIX Interface   [Contents][Index]


6.6 Unix System Calls

You probably won’t have much cause to use them, but all the Unix system calls are available. The Unix system call functions are in the Unix package. The name of the interface for a particular system call is the name of the system call prepended with unix-. The system usually defines the associated constants without any prefix name. To find out how to use a particular system call, try using describe on it. If that is unhelpful, look at the source in unix.lisp or consult your system maintainer.

The Unix system calls indicate an error by returning nil as the first value and the Unix error number as the second value. If the call succeeds, then the first value will always be non-nil, often t.

For example, to use the chdir syscall:

(multiple-value-bind (success errno)
    (unix:unix-chdir "/tmp")
  (unless success
     (error "Can't change working directory: ~a"
            (unix:get-unix-error-msg errno))))
Function: Unix:get-unix-error-msg error

This function returns a string describing the Unix error number error (this is similar to the Unix function perror).