1 /**
2  * D header file for C99.
3  *
4  * $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_errno.h.html, _errno.h)
5  *
6  * Copyright: Copyright Sean Kelly 2005 - 2009.
7  * License: Distributed under the
8  *      $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
9  *    (See accompanying file LICENSE)
10  * Authors:   Sean Kelly, Alex Rønne Petersen
11  * Source:    https://github.com/dlang/dmd/blob/master/druntime/src/core/stdc/errno.d
12  * Standards: ISO/IEC 9899:1999 (E)
13  */
14 
15 module core.stdc.errno;
16 
17 version (OSX)
18     version = Darwin;
19 else version (iOS)
20     version = Darwin;
21 else version (TVOS)
22     version = Darwin;
23 else version (WatchOS)
24     version = Darwin;
25 
26 version (ARM)     version = ARM_Any;
27 version (AArch64) version = ARM_Any;
28 version (HPPA)    version = HPPA_Any;
29 version (MIPS32)  version = MIPS_Any;
30 version (MIPS64)  version = MIPS_Any;
31 version (PPC)     version = PPC_Any;
32 version (PPC64)   version = PPC_Any;
33 version (RISCV32) version = RISCV_Any;
34 version (RISCV64) version = RISCV_Any;
35 version (S390)    version = IBMZ_Any;
36 version (SPARC)   version = SPARC_Any;
37 version (SPARC64) version = SPARC_Any;
38 version (SystemZ) version = IBMZ_Any;
39 version (X86)     version = X86_Any;
40 version (X86_64)  version = X86_Any;
41 
42 @trusted: // Only manipulates errno.
43 nothrow:
44 @nogc:
45 
46 version (CRuntime_DigitalMars)
47 {
48     extern (C)
49     {
50         ref int _errno();
51         alias errno = _errno;
52     }
53 }
54 else version (CRuntime_Microsoft)
55 {
56     extern (C)
57     {
58         ref int _errno();
59         alias errno = _errno;
60     }
61 }
62 else version (CRuntime_Glibc)
63 {
64     extern (C)
65     {
66         ref int __errno_location();
67         alias errno = __errno_location;
68     }
69 }
70 else version (CRuntime_Musl)
71 {
72     extern (C)
73     {
74         ref int __errno_location();
75         alias errno = __errno_location;
76     }
77 }
78 else version (OpenBSD)
79 {
80     // https://github.com/openbsd/src/blob/master/include/errno.h
81     extern (C)
82     {
83         ref int __errno();
84         alias errno = __errno;
85     }
86 }
87 else version (NetBSD)
88 {
89     // https://github.com/NetBSD/src/blob/trunk/include/errno.h
90     extern (C)
91     {
92         ref int __errno();
93         alias errno = __errno;
94     }
95 }
96 else version (FreeBSD)
97 {
98     extern (C)
99     {
100         ref int __error();
101         alias errno = __error;
102     }
103 }
104 else version (DragonFlyBSD)
105 {
106     extern (C)
107     {
108         pragma(mangle, "errno") int __errno;
109         ref int __error() {
110             return __errno;
111         }
112         alias errno = __error;
113     }
114 }
115 else version (CRuntime_Bionic)
116 {
117     extern (C)
118     {
119         ref int __errno();
120         alias errno = __errno;
121     }
122 }
123 else version (CRuntime_UClibc)
124 {
125     extern (C)
126     {
127         ref int __errno_location();
128         alias errno = __errno_location;
129     }
130 }
131 else version (Darwin)
132 {
133     extern (C)
134     {
135         ref int __error();
136         alias errno = __error;
137     }
138 }
139 else version (Solaris)
140 {
141     extern (C)
142     {
143         ref int ___errno();
144         alias errno = ___errno;
145     }
146 }
147 else version (Haiku)
148 {
149     // https://github.com/haiku/haiku/blob/master/headers/posix/errno.h
150     extern (C)
151     {
152         ref int _errnop();
153         alias errno = _errnop;
154     }
155 }
156 else
157 {
158     ///
159     extern(C) pragma(mangle, "getErrno") @property int errno();
160     ///
161     extern(C) pragma(mangle, "setErrno") @property int errno(int n);
162 }
163 
164 extern (C):
165 
166 
167 version (Windows)
168 {
169     enum EPERM              = 1;        /// Operation not permitted
170     enum ENOENT             = 2;        /// No such file or directory
171     enum ESRCH              = 3;        /// No such process
172     enum EINTR              = 4;        /// Interrupted system call
173     enum EIO                = 5;        /// I/O error
174     enum ENXIO              = 6;        /// No such device or address
175     enum E2BIG              = 7;        /// Argument list too long
176     enum ENOEXEC            = 8;        /// Exec format error
177     enum EBADF              = 9;        /// Bad file number
178     enum ECHILD             = 10;       /// No child processes
179     enum EAGAIN             = 11;       /// Try again
180     enum ENOMEM             = 12;       /// Out of memory
181     enum EACCES             = 13;       /// Permission denied
182     enum EFAULT             = 14;       /// Bad address
183     enum EBUSY              = 16;       /// Device or resource busy
184     enum EEXIST             = 17;       /// File exists
185     enum EXDEV              = 18;       /// Cross-device link
186     enum ENODEV             = 19;       /// No such device
187     enum ENOTDIR            = 20;       /// Not a directory
188     enum EISDIR             = 21;       /// Is a directory
189     enum EINVAL             = 22;       /// Invalid argument
190     enum ENFILE             = 23;       /// File table overflow
191     enum EMFILE             = 24;       /// Too many open files
192     enum ENOTTY             = 25;       /// Not a typewriter
193     enum EFBIG              = 27;       /// File too large
194     enum ENOSPC             = 28;       /// No space left on device
195     enum ESPIPE             = 29;       /// Illegal seek
196     enum EROFS              = 30;       /// Read-only file system
197     enum EMLINK             = 31;       /// Too many links
198     enum EPIPE              = 32;       /// Broken pipe
199     enum EDOM               = 33;       /// Math argument out of domain of func
200     enum ERANGE             = 34;       /// Math result not representable
201     enum EDEADLK            = 36;       /// Resource deadlock would occur
202     enum ENAMETOOLONG       = 38;       /// File name too long
203     enum ENOLCK             = 39;       /// No record locks available
204     enum ENOSYS             = 40;       /// Function not implemented
205     enum ENOTEMPTY          = 41;       /// Directory not empty
206     enum EILSEQ             = 42;       /// Illegal byte sequence
207     enum EDEADLOCK          = EDEADLK;  /// Resource deadlock would occur
208 
209     // POSIX compatibility
210     // See_Also: https://docs.microsoft.com/en-us/cpp/c-runtime-library/errno-constants
211     enum EADDRINUSE         = 100;
212     enum EADDRNOTAVAIL      = 101;
213     enum EAFNOSUPPORT       = 102;
214     enum EALREADY           = 103;
215     enum EBADMSG            = 104;
216     enum ECANCELED          = 105;
217     enum ECONNABORTED       = 106;
218     enum ECONNREFUSED       = 107;
219     enum ECONNRESET         = 108;
220     enum EDESTADDRREQ       = 109;
221     enum EHOSTUNREACH       = 110;
222     enum EIDRM              = 111;
223     enum EINPROGRESS        = 112;
224     enum EISCONN            = 113;
225     enum ELOOP              = 114;
226     enum EMSGSIZE           = 115;
227     enum ENETDOWN           = 116;
228     enum ENETRESET          = 117;
229     enum ENETUNREACH        = 118;
230     enum ENOBUFS            = 119;
231     enum ENODATA            = 120;
232     enum ENOLINK            = 121;
233     enum ENOMSG             = 122;
234     enum ENOPROTOOPT        = 123;
235     enum ENOSR              = 124;
236     enum ENOSTR             = 125;
237     enum ENOTCONN           = 126;
238     enum ENOTRECOVERABLE    = 127;
239     enum ENOTSOCK           = 128;
240     enum ENOTSUP            = 129;
241     enum EOPNOTSUPP         = 130;
242     enum EOTHER             = 131;
243     enum EOVERFLOW          = 132;
244     enum EOWNERDEAD         = 133;
245     enum EPROTO             = 134;
246     enum EPROTONOSUPPORT    = 135;
247     enum EPROTOTYPE         = 136;
248     enum ETIME              = 137;
249     enum ETIMEDOUT          = 138;
250     enum ETXTBSY            = 139;
251     enum EWOULDBLOCK        = 140;
252 }
253 else version (linux)
254 {
255     enum EPERM              = 1;  ///
256     enum ENOENT             = 2;  ///
257     enum ESRCH              = 3;  ///
258     enum EINTR              = 4;  ///
259     enum EIO                = 5;  ///
260     enum ENXIO              = 6;  ///
261     enum E2BIG              = 7;  ///
262     enum ENOEXEC            = 8;  ///
263     enum EBADF              = 9;  ///
264     enum ECHILD             = 10; ///
265     enum EAGAIN             = 11; ///
266     enum ENOMEM             = 12; ///
267     enum EACCES             = 13; ///
268     enum EFAULT             = 14; ///
269     enum ENOTBLK            = 15; ///
270     enum EBUSY              = 16; ///
271     enum EEXIST             = 17; ///
272     enum EXDEV              = 18; ///
273     enum ENODEV             = 19; ///
274     enum ENOTDIR            = 20; ///
275     enum EISDIR             = 21; ///
276     enum EINVAL             = 22; ///
277     enum ENFILE             = 23; ///
278     enum EMFILE             = 24; ///
279     enum ENOTTY             = 25; ///
280     enum ETXTBSY            = 26; ///
281     enum EFBIG              = 27; ///
282     enum ENOSPC             = 28; ///
283     enum ESPIPE             = 29; ///
284     enum EROFS              = 30; ///
285     enum EMLINK             = 31; ///
286     enum EPIPE              = 32; ///
287     enum EDOM               = 33; ///
288     enum ERANGE             = 34; ///
289 
290     version (X86_Any)
291     {
292         enum EDEADLK            = 35;         ///
293         enum ENAMETOOLONG       = 36;         ///
294         enum ENOLCK             = 37;         ///
295         enum ENOSYS             = 38;         ///
296         enum ENOTEMPTY          = 39;         ///
297         enum ELOOP              = 40;         ///
298         enum EWOULDBLOCK        = EAGAIN;     ///
299         enum ENOMSG             = 42;         ///
300         enum EIDRM              = 43;         ///
301         enum ECHRNG             = 44;         ///
302         enum EL2NSYNC           = 45;         ///
303         enum EL3HLT             = 46;         ///
304         enum EL3RST             = 47;         ///
305         enum ELNRNG             = 48;         ///
306         enum EUNATCH            = 49;         ///
307         enum ENOCSI             = 50;         ///
308         enum EL2HLT             = 51;         ///
309         enum EBADE              = 52;         ///
310         enum EBADR              = 53;         ///
311         enum EXFULL             = 54;         ///
312         enum ENOANO             = 55;         ///
313         enum EBADRQC            = 56;         ///
314         enum EBADSLT            = 57;         ///
315         enum EDEADLOCK          = EDEADLK;    ///
316         enum EBFONT             = 59;         ///
317         enum ENOSTR             = 60;         ///
318         enum ENODATA            = 61;         ///
319         enum ETIME              = 62;         ///
320         enum ENOSR              = 63;         ///
321         enum ENONET             = 64;         ///
322         enum ENOPKG             = 65;         ///
323         enum EREMOTE            = 66;         ///
324         enum ENOLINK            = 67;         ///
325         enum EADV               = 68;         ///
326         enum ESRMNT             = 69;         ///
327         enum ECOMM              = 70;         ///
328         enum EPROTO             = 71;         ///
329         enum EMULTIHOP          = 72;         ///
330         enum EDOTDOT            = 73;         ///
331         enum EBADMSG            = 74;         ///
332         enum EOVERFLOW          = 75;         ///
333         enum ENOTUNIQ           = 76;         ///
334         enum EBADFD             = 77;         ///
335         enum EREMCHG            = 78;         ///
336         enum ELIBACC            = 79;         ///
337         enum ELIBBAD            = 80;         ///
338         enum ELIBSCN            = 81;         ///
339         enum ELIBMAX            = 82;         ///
340         enum ELIBEXEC           = 83;         ///
341         enum EILSEQ             = 84;         ///
342         enum ERESTART           = 85;         ///
343         enum ESTRPIPE           = 86;         ///
344         enum EUSERS             = 87;         ///
345         enum ENOTSOCK           = 88;         ///
346         enum EDESTADDRREQ       = 89;         ///
347         enum EMSGSIZE           = 90;         ///
348         enum EPROTOTYPE         = 91;         ///
349         enum ENOPROTOOPT        = 92;         ///
350         enum EPROTONOSUPPORT    = 93;         ///
351         enum ESOCKTNOSUPPORT    = 94;         ///
352         enum EOPNOTSUPP         = 95;         ///
353         enum ENOTSUP            = EOPNOTSUPP; ///
354         enum EPFNOSUPPORT       = 96;         ///
355         enum EAFNOSUPPORT       = 97;         ///
356         enum EADDRINUSE         = 98;         ///
357         enum EADDRNOTAVAIL      = 99;         ///
358         enum ENETDOWN           = 100;        ///
359         enum ENETUNREACH        = 101;        ///
360         enum ENETRESET          = 102;        ///
361         enum ECONNABORTED       = 103;        ///
362         enum ECONNRESET         = 104;        ///
363         enum ENOBUFS            = 105;        ///
364         enum EISCONN            = 106;        ///
365         enum ENOTCONN           = 107;        ///
366         enum ESHUTDOWN          = 108;        ///
367         enum ETOOMANYREFS       = 109;        ///
368         enum ETIMEDOUT          = 110;        ///
369         enum ECONNREFUSED       = 111;        ///
370         enum EHOSTDOWN          = 112;        ///
371         enum EHOSTUNREACH       = 113;        ///
372         enum EALREADY           = 114;        ///
373         enum EINPROGRESS        = 115;        ///
374         enum ESTALE             = 116;        ///
375         enum EUCLEAN            = 117;        ///
376         enum ENOTNAM            = 118;        ///
377         enum ENAVAIL            = 119;        ///
378         enum EISNAM             = 120;        ///
379         enum EREMOTEIO          = 121;        ///
380         enum EDQUOT             = 122;        ///
381         enum ENOMEDIUM          = 123;        ///
382         enum EMEDIUMTYPE        = 124;        ///
383         enum ECANCELED          = 125;        ///
384         enum ENOKEY             = 126;        ///
385         enum EKEYEXPIRED        = 127;        ///
386         enum EKEYREVOKED        = 128;        ///
387         enum EKEYREJECTED       = 129;        ///
388         enum EOWNERDEAD         = 130;        ///
389         enum ENOTRECOVERABLE    = 131;        ///
390         enum ERFKILL            = 132;        ///
391         enum EHWPOISON          = 133;        ///
392     }
393     else version (ARM_Any)
394     {
395         enum EDEADLK            = 35;         ///
396         enum ENAMETOOLONG       = 36;         ///
397         enum ENOLCK             = 37;         ///
398         enum ENOSYS             = 38;         ///
399         enum ENOTEMPTY          = 39;         ///
400         enum ELOOP              = 40;         ///
401         enum EWOULDBLOCK        = EAGAIN;     ///
402         enum ENOMSG             = 42;         ///
403         enum EIDRM              = 43;         ///
404         enum ECHRNG             = 44;         ///
405         enum EL2NSYNC           = 45;         ///
406         enum EL3HLT             = 46;         ///
407         enum EL3RST             = 47;         ///
408         enum ELNRNG             = 48;         ///
409         enum EUNATCH            = 49;         ///
410         enum ENOCSI             = 50;         ///
411         enum EL2HLT             = 51;         ///
412         enum EBADE              = 52;         ///
413         enum EBADR              = 53;         ///
414         enum EXFULL             = 54;         ///
415         enum ENOANO             = 55;         ///
416         enum EBADRQC            = 56;         ///
417         enum EBADSLT            = 57;         ///
418         enum EDEADLOCK          = EDEADLK;    ///
419         enum EBFONT             = 59;         ///
420         enum ENOSTR             = 60;         ///
421         enum ENODATA            = 61;         ///
422         enum ETIME              = 62;         ///
423         enum ENOSR              = 63;         ///
424         enum ENONET             = 64;         ///
425         enum ENOPKG             = 65;         ///
426         enum EREMOTE            = 66;         ///
427         enum ENOLINK            = 67;         ///
428         enum EADV               = 68;         ///
429         enum ESRMNT             = 69;         ///
430         enum ECOMM              = 70;         ///
431         enum EPROTO             = 71;         ///
432         enum EMULTIHOP          = 72;         ///
433         enum EDOTDOT            = 73;         ///
434         enum EBADMSG            = 74;         ///
435         enum EOVERFLOW          = 75;         ///
436         enum ENOTUNIQ           = 76;         ///
437         enum EBADFD             = 77;         ///
438         enum EREMCHG            = 78;         ///
439         enum ELIBACC            = 79;         ///
440         enum ELIBBAD            = 80;         ///
441         enum ELIBSCN            = 81;         ///
442         enum ELIBMAX            = 82;         ///
443         enum ELIBEXEC           = 83;         ///
444         enum EILSEQ             = 84;         ///
445         enum ERESTART           = 85;         ///
446         enum ESTRPIPE           = 86;         ///
447         enum EUSERS             = 87;         ///
448         enum ENOTSOCK           = 88;         ///
449         enum EDESTADDRREQ       = 89;         ///
450         enum EMSGSIZE           = 90;         ///
451         enum EPROTOTYPE         = 91;         ///
452         enum ENOPROTOOPT        = 92;         ///
453         enum EPROTONOSUPPORT    = 93;         ///
454         enum ESOCKTNOSUPPORT    = 94;         ///
455         enum EOPNOTSUPP         = 95;         ///
456         enum ENOTSUP            = EOPNOTSUPP; ///
457         enum EPFNOSUPPORT       = 96;         ///
458         enum EAFNOSUPPORT       = 97;         ///
459         enum EADDRINUSE         = 98;         ///
460         enum EADDRNOTAVAIL      = 99;         ///
461         enum ENETDOWN           = 100;        ///
462         enum ENETUNREACH        = 101;        ///
463         enum ENETRESET          = 102;        ///
464         enum ECONNABORTED       = 103;        ///
465         enum ECONNRESET         = 104;        ///
466         enum ENOBUFS            = 105;        ///
467         enum EISCONN            = 106;        ///
468         enum ENOTCONN           = 107;        ///
469         enum ESHUTDOWN          = 108;        ///
470         enum ETOOMANYREFS       = 109;        ///
471         enum ETIMEDOUT          = 110;        ///
472         enum ECONNREFUSED       = 111;        ///
473         enum EHOSTDOWN          = 112;        ///
474         enum EHOSTUNREACH       = 113;        ///
475         enum EALREADY           = 114;        ///
476         enum EINPROGRESS        = 115;        ///
477         enum ESTALE             = 116;        ///
478         enum EUCLEAN            = 117;        ///
479         enum ENOTNAM            = 118;        ///
480         enum ENAVAIL            = 119;        ///
481         enum EISNAM             = 120;        ///
482         enum EREMOTEIO          = 121;        ///
483         enum EDQUOT             = 122;        ///
484         enum ENOMEDIUM          = 123;        ///
485         enum EMEDIUMTYPE        = 124;        ///
486         enum ECANCELED          = 125;        ///
487         enum ENOKEY             = 126;        ///
488         enum EKEYEXPIRED        = 127;        ///
489         enum EKEYREVOKED        = 128;        ///
490         enum EKEYREJECTED       = 129;        ///
491         enum EOWNERDEAD         = 130;        ///
492         enum ENOTRECOVERABLE    = 131;        ///
493         enum ERFKILL            = 132;        ///
494         enum EHWPOISON          = 133;        ///
495     }
496     else version (HPPA_Any)
497     {
498         enum ENOMSG             = 35;         ///
499         enum EIDRM              = 36;         ///
500         enum ECHRNG             = 37;         ///
501         enum EL2NSYNC           = 38;         ///
502         enum EL3HLT             = 39;         ///
503         enum EL3RST             = 40;         ///
504         enum ELNRNG             = 41;         ///
505         enum EUNATCH            = 42;         ///
506         enum ENOCSI             = 43;         ///
507         enum EL2HLT             = 44;         ///
508         enum EDEADLK            = 45;         ///
509         enum EDEADLOCK          = EDEADLK;    ///
510         enum ENOLCK             = 46;         ///
511         enum EILSEQ             = 47;         ///
512         enum ENONET             = 50;         ///
513         enum ENODATA            = 51;         ///
514         enum ETIME              = 52;         ///
515         enum ENOSR              = 53;         ///
516         enum ENOSTR             = 54;         ///
517         enum ENOPKG             = 55;         ///
518         enum ENOLINK            = 57;         ///
519         enum EADV               = 58;         ///
520         enum ESRMNT             = 59;         ///
521         enum ECOMM              = 60;         ///
522         enum EPROTO             = 61;         ///
523         enum EMULTIHOP          = 64;         ///
524         enum EDOTDOT            = 66;         ///
525         enum EBADMSG            = 67;         ///
526         enum EUSERS             = 68;         ///
527         enum EDQUOT             = 69;         ///
528         enum ESTALE             = 70;         ///
529         enum EREMOTE            = 71;         ///
530         enum EOVERFLOW          = 72;         ///
531         enum EBADE              = 160;        ///
532         enum EBADR              = 161;        ///
533         enum EXFULL             = 162;        ///
534         enum ENOANO             = 163;        ///
535         enum EBADRQC            = 164;        ///
536         enum EBADSLT            = 165;        ///
537         enum EBFONT             = 166;        ///
538         enum ENOTUNIQ           = 167;        ///
539         enum EBADFD             = 168;        ///
540         enum EREMCHG            = 169;        ///
541         enum ELIBACC            = 170;        ///
542         enum ELIBBAD            = 171;        ///
543         enum ELIBSCN            = 172;        ///
544         enum ELIBMAX            = 173;        ///
545         enum ELIBEXEC           = 174;        ///
546         enum ERESTART           = 175;        ///
547         enum ESTRPIPE           = 176;        ///
548         enum EUCLEAN            = 177;        ///
549         enum ENOTNAM            = 178;        ///
550         enum ENAVAIL            = 179;        ///
551         enum EISNAM             = 180;        ///
552         enum EREMOTEIO          = 181;        ///
553         enum ENOMEDIUM          = 182;        ///
554         enum EMEDIUMTYPE        = 183;        ///
555         enum ENOKEY             = 184;        ///
556         enum EKEYEXPIRED        = 185;        ///
557         enum EKEYREVOKED        = 186;        ///
558         enum EKEYREJECTED       = 187;        ///
559         enum ENOSYM             = 215;        ///
560         enum ENOTSOCK           = 216;        ///
561         enum EDESTADDRREQ       = 217;        ///
562         enum EMSGSIZE           = 218;        ///
563         enum EPROTOTYPE         = 219;        ///
564         enum ENOPROTOOPT        = 220;        ///
565         enum EPROTONOSUPPORT    = 221;        ///
566         enum ESOCKTNOSUPPORT    = 221;        ///
567         enum EOPNOTSUPP         = 223;        ///
568         enum EPFNOSUPPORT       = 224;        ///
569         enum EAFNOSUPPORT       = 225;        ///
570         enum EADDRINUSE         = 226;        ///
571         enum EADDRNOTAVAIL      = 227;        ///
572         enum ENETDOWN           = 228;        ///
573         enum ENETUNREACH        = 229;        ///
574         enum ENETRESET          = 230;        ///
575         enum ECONNABORTED       = 231;        ///
576         enum ECONNRESET         = 232;        ///
577         enum ENOBUFS            = 233;        ///
578         enum EISCONN            = 234;        ///
579         enum ENOTCONN           = 235;        ///
580         enum ESHUTDOWN          = 236;        ///
581         enum ETOOMANYREFS       = 237;        ///
582         enum ETIMEDOUT          = 238;        ///
583         enum ECONNREFUSED       = 239;        ///
584         enum EREFUSED           = ECONNREFUSED; ///
585         enum EREMOTERELEASE     = 240;        ///
586         enum EHOSTDOWN          = 241;        ///
587         enum EHOSTUNREACH       = 242;        ///
588         enum EALREADY           = 244;        ///
589         enum EINPROGRESS        = 245;        ///
590         enum EWOULDBLOCK        = EAGAIN;     ///
591         enum ENOTEMPTY          = 247;        ///
592         enum ENAMETOOLONG       = 248;        ///
593         enum ELOOP              = 249;        ///
594         enum ENOSYS             = 251;        ///
595         enum ECANCELLED         = 253;        ///
596         enum ECANCELED          = ECANCELLED;  ///
597         enum EOWNERDEAD         = 254;        ///
598         enum ENOTRECOVERABLE    = 255;        ///
599         enum ERFKILL            = 256;        ///
600         enum EHWPOISON          = 257;        ///
601     }
602     else version (MIPS_Any)
603     {
604         enum ENOMSG             = 35;         ///
605         enum EIDRM              = 36;         ///
606         enum ECHRNG             = 37;         ///
607         enum EL2NSYNC           = 38;         ///
608         enum EL3HLT             = 39;         ///
609         enum EL3RST             = 40;         ///
610         enum ELNRNG             = 41;         ///
611         enum EUNATCH            = 42;         ///
612         enum ENOCSI             = 43;         ///
613         enum EL2HLT             = 44;         ///
614         enum EDEADLK            = 45;         ///
615         enum ENOLCK             = 46;         ///
616         enum EBADE              = 50;         ///
617         enum EBADR              = 51;         ///
618         enum EXFULL             = 52;         ///
619         enum ENOANO             = 53;         ///
620         enum EBADRQC            = 54;         ///
621         enum EBADSLT            = 55;         ///
622         enum EDEADLOCK          = 56;         ///
623         enum EBFONT             = 59;         ///
624         enum ENOSTR             = 60;         ///
625         enum ENODATA            = 61;         ///
626         enum ETIME              = 62;         ///
627         enum ENOSR              = 63;         ///
628         enum ENONET             = 64;         ///
629         enum ENOPKG             = 65;         ///
630         enum EREMOTE            = 66;         ///
631         enum ENOLINK            = 67;         ///
632         enum EADV               = 68;         ///
633         enum ESRMNT             = 69;         ///
634         enum ECOMM              = 70;         ///
635         enum EPROTO             = 71;         ///
636         enum EDOTDOT            = 73;         ///
637         enum EMULTIHOP          = 74;         ///
638         enum EBADMSG            = 77;         ///
639         enum ENAMETOOLONG       = 78;         ///
640         enum EOVERFLOW          = 79;         ///
641         enum ENOTUNIQ           = 80;         ///
642         enum EBADFD             = 81;         ///
643         enum EREMCHG            = 82;         ///
644         enum ELIBACC            = 83;         ///
645         enum ELIBBAD            = 84;         ///
646         enum ELIBSCN            = 85;         ///
647         enum ELIBMAX            = 86;         ///
648         enum ELIBEXEC           = 87;         ///
649         enum EILSEQ             = 88;         ///
650         enum ENOSYS             = 89;         ///
651         enum ELOOP              = 90;         ///
652         enum ERESTART           = 91;         ///
653         enum ESTRPIPE           = 92;         ///
654         enum ENOTEMPTY          = 93;         ///
655         enum EUSERS             = 94;         ///
656         enum ENOTSOCK           = 95;         ///
657         enum EDESTADDRREQ       = 96;         ///
658         enum EMSGSIZE           = 97;         ///
659         enum EPROTOTYPE         = 98;         ///
660         enum ENOPROTOOPT        = 99;         ///
661         enum EPROTONOSUPPORT    = 120;        ///
662         enum ESOCKTNOSUPPORT    = 121;        ///
663         enum EOPNOTSUPP         = 122;        ///
664         enum ENOTSUP            = EOPNOTSUPP; ///
665         enum EPFNOSUPPORT       = 123;        ///
666         enum EAFNOSUPPORT       = 124;        ///
667         enum EADDRINUSE         = 125;        ///
668         enum EADDRNOTAVAIL      = 126;        ///
669         enum ENETDOWN           = 127;        ///
670         enum ENETUNREACH        = 128;        ///
671         enum ENETRESET          = 129;        ///
672         enum ECONNABORTED       = 130;        ///
673         enum ECONNRESET         = 131;        ///
674         enum ENOBUFS            = 132;        ///
675         enum EISCONN            = 133;        ///
676         enum ENOTCONN           = 134;        ///
677         enum EUCLEAN            = 135;        ///
678         enum ENOTNAM            = 137;        ///
679         enum ENAVAIL            = 138;        ///
680         enum EISNAM             = 139;        ///
681         enum EREMOTEIO          = 140;        ///
682         enum EINIT              = 141;        ///
683         enum EREMDEV            = 142;        ///
684         enum ESHUTDOWN          = 143;        ///
685         enum ETOOMANYREFS       = 144;        ///
686         enum ETIMEDOUT          = 145;        ///
687         enum ECONNREFUSED       = 146;        ///
688         enum EHOSTDOWN          = 147;        ///
689         enum EHOSTUNREACH       = 148;        ///
690         enum EWOULDBLOCK        = EAGAIN;     ///
691         enum EALREADY           = 149;        ///
692         enum EINPROGRESS        = 150;        ///
693         enum ESTALE             = 151;        ///
694         enum ECANCELED          = 158;        ///
695         enum ENOMEDIUM          = 159;        ///
696         enum EMEDIUMTYPE        = 160;        ///
697         enum ENOKEY             = 161;        ///
698         enum EKEYEXPIRED        = 162;        ///
699         enum EKEYREVOKED        = 163;        ///
700         enum EKEYREJECTED       = 164;        ///
701         enum EOWNERDEAD         = 165;        ///
702         enum ENOTRECOVERABLE    = 166;        ///
703         enum ERFKILL            = 167;        ///
704         enum EHWPOISON          = 168;        ///
705         enum EDQUOT             = 1133;       ///
706     }
707     else version (PPC_Any)
708     {
709         enum EDEADLK            = 35;         ///
710         enum ENAMETOOLONG       = 36;         ///
711         enum ENOLCK             = 37;         ///
712         enum ENOSYS             = 38;         ///
713         enum ENOTEMPTY          = 39;         ///
714         enum ELOOP              = 40;         ///
715         enum EWOULDBLOCK        = EAGAIN;     ///
716         enum ENOMSG             = 42;         ///
717         enum EIDRM              = 43;         ///
718         enum ECHRNG             = 44;         ///
719         enum EL2NSYNC           = 45;         ///
720         enum EL3HLT             = 46;         ///
721         enum EL3RST             = 47;         ///
722         enum ELNRNG             = 48;         ///
723         enum EUNATCH            = 49;         ///
724         enum ENOCSI             = 50;         ///
725         enum EL2HLT             = 51;         ///
726         enum EBADE              = 52;         ///
727         enum EBADR              = 53;         ///
728         enum EXFULL             = 54;         ///
729         enum ENOANO             = 55;         ///
730         enum EBADRQC            = 56;         ///
731         enum EBADSLT            = 57;         ///
732         enum EDEADLOCK          = 58;         ///
733         enum EBFONT             = 59;         ///
734         enum ENOSTR             = 60;         ///
735         enum ENODATA            = 61;         ///
736         enum ETIME              = 62;         ///
737         enum ENOSR              = 63;         ///
738         enum ENONET             = 64;         ///
739         enum ENOPKG             = 65;         ///
740         enum EREMOTE            = 66;         ///
741         enum ENOLINK            = 67;         ///
742         enum EADV               = 68;         ///
743         enum ESRMNT             = 69;         ///
744         enum ECOMM              = 70;         ///
745         enum EPROTO             = 71;         ///
746         enum EMULTIHOP          = 72;         ///
747         enum EDOTDOT            = 73;         ///
748         enum EBADMSG            = 74;         ///
749         enum EOVERFLOW          = 75;         ///
750         enum ENOTUNIQ           = 76;         ///
751         enum EBADFD             = 77;         ///
752         enum EREMCHG            = 78;         ///
753         enum ELIBACC            = 79;         ///
754         enum ELIBBAD            = 80;         ///
755         enum ELIBSCN            = 81;         ///
756         enum ELIBMAX            = 82;         ///
757         enum ELIBEXEC           = 83;         ///
758         enum EILSEQ             = 84;         ///
759         enum ERESTART           = 85;         ///
760         enum ESTRPIPE           = 86;         ///
761         enum EUSERS             = 87;         ///
762         enum ENOTSOCK           = 88;         ///
763         enum EDESTADDRREQ       = 89;         ///
764         enum EMSGSIZE           = 90;         ///
765         enum EPROTOTYPE         = 91;         ///
766         enum ENOPROTOOPT        = 92;         ///
767         enum EPROTONOSUPPORT    = 93;         ///
768         enum ESOCKTNOSUPPORT    = 94;         ///
769         enum EOPNOTSUPP         = 95;         ///
770         enum ENOTSUP            = EOPNOTSUPP; ///
771         enum EPFNOSUPPORT       = 96;         ///
772         enum EAFNOSUPPORT       = 97;         ///
773         enum EADDRINUSE         = 98;         ///
774         enum EADDRNOTAVAIL      = 99;         ///
775         enum ENETDOWN           = 100;        ///
776         enum ENETUNREACH        = 101;        ///
777         enum ENETRESET          = 102;        ///
778         enum ECONNABORTED       = 103;        ///
779         enum ECONNRESET         = 104;        ///
780         enum ENOBUFS            = 105;        ///
781         enum EISCONN            = 106;        ///
782         enum ENOTCONN           = 107;        ///
783         enum ESHUTDOWN          = 108;        ///
784         enum ETOOMANYREFS       = 109;        ///
785         enum ETIMEDOUT          = 110;        ///
786         enum ECONNREFUSED       = 111;        ///
787         enum EHOSTDOWN          = 112;        ///
788         enum EHOSTUNREACH       = 113;        ///
789         enum EALREADY           = 114;        ///
790         enum EINPROGRESS        = 115;        ///
791         enum ESTALE             = 116;        ///
792         enum EUCLEAN            = 117;        ///
793         enum ENOTNAM            = 118;        ///
794         enum ENAVAIL            = 119;        ///
795         enum EISNAM             = 120;        ///
796         enum EREMOTEIO          = 121;        ///
797         enum EDQUOT             = 122;        ///
798         enum ENOMEDIUM          = 123;        ///
799         enum EMEDIUMTYPE        = 124;        ///
800         enum ECANCELED          = 125;        ///
801         enum ENOKEY             = 126;        ///
802         enum EKEYEXPIRED        = 127;        ///
803         enum EKEYREVOKED        = 128;        ///
804         enum EKEYREJECTED       = 129;        ///
805         enum EOWNERDEAD         = 130;        ///
806         enum ENOTRECOVERABLE    = 131;        ///
807         enum ERFKILL            = 132;        ///
808         enum EHWPOISON          = 133;        ///
809     }
810     else version (RISCV_Any)
811     {
812         enum EDEADLK            = 35;         ///
813         enum ENAMETOOLONG       = 36;         ///
814         enum ENOLCK             = 37;         ///
815         enum ENOSYS             = 38;         ///
816         enum ENOTEMPTY          = 39;         ///
817         enum ELOOP              = 40;         ///
818         enum EWOULDBLOCK        = EAGAIN;     ///
819         enum ENOMSG             = 42;         ///
820         enum EIDRM              = 43;         ///
821         enum ECHRNG             = 44;         ///
822         enum EL2NSYNC           = 45;         ///
823         enum EL3HLT             = 46;         ///
824         enum EL3RST             = 47;         ///
825         enum ELNRNG             = 48;         ///
826         enum EUNATCH            = 49;         ///
827         enum ENOCSI             = 50;         ///
828         enum EL2HLT             = 51;         ///
829         enum EBADE              = 52;         ///
830         enum EBADR              = 53;         ///
831         enum EXFULL             = 54;         ///
832         enum ENOANO             = 55;         ///
833         enum EBADRQC            = 56;         ///
834         enum EBADSLT            = 57;         ///
835         enum EDEADLOCK          = EDEADLK;    ///
836         enum EBFONT             = 59;         ///
837         enum ENOSTR             = 60;         ///
838         enum ENODATA            = 61;         ///
839         enum ETIME              = 62;         ///
840         enum ENOSR              = 63;         ///
841         enum ENONET             = 64;         ///
842         enum ENOPKG             = 65;         ///
843         enum EREMOTE            = 66;         ///
844         enum ENOLINK            = 67;         ///
845         enum EADV               = 68;         ///
846         enum ESRMNT             = 69;         ///
847         enum ECOMM              = 70;         ///
848         enum EPROTO             = 71;         ///
849         enum EMULTIHOP          = 72;         ///
850         enum EDOTDOT            = 73;         ///
851         enum EBADMSG            = 74;         ///
852         enum EOVERFLOW          = 75;         ///
853         enum ENOTUNIQ           = 76;         ///
854         enum EBADFD             = 77;         ///
855         enum EREMCHG            = 78;         ///
856         enum ELIBACC            = 79;         ///
857         enum ELIBBAD            = 80;         ///
858         enum ELIBSCN            = 81;         ///
859         enum ELIBMAX            = 82;         ///
860         enum ELIBEXEC           = 83;         ///
861         enum EILSEQ             = 84;         ///
862         enum ERESTART           = 85;         ///
863         enum ESTRPIPE           = 86;         ///
864         enum EUSERS             = 87;         ///
865         enum ENOTSOCK           = 88;         ///
866         enum EDESTADDRREQ       = 89;         ///
867         enum EMSGSIZE           = 90;         ///
868         enum EPROTOTYPE         = 91;         ///
869         enum ENOPROTOOPT        = 92;         ///
870         enum EPROTONOSUPPORT    = 93;         ///
871         enum ESOCKTNOSUPPORT    = 94;         ///
872         enum EOPNOTSUPP         = 95;         ///
873         enum EPFNOSUPPORT       = 96;         ///
874         enum EAFNOSUPPORT       = 97;         ///
875         enum EADDRINUSE         = 98;         ///
876         enum EADDRNOTAVAIL      = 99;         ///
877         enum ENETDOWN           = 100;        ///
878         enum ENETUNREACH        = 101;        ///
879         enum ENETRESET          = 102;        ///
880         enum ECONNABORTED       = 103;        ///
881         enum ECONNRESET         = 104;        ///
882         enum ENOBUFS            = 105;        ///
883         enum EISCONN            = 106;        ///
884         enum ENOTCONN           = 107;        ///
885         enum ESHUTDOWN          = 108;        ///
886         enum ETOOMANYREFS       = 109;        ///
887         enum ETIMEDOUT          = 110;        ///
888         enum ECONNREFUSED       = 111;        ///
889         enum EHOSTDOWN          = 112;        ///
890         enum EHOSTUNREACH       = 113;        ///
891         enum EALREADY           = 114;        ///
892         enum EINPROGRESS        = 115;        ///
893         enum ESTALE             = 116;        ///
894         enum EUCLEAN            = 117;        ///
895         enum ENOTNAM            = 118;        ///
896         enum ENAVAIL            = 119;        ///
897         enum EISNAM             = 120;        ///
898         enum EREMOTEIO          = 121;        ///
899         enum EDQUOT             = 122;        ///
900         enum ENOMEDIUM          = 123;        ///
901         enum EMEDIUMTYPE        = 124;        ///
902         enum ECANCELED          = 125;        ///
903         enum ENOKEY             = 126;        ///
904         enum EKEYEXPIRED        = 127;        ///
905         enum EKEYREVOKED        = 128;        ///
906         enum EKEYREJECTED       = 129;        ///
907         enum EOWNERDEAD         = 130;        ///
908         enum ENOTRECOVERABLE    = 131;        ///
909         enum ERFKILL            = 132;        ///
910         enum EHWPOISON          = 133;        ///
911     }
912     else version (SPARC_Any)
913     {
914         enum EWOULDBLOCK        = EAGAIN;     ///
915         enum EINPROGRESS        = 36;         ///
916         enum EALREADY           = 37;         ///
917         enum ENOTSOCK           = 38;         ///
918         enum EDESTADDRREQ       = 39;         ///
919         enum EMSGSIZE           = 40;         ///
920         enum EPROTOTYPE         = 41;         ///
921         enum ENOPROTOOPT        = 42;         ///
922         enum EPROTONOSUPPORT    = 43;         ///
923         enum ESOCKTNOSUPPORT    = 44;         ///
924         enum EOPNOTSUPP         = 45;         ///
925         enum ENOTSUP            = EOPNOTSUPP; ///
926         enum EPFNOSUPPORT       = 46;         ///
927         enum EAFNOSUPPORT       = 47;         ///
928         enum EADDRINUSE         = 48;         ///
929         enum EADDRNOTAVAIL      = 49;         ///
930         enum ENETDOWN           = 50;         ///
931         enum ENETUNREACH        = 51;         ///
932         enum ENETRESET          = 52;         ///
933         enum ECONNABORTED       = 53;         ///
934         enum ECONNRESET         = 54;         ///
935         enum ENOBUFS            = 55;         ///
936         enum EISCONN            = 56;         ///
937         enum ENOTCONN           = 57;         ///
938         enum ESHUTDOWN          = 58;         ///
939         enum ETOOMANYREFS       = 59;         ///
940         enum ETIMEDOUT          = 60;         ///
941         enum ECONNREFUSED       = 61;         ///
942         enum ELOOP              = 62;         ///
943         enum ENAMETOOLONG       = 63;         ///
944         enum EHOSTDOWN          = 64;         ///
945         enum EHOSTUNREACH       = 65;         ///
946         enum ENOTEMPTY          = 66;         ///
947         enum EPROCLIM           = 67;         ///
948         enum EUSERS             = 68;         ///
949         enum EDQUOT             = 69;         ///
950         enum ESTALE             = 70;         ///
951         enum EREMOTE            = 71;         ///
952         enum ENOSTR             = 72;         ///
953         enum ETIME              = 73;         ///
954         enum ENOSR              = 74;         ///
955         enum ENOMSG             = 75;         ///
956         enum EBADMSG            = 76;         ///
957         enum EIDRM              = 77;         ///
958         enum EDEADLK            = 78;         ///
959         enum ENOLCK             = 79;         ///
960         enum ENONET             = 80;         ///
961         enum ERREMOTE           = 81;         ///
962         enum ENOLINK            = 82;         ///
963         enum EADV               = 83;         ///
964         enum ESRMNT             = 84;         ///
965         enum ECOMM              = 85;         ///
966         enum EPROTO             = 86;         ///
967         enum EMULTIHOP          = 87;         ///
968         enum EDOTDOT            = 88;         ///
969         enum EREMCHG            = 89;         ///
970         enum ENOSYS             = 90;         ///
971         enum ESTRPIPE           = 91;         ///
972         enum EOVERFLOW          = 92;         ///
973         enum EBADFD             = 93;         ///
974         enum ECHRNG             = 94;         ///
975         enum EL2NSYNC           = 95;         ///
976         enum EL3HLT             = 96;         ///
977         enum EL3RST             = 97;         ///
978         enum ELNRNG             = 98;         ///
979         enum EUNATCH            = 99;         ///
980         enum ENOCSI             = 100;        ///
981         enum EL2HLT             = 101;        ///
982         enum EBADE              = 102;        ///
983         enum EBADR              = 103;        ///
984         enum EXFULL             = 104;        ///
985         enum ENOANO             = 105;        ///
986         enum EBADRQC            = 106;        ///
987         enum EBADSLT            = 107;        ///
988         enum EDEADLOCK          = 108;        ///
989         enum EBFONT             = 109;        ///
990         enum ELIBEXEC           = 110;        ///
991         enum ENODATA            = 111;        ///
992         enum ELIBBAD            = 112;        ///
993         enum ENOPKG             = 113;        ///
994         enum ELIBACC            = 114;        ///
995         enum ENOTUNIQ           = 115;        ///
996         enum ERESTART           = 116;        ///
997         enum EUCLEAN            = 117;        ///
998         enum ENOTNAM            = 118;        ///
999         enum ENAVAIL            = 119;        ///
1000         enum EISNAM             = 120;        ///
1001         enum EREMOTEIO          = 121;        ///
1002         enum EILSEQ             = 122;        ///
1003         enum ELIBMAX            = 123;        ///
1004         enum ELIBSCN            = 124;        ///
1005         enum ENOMEDIUM          = 125;        ///
1006         enum EMEDIUMTYPE        = 126;        ///
1007         enum ECANCELED          = 127;        ///
1008         enum ENOKEY             = 128;        ///
1009         enum EKEYEXPIRED        = 129;        ///
1010         enum EKEYREVOKED        = 130;        ///
1011         enum EKEYREJECTED       = 131;        ///
1012         enum EOWNERDEAD         = 132;        ///
1013         enum ENOTRECOVERABLE    = 133;        ///
1014         enum ERFKILL            = 134;        ///
1015         enum EHWPOISON          = 135;        ///
1016     }
1017     else version (IBMZ_Any)
1018     {
1019         enum EDEADLK            = 35;         ///
1020         enum ENAMETOOLONG       = 36;         ///
1021         enum ENOLCK             = 37;         ///
1022         enum ENOSYS             = 38;         ///
1023         enum ENOTEMPTY          = 39;         ///
1024         enum ELOOP              = 40;         ///
1025         enum EWOULDBLOCK        = EAGAIN;     ///
1026         enum ENOMSG             = 42;         ///
1027         enum EIDRM              = 43;         ///
1028         enum ECHRNG             = 44;         ///
1029         enum EL2NSYNC           = 45;         ///
1030         enum EL3HLT             = 46;         ///
1031         enum EL3RST             = 47;         ///
1032         enum ELNRNG             = 48;         ///
1033         enum EUNATCH            = 49;         ///
1034         enum ENOCSI             = 50;         ///
1035         enum EL2HLT             = 51;         ///
1036         enum EBADE              = 52;         ///
1037         enum EBADR              = 53;         ///
1038         enum EXFULL             = 54;         ///
1039         enum ENOANO             = 55;         ///
1040         enum EBADRQC            = 56;         ///
1041         enum EBADSLT            = 57;         ///
1042         enum EDEADLOCK          = EDEADLK;    ///
1043         enum EBFONT             = 59;         ///
1044         enum ENOSTR             = 60;         ///
1045         enum ENODATA            = 61;         ///
1046         enum ETIME              = 62;         ///
1047         enum ENOSR              = 63;         ///
1048         enum ENONET             = 64;         ///
1049         enum ENOPKG             = 65;         ///
1050         enum EREMOTE            = 66;         ///
1051         enum ENOLINK            = 67;         ///
1052         enum EADV               = 68;         ///
1053         enum ESRMNT             = 69;         ///
1054         enum ECOMM              = 70;         ///
1055         enum EPROTO             = 71;         ///
1056         enum EMULTIHOP          = 72;         ///
1057         enum EDOTDOT            = 73;         ///
1058         enum EBADMSG            = 74;         ///
1059         enum EOVERFLOW          = 75;         ///
1060         enum ENOTUNIQ           = 76;         ///
1061         enum EBADFD             = 77;         ///
1062         enum EREMCHG            = 78;         ///
1063         enum ELIBACC            = 79;         ///
1064         enum ELIBBAD            = 80;         ///
1065         enum ELIBSCN            = 81;         ///
1066         enum ELIBMAX            = 82;         ///
1067         enum ELIBEXEC           = 83;         ///
1068         enum EILSEQ             = 84;         ///
1069         enum ERESTART           = 85;         ///
1070         enum ESTRPIPE           = 86;         ///
1071         enum EUSERS             = 87;         ///
1072         enum ENOTSOCK           = 88;         ///
1073         enum EDESTADDRREQ       = 89;         ///
1074         enum EMSGSIZE           = 90;         ///
1075         enum EPROTOTYPE         = 91;         ///
1076         enum ENOPROTOOPT        = 92;         ///
1077         enum EPROTONOSUPPORT    = 93;         ///
1078         enum ESOCKTNOSUPPORT    = 94;         ///
1079         enum EOPNOTSUPP         = 95;         ///
1080         enum ENOTSUP            = EOPNOTSUPP; ///
1081         enum EPFNOSUPPORT       = 96;         ///
1082         enum EAFNOSUPPORT       = 97;         ///
1083         enum EADDRINUSE         = 98;         ///
1084         enum EADDRNOTAVAIL      = 99;         ///
1085         enum ENETDOWN           = 100;        ///
1086         enum ENETUNREACH        = 101;        ///
1087         enum ENETRESET          = 102;        ///
1088         enum ECONNABORTED       = 103;        ///
1089         enum ECONNRESET         = 104;        ///
1090         enum ENOBUFS            = 105;        ///
1091         enum EISCONN            = 106;        ///
1092         enum ENOTCONN           = 107;        ///
1093         enum ESHUTDOWN          = 108;        ///
1094         enum ETOOMANYREFS       = 109;        ///
1095         enum ETIMEDOUT          = 110;        ///
1096         enum ECONNREFUSED       = 111;        ///
1097         enum EHOSTDOWN          = 112;        ///
1098         enum EHOSTUNREACH       = 113;        ///
1099         enum EALREADY           = 114;        ///
1100         enum EINPROGRESS        = 115;        ///
1101         enum ESTALE             = 116;        ///
1102         enum EUCLEAN            = 117;        ///
1103         enum ENOTNAM            = 118;        ///
1104         enum ENAVAIL            = 119;        ///
1105         enum EISNAM             = 120;        ///
1106         enum EREMOTEIO          = 121;        ///
1107         enum EDQUOT             = 122;        ///
1108         enum ENOMEDIUM          = 123;        ///
1109         enum EMEDIUMTYPE        = 124;        ///
1110         enum ECANCELED          = 125;        ///
1111         enum ENOKEY             = 126;        ///
1112         enum EKEYEXPIRED        = 127;        ///
1113         enum EKEYREVOKED        = 128;        ///
1114         enum EKEYREJECTED       = 129;        ///
1115         enum EOWNERDEAD         = 130;        ///
1116         enum ENOTRECOVERABLE    = 131;        ///
1117         enum ERFKILL            = 132;        ///
1118         enum EHWPOISON          = 133;        ///
1119     }
1120     else
1121     {
1122         static assert(false, "Architecture not supported.");
1123     }
1124 }
1125 else version (Darwin)
1126 {
1127     enum EPERM              = 1;        /// Operation not permitted
1128     enum ENOENT             = 2;        /// No such file or directory
1129     enum ESRCH              = 3;        /// No such process
1130     enum EINTR              = 4;        /// Interrupted system call
1131     enum EIO                = 5;        /// Input/output error
1132     enum ENXIO              = 6;        /// Device not configured
1133     enum E2BIG              = 7;        /// Argument list too long
1134     enum ENOEXEC            = 8;        /// Exec format error
1135     enum EBADF              = 9;        /// Bad file descriptor
1136     enum ECHILD             = 10;       /// No child processes
1137     enum EDEADLK            = 11;       /// Resource deadlock avoided
1138     enum ENOMEM             = 12;       /// Cannot allocate memory
1139     enum EACCES             = 13;       /// Permission denied
1140     enum EFAULT             = 14;       /// Bad address
1141     enum EBUSY              = 16;       /// Device busy
1142     enum EEXIST             = 17;       /// File exists
1143     enum EXDEV              = 18;       /// Cross-device link
1144     enum ENODEV             = 19;       /// Operation not supported by device
1145     enum ENOTDIR            = 20;       /// Not a directory
1146     enum EISDIR             = 21;       /// Is a directory
1147     enum EINVAL             = 22;       /// Invalid argument
1148     enum ENFILE             = 23;       /// Too many open files in system
1149     enum EMFILE             = 24;       /// Too many open files
1150     enum ENOTTY             = 25;       /// Inappropriate ioctl for device
1151     enum ETXTBSY            = 26;       /// Text file busy
1152     enum EFBIG              = 27;       /// File too large
1153     enum ENOSPC             = 28;       /// No space left on device
1154     enum ESPIPE             = 29;       /// Illegal seek
1155     enum EROFS              = 30;       /// Read-only file system
1156     enum EMLINK             = 31;       /// Too many links
1157     enum EPIPE              = 32;       /// Broken pipe
1158     enum EDOM               = 33;       /// Numerical argument out of domain
1159     enum ERANGE             = 34;       /// Result too large
1160     enum EAGAIN             = 35;       /// Resource temporarily unavailable
1161     enum EWOULDBLOCK        = EAGAIN;   /// Operation would block
1162     enum EINPROGRESS        = 36;       /// Operation now in progress
1163     enum EALREADY           = 37;       /// Operation already in progress
1164     enum ENOTSOCK           = 38;       /// Socket operation on non-socket
1165     enum EDESTADDRREQ       = 39;       /// Destination address required
1166     enum EMSGSIZE           = 40;       /// Message too long
1167     enum EPROTOTYPE         = 41;       /// Protocol wrong type for socket
1168     enum ENOPROTOOPT        = 42;       /// Protocol not available
1169     enum EPROTONOSUPPORT    = 43;       /// Protocol not supported
1170     enum ENOTSUP            = 45;       /// Operation not supported
1171     enum EOPNOTSUPP         = ENOTSUP;  /// Operation not supported on socket
1172     enum EAFNOSUPPORT       = 47;       /// Address family not supported by protocol family
1173     enum EADDRINUSE         = 48;       /// Address already in use
1174     enum EADDRNOTAVAIL      = 49;       /// Can't assign requested address
1175     enum ENETDOWN           = 50;       /// Network is down
1176     enum ENETUNREACH        = 51;       /// Network is unreachable
1177     enum ENETRESET          = 52;       /// Network dropped connection on reset
1178     enum ECONNABORTED       = 53;       /// Software caused connection abort
1179     enum ECONNRESET         = 54;       /// Connection reset by peer
1180     enum ENOBUFS            = 55;       /// No buffer space available
1181     enum EISCONN            = 56;       /// Socket is already connected
1182     enum ENOTCONN           = 57;       /// Socket is not connected
1183     enum ETIMEDOUT          = 60;       /// Operation timed out
1184     enum ECONNREFUSED       = 61;       /// Connection refused
1185     enum ELOOP              = 62;       /// Too many levels of symbolic links
1186     enum ENAMETOOLONG       = 63;       /// File name too long
1187     enum EHOSTUNREACH       = 65;       /// No route to host
1188     enum ENOTEMPTY          = 66;       /// Directory not empty
1189     enum EDQUOT             = 69;       /// Disc quota exceeded
1190     enum ESTALE             = 70;       /// Stale NFS file handle
1191     enum ENOLCK             = 77;       /// No locks available
1192     enum ENOSYS             = 78;       /// Function not implemented
1193     enum EOVERFLOW          = 84;       /// Value too large to be stored in data type
1194     enum ECANCELED          = 89;       /// Operation canceled
1195     enum EIDRM              = 90;       /// Identifier removed
1196     enum ENOMSG             = 91;       /// No message of desired type
1197     enum EILSEQ             = 92;       /// Illegal byte sequence
1198     enum EBADMSG            = 94;       /// Bad message
1199     enum EMULTIHOP          = 95;       /// Reserved
1200     enum ENODATA            = 96;       /// No message available on STREAM
1201     enum ENOLINK            = 97;       /// Reserved
1202     enum ENOSR              = 98;       /// No STREAM resources
1203     enum ENOSTR             = 99;       /// Not a STREAM
1204     enum EPROTO             = 100;      /// Protocol error
1205     enum ETIME              = 101;      /// STREAM ioctl timeout
1206     enum ELAST              = 101;      /// Must be equal largest errno
1207 }
1208 else version (FreeBSD)
1209 {
1210     enum EPERM              = 1;        /// Operation not permitted
1211     enum ENOENT             = 2;        /// No such file or directory
1212     enum ESRCH              = 3;        /// No such process
1213     enum EINTR              = 4;        /// Interrupted system call
1214     enum EIO                = 5;        /// Input/output error
1215     enum ENXIO              = 6;        /// Device not configured
1216     enum E2BIG              = 7;        /// Argument list too long
1217     enum ENOEXEC            = 8;        /// Exec format error
1218     enum EBADF              = 9;        /// Bad file descriptor
1219     enum ECHILD             = 10;       /// No child processes
1220     enum EDEADLK            = 11;       /// Resource deadlock avoided
1221     enum ENOMEM             = 12;       /// Cannot allocate memory
1222     enum EACCES             = 13;       /// Permission denied
1223     enum EFAULT             = 14;       /// Bad address
1224     enum ENOTBLK            = 15;       /// Block device required
1225     enum EBUSY              = 16;       /// Device busy
1226     enum EEXIST             = 17;       /// File exists
1227     enum EXDEV              = 18;       /// Cross-device link
1228     enum ENODEV             = 19;       /// Operation not supported by device
1229     enum ENOTDIR            = 20;       /// Not a directory
1230     enum EISDIR             = 21;       /// Is a directory
1231     enum EINVAL             = 22;       /// Invalid argument
1232     enum ENFILE             = 23;       /// Too many open files in system
1233     enum EMFILE             = 24;       /// Too many open files
1234     enum ENOTTY             = 25;       /// Inappropriate ioctl for device
1235     enum ETXTBSY            = 26;       /// Text file busy
1236     enum EFBIG              = 27;       /// File too large
1237     enum ENOSPC             = 28;       /// No space left on device
1238     enum ESPIPE             = 29;       /// Illegal seek
1239     enum EROFS              = 30;       /// Read-only file system
1240     enum EMLINK             = 31;       /// Too many links
1241     enum EPIPE              = 32;       /// Broken pipe
1242     enum EDOM               = 33;       /// Numerical argument out of domain
1243     enum ERANGE             = 34;       /// Result too large
1244     enum EAGAIN             = 35;       /// Resource temporarily unavailable
1245     enum EWOULDBLOCK        = EAGAIN;   /// Operation would block
1246     enum EINPROGRESS        = 36;       /// Operation now in progress
1247     enum EALREADY           = 37;       /// Operation already in progress
1248     enum ENOTSOCK           = 38;       /// Socket operation on non-socket
1249     enum EDESTADDRREQ       = 39;       /// Destination address required
1250     enum EMSGSIZE           = 40;       /// Message too long
1251     enum EPROTOTYPE         = 41;       /// Protocol wrong type for socket
1252     enum ENOPROTOOPT        = 42;       /// Protocol not available
1253     enum EPROTONOSUPPORT    = 43;       /// Protocol not supported
1254     enum ENOTSUP            = 45;       /// Operation not supported
1255     enum EOPNOTSUPP         = ENOTSUP;  /// Operation not supported on socket
1256     enum EAFNOSUPPORT       = 47;       /// Address family not supported by protocol family
1257     enum EADDRINUSE         = 48;       /// Address already in use
1258     enum EADDRNOTAVAIL      = 49;       /// Can't assign requested address
1259     enum ENETDOWN           = 50;       /// Network is down
1260     enum ENETUNREACH        = 51;       /// Network is unreachable
1261     enum ENETRESET          = 52;       /// Network dropped connection on reset
1262     enum ECONNABORTED       = 53;       /// Software caused connection abort
1263     enum ECONNRESET         = 54;       /// Connection reset by peer
1264     enum ENOBUFS            = 55;       /// No buffer space available
1265     enum EISCONN            = 56;       /// Socket is already connected
1266     enum ENOTCONN           = 57;       /// Socket is not connected
1267     enum ESHUTDOWN          = 58;       /// Can't send after socket shutdown
1268     enum ETOOMANYREFS       = 59;       /// Too many refrences; can't splice
1269     enum ETIMEDOUT          = 60;       /// Operation timed out
1270     enum ECONNREFUSED       = 61;       /// Connection refused
1271     enum ELOOP              = 62;       /// Too many levels of symbolic links
1272     enum ENAMETOOLONG       = 63;       /// File name too long
1273     enum EHOSTUNREACH       = 65;       /// No route to host
1274     enum ENOTEMPTY          = 66;       /// Directory not empty
1275     enum EPROCLIM           = 67;       /// Too many processes
1276     enum EUSERS             = 68;       /// Too many users
1277     enum EDQUOT             = 69;       /// Disc quota exceeded
1278     enum ESTALE             = 70;       /// Stale NFS file handle
1279     enum EREMOTE            = 71;       /// Too many levels of remote in path
1280     enum EBADRPC            = 72;       /// RPC struct is bad
1281     enum ERPCMISMATCH       = 73;       /// RPC version wrong
1282     enum EPROGUNAVAIL       = 74;       /// RPC prog. not avail
1283     enum EPROGMISMATCH      = 75;       /// Program version wrong
1284     enum EPROCUNAVAIL       = 76;       /// Bad procedure for program
1285     enum ENOLCK             = 77;       /// No locks available
1286     enum ENOSYS             = 78;       /// Function not implemented
1287     enum EFTYPE             = 79;       /// Inappropriate file type or format
1288     enum EAUTH              = 80;       /// Authentication error
1289     enum ENEEDAUTH          = 81;       /// Need authenticator
1290     enum EIDRM              = 82;       /// Itendifier removed
1291     enum ENOMSG             = 83;       /// No message of desired type
1292     enum EOVERFLOW          = 84;       /// Value too large to be stored in data type
1293     enum ECANCELED          = 85;       /// Operation canceled
1294     enum EILSEQ             = 86;       /// Illegal byte sequence
1295     enum ENOATTR            = 87;       /// Attribute not found
1296     enum EDOOFUS            = 88;       /// Programming error
1297     enum EBADMSG            = 89;       /// Bad message
1298     enum EMULTIHOP          = 90;       /// Multihop attempted
1299     enum ENOLINK            = 91;       /// Link has been severed
1300     enum EPROTO             = 92;       /// Protocol error
1301     enum ELAST              = 92;       /// Must be equal largest errno
1302 }
1303 else version (NetBSD)
1304 {
1305     // http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/sys/errno.h
1306     enum EPERM           = 1;
1307     enum ENOENT          = 2;
1308     enum ESRCH           = 3;
1309     enum EINTR           = 4;
1310     enum EIO             = 5;
1311     enum ENXIO           = 6;
1312     enum E2BIG           = 7;
1313     enum ENOEXEC         = 8;
1314     enum EBADF           = 9;
1315     enum ECHILD          = 10;
1316     enum EDEADLK         = 11;
1317     ///
1318     enum ENOMEM          = 12;
1319     enum EACCES          = 13;
1320     enum EFAULT          = 14;
1321     enum ENOTBLK         = 15;
1322     enum EBUSY           = 16;
1323     enum EEXIST          = 17;
1324     enum EXDEV           = 18;
1325     enum ENODEV          = 19;
1326     enum ENOTDIR         = 20;
1327     enum EISDIR          = 21;
1328     enum EINVAL          = 22;
1329     enum ENFILE          = 23;
1330     enum EMFILE          = 24;
1331     enum ENOTTY          = 25;
1332     enum ETXTBSY         = 26;
1333     enum EFBIG           = 27;
1334     enum ENOSPC          = 28;
1335     enum ESPIPE          = 29;
1336     enum EROFS           = 30;
1337     enum EMLINK          = 31;
1338     enum EPIPE           = 32;
1339     ///
1340     enum EDOM            = 33;
1341     enum ERANGE          = 34;
1342 
1343     ///
1344     enum EAGAIN          = 35;
1345     enum EWOULDBLOCK     = EAGAIN;
1346     enum EINPROGRESS     = 36;
1347     enum EALREADY        = 37;
1348 
1349     ///
1350     enum ENOTSOCK        = 38;
1351     enum EDESTADDRREQ    = 39;
1352     enum EMSGSIZE        = 40;
1353     enum EPROTOTYPE      = 41;
1354     enum ENOPROTOOPT     = 42;
1355     enum EPROTONOSUPPORT = 43;
1356     enum ESOCKTNOSUPPORT = 44;
1357     enum EOPNOTSUPP      = 45;
1358     enum EPFNOSUPPORT    = 46;
1359     enum EAFNOSUPPORT    = 47;
1360     enum EADDRINUSE      = 48;
1361     enum EADDRNOTAVAIL   = 49;
1362 
1363     ///
1364     enum ENETDOWN        = 50;
1365     enum ENETUNREACH     = 51;
1366     enum ENETRESET       = 52;
1367     enum ECONNABORTED    = 53;
1368     enum ECONNRESET      = 54;
1369     enum ENOBUFS         = 55;
1370     enum EISCONN         = 56;
1371     enum ENOTCONN        = 57;
1372     enum ESHUTDOWN       = 58;
1373     enum ETOOMANYREFS    = 59;
1374     enum ETIMEDOUT       = 60;
1375     enum ECONNREFUSED    = 61;
1376     enum ELOOP           = 62;
1377     enum ENAMETOOLONG    = 63;
1378 
1379     ///
1380     enum EHOSTDOWN       = 64;
1381     enum EHOSTUNREACH    = 65;
1382     enum ENOTEMPTY       = 66;
1383 
1384     ///
1385     enum EPROCLIM        = 67;
1386     enum EUSERS          = 68;
1387     enum EDQUOT          = 69;
1388 
1389     ///
1390     enum ESTALE          = 70;
1391     enum EREMOTE         = 71;
1392     enum EBADRPC         = 72;
1393     enum ERPCMISMATCH    = 73;
1394     enum EPROGUNAVAIL    = 74;
1395     enum EPROGMISMATCH   = 75;
1396     enum EPROCUNAVAIL    = 76;
1397 
1398     enum ENOLCK          = 77;
1399     enum ENOSYS          = 78;
1400 
1401     enum EFTYPE          = 79;
1402     enum EAUTH           = 80;
1403     enum ENEEDAUTH       = 81;
1404 
1405     ///
1406     enum EIDRM           = 82;
1407     enum ENOMSG          = 83;
1408     enum EOVERFLOW       = 84;
1409     ///
1410     enum EILSEQ          = 85;
1411 
1412     ///
1413     enum ENOTSUP         = 86;
1414 
1415     ///
1416     enum ECANCELED       = 87;
1417 
1418     ///
1419     enum EBADMSG         = 88;
1420 
1421     ///
1422     enum ENODATA         = 89;
1423     enum ENOSR           = 90;
1424     enum ENOSTR          = 91;
1425     enum ETIME           = 92;
1426 
1427     ///
1428     enum ENOATTR         = 93;
1429 
1430     ///
1431     enum EMULTIHOP       = 94;
1432     enum ENOLINK         = 95;
1433     enum EPROTO          = 96;
1434 }
1435 else version (OpenBSD)
1436 {
1437     enum EPERM              = 1;        /// Operation not permitted
1438     enum ENOENT             = 2;        /// No such file or directory
1439     enum ESRCH              = 3;        /// No such process
1440     enum EINTR              = 4;        /// Interrupted system call
1441     enum EIO                = 5;        /// Input/output error
1442     enum ENXIO              = 6;        /// Device not configured
1443     enum E2BIG              = 7;        /// Argument list too long
1444     enum ENOEXEC            = 8;        /// Exec format error
1445     enum EBADF              = 9;        /// Bad file descriptor
1446     enum ECHILD             = 10;       /// No child processes
1447     enum EDEADLK            = 11;       /// Resource deadlock avoided
1448     enum ENOMEM             = 12;       /// Cannot allocate memory
1449     enum EACCES             = 13;       /// Permission denied
1450     enum EFAULT             = 14;       /// Bad address
1451     enum ENOTBLK            = 15;       /// Block device required
1452     enum EBUSY              = 16;       /// Device busy
1453     enum EEXIST             = 17;       /// File exists
1454     enum EXDEV              = 18;       /// Cross-device link
1455     enum ENODEV             = 19;       /// Operation not supported by device
1456     enum ENOTDIR            = 20;       /// Not a directory
1457     enum EISDIR             = 21;       /// Is a directory
1458     enum EINVAL             = 22;       /// Invalid argument
1459     enum ENFILE             = 23;       /// Too many open files in system
1460     enum EMFILE             = 24;       /// Too many open files
1461     enum ENOTTY             = 25;       /// Inappropriate ioctl for device
1462     enum ETXTBSY            = 26;       /// Text file busy
1463     enum EFBIG              = 27;       /// File too large
1464     enum ENOSPC             = 28;       /// No space left on device
1465     enum ESPIPE             = 29;       /// Illegal seek
1466     enum EROFS              = 30;       /// Read-only file system
1467     enum EMLINK             = 31;       /// Too many links
1468     enum EPIPE              = 32;       /// Broken pipe
1469     enum EDOM               = 33;       /// Numerical argument out of domain
1470     enum ERANGE             = 34;       /// Result too large
1471     enum EAGAIN             = 35;       /// Resource temporarily unavailable
1472     enum EWOULDBLOCK        = EAGAIN;   /// Operation would block
1473     enum EINPROGRESS        = 36;       /// Operation now in progress
1474     enum EALREADY           = 37;       /// Operation already in progress
1475     enum ENOTSOCK           = 38;       /// Socket operation on non-socket
1476     enum EDESTADDRREQ       = 39;       /// Destination address required
1477     enum EMSGSIZE           = 40;       /// Message too long
1478     enum EPROTOTYPE         = 41;       /// Protocol wrong type for socket
1479     enum ENOPROTOOPT        = 42;       /// Protocol not available
1480     enum EPROTONOSUPPORT    = 43;       /// Protocol not supported
1481     enum ESOCKTNOSUPPORT    = 44;       /// Socket type not supported
1482     enum EOPNOTSUPP         = 45;       /// Operation not supported
1483     enum EPFNOSUPPORT       = 46;       /// Protocol family not supported
1484     enum EAFNOSUPPORT       = 47;       /// Address family not supported by protocol family
1485     enum EADDRINUSE         = 48;       /// Address already in use
1486     enum EADDRNOTAVAIL      = 49;       /// Can't assign requested address
1487     enum ENETDOWN           = 50;       /// Network is down
1488     enum ENETUNREACH        = 51;       /// Network is unreachable
1489     enum ENETRESET          = 52;       /// Network dropped connection on reset
1490     enum ECONNABORTED       = 53;       /// Software caused connection abort
1491     enum ECONNRESET         = 54;       /// Connection reset by peer
1492     enum ENOBUFS            = 55;       /// No buffer space available
1493     enum EISCONN            = 56;       /// Socket is already connected
1494     enum ENOTCONN           = 57;       /// Socket is not connected
1495     enum ESHUTDOWN          = 58;       /// Can't send after socket shutdown
1496     enum ETOOMANYREFS       = 59;       /// Too many references: can't splice
1497     enum ETIMEDOUT          = 60;       /// Operation timed out
1498     enum ECONNREFUSED       = 61;       /// Connection refused
1499     enum ELOOP              = 62;       /// Too many levels of symbolic links
1500     enum ENAMETOOLONG       = 63;       /// File name too long
1501     enum EHOSTDOWN          = 64;       /// Host is down
1502     enum EHOSTUNREACH       = 65;       /// No route to host
1503     enum ENOTEMPTY          = 66;       /// Directory not empty
1504     enum EPROCLIM           = 67;       /// Too many processes
1505     enum EUSERS             = 68;       /// Too many users
1506     enum EDQUOT             = 69;       /// Disk quota exceeded
1507     enum ESTALE             = 70;       /// Stale NFS file handle
1508     enum EREMOTE            = 71;       /// Too many levels of remote in path
1509     enum EBADRPC            = 72;       /// RPC struct is bad
1510     enum ERPCMISMATCH       = 73;       /// RPC version wrong
1511     enum EPROGUNAVAIL       = 74;       /// RPC program not available
1512     enum EPROGMISMATCH      = 75;       /// Program version wrong
1513     enum EPROCUNAVAIL       = 76;       /// Bad procedure for program
1514     enum ENOLCK             = 77;       /// No locks available
1515     enum ENOSYS             = 78;       /// Function not implemented
1516     enum EFTYPE             = 79;       /// Inappropriate file type or format
1517     enum EAUTH              = 80;       /// Authentication error
1518     enum ENEEDAUTH          = 81;       /// Need authenticator
1519     enum EIPSEC             = 82;       /// IPsec processing failure
1520     enum ENOATTR            = 83;       /// Attribute not found
1521     enum EILSEQ             = 84;       /// Illegal byte sequence
1522     enum ENOMEDIUM          = 85;       /// No medium found
1523     enum EMEDIUMTYPE        = 86;       /// Wrong medium type
1524     enum EOVERFLOW          = 87;       /// Value too large to be stored in data type
1525     enum ECANCELED          = 88;       /// Operation canceled
1526     enum EIDRM              = 89;       /// Identifier removed
1527     enum ENOMSG             = 90;       /// No message of desired type
1528     enum ENOTSUP            = 91;       /// Not supported
1529     enum EBADMSG            = 92;       /// Bad message
1530     enum ENOTRECOVERABLE    = 93;       /// State not recoverable
1531     enum EOWNERDEAD         = 94;       /// Previous owner died
1532     enum EPROTO             = 95;       /// Protocol error
1533     enum ELAST              = 95;       /// Must be equal largest errno
1534 }
1535 else version (DragonFlyBSD)
1536 {
1537     enum EPERM              = 1;
1538     enum ENOENT             = 2;
1539     enum ESRCH              = 3;
1540     enum EINTR              = 4;
1541     enum EIO                = 5;
1542     enum ENXIO              = 6;
1543     enum E2BIG              = 7;
1544     enum ENOEXEC            = 8;
1545     enum EBADF              = 9;
1546     enum ECHILD             = 10;
1547     enum EDEADLK            = 11;
1548     enum ENOMEM             = 12;
1549     enum EACCES             = 13;
1550     enum EFAULT             = 14;
1551     enum ENOTBLK            = 15;
1552     enum EBUSY              = 16;
1553     enum EEXIST             = 17;
1554     enum EXDEV              = 18;
1555     enum ENODEV             = 19;
1556     enum ENOTDIR            = 20;
1557     enum EISDIR             = 21;
1558     enum EINVAL             = 22;
1559     enum ENFILE             = 23;
1560     enum EMFILE             = 24;
1561     enum ENOTTY             = 25;
1562     enum ETXTBSY            = 26;
1563     enum EFBIG              = 27;
1564     enum ENOSPC             = 28;
1565     enum ESPIPE             = 29;
1566     enum EROFS              = 30;
1567     enum EMLINK             = 31;
1568     enum EPIPE              = 32;
1569     enum EDOM               = 33;
1570     enum ERANGE             = 34;
1571     enum EAGAIN             = 35;
1572     enum EWOULDBLOCK        = EAGAIN;
1573     enum EINPROGRESS        = 36;
1574     enum EALREADY           = 37;
1575     enum ENOTSOCK           = 38;
1576     enum EDESTADDRREQ       = 39;
1577     enum EMSGSIZE           = 40;
1578     enum EPROTOTYPE         = 41;
1579     enum ENOPROTOOPT        = 42;
1580     enum EPROTONOSUPPORT    = 43;
1581     enum ENOTSUP            = 45;
1582     enum EOPNOTSUPP         = ENOTSUP;
1583     enum EPFNOSUPPORT       = 46;
1584     enum EAFNOSUPPORT       = 47;
1585     enum EADDRINUSE         = 48;
1586     enum EADDRNOTAVAIL      = 49;
1587     enum ENETDOWN           = 50;
1588     enum ENETUNREACH        = 51;
1589     enum ENETRESET          = 52;
1590     enum ECONNABORTED       = 53;
1591     enum ECONNRESET         = 54;
1592     enum ENOBUFS            = 55;
1593     enum EISCONN            = 56;
1594     enum ENOTCONN           = 57;
1595     enum ESHUTDOWN          = 58;
1596     enum ETOOMANYREFS       = 59;
1597     enum ETIMEDOUT          = 60;
1598     enum ECONNREFUSED       = 61;
1599     enum ELOOP              = 62;
1600     enum ENAMETOOLONG       = 63;
1601     enum EHOSTUNREACH       = 65;
1602     enum ENOTEMPTY          = 66;
1603     enum EPROCLIM           = 67;
1604     enum EUSERS             = 68;
1605     enum EDQUOT             = 69;
1606     enum ESTALE             = 70;
1607     enum EREMOTE            = 71;
1608     enum EBADRPC            = 72;
1609     enum ERPCMISMATCH       = 73;
1610     enum EPROGUNAVAIL       = 74;
1611     enum EPROGMISMATCH      = 75;
1612     enum EPROCUNAVAIL       = 76;
1613     enum ENOLCK             = 77;
1614     enum ENOSYS             = 78;
1615     enum EFTYPE             = 79;
1616     enum EAUTH              = 80;
1617     enum ENEEDAUTH          = 81;
1618     enum EIDRM              = 82;
1619     enum ENOMSG             = 83;
1620     enum EOVERFLOW          = 84;
1621     enum ECANCELED          = 85;
1622     enum EILSEQ             = 86;
1623     enum ENOATTR            = 87;
1624     enum EDOOFUS            = 88;
1625     enum EBADMSG            = 89;
1626     enum EMULTIHOP          = 90;
1627     enum ENOLINK            = 91;
1628     enum EPROTO             = 92;
1629     enum ENOMEDIUM          = 93;
1630     enum EUNUSED94          = 94;
1631     enum EUNUSED95          = 95;
1632     enum EUNUSED96          = 96;
1633     enum EUNUSED97          = 97;
1634     enum EUNUSED98          = 98;
1635     enum EASYNC             = 99;
1636     enum ELAST              = 99;
1637 }
1638 else version (Solaris)
1639 {
1640     enum EPERM =  1;              ///  Not super-user
1641     enum ENOENT = 2;              ///  No such file or directory
1642     enum ESRCH =  3;              ///  No such process
1643     enum EINTR =  4;              ///  interrupted system call
1644     enum EIO =    5;              ///  I/O error
1645     enum ENXIO =  6;              ///  No such device or address
1646     enum E2BIG =  7;              ///  Arg list too long
1647     enum ENOEXEC = 8;             ///  Exec format error
1648     enum EBADF =  9;              ///  Bad file number
1649     enum ECHILD = 10;             ///  No children
1650     enum EAGAIN = 11;             ///  Resource temporarily unavailable
1651     enum ENOMEM = 12;             ///  Not enough core
1652     enum EACCES = 13;             ///  Permission denied
1653     enum EFAULT = 14;             ///  Bad address
1654     enum ENOTBLK = 15;            ///  Block device required
1655     enum EBUSY =  16;             ///  Mount device busy
1656     enum EEXIST = 17;             ///  File exists
1657     enum EXDEV =  18;             ///  Cross-device link
1658     enum ENODEV = 19;             ///  No such device
1659     enum ENOTDIR = 20;            ///  Not a directory
1660     enum EISDIR = 21;             ///  Is a directory
1661     enum EINVAL = 22;             ///  Invalid argument
1662     enum ENFILE = 23;             ///  File table overflow
1663     enum EMFILE = 24;             ///  Too many open files
1664     enum ENOTTY = 25;             ///  Inappropriate ioctl for device
1665     enum ETXTBSY = 26;            ///  Text file busy
1666     enum EFBIG =  27;             ///  File too large
1667     enum ENOSPC = 28;             ///  No space left on device
1668     enum ESPIPE = 29;             ///  Illegal seek
1669     enum EROFS =  30;             ///  Read only file system
1670     enum EMLINK = 31;             ///  Too many links
1671     enum EPIPE =  32;             ///  Broken pipe
1672     enum EDOM =   33;             ///  Math arg out of domain of func
1673     enum ERANGE = 34;             ///  Math result not representable
1674     enum ENOMSG = 35;             ///  No message of desired type
1675     enum EIDRM =  36;             ///  Identifier removed
1676     enum ECHRNG = 37;             ///  Channel number out of range
1677     enum EL2NSYNC = 38;           ///  Level 2 not synchronized
1678     enum EL3HLT = 39;             ///  Level 3 halted
1679     enum EL3RST = 40;             ///  Level 3 reset
1680     enum ELNRNG = 41;             ///  Link number out of range
1681     enum EUNATCH = 42;            ///  Protocol driver not attached
1682     enum ENOCSI = 43;             ///  No CSI structure available
1683     enum EL2HLT = 44;             ///  Level 2 halted
1684     enum EDEADLK = 45;            ///  Deadlock condition.
1685     enum ENOLCK = 46;             ///  No record locks available.
1686     enum ECANCELED = 47;          ///  Operation canceled
1687     enum ENOTSUP = 48;            ///  Operation not supported
1688     enum EDQUOT = 49;             ///  Disc quota exceeded
1689     enum EBADE =  50;             ///  invalid exchange
1690     enum EBADR =  51;             ///  invalid request descriptor
1691     enum EXFULL = 52;             ///  exchange full
1692     enum ENOANO = 53;             ///  no anode
1693     enum EBADRQC = 54;            ///  invalid request code
1694     enum EBADSLT = 55;            ///  invalid slot
1695     enum EDEADLOCK = 56;          ///  file locking deadlock error
1696     enum EBFONT = 57;             ///  bad font file fmt
1697     enum EOWNERDEAD =     58;     ///  process died with the lock
1698     enum ENOTRECOVERABLE = 59;    ///  lock is not recoverable
1699     enum ENOSTR = 60;             ///  Device not a stream
1700     enum ENODATA = 61;            ///  no data (for no delay io)
1701     enum ETIME =  62;             ///  timer expired
1702     enum ENOSR =  63;             ///  out of streams resources
1703     enum ENONET = 64;             ///  Machine is not on the network
1704     enum ENOPKG = 65;             ///  Package not installed
1705     enum EREMOTE = 66;            ///  The object is remote
1706     enum ENOLINK = 67;            ///  the link has been severed
1707     enum EADV =   68;             ///  advertise error
1708     enum ESRMNT = 69;             ///  srmount error
1709     enum ECOMM =  70;             ///  Communication error on send
1710     enum EPROTO = 71;             ///  Protocol error
1711     enum ELOCKUNMAPPED =  72;     ///  locked lock was unmapped
1712     enum ENOTACTIVE = 73;         ///  Facility is not active
1713     enum EMULTIHOP = 74;          ///  multihop attempted
1714     enum EBADMSG = 77;            ///  trying to read unreadable message
1715     enum ENAMETOOLONG = 78;       ///  path name is too long
1716     enum EOVERFLOW = 79;          ///  value too large to be stored in data type
1717     enum ENOTUNIQ = 80;           ///  given log. name not unique
1718     enum EBADFD =  81;            ///  f.d. invalid for this operation
1719     enum EREMCHG = 82;            ///  Remote address changed
1720     enum ELIBACC = 83;            ///  Can't access a needed shared lib.
1721     enum ELIBBAD = 84;            ///  Accessing a corrupted shared lib.
1722     enum ELIBSCN = 85;            ///  .lib section in a.out corrupted.
1723     enum ELIBMAX = 86;            ///  Attempting to link in too many libs.
1724     enum ELIBEXEC = 87;           ///  Attempting to exec a shared library.
1725     enum EILSEQ = 88;             ///  Illegal byte sequence.
1726     enum ENOSYS = 89;             ///  Unsupported file system operation
1727     enum ELOOP =  90;             ///  Symbolic link loop
1728     enum ERESTART = 91;           ///  Restartable system call
1729     enum ESTRPIPE = 92;           ///  if pipe/FIFO, don't sleep in stream head
1730     enum ENOTEMPTY = 93;          ///  directory not empty
1731     enum EUSERS = 94;             ///  Too many users (for UFS)
1732     enum ENOTSOCK =       95;     ///  Socket operation on non-socket
1733     enum EDESTADDRREQ =   96;     ///  Destination address required
1734     enum EMSGSIZE =       97;     ///  Message too long
1735     enum EPROTOTYPE =     98;     ///  Protocol wrong type for socket
1736     enum ENOPROTOOPT =    99;     ///  Protocol not available
1737     enum EPROTONOSUPPORT = 120;   ///  Protocol not supported
1738     enum ESOCKTNOSUPPORT = 121;   ///  Socket type not supported
1739     enum EOPNOTSUPP =     122;    ///  Operation not supported on socket
1740     enum EPFNOSUPPORT =   123;    ///  Protocol family not supported
1741     enum EAFNOSUPPORT =   124;    ///  Address family not supported by the protocol family
1742     enum EADDRINUSE =     125;    ///  Address already in use
1743     enum EADDRNOTAVAIL =   126;   ///  Can't assign requested address
1744     enum ENETDOWN =       127;    ///  Network is down
1745     enum ENETUNREACH =    128;    ///  Network is unreachable
1746     enum ENETRESET =      129;    ///  Network dropped connection because of reset
1747     enum ECONNABORTED =   130;    ///  Software caused connection abort
1748     enum ECONNRESET =     131;    ///  Connection reset by peer
1749     enum ENOBUFS =        132;    ///  No buffer space available
1750     enum EISCONN =        133;    ///  Socket is already connected
1751     enum ENOTCONN =       134;    ///  Socket is not connected
1752     enum ESHUTDOWN =      143;    ///  Can't send after socket shutdown
1753     enum ETOOMANYREFS =   144;    ///  Too many references: can't splice
1754     enum ETIMEDOUT =      145;    ///  Connection timed out
1755     enum ECONNREFUSED =   146;    ///  Connection refused
1756     enum EHOSTDOWN =      147;    ///  Host is down
1757     enum EHOSTUNREACH =   148;    ///  No route to host
1758     enum EWOULDBLOCK =    EAGAIN; ///  Resource temporarily unavailable
1759     enum EALREADY =       149;    ///  operation already in progress
1760     enum EINPROGRESS =    150;    ///  operation now in progress
1761     enum ESTALE =         151;    ///  Stale NFS file handle
1762 }
1763 else version (Haiku)
1764 {
1765     // https://github.com/haiku/haiku/blob/master/headers/os/support/Errors.h
1766     // https://github.com/haiku/haiku/blob/master/headers/build/os/support/Errors.h
1767     import core.stdc.limits : INT_MIN;
1768     enum B_GENERAL_ERROR_BASE        = INT_MIN;
1769     enum B_OS_ERROR_BASE             = (B_GENERAL_ERROR_BASE + 0x1000);
1770     enum B_APP_ERROR_BASE            = (B_GENERAL_ERROR_BASE + 0x2000);
1771     enum B_INTERFACE_ERROR_BASE      = (B_GENERAL_ERROR_BASE + 0x3000);
1772     enum B_MEDIA_ERROR_BASE          = (B_GENERAL_ERROR_BASE + 0x4000);
1773                                             /* - 0x41ff */
1774     enum B_TRANSLATION_ERROR_BASE    = (B_GENERAL_ERROR_BASE + 0x4800);
1775                                             /* - 0x48ff */
1776     enum B_MIDI_ERROR_BASE           = (B_GENERAL_ERROR_BASE + 0x5000);
1777     enum B_STORAGE_ERROR_BASE        = (B_GENERAL_ERROR_BASE + 0x6000);
1778     enum B_POSIX_ERROR_BASE          = (B_GENERAL_ERROR_BASE + 0x7000);
1779     enum B_MAIL_ERROR_BASE           = (B_GENERAL_ERROR_BASE + 0x8000);
1780     enum B_PRINT_ERROR_BASE          = (B_GENERAL_ERROR_BASE + 0x9000);
1781     enum B_DEVICE_ERROR_BASE         = (B_GENERAL_ERROR_BASE + 0xa000);
1782 
1783     /* General Errors */
1784     enum B_NO_MEMORY                 = (B_GENERAL_ERROR_BASE + 0);
1785     enum B_IO_ERROR                  = (B_GENERAL_ERROR_BASE + 1);
1786     enum B_PERMISSION_DENIED         = (B_GENERAL_ERROR_BASE + 2);
1787     enum B_BAD_INDEX                 = (B_GENERAL_ERROR_BASE + 3);
1788     enum B_BAD_TYPE                  = (B_GENERAL_ERROR_BASE + 4);
1789     enum B_BAD_VALUE                 = (B_GENERAL_ERROR_BASE + 5);
1790     enum B_MISMATCHED_VALUES         = (B_GENERAL_ERROR_BASE + 6);
1791     enum B_NAME_NOT_FOUND            = (B_GENERAL_ERROR_BASE + 7);
1792     enum B_NAME_IN_USE               = (B_GENERAL_ERROR_BASE + 8);
1793     enum B_TIMED_OUT                 = (B_GENERAL_ERROR_BASE + 9);
1794     enum B_INTERRUPTED               = (B_GENERAL_ERROR_BASE + 10);
1795     enum B_WOULD_BLOCK               = (B_GENERAL_ERROR_BASE + 11);
1796     enum B_CANCELED                  = (B_GENERAL_ERROR_BASE + 12);
1797     enum B_NO_INIT                   = (B_GENERAL_ERROR_BASE + 13);
1798     enum B_NOT_INITIALIZED           = (B_GENERAL_ERROR_BASE + 13);
1799     enum B_BUSY                      = (B_GENERAL_ERROR_BASE + 14);
1800     enum B_NOT_ALLOWED               = (B_GENERAL_ERROR_BASE + 15);
1801     enum B_BAD_DATA                  = (B_GENERAL_ERROR_BASE + 16);
1802     enum B_DONT_DO_THAT              = (B_GENERAL_ERROR_BASE + 17);
1803 
1804     enum B_ERROR                     = (-1);
1805     enum B_OK                        = (int(0));
1806     enum B_NO_ERROR                  = (int(0));
1807 
1808     /* Kernel Kit Errors */
1809     enum B_BAD_SEM_ID                = (B_OS_ERROR_BASE + 0);
1810     enum B_NO_MORE_SEMS              = (B_OS_ERROR_BASE + 1);
1811 
1812     enum B_BAD_THREAD_ID             = (B_OS_ERROR_BASE + 0x100);
1813     enum B_NO_MORE_THREADS           = (B_OS_ERROR_BASE + 0x101);
1814     enum B_BAD_THREAD_STATE          = (B_OS_ERROR_BASE + 0x102);
1815     enum B_BAD_TEAM_ID               = (B_OS_ERROR_BASE + 0x103);
1816     enum B_NO_MORE_TEAMS             = (B_OS_ERROR_BASE + 0x104);
1817 
1818     enum B_BAD_PORT_ID               = (B_OS_ERROR_BASE + 0x200);
1819     enum B_NO_MORE_PORTS             = (B_OS_ERROR_BASE + 0x201);
1820 
1821     enum B_BAD_IMAGE_ID              = (B_OS_ERROR_BASE + 0x300);
1822     enum B_BAD_ADDRESS               = (B_OS_ERROR_BASE + 0x301);
1823     enum B_NOT_AN_EXECUTABLE         = (B_OS_ERROR_BASE + 0x302);
1824     enum B_MISSING_LIBRARY           = (B_OS_ERROR_BASE + 0x303);
1825     enum B_MISSING_SYMBOL            = (B_OS_ERROR_BASE + 0x304);
1826     enum B_UNKNOWN_EXECUTABLE        = (B_OS_ERROR_BASE + 0x305);
1827     enum B_LEGACY_EXECUTABLE         = (B_OS_ERROR_BASE + 0x306);
1828 
1829     enum B_DEBUGGER_ALREADY_INSTALLED    = (B_OS_ERROR_BASE + 0x400);
1830 
1831     /* Application Kit Errors */
1832     enum B_BAD_REPLY                         = (B_APP_ERROR_BASE + 0);
1833     enum B_DUPLICATE_REPLY                   = (B_APP_ERROR_BASE + 1);
1834     enum B_MESSAGE_TO_SELF                   = (B_APP_ERROR_BASE + 2);
1835     enum B_BAD_HANDLER                       = (B_APP_ERROR_BASE + 3);
1836     enum B_ALREADY_RUNNING                   = (B_APP_ERROR_BASE + 4);
1837     enum B_LAUNCH_FAILED                     = (B_APP_ERROR_BASE + 5);
1838     enum B_AMBIGUOUS_APP_LAUNCH              = (B_APP_ERROR_BASE + 6);
1839     enum B_UNKNOWN_MIME_TYPE                 = (B_APP_ERROR_BASE + 7);
1840     enum B_BAD_SCRIPT_SYNTAX                 = (B_APP_ERROR_BASE + 8);
1841     enum B_LAUNCH_FAILED_NO_RESOLVE_LINK     = (B_APP_ERROR_BASE + 9);
1842     enum B_LAUNCH_FAILED_EXECUTABLE          = (B_APP_ERROR_BASE + 10);
1843     enum B_LAUNCH_FAILED_APP_NOT_FOUND       = (B_APP_ERROR_BASE + 11);
1844     enum B_LAUNCH_FAILED_APP_IN_TRASH        = (B_APP_ERROR_BASE + 12);
1845     enum B_LAUNCH_FAILED_NO_PREFERRED_APP    = (B_APP_ERROR_BASE + 13);
1846     enum B_LAUNCH_FAILED_FILES_APP_NOT_FOUND = (B_APP_ERROR_BASE + 14);
1847     enum B_BAD_MIME_SNIFFER_RULE             = (B_APP_ERROR_BASE + 15);
1848     enum B_NOT_A_MESSAGE                     = (B_APP_ERROR_BASE + 16);
1849     enum B_SHUTDOWN_CANCELLED                = (B_APP_ERROR_BASE + 17);
1850     enum B_SHUTTING_DOWN                     = (B_APP_ERROR_BASE + 18);
1851 
1852     /* Storage Kit/File System Errors */
1853     enum B_FILE_ERROR                        = (B_STORAGE_ERROR_BASE + 0);
1854     enum B_FILE_NOT_FOUND                    = (B_STORAGE_ERROR_BASE + 1);
1855                 /* deprecated: use B_ENTRY_NOT_FOUND instead */
1856     enum B_FILE_EXISTS                       = (B_STORAGE_ERROR_BASE + 2);
1857     enum B_ENTRY_NOT_FOUND                   = (B_STORAGE_ERROR_BASE + 3);
1858     enum B_NAME_TOO_LONG                     = (B_STORAGE_ERROR_BASE + 4);
1859     enum B_NOT_A_DIRECTORY                   = (B_STORAGE_ERROR_BASE + 5);
1860     enum B_DIRECTORY_NOT_EMPTY               = (B_STORAGE_ERROR_BASE + 6);
1861     enum B_DEVICE_FULL                       = (B_STORAGE_ERROR_BASE + 7);
1862     enum B_READ_ONLY_DEVICE                  = (B_STORAGE_ERROR_BASE + 8);
1863     enum B_IS_A_DIRECTORY                    = (B_STORAGE_ERROR_BASE + 9);
1864     enum B_NO_MORE_FDS                       = (B_STORAGE_ERROR_BASE + 10);
1865     enum B_CROSS_DEVICE_LINK                 = (B_STORAGE_ERROR_BASE + 11);
1866     enum B_LINK_LIMIT                        = (B_STORAGE_ERROR_BASE + 12);
1867     enum B_BUSTED_PIPE                       = (B_STORAGE_ERROR_BASE + 13);
1868     enum B_UNSUPPORTED                       = (B_STORAGE_ERROR_BASE + 14);
1869     enum B_PARTITION_TOO_SMALL               = (B_STORAGE_ERROR_BASE + 15);
1870     enum B_PARTIAL_READ                      = (B_STORAGE_ERROR_BASE + 16);
1871     enum B_PARTIAL_WRITE                     = (B_STORAGE_ERROR_BASE + 17);
1872 
1873     /* POSIX Errors */
1874     enum B_USE_POSITIVE_POSIX_ERRORS = false;
1875 
1876     static if (B_USE_POSITIVE_POSIX_ERRORS)
1877     {
1878         enum B_TO_POSIX_ERROR(int code) = -code;
1879     }
1880     else
1881     {
1882         enum B_TO_POSIX_ERROR(int code) = code;
1883     }
1884     alias B_FROM_POSIX_ERROR = B_TO_POSIX_ERROR;
1885 
1886     enum B_POSIX_ENOMEM  = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 0);
1887     enum E2BIG           = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 1);
1888     enum ECHILD          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 2);
1889     enum EDEADLK         = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 3);
1890     enum EFBIG           = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 4);
1891     enum EMLINK          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 5);
1892     enum ENFILE          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 6);
1893     enum ENODEV          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 7);
1894     enum ENOLCK          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 8);
1895     enum ENOSYS          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 9);
1896     enum ENOTTY          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 10);
1897     enum ENXIO           = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 11);
1898     enum ESPIPE          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 12);
1899     enum ESRCH           = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 13);
1900     enum EFPOS           = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 14);
1901     enum ESIGPARM        = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 15);
1902     enum EDOM            = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 16);
1903     enum ERANGE          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 17);
1904     enum EPROTOTYPE      = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 18);
1905     enum EPROTONOSUPPORT = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 19);
1906     enum EPFNOSUPPORT    = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 20);
1907     enum EAFNOSUPPORT    = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 21);
1908     enum EADDRINUSE      = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 22);
1909     enum EADDRNOTAVAIL   = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 23);
1910     enum ENETDOWN        = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 24);
1911     enum ENETUNREACH     = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 25);
1912     enum ENETRESET       = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 26);
1913     enum ECONNABORTED    = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 27);
1914     enum ECONNRESET      = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 28);
1915     enum EISCONN         = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 29);
1916     enum ENOTCONN        = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 30);
1917     enum ESHUTDOWN       = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 31);
1918     enum ECONNREFUSED    = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 32);
1919     enum EHOSTUNREACH    = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 33);
1920     enum ENOPROTOOPT     = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 34);
1921     enum ENOBUFS         = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 35);
1922     enum EINPROGRESS     = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 36);
1923     enum EALREADY        = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 37);
1924     enum EILSEQ          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 38);
1925     enum ENOMSG          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 39);
1926     enum ESTALE          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 40);
1927     enum EOVERFLOW       = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 41);
1928     enum EMSGSIZE        = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 42);
1929     enum EOPNOTSUPP      = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 43);
1930     enum ENOTSOCK        = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 44);
1931     enum EHOSTDOWN       = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 45);
1932     enum EBADMSG         = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 46);
1933     enum ECANCELED       = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 47);
1934     enum EDESTADDRREQ    = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 48);
1935     enum EDQUOT          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 49);
1936     enum EIDRM           = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 50);
1937     enum EMULTIHOP       = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 51);
1938     enum ENODATA         = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 52);
1939     enum ENOLINK         = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 53);
1940     enum ENOSR           = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 54);
1941     enum ENOSTR          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 55);
1942     enum ENOTSUP         = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 56);
1943     enum EPROTO          = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 57);
1944     enum ETIME           = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 58);
1945     enum ETXTBSY         = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 59);
1946     enum ENOATTR         = B_TO_POSIX_ERROR!(B_POSIX_ERROR_BASE + 60);
1947 
1948     /* B_NO_MEMORY (0x80000000) can't be negated, so it needs special handling */
1949     static if (B_USE_POSITIVE_POSIX_ERRORS)
1950         enum ENOMEM = B_POSIX_ENOMEM;
1951     else
1952         enum ENOMEM = B_NO_MEMORY;
1953 
1954     /* POSIX errors that can be mapped to BeOS error codes */
1955     enum EACCES          = B_TO_POSIX_ERROR!(B_PERMISSION_DENIED);
1956     enum EINTR           = B_TO_POSIX_ERROR!(B_INTERRUPTED);
1957     enum EIO             = B_TO_POSIX_ERROR!(B_IO_ERROR);
1958     enum EBUSY           = B_TO_POSIX_ERROR!(B_BUSY);
1959     enum EFAULT          = B_TO_POSIX_ERROR!(B_BAD_ADDRESS);
1960     enum ETIMEDOUT       = B_TO_POSIX_ERROR!(B_TIMED_OUT);
1961     enum EAGAIN          = B_TO_POSIX_ERROR!(B_WOULD_BLOCK) /* SysV compatibility */;
1962     enum EWOULDBLOCK     = B_TO_POSIX_ERROR!(B_WOULD_BLOCK) /* BSD compatibility */;
1963     enum EBADF           = B_TO_POSIX_ERROR!(B_FILE_ERROR);
1964     enum EEXIST          = B_TO_POSIX_ERROR!(B_FILE_EXISTS);
1965     enum EINVAL          = B_TO_POSIX_ERROR!(B_BAD_VALUE);
1966     enum ENAMETOOLONG    = B_TO_POSIX_ERROR!(B_NAME_TOO_LONG);
1967     enum ENOENT          = B_TO_POSIX_ERROR!(B_ENTRY_NOT_FOUND);
1968     enum EPERM           = B_TO_POSIX_ERROR!(B_NOT_ALLOWED);
1969     enum ENOTDIR         = B_TO_POSIX_ERROR!(B_NOT_A_DIRECTORY);
1970     enum EISDIR          = B_TO_POSIX_ERROR!(B_IS_A_DIRECTORY);
1971     enum ENOTEMPTY       = B_TO_POSIX_ERROR!(B_DIRECTORY_NOT_EMPTY);
1972     enum ENOSPC          = B_TO_POSIX_ERROR!(B_DEVICE_FULL);
1973     enum EROFS           = B_TO_POSIX_ERROR!(B_READ_ONLY_DEVICE);
1974     enum EMFILE          = B_TO_POSIX_ERROR!(B_NO_MORE_FDS);
1975     enum EXDEV           = B_TO_POSIX_ERROR!(B_CROSS_DEVICE_LINK);
1976     enum ELOOP           = B_TO_POSIX_ERROR!(B_LINK_LIMIT);
1977     enum ENOEXEC         = B_TO_POSIX_ERROR!(B_NOT_AN_EXECUTABLE);
1978     enum EPIPE           = B_TO_POSIX_ERROR!(B_BUSTED_PIPE);
1979 
1980     /* new error codes that can be mapped to POSIX errors */
1981     enum B_BUFFER_OVERFLOW          =  B_FROM_POSIX_ERROR!(EOVERFLOW);
1982     enum B_TOO_MANY_ARGS            =  B_FROM_POSIX_ERROR!(E2BIG);
1983     enum B_FILE_TOO_LARGE           =  B_FROM_POSIX_ERROR!(EFBIG);
1984     enum B_RESULT_NOT_REPRESENTABLE =  B_FROM_POSIX_ERROR!(ERANGE);
1985     enum B_DEVICE_NOT_FOUND         =  B_FROM_POSIX_ERROR!(ENODEV);
1986     enum B_NOT_SUPPORTED            =  B_FROM_POSIX_ERROR!(EOPNOTSUPP);
1987 
1988     /* Media Kit Errors */
1989     enum B_STREAM_NOT_FOUND              = (B_MEDIA_ERROR_BASE + 0);
1990     enum B_SERVER_NOT_FOUND              = (B_MEDIA_ERROR_BASE + 1);
1991     enum B_RESOURCE_NOT_FOUND            = (B_MEDIA_ERROR_BASE + 2);
1992     enum B_RESOURCE_UNAVAILABLE          = (B_MEDIA_ERROR_BASE + 3);
1993     enum B_BAD_SUBSCRIBER                = (B_MEDIA_ERROR_BASE + 4);
1994     enum B_SUBSCRIBER_NOT_ENTERED        = (B_MEDIA_ERROR_BASE + 5);
1995     enum B_BUFFER_NOT_AVAILABLE          = (B_MEDIA_ERROR_BASE + 6);
1996     enum B_LAST_BUFFER_ERROR             = (B_MEDIA_ERROR_BASE + 7);
1997 
1998     enum B_MEDIA_SYSTEM_FAILURE          = (B_MEDIA_ERROR_BASE + 100);
1999     enum B_MEDIA_BAD_NODE                = (B_MEDIA_ERROR_BASE + 101);
2000     enum B_MEDIA_NODE_BUSY               = (B_MEDIA_ERROR_BASE + 102);
2001     enum B_MEDIA_BAD_FORMAT              = (B_MEDIA_ERROR_BASE + 103);
2002     enum B_MEDIA_BAD_BUFFER              = (B_MEDIA_ERROR_BASE + 104);
2003     enum B_MEDIA_TOO_MANY_NODES          = (B_MEDIA_ERROR_BASE + 105);
2004     enum B_MEDIA_TOO_MANY_BUFFERS        = (B_MEDIA_ERROR_BASE + 106);
2005     enum B_MEDIA_NODE_ALREADY_EXISTS     = (B_MEDIA_ERROR_BASE + 107);
2006     enum B_MEDIA_BUFFER_ALREADY_EXISTS   = (B_MEDIA_ERROR_BASE + 108);
2007     enum B_MEDIA_CANNOT_SEEK             = (B_MEDIA_ERROR_BASE + 109);
2008     enum B_MEDIA_CANNOT_CHANGE_RUN_MODE  = (B_MEDIA_ERROR_BASE + 110);
2009     enum B_MEDIA_APP_ALREADY_REGISTERED  = (B_MEDIA_ERROR_BASE + 111);
2010     enum B_MEDIA_APP_NOT_REGISTERED      = (B_MEDIA_ERROR_BASE + 112);
2011     enum B_MEDIA_CANNOT_RECLAIM_BUFFERS  = (B_MEDIA_ERROR_BASE + 113);
2012     enum B_MEDIA_BUFFERS_NOT_RECLAIMED   = (B_MEDIA_ERROR_BASE + 114);
2013     enum B_MEDIA_TIME_SOURCE_STOPPED     = (B_MEDIA_ERROR_BASE + 115);
2014     enum B_MEDIA_TIME_SOURCE_BUSY        = (B_MEDIA_ERROR_BASE + 116);
2015     enum B_MEDIA_BAD_SOURCE              = (B_MEDIA_ERROR_BASE + 117);
2016     enum B_MEDIA_BAD_DESTINATION         = (B_MEDIA_ERROR_BASE + 118);
2017     enum B_MEDIA_ALREADY_CONNECTED       = (B_MEDIA_ERROR_BASE + 119);
2018     enum B_MEDIA_NOT_CONNECTED           = (B_MEDIA_ERROR_BASE + 120);
2019     enum B_MEDIA_BAD_CLIP_FORMAT         = (B_MEDIA_ERROR_BASE + 121);
2020     enum B_MEDIA_ADDON_FAILED            = (B_MEDIA_ERROR_BASE + 122);
2021     enum B_MEDIA_ADDON_DISABLED          = (B_MEDIA_ERROR_BASE + 123);
2022     enum B_MEDIA_CHANGE_IN_PROGRESS      = (B_MEDIA_ERROR_BASE + 124);
2023     enum B_MEDIA_STALE_CHANGE_COUNT      = (B_MEDIA_ERROR_BASE + 125);
2024     enum B_MEDIA_ADDON_RESTRICTED        = (B_MEDIA_ERROR_BASE + 126);
2025     enum B_MEDIA_NO_HANDLER              = (B_MEDIA_ERROR_BASE + 127);
2026     enum B_MEDIA_DUPLICATE_FORMAT        = (B_MEDIA_ERROR_BASE + 128);
2027     enum B_MEDIA_REALTIME_DISABLED       = (B_MEDIA_ERROR_BASE + 129);
2028     enum B_MEDIA_REALTIME_UNAVAILABLE    = (B_MEDIA_ERROR_BASE + 130);
2029 
2030     /* Mail Kit Errors */
2031     enum B_MAIL_NO_DAEMON                = (B_MAIL_ERROR_BASE + 0);
2032     enum B_MAIL_UNKNOWN_USER             = (B_MAIL_ERROR_BASE + 1);
2033     enum B_MAIL_WRONG_PASSWORD           = (B_MAIL_ERROR_BASE + 2);
2034     enum B_MAIL_UNKNOWN_HOST             = (B_MAIL_ERROR_BASE + 3);
2035     enum B_MAIL_ACCESS_ERROR             = (B_MAIL_ERROR_BASE + 4);
2036     enum B_MAIL_UNKNOWN_FIELD            = (B_MAIL_ERROR_BASE + 5);
2037     enum B_MAIL_NO_RECIPIENT             = (B_MAIL_ERROR_BASE + 6);
2038     enum B_MAIL_INVALID_MAIL             = (B_MAIL_ERROR_BASE + 7);
2039 
2040     /* Printing Errors */
2041     enum B_NO_PRINT_SERVER               = (B_PRINT_ERROR_BASE + 0);
2042 
2043     /* Device Kit Errors */
2044     enum B_DEV_INVALID_IOCTL             = (B_DEVICE_ERROR_BASE + 0);
2045     enum B_DEV_NO_MEMORY                 = (B_DEVICE_ERROR_BASE + 1);
2046     enum B_DEV_BAD_DRIVE_NUM             = (B_DEVICE_ERROR_BASE + 2);
2047     enum B_DEV_NO_MEDIA                  = (B_DEVICE_ERROR_BASE + 3);
2048     enum B_DEV_UNREADABLE                = (B_DEVICE_ERROR_BASE + 4);
2049     enum B_DEV_FORMAT_ERROR              = (B_DEVICE_ERROR_BASE + 5);
2050     enum B_DEV_TIMEOUT                   = (B_DEVICE_ERROR_BASE + 6);
2051     enum B_DEV_RECALIBRATE_ERROR         = (B_DEVICE_ERROR_BASE + 7);
2052     enum B_DEV_SEEK_ERROR                = (B_DEVICE_ERROR_BASE + 8);
2053     enum B_DEV_ID_ERROR                  = (B_DEVICE_ERROR_BASE + 9);
2054     enum B_DEV_READ_ERROR                = (B_DEVICE_ERROR_BASE + 10);
2055     enum B_DEV_WRITE_ERROR               = (B_DEVICE_ERROR_BASE + 11);
2056     enum B_DEV_NOT_READY                 = (B_DEVICE_ERROR_BASE + 12);
2057     enum B_DEV_MEDIA_CHANGED             = (B_DEVICE_ERROR_BASE + 13);
2058     enum B_DEV_MEDIA_CHANGE_REQUESTED    = (B_DEVICE_ERROR_BASE + 14);
2059     enum B_DEV_RESOURCE_CONFLICT         = (B_DEVICE_ERROR_BASE + 15);
2060     enum B_DEV_CONFIGURATION_ERROR       = (B_DEVICE_ERROR_BASE + 16);
2061     enum B_DEV_DISABLED_BY_USER          = (B_DEVICE_ERROR_BASE + 17);
2062     enum B_DEV_DOOR_OPEN                 = (B_DEVICE_ERROR_BASE + 18);
2063 
2064     enum B_DEV_INVALID_PIPE              = (B_DEVICE_ERROR_BASE + 19);
2065     enum B_DEV_CRC_ERROR                 = (B_DEVICE_ERROR_BASE + 20);
2066     enum B_DEV_STALLED                   = (B_DEVICE_ERROR_BASE + 21);
2067     enum B_DEV_BAD_PID                   = (B_DEVICE_ERROR_BASE + 22);
2068     enum B_DEV_UNEXPECTED_PID            = (B_DEVICE_ERROR_BASE + 23);
2069     enum B_DEV_DATA_OVERRUN              = (B_DEVICE_ERROR_BASE + 24);
2070     enum B_DEV_DATA_UNDERRUN             = (B_DEVICE_ERROR_BASE + 25);
2071     enum B_DEV_FIFO_OVERRUN              = (B_DEVICE_ERROR_BASE + 26);
2072     enum B_DEV_FIFO_UNDERRUN             = (B_DEVICE_ERROR_BASE + 27);
2073     enum B_DEV_PENDING                   = (B_DEVICE_ERROR_BASE + 28);
2074     enum B_DEV_MULTIPLE_ERRORS           = (B_DEVICE_ERROR_BASE + 29);
2075     enum B_DEV_TOO_LATE                  = (B_DEVICE_ERROR_BASE + 30);
2076 
2077     /* Translation Kit Errors */
2078     enum B_TRANSLATION_BASE_ERROR        = (B_TRANSLATION_ERROR_BASE + 0);
2079     enum B_NO_TRANSLATOR                 = (B_TRANSLATION_ERROR_BASE + 1);
2080     enum B_ILLEGAL_DATA                  = (B_TRANSLATION_ERROR_BASE + 2);
2081 }
2082 else version (WASI)
2083 {
2084     enum EPERM            = 1;
2085     enum ENOENT           = 2;
2086     enum ESRCH            = 3;
2087     enum EINTR            = 4;
2088     enum EIO              = 5;
2089     enum ENXIO            = 6;
2090     enum E2BIG            = 7;
2091     enum ENOEXEC          = 8;
2092     enum EBADF            = 9;
2093     enum ECHILD          = 10;
2094     enum EAGAIN          = 11;
2095     enum ENOMEM          = 12;
2096     enum EACCES          = 13;
2097     enum EFAULT          = 14;
2098     enum ENOTBLK         = 15;
2099     enum EBUSY           = 16;
2100     enum EEXIST          = 17;
2101     enum EXDEV           = 18;
2102     enum ENODEV          = 19;
2103     enum ENOTDIR         = 20;
2104     enum EISDIR          = 21;
2105     enum EINVAL          = 22;
2106     enum ENFILE          = 23;
2107     enum EMFILE          = 24;
2108     enum ENOTTY          = 25;
2109     enum ETXTBSY         = 26;
2110     enum EFBIG           = 27;
2111     enum ENOSPC          = 28;
2112     enum ESPIPE          = 29;
2113     enum EROFS           = 30;
2114     enum EMLINK          = 31;
2115     enum EPIPE           = 32;
2116     enum EDOM            = 33;
2117     enum ERANGE          = 34;
2118     enum EDEADLK         = 35;
2119     enum ENAMETOOLONG    = 36;
2120     enum ENOLCK          = 37;
2121     enum ENOSYS          = 38;
2122     enum ENOTEMPTY       = 39;
2123     enum ELOOP           = 40;
2124     enum EWOULDBLOCK     = EAGAIN;
2125     enum ENOMSG          = 42;
2126     enum EIDRM           = 43;
2127     enum ECHRNG          = 44;
2128     enum EL2NSYNC        = 45;
2129     enum EL3HLT          = 46;
2130     enum EL3RST          = 47;
2131     enum ELNRNG          = 48;
2132     enum EUNATCH         = 49;
2133     enum ENOCSI          = 50;
2134     enum EL2HLT          = 51;
2135     enum EBADE           = 52;
2136     enum EBADR           = 53;
2137     enum EXFULL          = 54;
2138     enum ENOANO          = 55;
2139     enum EBADRQC         = 56;
2140     enum EBADSLT         = 57;
2141     enum EDEADLOCK       = EDEADLK;
2142     enum EBFONT          = 59;
2143     enum ENOSTR          = 60;
2144     enum ENODATA         = 61;
2145     enum ETIME           = 62;
2146     enum ENOSR           = 63;
2147     enum ENONET          = 64;
2148     enum ENOPKG          = 65;
2149     enum EREMOTE         = 66;
2150     enum ENOLINK         = 67;
2151     enum EADV            = 68;
2152     enum ESRMNT          = 69;
2153     enum ECOMM           = 70;
2154     enum EPROTO          = 71;
2155     enum EMULTIHOP       = 72;
2156     enum EDOTDOT         = 73;
2157     enum EBADMSG         = 74;
2158     enum EOVERFLOW       = 75;
2159     enum ENOTUNIQ        = 76;
2160     enum EBADFD          = 77;
2161     enum EREMCHG         = 78;
2162     enum ELIBACC         = 79;
2163     enum ELIBBAD         = 80;
2164     enum ELIBSCN         = 81;
2165     enum ELIBMAX         = 82;
2166     enum ELIBEXEC        = 83;
2167     enum EILSEQ          = 84;
2168     enum ERESTART        = 85;
2169     enum ESTRPIPE        = 86;
2170     enum EUSERS          = 87;
2171     enum ENOTSOCK        = 88;
2172     enum EDESTADDRREQ    = 89;
2173     enum EMSGSIZE        = 90;
2174     enum EPROTOTYPE      = 91;
2175     enum ENOPROTOOPT     = 92;
2176     enum EPROTONOSUPPORT = 93;
2177     enum ESOCKTNOSUPPORT = 94;
2178     enum EOPNOTSUPP      = 95;
2179     enum ENOTSUP         = EOPNOTSUPP;
2180     enum EPFNOSUPPORT    = 96;
2181     enum EAFNOSUPPORT    = 97;
2182     enum EADDRINUSE      = 98;
2183     enum EADDRNOTAVAIL   = 99;
2184     enum ENETDOWN        = 100;
2185     enum ENETUNREACH     = 101;
2186     enum ENETRESET       = 102;
2187     enum ECONNABORTED    = 103;
2188     enum ECONNRESET      = 104;
2189     enum ENOBUFS         = 105;
2190     enum EISCONN         = 106;
2191     enum ENOTCONN        = 107;
2192     enum ESHUTDOWN       = 108;
2193     enum ETOOMANYREFS    = 109;
2194     enum ETIMEDOUT       = 110;
2195     enum ECONNREFUSED    = 111;
2196     enum EHOSTDOWN       = 112;
2197     enum EHOSTUNREACH    = 113;
2198     enum EALREADY        = 114;
2199     enum EINPROGRESS     = 115;
2200     enum ESTALE          = 116;
2201     enum EUCLEAN         = 117;
2202     enum ENOTNAM         = 118;
2203     enum ENAVAIL         = 119;
2204     enum EISNAM          = 120;
2205     enum EREMOTEIO       = 121;
2206     enum EDQUOT          = 122;
2207     enum ENOMEDIUM       = 123;
2208     enum EMEDIUMTYPE     = 124;
2209     enum ECANCELED       = 125;
2210     enum ENOKEY          = 126;
2211     enum EKEYEXPIRED     = 127;
2212     enum EKEYREVOKED     = 128;
2213     enum EKEYREJECTED    = 129;
2214     enum EOWNERDEAD      = 130;
2215     enum ENOTRECOVERABLE = 131;
2216     enum ERFKILL         = 132;
2217     enum EHWPOISON       = 133;
2218 }
2219 else
2220 {
2221     static assert(false, "Unsupported platform");
2222 }