Pristine Ack-5.5
[Ack-5.5.git] / lib / minix / include / sys / errno.h
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               39  /* number of errors */  
35
36 #define ERROR         (_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 are not POSIX errors, but they can still happen. */
78 #define ELOCKED      (_SIGN 101)  /* can't send message */
79 #define EBADCALL     (_SIGN 102)  /* error on send/receive */
80
81 /* The following error codes are generated by the kernel itself. */
82 #ifdef _SYSTEM
83 #define E_BAD_DEST        -1    /* destination address illegal */
84 #define E_BAD_SRC         -2    /* source address illegal */
85 #define E_TRY_AGAIN       -3    /* can't send-- tables full */
86 #define E_OVERRUN         -4    /* interrupt for task that is not waiting */
87 #define E_BAD_BUF         -5    /* message buf outside caller's addr space */
88 #define E_TASK            -6    /* can't send to task */
89 #define E_NO_MESSAGE      -7    /* RECEIVE failed: no message present */
90 #define E_NO_PERM         -8    /* ordinary users can't send to tasks */
91 #define E_BAD_FCN         -9    /* only valid fcns are SEND, RECEIVE, BOTH */
92 #define E_BAD_ADDR       -10    /* bad address given to utility routine */
93 #define E_BAD_PROC       -11    /* bad proc number given to utility */
94 #endif /* _SYSTEM */
95
96 #endif /* _ERRNO_H */