Linux Error Numbers
Macro: int E2BIG Argument list too long; used when the arguments passed to a new program being executed with one of the exec functions (see Executing a File) occupy too much Link Felix Frank October 21, 2010, 8:16 am Hi, good thinking, but this article desperately lacks a reference to perror. The system cannot allocate more virtual memory because its capacity is full. Macro: int EAFNOSUPPORT The address family specified for a socket is not supported; it is inconsistent with the protocol being used on the socket. this contact form
Macro: int EMFILE The current process has too many files open and can’t open any more. However, many scripts use an exit 1 as a general bailout-upon-error. Macro: int ENAMETOOLONG Filename too long (longer than PATH_MAX; see Limits for Files) or host name too long (in gethostname or sethostname; see Host Identification). Macro: int EPFNOSUPPORT The socket communications protocol family you requested is not supported. http://www-numi.fnal.gov/offline_software/srt_public_context/WebDocs/Errors/unix_system_errors.html
Linux Errno Example
See Creating a Socket. Macro: int ECONNRESET A network connection was closed for reasons outside the control of the local host, such as by the remote machine rebooting or an unrecoverable protocol violation. Not the answer you're looking for?
This is used by the file locking facilities; see File Locks. For example, if you try to delete a file that is the root of a currently mounted filesystem, you get this error. In the driver implementation (drivers/mmc/core/core.c), it is assumed that card could be removed during the life cycle. Errno.h In C Macro: int ERANGE Range error; used by mathematical functions when the result value is not representable because of overflow or underflow.
Macro: int ETXTBSY An attempt to execute a file that is currently open for writing, or write to a file that is currently being executed. Posix Error Codes rename can cause this error if the file being renamed already has as many links as it can take (see Renaming Files). Macro: int EXDEV An attempt to make an improper link across file systems was detected. How do dragons not burn themselves?
Find lane lines Why wasn't Peter Pettigrew bound with an Unbreakable Vow? Errno.h Windows Why is water-contaminated fuel bad, but water-injection is not? linux system-calls error-handling share|improve this question edited Feb 11 '12 at 0:00 Gilles 380k727001145 asked Feb 28 '11 at 7:02 TheCottonSilk 13327 migrated from stackoverflow.com Feb 28 '11 at 20:33 This My focus is to write articles that will either teach you or help you resolve a problem.
Posix Error Codes
Macro: int EEXIST File exists; an existing file was specified in a context where it only makes sense to specify a new file. This is a “file doesn’t exist” error for ordinary files that are referenced in contexts where they are expected to already exist. Linux Errno Example If you are denied entry to a country at the airport, can you chose to fly to another destination? Errno.h Linux Kernel How to use breakpoints for debugging Who is the tallest?
The man page for many library functions will indicate that they return -1 on error, and set errno. When this happens, you should try the call again. Is Configuration Management useable for a small number of servers? navigate here Macro: int ENOENT No such file or directory.
For some system calls and library functions (e.g., getpriority(2)), -1 is a valid return on success. Ebadf Macro: int EIEIO Go home and have a glass of warm, dairy-fresh milk. Thank you @Keith!
I'll stick to Perl or Python.
Browse other questions tagged c linux sockets or ask your own question. Some functions that must always block (such as connect; see Connecting) never return EAGAIN. Attempts to manipulate the object before the call completes return EALREADY. Errno 0 Macro: int EADDRINUSE The requested socket address is already in use.
Ending a script with exit 127 would certainly cause confusion when troubleshooting (is the error code a "command not found" or a user-defined one?). Macro: int EPROCLIM This means that the per-user limit on new process would be exceeded by an attempted fork. Oh, it's from MySQL, not everybody has this. –Gilles Feb 28 '11 at 21:31 @Gilles D'oh, you beat me to the perl version! ;-) –Mikel Feb 28 '11 at his comment is here Macro: int EISDIR File is a directory; you cannot open a directory for writing, or create or remove hard links to it.
O_EXCL flag is used with O_CREAT, if the file is already exist open call will fail with the proper error number. $ cat fileopen.c #include