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 |
|
---|
31 | extern 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 | #define ELOOP (_SIGN 40) /* too many levels of symlinks detected */
|
---|
77 |
|
---|
78 | /* The following errors relate to networking. */
|
---|
79 | #define EPACKSIZE (_SIGN 50) /* invalid packet size for some protocol */
|
---|
80 | #define EOUTOFBUFS (_SIGN 51) /* not enough buffers left */
|
---|
81 | #define EBADIOCTL (_SIGN 52) /* illegal ioctl for device */
|
---|
82 | #define EBADMODE (_SIGN 53) /* badmode in ioctl */
|
---|
83 | #define EWOULDBLOCK (_SIGN 54)
|
---|
84 | #define EBADDEST (_SIGN 55) /* not a valid destination address */
|
---|
85 | #define EDSTNOTRCH (_SIGN 56) /* destination not reachable */
|
---|
86 | #define EISCONN (_SIGN 57) /* all ready connected */
|
---|
87 | #define EADDRINUSE (_SIGN 58) /* address in use */
|
---|
88 | #define ECONNREFUSED (_SIGN 59) /* connection refused */
|
---|
89 | #define ECONNRESET (_SIGN 60) /* connection reset */
|
---|
90 | #define ETIMEDOUT (_SIGN 61) /* connection timed out */
|
---|
91 | #define EURG (_SIGN 62) /* urgent data present */
|
---|
92 | #define ENOURG (_SIGN 63) /* no urgent data present */
|
---|
93 | #define ENOTCONN (_SIGN 64) /* no connection (yet or anymore) */
|
---|
94 | #define ESHUTDOWN (_SIGN 65) /* a write call to a shutdown connection */
|
---|
95 | #define ENOCONN (_SIGN 66) /* no such connection */
|
---|
96 | #define EAFNOSUPPORT (_SIGN 67) /* address family not supported */
|
---|
97 | #define EPROTONOSUPPORT (_SIGN 68) /* protocol not supported by AF */
|
---|
98 | #define EPROTOTYPE (_SIGN 69) /* Protocol wrong type for socket */
|
---|
99 | #define EINPROGRESS (_SIGN 70) /* Operation now in progress */
|
---|
100 | #define EADDRNOTAVAIL (_SIGN 71) /* Can't assign requested address */
|
---|
101 | #define EALREADY (_SIGN 72) /* Connection already in progress */
|
---|
102 | #define EMSGSIZE (_SIGN 73) /* Message too long */
|
---|
103 | #define ENOTSOCK (_SIGN 74) /* Socket operation on non-socket */
|
---|
104 | #define ENOPROTOOPT (_SIGN 75) /* Protocol not available */
|
---|
105 |
|
---|
106 | /* The following are not POSIX errors, but they can still happen.
|
---|
107 | * All of these are generated by the kernel and relate to message passing.
|
---|
108 | */
|
---|
109 | #define ELOCKED (_SIGN 101) /* can't send message due to deadlock */
|
---|
110 | #define EBADCALL (_SIGN 102) /* illegal system call number */
|
---|
111 | #define EBADSRCDST (_SIGN 103) /* bad source or destination process */
|
---|
112 | #define ECALLDENIED (_SIGN 104) /* no permission for system call */
|
---|
113 | #define EDEADSRCDST (_SIGN 105) /* source or destination is not alive */
|
---|
114 | #define ENOTREADY (_SIGN 106) /* source or destination is not ready */
|
---|
115 | #define EBADREQUEST (_SIGN 107) /* destination cannot handle request */
|
---|
116 | #define ESRCDIED (_SIGN 108) /* source just died */
|
---|
117 | #define EDSTDIED (_SIGN 109) /* destination just died */
|
---|
118 | #define ETRAPDENIED (_SIGN 110) /* IPC trap not allowed */
|
---|
119 | #define EDONTREPLY (_SIGN 201) /* pseudo-code: don't send a reply */
|
---|
120 |
|
---|
121 | #endif /* _ERRNO_H */
|
---|