The low-level interfaces are designed to give Scheme programs access to as much functionality as possible from the underlying Unix system. They can be used to implement higher level intefaces such as the Scheme shell section The Scheme shell (scsh).
Generally there is a single procedure for each corresponding Unix
facility. There are some exceptions, such as procedures implemented for
speed and convenience in Scheme with no primitive Unix equivalent,
e.g., copy-file
.
The interfaces are intended as far as possible to be portable across different versions of Unix, so that Scheme programmers don't need to be concerned with implementation differences. In some cases procedures which can't be implemented (or reimplemented) on particular systems may become no-ops, or perform limited actions. In other cases they may throw errors. It should be possible to use the feature system to determine what functionality is available.
General naming conventions are as follows:
recv!
.
#t
or #f
) have question marks
added, e.g., access?
.
primitive-fork
.
EPERM
or R_OK
are converted
to Scheme variables of the same name (underscores are not replaced
with hyphens).
Most of the procedures can be relied on to return a well-specified value. Unexpected conditions are handled by raising exceptions.
There are a few procedures which return a special
value if they don't succeed, e.g., getenv
returns #f
if it the requested string is not found in the environment. These
cases will be noted in the documentation.
For ways to deal with exceptions, section Exceptions.
Errors which the C-library would report by returning a NULL
pointer or through some other means are reported by raising a
system-error
exception.
The value of the Unix errno
variable is available
in the data passed by the exception. Accessing the
global errno value directly would be unreliable due to
continuations, interrupts or multiple threads.
Go to the first, previous, next, last section, table of contents.