-
-
Notifications
You must be signed in to change notification settings - Fork 523
/
errno.h
712 lines (612 loc) · 13.8 KB
/
errno.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
#ifndef COSMOPOLITAN_LIBC_ERRNO_H_
#define COSMOPOLITAN_LIBC_ERRNO_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/**
* @fileoverview System error codes.
* @see libc/sysv/consts.sh for numbers
*/
#if defined(__GNUC__) && defined(__x86_64__) && defined(__MNO_RED_ZONE__) && \
!defined(__STRICT_ANSI__) && !defined(__cplusplus)
#define errno \
(*({ \
errno_t *_ep; \
asm("call\t__errno_location" : "=a"(_ep) : /* no inputs */ : "cc"); \
_ep; \
}))
#elif defined(__GNUC__) && defined(__aarch64__) && \
!defined(__STRICT_ANSI__) && !defined(__cplusplus)
#define errno \
(*({ \
errno_t *_ep; \
asm("sub\t%0,x28,#1092" : "=r"(_ep)); \
_ep; \
}))
#else
#define errno (*__errno_location())
#endif
/**
* System call unavailable.
* @note kNtErrorInvalidFunction on NT
*/
extern const errno_t ENOSYS;
/**
* Operation not permitted.
* @note kNtErrorInvalidAccess on NT
*/
extern const errno_t EPERM;
/**
* No such file or directory.
*/
extern const errno_t ENOENT;
/**
* No such process.
*/
extern const errno_t ESRCH;
/**
* The greatest of all errnos.
*/
extern const errno_t EINTR;
/**
* Unix consensus.
*/
extern const errno_t EIO;
/**
* No such device or address.
*/
extern const errno_t ENXIO;
/**
* Argument list too errno_t.
*/
extern const errno_t E2BIG;
/**
* Exec format error.
*/
extern const errno_t ENOEXEC;
/**
* Bad file descriptor.
*/
extern const errno_t EBADF;
/**
* No child process.
*/
extern const errno_t ECHILD;
/**
* Resource temporarily unavailable (e.g. SO_RCVTIMEO expired, too many
* processes, too much memory locked, read or write with O_NONBLOCK needs
* polling, etc.).
*/
extern const errno_t EAGAIN;
/**
* We require more vespene gas.
*/
extern const errno_t ENOMEM;
/**
* Permission denied.
*/
extern const errno_t EACCES;
/**
* Pointer passed to system call that would otherwise segfault.
*/
extern const errno_t EFAULT;
/**
* Block device required.
*/
extern const errno_t ENOTBLK;
/**
* Device or resource busy.
*/
extern const errno_t EBUSY;
/**
* File exists.
*/
extern const errno_t EEXIST;
/**
* Improper link.
*/
extern const errno_t EXDEV;
/**
* No such device.
*/
extern const errno_t ENODEV;
/**
* Not a directory.
*/
extern const errno_t ENOTDIR;
/**
* Is a a directory.
*/
extern const errno_t EISDIR;
/**
* Invalid argument.
*/
extern const errno_t EINVAL;
/**
* Too many open files in system.
*/
extern const errno_t ENFILE;
/**
* Too many open files.
*/
extern const errno_t EMFILE;
/**
* Inappropriate i/o control operation.
*/
extern const errno_t ENOTTY;
/**
* Won't open executable that's executing in write mode.
*/
extern const errno_t ETXTBSY;
/**
* File too large.
*/
extern const errno_t EFBIG;
/**
* No space left on device.
*/
extern const errno_t ENOSPC;
/**
* Disk quota exceeded.
*/
extern const errno_t EDQUOT;
/**
* Invalid seek.
*/
extern const errno_t ESPIPE;
/**
* Read-only filesystem.
*/
extern const errno_t EROFS;
/**
* Too many links.
*/
extern const errno_t EMLINK;
/**
* Broken pipe.
*/
extern const errno_t EPIPE;
/**
* Mathematics argument out of domain of function.
*/
extern const errno_t EDOM;
/**
* Result too large.
*/
extern const errno_t ERANGE;
/**
* Resource deadlock avoided.
*/
extern const errno_t EDEADLK;
/**
* Filename too errno_t.
*/
extern const errno_t ENAMETOOLONG;
/**
* No locks available.
*/
extern const errno_t ENOLCK;
/**
* Directory not empty.
*/
extern const errno_t ENOTEMPTY;
/**
* Too many levels of symbolic links.
*/
extern const errno_t ELOOP;
/**
* No message error.
*/
extern const errno_t ENOMSG;
/**
* Identifier removed.
*/
extern const errno_t EIDRM;
/**
* Timer expired.
*/
extern const errno_t ETIME;
/**
* Protocol error.
*/
extern const errno_t EPROTO;
/**
* Overflow error.
*/
extern const errno_t EOVERFLOW;
/**
* Unicode decoding error.
*/
extern const errno_t EILSEQ;
/**
* Too many users.
*/
extern const errno_t EUSERS;
/**
* Not a socket.
*/
extern const errno_t ENOTSOCK;
/**
* Destination address required.
*/
extern const errno_t EDESTADDRREQ;
/**
* Message too errno_t.
*/
extern const errno_t EMSGSIZE;
/**
* Protocol wrong type for socket.
*/
extern const errno_t EPROTOTYPE;
/**
* Protocol not available.
*/
extern const errno_t ENOPROTOOPT;
/**
* Protocol not supported.
*/
extern const errno_t EPROTONOSUPPORT;
/**
* Socket type not supported.
*/
extern const errno_t ESOCKTNOSUPPORT;
/**
* Operation not supported.
*/
extern const errno_t ENOTSUP;
/**
* Socket operation not supported.
*/
extern const errno_t EOPNOTSUPP;
/**
* Protocol family not supported.
*/
extern const errno_t EPFNOSUPPORT;
/**
* Address family not supported.
*/
extern const errno_t EAFNOSUPPORT;
/**
* Address already in use.
*/
extern const errno_t EADDRINUSE;
/**
* Address not available.
*/
extern const errno_t EADDRNOTAVAIL;
/**
* Network is down.
*/
extern const errno_t ENETDOWN;
/**
* Host is unreachable.
*/
extern const errno_t ENETUNREACH;
/**
* Connection reset by network.
*/
extern const errno_t ENETRESET;
/**
* Connection reset before accept.
*/
extern const errno_t ECONNABORTED;
/**
* Connection reset by client.
*/
extern const errno_t ECONNRESET;
/**
* No buffer space available.
*/
extern const errno_t ENOBUFS;
/**
* Socket is connected.
*/
extern const errno_t EISCONN;
/**
* Socket is not connected.
*/
extern const errno_t ENOTCONN;
/**
* Cannot send after transport endpoint shutdown.
*/
extern const errno_t ESHUTDOWN;
/**
* Too many references: cannot splice.
*/
extern const errno_t ETOOMANYREFS;
/**
* Connection timed out.
*/
extern const errno_t ETIMEDOUT;
/**
* Connection refused error.
*/
extern const errno_t ECONNREFUSED;
/**
* Host down error.
*/
extern const errno_t EHOSTDOWN;
/**
* Host unreachable error.
*/
extern const errno_t EHOSTUNREACH;
/**
* Connection already in progress.
*/
extern const errno_t EALREADY;
/**
* Operation already in progress.
*/
extern const errno_t EINPROGRESS;
/**
* Stale error.
*/
extern const errno_t ESTALE;
/**
* Remote error.
*/
extern const errno_t EREMOTE;
/**
* Bad message.
*/
extern const errno_t EBADMSG;
/**
* Operation canceled.
*/
extern const errno_t ECANCELED;
/**
* Owner died.
*/
extern const errno_t EOWNERDEAD;
/**
* State not recoverable.
*/
extern const errno_t ENOTRECOVERABLE;
/**
* No network.
*/
extern const errno_t ENONET;
/**
* Please restart syscall.
*/
extern const errno_t ERESTART;
/**
* Out of streams resources.
*/
extern const errno_t ENOSR;
/**
* No string.
*/
extern const errno_t ENOSTR;
/**
* No data.
*/
extern const errno_t ENODATA;
/**
* Multihop attempted.
*/
extern const errno_t EMULTIHOP;
/**
* Link severed.
*/
extern const errno_t ENOLINK;
/**
* No medium found.
*/
extern const errno_t ENOMEDIUM;
/**
* Wrong medium type.
*/
extern const errno_t EMEDIUMTYPE;
/**
* Inappropriate file type or format. (BSD only)
*/
extern const errno_t EFTYPE;
extern const errno_t EAUTH;
extern const errno_t EBADARCH;
extern const errno_t EBADEXEC;
extern const errno_t EBADMACHO;
extern const errno_t EBADRPC;
extern const errno_t EDEVERR;
extern const errno_t ENEEDAUTH;
extern const errno_t ENOATTR;
extern const errno_t ENOPOLICY;
extern const errno_t EPROCLIM;
extern const errno_t EPROCUNAVAIL;
extern const errno_t EPROGMISMATCH;
extern const errno_t EPROGUNAVAIL;
extern const errno_t EPWROFF;
extern const errno_t ERPCMISMATCH;
extern const errno_t ESHLIBVERS;
extern const errno_t EADV;
extern const errno_t EBADE;
extern const errno_t EBADFD;
extern const errno_t EBADR;
extern const errno_t EBADRQC;
extern const errno_t EBADSLT;
extern const errno_t ECHRNG;
extern const errno_t ECOMM;
extern const errno_t EDOTDOT;
extern const errno_t EHWPOISON;
extern const errno_t EISNAM;
extern const errno_t EKEYEXPIRED;
extern const errno_t EKEYREJECTED;
extern const errno_t EKEYREVOKED;
extern const errno_t EL2HLT;
extern const errno_t EL2NSYNC;
extern const errno_t EL3HLT;
extern const errno_t EL3RST;
extern const errno_t ELIBACC;
extern const errno_t ELIBBAD;
extern const errno_t ELIBEXEC;
extern const errno_t ELIBMAX;
extern const errno_t ELIBSCN;
extern const errno_t ELNRNG;
extern const errno_t ENAVAIL;
extern const errno_t ENOANO;
extern const errno_t ENOCSI;
extern const errno_t ENOKEY;
extern const errno_t ENOPKG;
extern const errno_t ENOTNAM;
extern const errno_t ENOTUNIQ;
extern const errno_t EREMCHG;
extern const errno_t EREMOTEIO;
extern const errno_t ERFKILL;
extern const errno_t ESRMNT;
extern const errno_t ESTRPIPE;
extern const errno_t EUCLEAN;
extern const errno_t EUNATCH;
extern const errno_t EXFULL;
#define E2BIG E2BIG
#define EACCES EACCES
#define EADDRINUSE EADDRINUSE
#define EADDRNOTAVAIL EADDRNOTAVAIL
#define EADV EADV
#define EAFNOSUPPORT EAFNOSUPPORT
#define EAGAIN EAGAIN
#define EALREADY EALREADY
#define EAUTH EAUTH
#define EBADARCH EBADARCH
#define EBADE EBADE
#define EBADEXEC EBADEXEC
#define EBADF EBADF
#define EBADFD EBADFD
#define EBADMACHO EBADMACHO
#define EBADMSG EBADMSG
#define EBADR EBADR
#define EBADRPC EBADRPC
#define EBADRQC EBADRQC
#define EBADSLT EBADSLT
#define EBUSY EBUSY
#define ECANCELED ECANCELED
#define ECHILD ECHILD
#define ECHRNG ECHRNG
#define ECOMM ECOMM
#define ECONNABORTED ECONNABORTED
#define ECONNREFUSED ECONNREFUSED
#define ECONNRESET ECONNRESET
#define EDEADLK EDEADLK
#define EDESTADDRREQ EDESTADDRREQ
#define EDEVERR EDEVERR
#define EDOM EDOM
#define EDOTDOT EDOTDOT
#define EDQUOT EDQUOT
#define EEXIST EEXIST
#define EFAULT EFAULT
#define EFBIG EFBIG
#define EFTYPE EFTYPE
#define EHOSTDOWN EHOSTDOWN
#define EHOSTUNREACH EHOSTUNREACH
#define EHWPOISON EHWPOISON
#define EIDRM EIDRM
#define EILSEQ EILSEQ
#define EINPROGRESS EINPROGRESS
#define EINTR EINTR
#define EINVAL EINVAL
#define EIO EIO
#define EISCONN EISCONN
#define EISDIR EISDIR
#define EISNAM EISNAM
#define EKEYEXPIRED EKEYEXPIRED
#define EKEYREJECTED EKEYREJECTED
#define EKEYREVOKED EKEYREVOKED
#define EL2HLT EL2HLT
#define EL2NSYNC EL2NSYNC
#define EL3HLT EL3HLT
#define EL3RST EL3RST
#define ELIBACC ELIBACC
#define ELIBBAD ELIBBAD
#define ELIBEXEC ELIBEXEC
#define ELIBMAX ELIBMAX
#define ELIBSCN ELIBSCN
#define ELNRNG ELNRNG
#define ELOOP ELOOP
#define EMEDIUMTYPE EMEDIUMTYPE
#define EMFILE EMFILE
#define EMLINK EMLINK
#define EMSGSIZE EMSGSIZE
#define EMULTIHOP EMULTIHOP
#define ENAMETOOLONG ENAMETOOLONG
#define ENAVAIL ENAVAIL
#define ENEEDAUTH ENEEDAUTH
#define ENETDOWN ENETDOWN
#define ENETRESET ENETRESET
#define ENETUNREACH ENETUNREACH
#define ENFILE ENFILE
#define ENOANO ENOANO
#define ENOATTR ENOATTR
#define ENOBUFS ENOBUFS
#define ENOCSI ENOCSI
#define ENODATA ENODATA
#define ENODEV ENODEV
#define ENOENT ENOENT
#define ENOEXEC ENOEXEC
#define ENOKEY ENOKEY
#define ENOLCK ENOLCK
#define ENOLINK ENOLINK
#define ENOMEDIUM ENOMEDIUM
#define ENOMEM ENOMEM
#define ENOMSG ENOMSG
#define ENONET ENONET
#define ENOPKG ENOPKG
#define ENOPOLICY ENOPOLICY
#define ENOPROTOOPT ENOPROTOOPT
#define ENOSPC ENOSPC
#define ENOSR ENOSR
#define ENOSTR ENOSTR
#define ENOSYS ENOSYS
#define ENOTBLK ENOTBLK
#define ENOTCONN ENOTCONN
#define ENOTDIR ENOTDIR
#define ENOTEMPTY ENOTEMPTY
#define ENOTNAM ENOTNAM
#define ENOTRECOVERABLE ENOTRECOVERABLE
#define ENOTSOCK ENOTSOCK
#define ENOTSUP ENOTSUP
#define ENOTTY ENOTTY
#define ENOTUNIQ ENOTUNIQ
#define ENXIO ENXIO
#define EOPNOTSUPP EOPNOTSUPP
#define EOVERFLOW EOVERFLOW
#define EOWNERDEAD EOWNERDEAD
#define EPERM EPERM
#define EPFNOSUPPORT EPFNOSUPPORT
#define EPIPE EPIPE
#define EPROCLIM EPROCLIM
#define EPROCUNAVAIL EPROCUNAVAIL
#define EPROGMISMATCH EPROGMISMATCH
#define EPROGUNAVAIL EPROGUNAVAIL
#define EPROTO EPROTO
#define EPROTONOSUPPORT EPROTONOSUPPORT
#define EPROTOTYPE EPROTOTYPE
#define EPWROFF EPWROFF
#define ERANGE ERANGE
#define EREMCHG EREMCHG
#define EREMOTE EREMOTE
#define EREMOTEIO EREMOTEIO
#define ERESTART ERESTART
#define ERFKILL ERFKILL
#define EROFS EROFS
#define ERPCMISMATCH ERPCMISMATCH
#define ESHLIBVERS ESHLIBVERS
#define ESHUTDOWN ESHUTDOWN
#define ESOCKTNOSUPPORT ESOCKTNOSUPPORT
#define ESPIPE ESPIPE
#define ESRCH ESRCH
#define ESRMNT ESRMNT
#define ESTALE ESTALE
#define ESTRPIPE ESTRPIPE
#define ETIME ETIME
#define ETIMEDOUT ETIMEDOUT
#define ETOOMANYREFS ETOOMANYREFS
#define ETXTBSY ETXTBSY
#define EUCLEAN EUCLEAN
#define EUNATCH EUNATCH
#define EUSERS EUSERS
#define EWOULDBLOCK EAGAIN
#define EXDEV EXDEV
#define EXFULL EXFULL
extern errno_t __errno;
errno_t *__errno_location(void);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_ERRNO_H_ */