1 /** @file
2   The header <errno.h> defines several macros, all relating to the reporting of
3   error conditions.
4 
5   The ISO/IEC 9899 specification requires that these be macros.
6 
7   The macros expand to integral constant expressions
8   with distinct nonzero values, suitable for use in #if preprocessing
9   directives; the variable errno which expands to a modifiable lvalue that has type int,
10   the value of which is set to a positive error number by several library
11   functions; and the variable EFIerrno which is an extension allowing the return status
12   of the underlying UEFI functions to be returned.
13 
14   The value of errno and EFIerrno is zero at program startup.  On program startup, errno
15   is initialized to zero but is never set to zero by
16   any library function.  The value of errno may be set to a non-zero value by
17   a library function call whether or not there is an error, provided the use
18   of errno is not documented in the description of the function in
19   the governing standard: ISO/IEC 9899:1990 with Amendment 1 or ISO/IEC 9899:199409.
20 
21   EFIerrno, like errno, should only be checked if it is known that the preceeding function call
22   called a UEFI function.  Functions in which UEFI functions are called dependent upon context
23   or parameter values should guarantee that EFIerrno is set to zero by default, or to the status
24   value returned by any UEFI functions which are called.
25 
26   All macro definitions in this list must begin with the letter 'E'
27   and be followed by a digit or an uppercase letter.
28 
29   Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
30   This program and the accompanying materials are licensed and made available under
31   the terms and conditions of the BSD License that accompanies this distribution.
32   The full text of the license may be found at
33   http://opensource.org/licenses/bsd-license.
34 
35   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
36   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
37 **/
38 #ifndef _ERRNO_H
39 #define _ERRNO_H
40 #include  <sys/EfiCdefs.h>
41 #include  <sys/errno.h>
42 
43 extern  int             errno;
44 extern  RETURN_STATUS   EFIerrno;
45 
46 // Define error number in terms of the ENUM in <sys/errno.h>
47 
48 #define ERESTART          -1                      /* restart syscall */
49 #define ESUCCESS          __ESUCCESS              /* No Problems */
50 
51 #define EMINERRORVAL      __EMINERRORVAL          /*  1   The lowest valid error value */
52 
53 #define EPERM             __EPERM                 /*  1   Operation not permitted */
54 #define ENOENT            __ENOENT                /*  2   No such file or directory */
55 #define ESRCH             __ESRCH                 /*  3   No such process */
56 #define EINTR             __EINTR                 /*  4   Interrupted system call */
57 #define EIO               __EIO                   /*  5   Input/output error */
58 #define ENXIO             __ENXIO                 /*  6   Device not configured */
59 #define E2BIG             __E2BIG                 /*  7   Argument list too long */
60 #define ENOEXEC           __ENOEXEC               /*  8   Exec format error */
61 #define EBADF             __EBADF                 /*  9   Bad file descriptor */
62 #define ECHILD            __ECHILD                /* 10   No child processes */
63 #define EDEADLK           __EDEADLK               /* 11   Resource deadlock avoided */
64 #define ENOMEM            __ENOMEM                /* 12   Cannot allocate memory */
65 #define EACCES            __EACCES                /* 13   Permission denied */
66 #define EFAULT            __EFAULT                /* 14   Bad address */
67 #define ENOTBLK           __ENOTBLK               /* 15   Block device required */
68 #define EBUSY             __EBUSY                 /* 16   Device busy */
69 #define EEXIST            __EEXIST                /* 17   File exists */
70 #define EXDEV             __EXDEV                 /* 18   Cross-device link */
71 #define ENODEV            __ENODEV                /* 19   Operation not supported by device */
72 #define ENOTDIR           __ENOTDIR               /* 20   Not a directory */
73 #define EISDIR            __EISDIR                /* 21   Is a directory */
74 #define EINVAL            __EINVAL                /* 22   Invalid argument */
75 #define ENFILE            __ENFILE                /* 23   Too many open files in system */
76 #define EMFILE            __EMFILE                /* 24   Too many open file descriptors */
77 #define ENOTTY            __ENOTTY                /* 25   Inappropriate ioctl for device */
78 #define ETXTBSY           __ETXTBSY               /* 26   Text file busy */
79 #define EFBIG             __EFBIG                 /* 27   File too large */
80 #define ENOSPC            __ENOSPC                /* 28   No space left on device */
81 #define ESPIPE            __ESPIPE                /* 29   Illegal seek */
82 #define EROFS             __EROFS                 /* 30   Read-only filesystem */
83 #define EMLINK            __EMLINK                /* 31   Too many links */
84 #define EPIPE             __EPIPE                 /* 32   Broken pipe */
85 
86 /* math software -- these are the only two values required by the C Standard */
87 #define EDOM              __EDOM                  /* 33   Numerical argument out of domain */
88 #define ERANGE            __ERANGE                /* 34   Result too large */
89 
90 /* non-blocking and interrupt i/o */
91 #define EAGAIN            __EAGAIN                /* 35   Resource temporarily unavailable */
92 #define EWOULDBLOCK       __EWOULDBLOCK           /* 35   Operation would block */
93 #define EINPROGRESS       __EINPROGRESS           /* 36   Operation now in progress */
94 #define EALREADY          __EALREADY              /* 37   Operation already in progress */
95 
96 /* ipc/network software -- argument errors */
97 #define ENOTSOCK          __ENOTSOCK              /* 38   Socket operation on non-socket */
98 #define EDESTADDRREQ      __EDESTADDRREQ          /* 39   Destination address required */
99 #define EMSGSIZE          __EMSGSIZE              /* 40   Message too long */
100 #define EPROTOTYPE        __EPROTOTYPE            /* 41   Protocol wrong type for socket */
101 #define ENOPROTOOPT       __ENOPROTOOPT           /* 42   Protocol not available */
102 #define EPROTONOSUPPORT   __EPROTONOSUPPORT       /* 43   Protocol not supported */
103 #define ESOCKTNOSUPPORT   __ESOCKTNOSUPPORT       /* 44   Socket type not supported */
104 #define EOPNOTSUPP        __EOPNOTSUPP            /* 45   Operation not supported */
105 #define ENOTSUP           __ENOTSUP               /* 45   Operation not supported */
106 #define EPFNOSUPPORT      __EPFNOSUPPORT          /* 46   Protocol family not supported */
107 #define EAFNOSUPPORT      __EAFNOSUPPORT          /* 47   Address family not supported by protocol family */
108 #define EADDRINUSE        __EADDRINUSE            /* 48   Address already in use */
109 #define EADDRNOTAVAIL     __EADDRNOTAVAIL         /* 49   Can't assign requested address */
110 
111 /* ipc/network software -- operational errors */
112 #define ENETDOWN          __ENETDOWN              /* 50   Network is down */
113 #define ENETUNREACH       __ENETUNREACH           /* 51   Network is unreachable */
114 #define ENETRESET         __ENETRESET             /* 52   Network dropped connection on reset */
115 #define ECONNABORTED      __ECONNABORTED          /* 53   Software caused connection abort */
116 #define ECONNRESET        __ECONNRESET            /* 54   Connection reset by peer */
117 #define ENOBUFS           __ENOBUFS               /* 55   No buffer space available */
118 #define EISCONN           __EISCONN               /* 56   Socket is already connected */
119 #define ENOTCONN          __ENOTCONN              /* 57   Socket is not connected */
120 #define ESHUTDOWN         __ESHUTDOWN             /* 58   Can't send after socket shutdown */
121 #define ETOOMANYREFS      __ETOOMANYREFS          /* 59   Too many references: can't splice */
122 #define ETIMEDOUT         __ETIMEDOUT             /* 60   Operation timed out */
123 #define ECONNREFUSED      __ECONNREFUSED          /* 61   Connection refused */
124 #define ELOOP             __ELOOP                 /* 62   Too many levels of symbolic links */
125 #define ENAMETOOLONG      __ENAMETOOLONG          /* 63   File name too long */
126 #define EHOSTDOWN         __EHOSTDOWN             /* 64   Host is down */
127 #define EHOSTUNREACH      __EHOSTUNREACH          /* 65   No route to host */
128 
129 #define ENOTEMPTY         __ENOTEMPTY             /* 66   Directory not empty */
130 
131 /* quotas, etc. */
132 #define EPROCLIM          __EPROCLIM              /* 67   Too many processes */
133 #define EUSERS            __EUSERS                /* 68   Too many users */
134 #define EDQUOT            __EDQUOT                /* 69   Disc quota exceeded */
135 
136 /* Network File System */
137 #define ESTALE            __ESTALE                /* 70   Stale NFS file handle */
138 #define EREMOTE           __EREMOTE               /* 71   Too many levels of remote in path */
139 #define EBADRPC           __EBADRPC               /* 72   RPC struct is bad */
140 #define ERPCMISMATCH      __ERPCMISMATCH          /* 73   RPC version wrong */
141 #define EPROGUNAVAIL      __EPROGUNAVAIL          /* 74   RPC prog. not avail */
142 #define EPROGMISMATCH     __EPROGMISMATCH         /* 75   Program version wrong */
143 #define EPROCUNAVAIL      __EPROCUNAVAIL          /* 76   Bad procedure for program */
144 #define ENOLCK            __ENOLCK                /* 77   No locks available */
145 #define ENOSYS            __ENOSYS                /* 78   Function not implemented */
146 #define EFTYPE            __EFTYPE                /* 79   Inappropriate file type or format */
147 #define EAUTH             __EAUTH                 /* 80   Authentication error */
148 #define ENEEDAUTH         __ENEEDAUTH             /* 81   Need authenticator */
149 #define EIDRM             __EIDRM                 /* 82   Identifier removed */
150 #define ENOMSG            __ENOMSG                /* 83   No message of desired type */
151 #define EOVERFLOW         __EOVERFLOW             /* 84   Value too large to be stored in data type */
152 #define EILSEQ            __EILSEQ                /* 85   Illegal byte sequence */
153 #define ENOTHING_1        __ENOTHING_1            /* 86   Place Holder */
154 #define ECANCELED         __ECANCELED             /* 87   Operation canceled */
155 
156 #define EBADMSG           __EBADMSG               /* 88   Bad message */
157 #define ENODATA           __ENODATA               /* 89   No message available */
158 #define ENOSR             __ENOSR                 /* 90   No STREAM resources */
159 #define ENOSTR            __ENOSTR                /* 91   Not a STREAM */
160 #define ETIME             __ETIME                 /* 92   STREAM ioctl timeout */
161 
162 #define ENOATTR           __ENOATTR               /* 93   Attribute not found */
163 
164 #define EDOOFUS           __EDOOFUS               /* 94   Programming error */
165 
166 #define EMULTIHOP         __EMULTIHOP             /* 95   Multihop attempted */
167 #define ENOLINK           __ENOLINK               /* 96   Link has been severed */
168 #define EPROTO            __EPROTO                /* 97   Protocol error */
169 
170 #define EBUFSIZE          __EBUFSIZE              /* 98   Buffer too small to hold result */
171 
172 #define EMAXERRORVAL      __EMAXERRORVAL          /* One more than the highest defined error value. */
173 
174 #endif  /* _ERRNO_H */
175