Explanation of the value of the errno

Source: Internet
Author: User
Tags reserved connection reset volatile

Ifndef _i386_errno_h
#define _i386_errno_h
#define EPERM 1/* Operation not permitted * *
#define ENOENT 2/* No such file or directory */
#define ESRCH 3/* No such process * *
#define EINTR 4/* Interrupted system call * *
#define EIO 5 */I/O error * *
#define ENXIO 6/* No such device or address * *
#define E2BIG 7/* ARG list too long * *
#define ENOEXEC 8/* Exec format Error */
#define EBADF 9/* Bad file number * *
#define ECHILD/* No Child processes * *
#define EAGAIN/* Try again * *
#define ENOMEM/* Out of memory * *
#define EACCES/* Permission denied * *
#define EFAULT/* Bad address * *
#define ENOTBLK/* block Device required * *
#define EBUSY/* Device or resource busy * *
#define EEXIST/* File exists * *
#define EXDEV/* cross-device Link * *
#define ENODEV/* No such device * *
#define ENOTDIR/* Not a directory * *
#define EISDIR/* is a directory * *
#define EINVAL/* Invalid argument * *
#define ENFILE/* File Table Overflow * *
#define EMFILE/* Too many open files */
#define ENOTTY/* Not a typewriter * *
#define ETXTBSY/* Text file Busy * *
#define EFBIG/* File too large * *
#define ENOSPC/* No spaces left on device * * *
#define ESPIPE/* Illegal seek * *
#define EROFS/* read-only File System * *
#define EMLINK/* Too many links */
#define EPIPE/* Broken Pipe * *
#define EDOM/* Math argument out of domain of Func *
#define ERANGE/* Math result is not representable * *
#define EDEADLK/* Resource deadlock would occur * *
#define ENAMETOOLONG/* File name too long * *
#define ENOLCK/No Record locks available * *
#define ENOSYS/* Function not implemented * *
#define ENOTEMPTY/* Directory not empty * *
#define ELOOP/* Too Many symbolic links encountered * *
#define Ewouldblock eagain/* Operation would block * *
#define ENOMSG/* No message of desired type * *
#define EIDRM/* Identifier removed * *
#define ECHRNG/* Channel number out of range * *
#define EL2NSYNC/* Level 2 is not synchronized * *
#define EL3HLT/* Level 3 halted * *
#define EL3RST/* Level 3 Reset */
#define ELNRNG/* Link number out of range * *
#define EUNATCH/* Protocol driver not attached * *
#define ENOCSI/* NO CSI structure Available * *
#define EL2HLT/* Level 2 halted * *
#define EBADE/* Invalid Exchange */
#define EBADR/* Invalid Request Descriptor * *
#define EXFULL/* Exchange full */
#define Enoano/* No Anode * *
#define EBADRQC/* Invalid Request Code * *
#define EBADSLT/* Invalid Slot * *
#define Edeadlock Edeadlk
#define EBFONT/* Bad font file format * *
#define ENOSTR/* Device not a stream * *
#define ENODATA/NO data available * *
#define ETIME/* Timer Expired * *
#define ENOSR/* Out of streams resources * *
#define ENONET/* Machine isn't on the network * *
#define ENOPKG/* Package not installed * *
#define EREMOTE/* Object is remote * *
#define ENOLINK/* Link has been severed * *
#define EADV/* Advertise Error * *
#define ESRMNT/* Srmount Error * *
#define ECOMM/* Communication error on Send * * *
#define EPROTO/* PROTOCOL Error * *
#define EMULTIHOP/* Multihop attempted * *
#define EDOTDOT/* RFS specific Error * *
#define EBADMSG/* Not a data message * *
#define EOVERFLOW/* Value too large for defined data type * *
#define ENOTUNIQ/* Name not unique on network * *
#define EBADFD/* File descriptor in Bad state * *
#define EREMCHG/Remote address changed * *
#define ELIBACC/* Can not access a needed shared library */
#define ELIBBAD/* Accessing a corrupted shared library */
#define ELIBSCN Bayi/*. lib section in a.out corrupted * *
#define ELIBMAX/* Attempting to link too many shared libraries * *
#define ELIBEXEC/* cannot exec a shared library directly * *
#define EILSEQ/* Illegal byte sequence * *
#define ERESTART/* Interrupted system call should is restarted * *
#define ESTRPIPE/* Streams Pipe Error * *
#define EUSERS/* Too many users * *
#define ENOTSOCK/* Socket operation on Non-socket * *
#define EDESTADDRREQ/* Destination Address required * *
#define EMSGSIZE/* Message too long * *
#define EPROTOTYPE/* Protocol wrong type for socket */
#define ENOPROTOOPT/* Protocol not available * *
#define EPROTONOSUPPORT/* Protocol not supported * *
#define ESOCKTNOSUPPORT * * Socket type not supported * *
#define EOPNOTSUPP/* Operation not supported on transport endpoint * *
#define EPFNOSUPPORT/* Protocol Family not supported * *
#define EAFNOSUPPORT * Address family not supported by protocol *
#define EADDRINUSE/* address already with use * *
#define EADDRNOTAVAIL/* Cannot assign requested address * *
#define ENETDOWN/* Network is down */
#define ENETUNREACH/* Network is unreachable * *
#define ENETRESET 102/* Network dropped connection because of reset */
#define ECONNABORTED/* Software caused connection Abort * *
#define ECONNRESET/* Connection Reset by Peer *
#define ENOBUFS/No buffer space Available * *
#define EISCONN/* Transport endpoint is already connected * *
#define ENOTCONN/* Transport endpoint is not connected * *
#define ESHUTDOWN 108/* Cannot send after transport endpoint shutdown * *
#define ETOOMANYREFS 109/* Too many references:cannot splice * *
#define ETIMEDOUT/* Connection timed out * *
#define ECONNREFUSED/* Connection refused * *
#define EHOSTDOWN 112/* Host is down */
#define EHOSTUNREACH 113/* No route to host * *
#define EALREADY 114/* Operation already in progress * *
#define EINPROGRESS * * Operation now Progress * *
#define ESTALE 116/* Stale NFS file handle * *
#define EUCLEAN 117/* Structure needs cleaning * *
#define ENOTNAM 118/* Not a XENIX named type file */
#define ENAVAIL 119/* No XENIX semaphores Available * *
#define EISNAM/* is a named type file */
#define EREMOTEIO 121/* Remote I/O error * *
#define EDQUOT 122/* Quota exceeded * *
#define Enomedium 123/* No Medium found * *
#define EMEDIUMTYPE 124/* Wrong medium type * *
#define ECANCELED/* Operation cancelled * *
#define ENOKEY 126/* Required key Not available * *
#define EKEYEXPIRED 127/* Key has expired * *
#define EKEYREVOKED 128/* Key has been revoked * *
#define EKEYREJECTED 129/* Key is rejected by service * *


Many GNU
The functions in the C Library monitor and report errors, and sometimes your programs need to check them to get the wrong case. For example, if you open an input file, you must check that the file is open correctly, and print an error message or take other actions when you make a call to a library function.

This chapter describes how the error reporting function works. To use this feature, your program must include the header file "Errno.h".

Wrong check

Many library functions return a special value to illustrate their failure. This particular value typically has-1, a null pointer, or a constant defined like EOF. But this return just tells you that the error has occurred. To find out what the error is, you must look at the error code stored in the variable errno. This variable is defined in the header file "Errno.h".

Variable: volatile int errno

The variable errno includes the system's error number, and you can change its value.

When errno is described as volatile, it will likely be changed by a signal processor synchronization; see "Defining the Signal processor". A written signal processor can save or restore the value of a errno, so you don't have to worry about it when you're writing a signal processor.

The initial value of the seemingly errno that the program starts is zero. Many library functions will be guaranteed to set it to a certain non-0 value after encountering certain errors. When these functions run successfully, it will not modify the value of the errno, so when a successful call errno the value does not have to be zero, and you cannot use errno to determine whether a call failed. The correct approach is to check the results of each function report, and then check errno if the call fails.

Some library functions set the errno to a value other than 0 as a return result of calling a different library function that might have failed. You must assume that any library function may change errno.

Compatibility tip: ANSI
C designates errno as a "variable-left value" that is stronger than a variable, allowing it to be implemented like a macro. For example, it can be extended to include a function call: like *
_errno (). In fact, that is the nature of its own on the GNU system. In the GNU Library on non-GNU systems, this is the case anyway.

Here are some library functions, like sqrt and Atan, that can return a valid value in the event of an error. For such a function, if you want to check for errors, the recommended method is to set the errno to 0 before calling the function, and then the function returns to check its value later.

All error codes have a symbolic name; they are all macros defined in "Errno.h". These names are followed by an "E" with a capital letter or number; You must consider these names as reserved words, see the reserved word

All error codes are distinct positive integers. (For example: Since these values are different, you can use them as a label for the switch structure.) You cannot assume other values for these symbolic constants with specific values.

errno values are not limited to these macros, so some library functions will return some other error codes in other cases. Of course, these specific values for these specific library functions listed in the manual have other meanings.

In non-GNU systems, many system calls that have an invalid pointer as arguments are returned to Efault.
Obviously this will happen when your program has bugs, and that doesn't happen in the GNU system, and for space, we don't mention efault when we're describing a separate function.
Error code

All error codes are defined in "Errno.h" in the header, all of which are integer constants after they are expanded. Some of these errors will not occur in the GNU system, but will occur when using the GNU library in other systems.

Macros: int eperm
The operation is not allowed, and only files (or other resources) or the owner of the process can be privileged to do so.

Macros: int enoent
There are no such files or directories. This is a "file does not exist" error on a normal file and the file is not in the referenced directory table.

Macros: int Esrch
No process matches the specified process number.

Macros: int eintr
The function call is interrupted, an asynchronous signal appears and the execution of the call is blocked. When this happens, you must try to call again.
You can choose a function to recover after processing the signal, which is better than the failure of RINTR, "simple signal interruption."

Macros: int Eio
Input and output errors, usually a physical read-write error.

Macros: int Enxio
There is no such device or address. Typically, this means that a file describes a device that is not properly installed and the system cannot find the correct device driver for it.

Macros: int E2big
The parameter table is too long and the arguments passed when using one of the exec functions take up too much memory space. This will not happen in the GNU system.

Macros: int enoexec
Invalid executable file format. This situation is detected by the EXEC function; "Execute a file"

Macros: int EBADF
The wrong file descriptor, for example, for IO operations on a closed file descriptor or for reading a write-open descriptor (and vice versa).

Macros: int Echild
No child processes. This error occurs when you want to manipulate the child process, there is no child process can be manipulated.

Macros: int edeadlk
deadlock avoidance; When allocating system resources, it can lead to deadlocks, for example, see file Lock

Macros: int Enomem
There is no memory available. The system cannot allocate more virtual memory because its capacity is full.

Macros: int eacces
permission is blocked; the permission of the file does not allow the operation to be attempted.

Macros: int efault
Error address, an invalid pointer was detected.

Macros: int enotblk
The given method requires a block of special files and this file is not. For example, this error occurs when trying to hang a regular file on a UNIX system.

Macros: int ebusy
Resource is busy; a system resource that is in use cannot be shared. For example, the file you need to delete is a file system that hangs in the system and you will get this error.

Macros: int eexist
File already exists; This file already exists explicitly in the table of contents when the new file should be manipulated.

Macros: int Exdev
Try a file link across the file system.

Macros: int Enodev
The wrong device type is given in a function that needs to go into the day to indicate the device class.

Macros: int Enotdir
The file is given only when the directory is processed, not the directory.

Macros: int Eisdir
is a directory file; This error occurs when you try to open a directory file for a write operation.

Macros: int einval
An invalid argument. Used to indicate various problems when passing to a library function parameter.

Macros: int enfile
Too many different files are open throughout the system. Note that many of the link channels are computed as an open file; see link Channel

Macros: int emfile
The current process has too many files open and cannot be opened again.

Macros: int Enotty
Improper IO control operations, such as attempting to set terminal mode on a common file.

Macros: int Etxtbsy
A file that you intend to run is currently being opened, or the file you want to write Open is currently running. (This name symbolizes "text file Busy".) This is not an error in the GNU system; If possible, the text file will be copied.

Macros: int Efbig
The file is too large. The file size exceeds the system's permission.

Macros: int ENOSPC
There is no space on the device; The write operation failed because the disk is full.

Macros: int espipe
The wrong lookup operation (for example, in a pipeline).

Macros: int Erofs
An attempt was made to modify a file in a read-only file system.

Macros: int Emlink
Too many connections; the number of links to a single file is too large.

Macros: int epipe
a broken pipe; there is no process on the other side of the pipe to read. All library functions produce a sigpipe signal when they return this error code, and the signal terminates the program if it is not processed or blocked. So, if you don't deal with or stop sigpipe, your program actually doesn't see Epipe.

Macros: int EDOM
Domain Error: This error occurs when a mathematical function gets a parameter value that is not within the allowable bounds of the function.

Macros: int Erange
Range error, this error occurs when the result of a mathematical function cannot be described because of an overflow or underflow.

Macros: int Eagain
Resource 0 is not available; If you wait for this call, you may succeed. Only fork will return the Eagain error code for this reason.

Macros: int Ewouldblock
An operation that requires a block on a target that is not a block format.
Compatibility tip: In 4.4BSD and GNU, Ewouldblock and Eagain are the same. Earlier versions of BSD (see "Berkeley UNIX") used two different codes, using Ewouldblock to represent operations requiring blocks, while eagain represents other kinds of errors.

Macros: int einprogress
An initialization operation on a target that is selected as not a block cannot be completed immediately.

Macros: int Ealready
An operation is in progress on a target that is selected as not a block type.

Macros: int Enotsock
The specified file is not a socket when a socket is needed.

Macros: int edestaddrreq
The destination address was not specified in the socket operation.

Macros: int emsgsize
The maximum size of the supported size operation for messages sent to the socket.

Macros: int Eprototype
The required communication protocol does not support the type of socket.

Macros: int enoprotoopt
The socket operation you specify cannot be recognized by the socket protocol used, see "Socket operation"

Macros: int Eprotonosupport
The socket domain does not support the requested communication protocol. See "Creating a Socket"

Macros: int Esocktnosupport
The socket type is not supported.

Macros: int Eopnotsupp
The operation you requested is not supported. Some socket functions are not recognized by all types of sockets, and some cannot be implemented on all communication protocols.

Macros: int Epfnosupport
The socket protocol group you requested is not supported.

Macros: int Eafnosupport
An address set specified by a socket is not supported, and it is inconsistent with the protocol used by the socket. See "Sockets"

Macros: int Eaddrinuse
The requested socket address is in use. See "Socket Address"

Macros: int Eaddrnotavail
The requested socket address is already unavailable; For example, you try to give a socket a name that is not the same as the native name. See "Socket Address"

Macros: int Enetdown
A socket operation failed due to a network failure.

Macros: int Enetunreach
A socket operation failed because the remote host on the subnet was unreachable.

Macros: int Enetreset
Network connection reset due to a remote host crash.

Macros: int econnaborted
A network connection was interrupted locally.

Macros: int Econnreset
A network connection shutdown due to external control of the local host. such as a remote reboot.

Macros: int Enobufs
The kernel buffers for IO operations are in use.

Macros: int Eisconn
You are trying to connect a socket that has already been connected. See "Creating a connection."

Macros: int Enotconn
Socket is not connected to anything. The reason you got this error is that you tried to transfer data through a socket, but you didn't specify the target of the data first.

Macros: int Eshutdown
The socket has been closed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.