errno is always left unchanged by successful operations.
errno may be a macro. In a multithreaded process it is almost invariably a macro. However, it is always an lvalue, that is, it may be assigned to.
Each numeric code has a symbolic name and a textual expansion. The symbolic names are used in source code; the textual expansions are printed out when errors are reported to a user.
The textual expansions can be retrieved with strerror or printed with err or warn.
EINVAL Invalid argument: an argument passed to a command or system call was badly formed, invalid, or nonsensical. EFAULT Bad memory reference: a pointer passed as an argument was not valid. ENAMETOOLONG String too long: a string passed as an argument was too long to process. ENOMEM Out of memory: a memory allocation failed. This normally means that a process has used up all the memory available to it (either because of limits or because it has used up all the memory available to the system.) It may also mean that memory allocation within the kernel has failed. EIO Input/output error: a hardware error occured on a device. Media errors on disks fall into this category. ENOENT No such file or directory: the requested filesystem object does/did not exist. ENOTDIR Not a directory: a directory was expected and a non-directory filesystem object was found. EISDIR Is a directory: a non-directory was expected and a directory was found. EEXIST File exists: a filesystem object that was expected not to exist did in fact already exist. EXDEV Cross-device link: an attempt was made to instruct one filesystem to handle files on another filesystem. EAGAIN Try again later: some resource is temporarily unavailable. ESPIPE Illegal seek: a seek operation was attempted on a sequential object where seeking makes no sense, like a terminal. EUNIMP Unimplemented feature: functionality not yet implemented would have been needed to perform the requested operation. ENXIO Device not available: the requested device exists but is not available (is not mounted, is off, etc.) ENODEV No such device: the requested device does not exist. EBUSY Device busy: the requested object cannot be used (or, perhaps, released) because something else is using it. EIOCTL Invalid or inappropriate ioctl: an operation requested via the ioctl system call was not defined or could not be performed on the indicated object. ENOTEMPTY Directory not empty: a directory must be empty of everything (except . and ..) before it may be removed. ERANGE Result too large: the result of an operation did not fit in the space provided. ENOSPC No space left on device: a filesystem is full. EMFILE Too many open files: the process file table is full, so the process cannot open more files. ENFILE Too many open files in system: a system-wide limit of some sort, if any exists, on the number of open files has been reached. ENOSYS No such system call: the call made was not defined, or perhaps not yet implemented. ENOEXEC File is not executable: an execv operation was attempted but the kernel was unable to run the requested program. E2BIG Argument list too long: the space taken up by the argv[] strings passed to a newly started program is larger than the system allows. EBADF Bad file number: a file operation was requested on an illegal file handle, or a file handle that was not open. Or, a write operation was attempted on a file handle that was open only for read or vice-versa.