Normally, a Scheme error is signaled by the UNIX extension whenever a UNIX system call or library function invoked by any of the above primitives fails. The macro unix-errval allows an application to handle an error condition in a specific way without the need to redefine the standard error handler of Elk.
unix-errval evaluates the specified expression and returns the result of the evaluation. If, during evaluation of the expression, an error is signaled due to failure of a UNIX function, the corresponding primitive procedure returns a unique error object instead of performing normal error handling.
For example, evaluating the expression
(unix-close 1000) ; close a bad file descriptor
(unix-errval (unix-close 1000))
(unix-errval (begin (unix-close 1000) 5))
This procedure returns #t if obj is the error object, #f otherwise. unix-error? is typically used to check whether a primitive invoked under control of unix-errval has signaled an error.
Returns the UNIX errno set by the last system call that has failed. Error codes are represented as symbols corresponding to the names of the standard UNIX error numbers with letters converted to lower case, i.e. enomem, ebadf, etc. The exact set of error codes that can be returned is platform-dependent.
The value returned by unix-errno is not reset when a UNIX system call executes successfully. However, value of unix-errno is also affected by functions from the Elk kernel (such as open-input-file) and possibly other extensions that make use of system calls.
unix-perror writes string followed by a colon and a short
message describing the last UNIX error encountered to the current
unix-perror makes use of the ``~E'' format specifier of the