values of the global errno variable
#include <errno.h>
The errno variable is set to certain error values by many functions whenever an error has occurred.
|
In QNX, many library functions make use of calls such as Send(), Sendfd() or qnx_vc_attach(). In order to avoid repetition in the description of possible errno values for each library function, the following table summarizes the errno values that may occur when the above functions are called:
Value | Meaning |
---|---|
EAGAIN | No more Process Manager to Network Manager queue packets available. |
EBADF | The process associated with the file descriptor was not valid. This error can occur with Sendfd(). |
EDSTFAULT | Destination would fault on a message pass. |
EFAULT | In order to complete the message exchange the current process would have incurred a segment violation. Your buffer(s) may be invalid or too small. |
EHOSTUNREACH | The destination node isn't in the Network Manager's netmap, or a physical I/O error occurred trying to communicate to the node. |
EINTR | The call was interrupted by a signal. |
EINVAL | The virtual circuit buffer cannot be grown because the message length is too large. |
ENOLIC | An attempt was made to communicate with a node outside your current licensing capabilities. |
ENOMEM | Insufficient memory to grow the virtual circuit buffer. |
ENOSYS | No Network Manager found. |
ENOVPE | No process entry available for virtual circuit. |
ESRCH | The process ID specified isn't valid |
The following errors may be returned when the filesystem detects a serious problem, or when a device or driver failure occurs:
Value | Meaning |
---|---|
EBADFSYS | Filesystem corruption detected. |
EIO | A file-related I/O error, usually indicating a device or disk failure (for example, a bad block), or a driver has been removed. |
errno may be implemented as a macro, but can always be examined or set as if it were a simple integer variable. Values for errno are defined in the file <errno.h>, and include at least the following values:
Value | Meaning |
---|---|
E2BIG | Arg list too long |
EACCES | Permission denied |
EAGAIN | Resource temporarily unavailable, try again |
EBADF | Bad file descriptor |
EBADFSYS | Corrupted file system detected |
EBUSY | Device or resource busy |
ECHILD | No child processes |
ECHRNG | Channel number out of range |
ECTRLTERM | Remap to the controlling terminal |
EDEADLK | Resource deadlock avoided |
EDOM | Math arg out of domain of func |
EEXIST | File exists |
EFAULT | Bad address |
EFBIG | File too large |
EHOSTUNREACH | Unable to communicate to remote node |
EIDRM | Identifier removed |
EINTR | Interrupted function call |
EINVAL | Invalid argument |
EIO | I/O error |
EISDIR | Is a directory |
EL2HLT | Level 2 halted |
EL2NSYNC | Level 2 not synchronized |
EL3HLT | Level 3 halted |
EL3RST | Level 3 reset |
ELIBACC | Can't access shared library |
ELIBBAD | Accessing a corrupted shared lib |
ELIBEXEC | Attempting to exec a shared lib |
ELIBMAX | Attempting to link in too many libs |
ELIBSCN | .lib section in a.out is corrupted |
ELNRNG | Link number out of range |
ELOOP | Too many levels of symbolic links or prefixes |
EMFILE | Too many open files |
EMLINK | Too many links |
EMORE | More to do, send message again |
ENAMETOOLONG | Filename too long |
ENFILE | Too many open files in the system |
ENO32BIT | 32-bit integer fields were used |
ENOCSI | No CSI structure available |
ENODEV | No such device |
ENOENT | No such file or directory |
ENOEXEC | Exec format error |
ENOLCK | No locks available |
ENOLIC | No license available |
ENOMEM | Not enough memory |
ENOMSG | No message of desired type |
ENONDP | Need an NDP (8087...) to run |
ENONETQ | process manager-to-net enqueuing failed |
ENOREMOTE | Must be done on local machine |
ENOSPC | No space left on device |
ENOSYS | Function not implemented |
ENOTBLK | Block device required |
ENOTDIR | Not a directory |
ENOTEMPTY | Directory not empty |
ENOTTY | Inappropriate I/O control operation |
ENOVPE | no proc entry avail for virtual process |
ENXIO | No such device or address |
EOK | No error |
EOPNOTSUPP | Operation not supported |
EPERM | Operation not permitted |
EPIPE | Broken pipe |
ERANGE | Result too large |
EROFS | Read-only file system |
ESPIPE | Illegal seek |
ESRCH | No such process |
ETXTBSY | Text file busy |
EUNATCH | Protocol driver not attached |
EVIDBUF2BIG | told to allocate a vid buf too big |
EVIDBUF2SML | told to allocate a vid buf too small |
EXDEV | Cross-device link |
/* * The following program makes an illegal call * to the write() function, then prints the * value held in 'errno'. */ #include <stdio.h> #include <unistd.h> #include <errno.h> #include <string.h> int main( void ) { int errvalue; errno = 0; write( -1, "hello, world\n", strlen( "hello, world\n" ) ); errvalue = errno; printf( "The error generated was %d\n", errvalue ); return( errvalue ); }
POSIX 1003.1
errno may be implemented as a macro, but can always be examined or set as if it were a simple integer variable.