Flashnux

GNU/Linux man pages

Livre :
Expressions régulières,
Syntaxe et mise en oeuvre :

ISBN : 978-2-7460-9712-4
EAN : 9782746097124
(Editions ENI)

GNU/Linux

CentOS 4.8

i386

errno(3)


ERRNO

ERRNO

NAME
SYNOPSIS
DESCRIPTION
NOTE
SEE ALSO

NAME

errno − number of last error

SYNOPSIS

#include <errno.h>

extern int errno;

DESCRIPTION

The integer errno is set by system calls (and some library functions) to indicate what went wrong. Its value is significant only when the call returned an error (usually −1), and a library function that does succeed is allowed to change errno.

Sometimes, when −1 is also a legal return value one has to zero errno before the call in order to detect possible errors.

errno is defined by the ISO C standard to be a modifiable lvalue of type int, and must not be explicitly declared; errno may be a macro. errno is thread-local; setting it in one thread does not affect its value in any other thread.

Valid error numbers are all non-zero; errno is never set to zero by any library function. All the error names specified by POSIX.1 must have distinct values.

POSIX.1 (2001 edition) lists the following symbolic error names. Of these, EDOM and ERANGE are in the ISO C standard. ISO C Amendment 1 defines the additional error number EILSEQ for coding errors in multibyte or wide characters.

E2BIG

Arg list too long

EACCES

Permission denied

EADDRINUSE

Address in use

EADDRNOTAVAIL

Address not available

EAFNOSUPPORT

Address family not supported

EAGAIN

Resource temporarily unavailable

EALREADY

Connection already in progress

EBADF

Bad file descriptor

EBADMSG

Bad message

EBUSY

Resource busy

ECANCELED

Operation canceled

ECHILD

No child processes

ECONNABORTED

Connection aborted

ECONNREFUSED

Connection refused

ECONNRESET

Connection reset

EDEADLK

Resource deadlock avoided

EDESTADDRREQ

Destination address required

EDOM

Domain error

EDQUOT

Reserved

EEXIST

File exists

EFAULT

Bad address

EFBIG

File too large

EHOSTUNREACH

Host is unreachable

EIDRM

Identifier removed

EILSEQ

Illegal byte sequence

EINPROGRESS

Operation in progress

EINTR

Interrupted function call

EINVAL

Invalid argument

EIO

Input/output error

EISCONN

Socket is connected

EISDIR

Is a directory

ELOOP

Too many levels of symbolic links

EMFILE

Too many open files

EMLINK

Too many links

EMSGSIZE

Inappropriate message buffer length

EMULTIHOP

Reserved

ENAMETOOLONG

Filename too long

ENETDOWN

Network is down

ENETRESET

Connection aborted by network

ENETUNREACH

Network unreachable

ENFILE

Too many open files in system

ENOBUFS

No buffer space available

ENODATA

No message is available on the STREAM head read queue

ENODEV

No such device

ENOENT

No such file or directory

ENOEXEC

Exec format error

ENOLCK

No locks available

ENOLINK

Reserved

ENOMEM

Not enough space

ENOMSG

No message of the desired type

ENOPROTOOPT

Protocol not available

ENOSPC

No space left on device

ENOSR

No STREAM resources

ENOSTR

Not a STREAM

ENOSYS

Function not implemented

ENOTCONN

The socket is not connected

ENOTDIR

Not a directory

ENOTEMPTY

Directory not empty

ENOTSOCK

Not a socket

ENOTSUP

Not supported

ENOTTY

Inappropriate I/O control operation

ENXIO

No such device or address

EOPNOTSUPP

Operation not supported on socket

EOVERFLOW

Value too large to be stored in data type

EPERM

Operation not permitted

EPIPE

Broken pipe

EPROTO

Protocol error

EPROTONOSUPPORT

Protocol not supported

EPROTOTYPE

Protocol wrong type for socket

ERANGE

Result too large

EROFS

Read-only file system

ESPIPE

Invalid seek

ESRCH

No such process

ESTALE

Reserved

ETIME

STREAM ioctl() timeout

ETIMEDOUT

Operation timed out

ETXTBSY

Test file busy

EWOULDBLOCK

Operation would block (may be same value as EAGAIN)

EXDEV

Improper link

NOTE

A common mistake is to do

if (somecall() == -1) {
printf("somecall() failed\n");
if (errno == ...) { ... }
}

where errno no longer needs to have the value it had upon return from somecall(). If the value of errno should be preserved across a library call, it must be saved:

if (somecall() == -1) {
int errsv = errno;
printf("somecall() failed\n");
if (errsv == ...) { ... }
}

SEE ALSO

perror(3), strerror(3)



errno(3)