libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]



#include <errno.h>

extern int errno;


This variable is used to hold the value of the error of the last function call. The value might be one of the following:


No Error. Library functions never set errno to zero, but the startup code does that just before calling main (this is ANSI C requirement).


EDOM -- Numerical input to a function is out of range.


ERANGE -- Numerical output of a function is out of range.


E2BIG -- Argument list too long. system and the functions from the spawn family assign this to errno when the command line is too long (longer than 126-character limit when invoking non-DJGPP programs, or longer than the transfer buffer size when invoking DJGPP programs).


EACCES -- Permission denied. Attempt to write to a read-only file, or remove a non-empty directory, or open a directory as if it were a file, etc. In essence, it's a DOS way of saying "You can't do that, but I'm too stupid to know why."


EAGAIN -- Resource temporarily unavailable, try again later. Almost never used in DJGPP, except when DOS returns error code 3Dh ("network print queue full") 81h (NetWare4 "CWait children still running") or 9Bh (NetWare4 "unable to create another TCB").


EBADF -- Bad file descriptor: an invalid file handle passed to a library function.


EBUSY -- Resource busy. Attempt to remove current directory (including current directory on another drive), or when a networked resource, such as a drive, is in use by another process.


ECHILD -- No child processes. Returned by wait and waitpid, and by NetWare-related calls.


EDEADLK -- Resource deadlock avoided. Never used in DJGPP.


EEXIST -- File exists. Returned by open and mkdir when a file or directory by that name already exists.


EFAULT -- Bad address. A function was passed a bad pointer (like a NULL pointer).


EFBIG -- File too large. Never used in DJGPP.


EINTR -- Interrupted system call. system and the functions of the spawn family use that when the child program was interrupted by Ctrl-C. Also, when DOS returns the "fail on INT 24h" error code.


EINVAL -- Invalid argument. Any case when any argument to a library function is found to be invalid. Examples include invalid drive number, "." or ".." as one of the arguments to rename, syntax errors in the command line passed to system, etc.


EIO -- Input or output error. Low-level error in I/O operation, like bad disk block, damaged FAT, etc.


EISDIR -- Is a directory: an attempt to do something with a directory which is only allowed with regular files. DOS usually returns EACCES in these cases, but DJGPP sometimes assigns EISDIR to errno, like when rename is called to move a regular file over a directory, or when system or one of the spawn* functions are passed a name of a directory instead of an executable program.


EMFILE -- Too many open files in system (no more handles available). This usually means that the number specified by the `FILES=' directive in `CONFIG.SYS' is too small.


EMLINK -- Too many links. Not used in DJGPP (as DOS doesn't support hard links).


ENAMETOOLONG -- File name too long (longer than FILENAME_MAX, defined in `stdio.h').


ENFILE -- Too many open files. Never used in DJGPP.


ENODEV -- No such device. Attempt to access an invalid drive, or an invalid operation for the type of drive.


ENOENT -- No such file or directory.


ENOEXEC -- Unable to execute file. Returned by _dxe_load (when the argument names a file that isn't a valid DXE), and by NetWare-related calls which run programs remotely.


ENOLCK -- No locks available. Returned when the DOS file-locking functions cannot lock more files (due to overflow of the sharing buffer).


ENOMEM -- Not enough memory. Note that, unlike your expectations, malloc does NOT set errno to ENOMEM; however, several library functions that use malloc will do that when it returns a NULL pointer.


ENOSPC -- No space left on drive. DOS usually doesn't return this error, but write and _write do this for it, when they detect a full disk condition.


ENOSYS -- Function not implemented. Any system call that isn't supported by the underlying OS, like an LFN function when running on plain DOS.


ENOTDIR -- Not a directory. DOS never returns this code, but some library functions, like rename and _truename, do that if they expect a valid directory pathname, but get either an invalid (e.g. empty) pathname or a file that is not a directory.


ENOTEMPTY -- Directory not empty. DOS never returns this code, but rename does, when it is called to move a directory over an existing non-empty directory.


ENOTTY -- Inappropriate I/O control operation. The termios functions set errno to this when called on a device that is not a TTY.


ENXIO -- No such device or address. An operation attempted to reference a device (not a disk drive) that is invalid, or non-existent, or access a disk drive that exists but is empty.


EPERM -- Operation not permitted. Examples include: sharing or file lock violations; denial of access to networked resources; expired password or illegal login attempts via a network; too many or duplicate network redirections; etc.


EPIPE -- Broken pipe: attempt to write to a pipe with nobody to read it. This never happens in DJGPP.


EROFS -- Read-only file system: attempt to write to a read-only disk. Unfortunately, DOS almost never returns this code.


ESPIPE -- Invalid seek: attempt to seek on a pipe. Never happens in DJGPP, except for NetWare-related operations, since pipes are simulated with regular files in MS-DOS, and therefore are always seekable.


ESRCH -- No such process. Not used in DJGPP.


EXDEV -- Improper link. An attempt to rename a file across drives or create a cross-device hardlink.


ENMFILE -- No more files. findfirst and findnext assign this to errno when they exhaust the files in the directory. readdir does that as well.


ELOOP -- Too many levels of symbolic links. Can be set virtually by any file handling function in library. Usually means encountered link loop (link1 -> link2, link2 -> link1).


EOVERFLOW -- Value too large. filelength can assign this to errno when a file's length is larger than 2^31-2 (see section filelength). lfilelength can assign this to errno when a file's length is larger than 2^63-1 (see section lfilelength).


EILSEQ -- Invalid or incomplete multibyte or wide character.

See section perror.


POSIX 1003.2-1992; 1003.1-2001

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004