source: branches/minix3-book/include/errno.h@ 4

Last change on this file since 4 was 4, checked in by Mattia Monga, 13 years ago

Importazione sorgenti libro

File size: 6.1 KB
Line 
1/* The <errno.h> header defines the numbers of the various errors that can
2 * occur during program execution. They are visible to user programs and
3 * should be small positive integers. However, they are also used within
4 * MINIX, where they must be negative. For example, the READ system call is
5 * executed internally by calling do_read(). This function returns either a
6 * (negative) error number or a (positive) number of bytes actually read.
7 *
8 * To solve the problem of having the error numbers be negative inside the
9 * the system and positive outside, the following mechanism is used. All the
10 * definitions are are the form:
11 *
12 * #define EPERM (_SIGN 1)
13 *
14 * If the macro _SYSTEM is defined, then _SIGN is set to "-", otherwise it is
15 * set to "". Thus when compiling the operating system, the macro _SYSTEM
16 * will be defined, setting EPERM to (- 1), whereas when when this
17 * file is included in an ordinary user program, EPERM has the value ( 1).
18 */
19
20#ifndef _ERRNO_H /* check if <errno.h> is already included */
21#define _ERRNO_H /* it is not included; note that fact */
22
23/* Now define _SIGN as "" or "-" depending on _SYSTEM. */
24#ifdef _SYSTEM
25# define _SIGN -
26# define OK 0
27#else
28# define _SIGN
29#endif
30
31extern int errno; /* place where the error numbers go */
32
33/* Here are the numerical values of the error numbers. */
34#define _NERROR 70 /* number of errors */
35
36#define EGENERIC (_SIGN 99) /* generic error */
37#define EPERM (_SIGN 1) /* operation not permitted */
38#define ENOENT (_SIGN 2) /* no such file or directory */
39#define ESRCH (_SIGN 3) /* no such process */
40#define EINTR (_SIGN 4) /* interrupted function call */
41#define EIO (_SIGN 5) /* input/output error */
42#define ENXIO (_SIGN 6) /* no such device or address */
43#define E2BIG (_SIGN 7) /* arg list too long */
44#define ENOEXEC (_SIGN 8) /* exec format error */
45#define EBADF (_SIGN 9) /* bad file descriptor */
46#define ECHILD (_SIGN 10) /* no child process */
47#define EAGAIN (_SIGN 11) /* resource temporarily unavailable */
48#define ENOMEM (_SIGN 12) /* not enough space */
49#define EACCES (_SIGN 13) /* permission denied */
50#define EFAULT (_SIGN 14) /* bad address */
51#define ENOTBLK (_SIGN 15) /* Extension: not a block special file */
52#define EBUSY (_SIGN 16) /* resource busy */
53#define EEXIST (_SIGN 17) /* file exists */
54#define EXDEV (_SIGN 18) /* improper link */
55#define ENODEV (_SIGN 19) /* no such device */
56#define ENOTDIR (_SIGN 20) /* not a directory */
57#define EISDIR (_SIGN 21) /* is a directory */
58#define EINVAL (_SIGN 22) /* invalid argument */
59#define ENFILE (_SIGN 23) /* too many open files in system */
60#define EMFILE (_SIGN 24) /* too many open files */
61#define ENOTTY (_SIGN 25) /* inappropriate I/O control operation */
62#define ETXTBSY (_SIGN 26) /* no longer used */
63#define EFBIG (_SIGN 27) /* file too large */
64#define ENOSPC (_SIGN 28) /* no space left on device */
65#define ESPIPE (_SIGN 29) /* invalid seek */
66#define EROFS (_SIGN 30) /* read-only file system */
67#define EMLINK (_SIGN 31) /* too many links */
68#define EPIPE (_SIGN 32) /* broken pipe */
69#define EDOM (_SIGN 33) /* domain error (from ANSI C std) */
70#define ERANGE (_SIGN 34) /* result too large (from ANSI C std) */
71#define EDEADLK (_SIGN 35) /* resource deadlock avoided */
72#define ENAMETOOLONG (_SIGN 36) /* file name too long */
73#define ENOLCK (_SIGN 37) /* no locks available */
74#define ENOSYS (_SIGN 38) /* function not implemented */
75#define ENOTEMPTY (_SIGN 39) /* directory not empty */
76
77/* The following errors relate to networking. */
78#define EPACKSIZE (_SIGN 50) /* invalid packet size for some protocol */
79#define EOUTOFBUFS (_SIGN 51) /* not enough buffers left */
80#define EBADIOCTL (_SIGN 52) /* illegal ioctl for device */
81#define EBADMODE (_SIGN 53) /* badmode in ioctl */
82#define EWOULDBLOCK (_SIGN 54)
83#define EBADDEST (_SIGN 55) /* not a valid destination address */
84#define EDSTNOTRCH (_SIGN 56) /* destination not reachable */
85#define EISCONN (_SIGN 57) /* all ready connected */
86#define EADDRINUSE (_SIGN 58) /* address in use */
87#define ECONNREFUSED (_SIGN 59) /* connection refused */
88#define ECONNRESET (_SIGN 60) /* connection reset */
89#define ETIMEDOUT (_SIGN 61) /* connection timed out */
90#define EURG (_SIGN 62) /* urgent data present */
91#define ENOURG (_SIGN 63) /* no urgent data present */
92#define ENOTCONN (_SIGN 64) /* no connection (yet or anymore) */
93#define ESHUTDOWN (_SIGN 65) /* a write call to a shutdown connection */
94#define ENOCONN (_SIGN 66) /* no such connection */
95#define EAFNOSUPPORT (_SIGN 67) /* address family not supported */
96#define EPROTONOSUPPORT (_SIGN 68) /* protocol not supported by AF */
97#define EPROTOTYPE (_SIGN 69) /* Protocol wrong type for socket */
98#define EINPROGRESS (_SIGN 70) /* Operation now in progress */
99#define EADDRNOTAVAIL (_SIGN 71) /* Can't assign requested address */
100#define EALREADY (_SIGN 72) /* Connection already in progress */
101#define EMSGSIZE (_SIGN 73) /* Message too long */
102
103/* The following are not POSIX errors, but they can still happen.
104 * All of these are generated by the kernel and relate to message passing.
105 */
106#define ELOCKED (_SIGN 101) /* can't send message due to deadlock */
107#define EBADCALL (_SIGN 102) /* illegal system call number */
108#define EBADSRCDST (_SIGN 103) /* bad source or destination process */
109#define ECALLDENIED (_SIGN 104) /* no permission for system call */
110#define EDEADDST (_SIGN 105) /* send destination is not alive */
111#define ENOTREADY (_SIGN 106) /* source or destination is not ready */
112#define EBADREQUEST (_SIGN 107) /* destination cannot handle request */
113#define EDONTREPLY (_SIGN 201) /* pseudo-code: don't send a reply */
114
115#endif /* _ERRNO_H */
Note: See TracBrowser for help on using the repository browser.