[Previous] [Contents] [Next]

<errno.h>


Include the standard header <errno.h> to test the value stored in errno by certain library functions. At program startup, the value stored is zero. Library functions store only values greater than zero. Any library function can alter the value stored, but only those cases where a library function is explicitly required to store a value are documented here.

To test whether a library function stores a value in errno, the program should store the value zero there immediately before it calls the library function.

#define EDOM <#if expression>
#define EILSEQ <#if expression> [added with Amendment 1]
#define ERANGE <#if expression>
#define errno <int modifiable lvalue>

An implementation can define additional macros in this standard header that you can test for equality with the value stored. All these additional macros have names that begin with E. The following macros, for example, are added by Posix:

#define E2BIG [argument list too long]
#define EACCES [process lacks access permission]
#define EAGAIN [resource temporarily unavailable]
#define EBADF [bad file descriptor]
#define EBADMSG [bad message]
#define EBUSY [resource is busy]
#define ECANCELED [operation canceled]
#define ECHILD [no child process present]
#define EDEADLK [resource deadlock was avoided]
#define EEXIST [file already exists]
#define EFAULT [bad memory address]
#define EFBIG [file would become too big]
#define EINPROGRESS [asynchronous operation not completed]
#define EINTR [operation interrupted by a signal]
#define EINVAL [invalid argument]
#define EIO [input/output error]
#define EISDIR [can't write to a directory]
#define EMFILE [process has too many files open]
#define EMLINK [too many links to a file]
#define EMSGSIZE [bad message buffer size]
#define ENAMETOOLONG [file name too long]
#define ENFILE [system has too many files open]
#define ENODEV [invalid device operation]
#define ENOENT [bad file or directory name]
#define ENOEXEC [can't execute file]
#define ENOLCK [too many locks on a file or record]
#define ENOMEM [insufficient memory]
#define ENOSPC [insufficient space on a device]
#define ENOSYS [unimplemented function]
#define ENOTDIR [invalid directory name]
#define ENOTEMPTY [directory not empty]
#define ENOTSUP [unsupported feature[
#define ENOTTY [bad I/O control operation]
#define ENXIO [bad device specifier]
#define EPERM [process lacks permission]
#define EPIPE [write to a broken pipe]
#define EROFS [write to a read-only file system]
#define ESPIPE [seek on a pipe]
#define ESRCH [process search failed]
#define ETIMEDOUT [time limit expired]
#define EXDEV [link across file systems]

EDOM

#define EDOM <#if expression>

The macro yields the value stored in errno on a domain error.

EILSEQ

#define EILSEQ <#if expression> [added with Amendment 1]

The macro yields the value stored in errno on an invalid multibyte sequence.

ERANGE

#define ERANGE <#if expression>

The macro yields the value stored in errno on a range error.

errno

#define errno <int modifiable lvalue>

The macro designates an object that is assigned a value greater than zero on certain library errors.


See also the Table of Contents and the Index.

Copyright © 1989-2002 by P.J. Plauger and Jim Brodie. All rights reserved.

[Previous] [Contents] [Next]