1. Module (chicken errno)
    1. errno
    2. errno constants

Module (chicken errno)

This module provides access to the standard C errno value.

Be careful, if you're using threads, errno might be clobbered as soon as another thread calls a C function. To prevent this from happening, you can add (declare (disable-interrupts)) at the top of your file, or use the -disable-interrupts compiler option to avoid any context switches while a procedure in this file is running.


[procedure] (errno)

Returns the error code of the last system call.

errno constants

[constant] errno/perm
[constant] errno/noent
[constant] errno/srch
[constant] errno/intr
[constant] errno/io
[constant] errno/noexec
[constant] errno/badf
[constant] errno/child
[constant] errno/nomem
[constant] errno/acces
[constant] errno/fault
[constant] errno/busy
[constant] errno/notdir
[constant] errno/isdir
[constant] errno/inval
[constant] errno/mfile
[constant] errno/nospc
[constant] errno/spipe
[constant] errno/pipe
[constant] errno/again
[constant] errno/rofs
[constant] errno/exist
[constant] errno/wouldblock

These variables contain error codes as returned by errno.

NOTE: On Windows, EWOULDBLOCK does not exist. For consistency, errno/wouldblock does exist, but it is defined as zero.

This does mean that in case there is no error, it looks like the errno/wouldblock error is returned. But you have to check the return code of a system call before accessing errno anyway, so this should typically never happen.

Previous: Module (chicken continuation)

Next: Module (chicken eval)