1 /*
2  * Copyright (c) 2013 Corey Tabaka
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 #pragma once
9 
10 #include <lk/compiler.h>
11 
12 __BEGIN_CDECLS
13 
14 extern int *__geterrno(void);
15 
16 #define errno (*__geterrno())
17 
18 #define EPERM 1     /* Not super-user */
19 #define ENOENT 2    /* No such file or directory */
20 #define ESRCH 3     /* No such process */
21 #define EINTR 4     /* Interrupted system call */
22 #define EIO 5       /* I/O error */
23 #define ENXIO 6     /* No such device or address */
24 #define E2BIG 7     /* Arg list too long */
25 #define ENOEXEC 8   /* Exec format error */
26 #define EBADF 9     /* Bad file number */
27 #define ECHILD 10   /* No children */
28 #define EAGAIN 11   /* No more processes */
29 #define ENOMEM 12   /* Not enough core */
30 #define EACCES 13   /* Permission denied */
31 #define EFAULT 14   /* Bad address */
32 #define ENOTBLK 15  /* Block device required */
33 #define EBUSY 16    /* Mount device busy */
34 #define EEXIST 17   /* File exists */
35 #define EXDEV 18    /* Cross-device link */
36 #define ENODEV 19   /* No such device */
37 #define ENOTDIR 20  /* Not a directory */
38 #define EISDIR 21   /* Is a directory */
39 #define EINVAL 22   /* Invalid argument */
40 #define ENFILE 23   /* Too many open files in system */
41 #define EMFILE 24   /* Too many open files */
42 #define ENOTTY 25   /* Not a typewriter */
43 #define ETXTBSY 26  /* Text file busy */
44 #define EFBIG 27    /* File too large */
45 #define ENOSPC 28   /* No space left on device */
46 #define ESPIPE 29   /* Illegal seek */
47 #define EROFS 30    /* Read only file system */
48 #define EMLINK 31   /* Too many links */
49 #define EPIPE 32    /* Broken pipe */
50 #define EDOM 33     /* Math arg out of domain of func */
51 #define ERANGE 34   /* Math result not representable */
52 #define ENOMSG 35   /* No message of desired type */
53 #define EIDRM 36    /* Identifier removed */
54 #define ECHRNG 37   /* Channel number out of range */
55 #define EL2NSYNC 38 /* Level 2 not synchronized */
56 #define EL3HLT 39   /* Level 3 halted */
57 #define EL3RST 40   /* Level 3 reset */
58 #define ELNRNG 41   /* Link number out of range */
59 #define EUNATCH 42  /* Protocol driver not attached */
60 #define ENOCSI 43   /* No CSI structure available */
61 #define EL2HLT 44   /* Level 2 halted */
62 #define EDEADLK 45  /* Deadlock condition */
63 #define ENOLCK 46   /* No record locks available */
64 #define EBADE 50    /* Invalid exchange */
65 #define EBADR 51    /* Invalid request descriptor */
66 #define EXFULL 52   /* Exchange full */
67 #define ENOANO 53   /* No anode */
68 #define EBADRQC 54  /* Invalid request code */
69 #define EBADSLT 55  /* Invalid slot */
70 #define EDEADLOCK 56    /* File locking deadlock error */
71 #define EBFONT 57   /* Bad font file fmt */
72 #define ENOSTR 60   /* Device not a stream */
73 #define ENODATA 61  /* No data (for no delay io) */
74 #define ETIME 62    /* Timer expired */
75 #define ENOSR 63    /* Out of streams resources */
76 #define ENONET 64   /* Machine is not on the network */
77 #define ENOPKG 65   /* Package not installed */
78 #define EREMOTE 66  /* The object is remote */
79 #define ENOLINK 67  /* The link has been severed */
80 #define EADV 68     /* Advertise error */
81 #define ESRMNT 69   /* Srmount error */
82 #define ECOMM 70    /* Communication error on send */
83 #define EPROTO 71   /* Protocol error */
84 #define EMULTIHOP 74    /* Multihop attempted */
85 #define ELBIN 75    /* Inode is remote (not really error) */
86 #define EDOTDOT 76  /* Cross mount point (not really error) */
87 #define EBADMSG 77  /* Trying to read unreadable message */
88 #define EFTYPE 79   /* Inappropriate file type or format */
89 #define ENOTUNIQ 80 /* Given log. name not unique */
90 #define EBADFD 81   /* f.d. invalid for this operation */
91 #define EREMCHG 82  /* Remote address changed */
92 #define ELIBACC 83  /* Can't access a needed shared lib */
93 #define ELIBBAD 84  /* Accessing a corrupted shared lib */
94 #define ELIBSCN 85  /* .lib section in a.out corrupted */
95 #define ELIBMAX 86  /* Attempting to link in too many libs */
96 #define ELIBEXEC 87 /* Attempting to exec a shared library */
97 #define ENOSYS 88   /* Function not implemented */
98 #define ENMFILE 89      /* No more files */
99 #define ENOTEMPTY 90    /* Directory not empty */
100 #define ENAMETOOLONG 91 /* File or path name too long */
101 #define ELOOP 92    /* Too many symbolic links */
102 #define EOPNOTSUPP 95   /* Operation not supported on transport endpoint */
103 #define EPFNOSUPPORT 96 /* Protocol family not supported */
104 #define ECONNRESET 104  /* Connection reset by peer */
105 #define ENOBUFS 105 /* No buffer space available */
106 #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
107 #define EPROTOTYPE 107  /* Protocol wrong type for socket */
108 #define ENOTSOCK 108    /* Socket operation on non-socket */
109 #define ENOPROTOOPT 109 /* Protocol not available */
110 #define ESHUTDOWN 110   /* Can't send after socket shutdown */
111 #define ECONNREFUSED 111    /* Connection refused */
112 #define EADDRINUSE 112      /* Address already in use */
113 #define ECONNABORTED 113    /* Connection aborted */
114 #define ENETUNREACH 114     /* Network is unreachable */
115 #define ENETDOWN 115        /* Network interface is not configured */
116 #define ETIMEDOUT 116       /* Connection timed out */
117 #define EHOSTDOWN 117       /* Host is down */
118 #define EHOSTUNREACH 118    /* Host is unreachable */
119 #define EINPROGRESS 119     /* Connection already in progress */
120 #define EALREADY 120        /* Socket already connected */
121 #define EDESTADDRREQ 121    /* Destination address required */
122 #define EMSGSIZE 122        /* Message too long */
123 #define EPROTONOSUPPORT 123 /* Unknown protocol */
124 #define ESOCKTNOSUPPORT 124 /* Socket type not supported */
125 #define EADDRNOTAVAIL 125   /* Address not available */
126 #define ENETRESET 126
127 #define EISCONN 127     /* Socket is already connected */
128 #define ENOTCONN 128        /* Socket is not connected */
129 #define ETOOMANYREFS 129
130 #define EPROCLIM 130
131 #define EUSERS 131
132 #define EDQUOT 132
133 #define ESTALE 133
134 #define ENOTSUP 134     /* Not supported */
135 #define ENOMEDIUM 135   /* No medium (in tape drive) */
136 #define ENOSHARE 136    /* No such host or network path */
137 #define ECASECLASH 137  /* Filename exists with different case */
138 #define EILSEQ 138
139 #define EOVERFLOW 139   /* Value too large for defined data type */
140 
141 #define EWOULDBLOCK EAGAIN  /* Operation would block */
142 
143 #define __ELASTERROR 2000   /* Users can add values starting here */
144 
145 __END_CDECLS
146 
147