File: POSIXError.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (1087 lines) | stat: -rw-r--r-- 29,553 bytes parent folder | download
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
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

#if (os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(visionOS)) && _runtime(_ObjC)

/// Enumeration describing POSIX error codes.
@objc
public enum POSIXErrorCode: Int32, Sendable {
  /// Operation not permitted.
  case EPERM           = 1
  /// No such file or directory.
  case ENOENT          = 2
  /// No such process.
  case ESRCH           = 3
  /// Interrupted system call.
  case EINTR           = 4
  /// Input/output error.
  case EIO             = 5
  /// Device not configured.
  case ENXIO           = 6
  /// Argument list too long.
  case E2BIG           = 7
  /// Exec format error.
  case ENOEXEC         = 8
  /// Bad file descriptor.
  case EBADF           = 9
  /// No child processes.
  case ECHILD          = 10
  /// Resource deadlock avoided.
  case EDEADLK         = 11
  /// 11 was EAGAIN.
  /// Cannot allocate memory.
  case ENOMEM          = 12
  /// Permission denied.
  case EACCES          = 13
  /// Bad address.
  case EFAULT          = 14
  /// Block device required.
  case ENOTBLK         = 15
  /// Device / Resource busy.
  case EBUSY           = 16
  /// File exists.
  case EEXIST          = 17
  /// Cross-device link.
  case EXDEV           = 18
  /// Operation not supported by device.
  case ENODEV          = 19
  /// Not a directory.
  case ENOTDIR         = 20
  /// Is a directory.
  case EISDIR          = 21
  /// Invalid argument.
  case EINVAL          = 22
  /// Too many open files in system.
  case ENFILE          = 23
  /// Too many open files.
  case EMFILE          = 24
  /// Inappropriate ioctl for device.
  case ENOTTY          = 25
  /// Text file busy.
  case ETXTBSY         = 26
  /// File too large.
  case EFBIG           = 27
  /// No space left on device.
  case ENOSPC          = 28
  /// Illegal seek.
  case ESPIPE          = 29
  /// Read-only file system.
  case EROFS           = 30
  /// Too many links.
  case EMLINK          = 31
  /// Broken pipe.
  case EPIPE           = 32
    
  /// math software.
  /// Numerical argument out of domain.
  case EDOM            = 33
  /// Result too large.
  case ERANGE          = 34
    
  /// non-blocking and interrupt i/o.
  /// Resource temporarily unavailable.
  case EAGAIN          = 35
  /// Operation would block.
  public static var EWOULDBLOCK: POSIXErrorCode { return EAGAIN }
  /// Operation now in progress.
  case EINPROGRESS     = 36
  /// Operation already in progress.
  case EALREADY        = 37
    
  /// ipc/network software -- argument errors.
  /// Socket operation on non-socket.
  case ENOTSOCK        = 38
  /// Destination address required.
  case EDESTADDRREQ    = 39
  /// Message too long.
  case EMSGSIZE        = 40
  /// Protocol wrong type for socket.
  case EPROTOTYPE      = 41
  /// Protocol not available.
  case ENOPROTOOPT     = 42
  /// Protocol not supported.
  case EPROTONOSUPPORT = 43
  /// Socket type not supported.
  case ESOCKTNOSUPPORT = 44
  /// Operation not supported.
  case ENOTSUP         = 45
  /// Protocol family not supported.
  case EPFNOSUPPORT    = 46
  /// Address family not supported by protocol family.
  case EAFNOSUPPORT    = 47
  /// Address already in use.
  case EADDRINUSE      = 48
  /// Can't assign requested address.
  case EADDRNOTAVAIL   = 49
    
  /// ipc/network software -- operational errors
  /// Network is down.
  case ENETDOWN        = 50
  /// Network is unreachable.
  case ENETUNREACH     = 51
  /// Network dropped connection on reset.
  case ENETRESET       = 52
  /// Software caused connection abort.
  case ECONNABORTED    = 53
  /// Connection reset by peer.
  case ECONNRESET      = 54
  /// No buffer space available.
  case ENOBUFS         = 55
  /// Socket is already connected.
  case EISCONN         = 56
  /// Socket is not connected.
  case ENOTCONN        = 57
  /// Can't send after socket shutdown.
  case ESHUTDOWN       = 58
  /// Too many references: can't splice.
  case ETOOMANYREFS    = 59
  /// Operation timed out.
  case ETIMEDOUT       = 60
  /// Connection refused.
  case ECONNREFUSED    = 61
    
  /// Too many levels of symbolic links.
  case ELOOP           = 62
  /// File name too long.
  case ENAMETOOLONG    = 63
    
  /// Host is down.
  case EHOSTDOWN       = 64
  /// No route to host.
  case EHOSTUNREACH    = 65
  /// Directory not empty.
  case ENOTEMPTY       = 66
    
  /// quotas & mush.
  /// Too many processes.
  case EPROCLIM        = 67
  /// Too many users.
  case EUSERS          = 68
  /// Disc quota exceeded.
  case EDQUOT          = 69
    
  /// Network File System.
  /// Stale NFS file handle.
  case ESTALE          = 70
  /// Too many levels of remote in path.
  case EREMOTE         = 71
  /// RPC struct is bad.
  case EBADRPC         = 72
  /// RPC version wrong.
  case ERPCMISMATCH    = 73
  /// RPC prog. not avail.
  case EPROGUNAVAIL    = 74
  /// Program version wrong.
  case EPROGMISMATCH   = 75
  /// Bad procedure for program.
  case EPROCUNAVAIL    = 76
    
  /// No locks available.
  case ENOLCK          = 77
  /// Function not implemented.
  case ENOSYS          = 78
    
  /// Inappropriate file type or format.
  case EFTYPE          = 79
  /// Authentication error.
  case EAUTH           = 80
  /// Need authenticator.
  case ENEEDAUTH       = 81
    
  /// Intelligent device errors.
  /// Device power is off.
  case EPWROFF         = 82
  /// Device error, e.g. paper out.
  case EDEVERR         = 83
    
  /// Value too large to be stored in data type.
  case EOVERFLOW       = 84

  // MARK: Program loading errors.

  /// Bad executable.
  case EBADEXEC        = 85
  /// Bad CPU type in executable.
  case EBADARCH        = 86
  /// Shared library version mismatch.
  case ESHLIBVERS      = 87
  /// Malformed Macho file.
  case EBADMACHO       = 88
    
  /// Operation canceled.
  case ECANCELED       = 89
    
  /// Identifier removed.
  case EIDRM           = 90
  /// No message of desired type.
  case ENOMSG          = 91
  /// Illegal byte sequence.
  case EILSEQ          = 92
  /// Attribute not found.
  case ENOATTR         = 93
    
  /// Bad message.
  case EBADMSG         = 94
  /// Reserved.
  case EMULTIHOP       = 95
  /// No message available on STREAM.
  case ENODATA         = 96
  /// Reserved.
  case ENOLINK         = 97
  /// No STREAM resources.
  case ENOSR           = 98
  /// Not a STREAM.
  case ENOSTR          = 99
  /// Protocol error.
  case EPROTO          = 100
  /// STREAM ioctl timeout.
  case ETIME           = 101
    
  /// No such policy registered.
  case ENOPOLICY       = 103
    
  /// State not recoverable.
  case ENOTRECOVERABLE = 104
  /// Previous owner died.
  case EOWNERDEAD      = 105
  
  /// Interface output queue is full.
  case EQFULL          = 106
  /// Must be equal largest errno.
  public static var ELAST: POSIXErrorCode { return EQFULL }
    
  // FIXME: EOPNOTSUPP has different values depending on __DARWIN_UNIX03 and
  // KERNEL.
}

#elseif os(Linux) || os(Android)

/// Enumeration describing POSIX error codes.
public enum POSIXErrorCode: Int32, Sendable {
  /// Operation not permitted.
  case EPERM           = 1
  /// No such file or directory.
  case ENOENT          = 2
  /// No such process.
  case ESRCH           = 3
  /// Interrupted system call.
  case EINTR           = 4
  /// Input/output error.
  case EIO             = 5
  /// Device not configured.
  case ENXIO           = 6
  /// Argument list too long.
  case E2BIG           = 7
  /// Exec format error.
  case ENOEXEC         = 8
  /// Bad file descriptor.
  case EBADF           = 9
  /// No child processes.
  case ECHILD          = 10
  /// Try again.
  case EAGAIN         = 11
  /// Cannot allocate memory.
  case ENOMEM          = 12
  /// Permission denied.
  case EACCES          = 13
  /// Bad address.
  case EFAULT          = 14
  /// Block device required.
  case ENOTBLK         = 15
  /// Device / Resource busy.
  case EBUSY           = 16
  /// File exists.
  case EEXIST          = 17
  /// Cross-device link.
  case EXDEV           = 18
  /// Operation not supported by device.
  case ENODEV          = 19
  /// Not a directory.
  case ENOTDIR         = 20
  /// Is a directory.
  case EISDIR          = 21
  /// Invalid argument.
  case EINVAL          = 22
  /// Too many open files in system.
  case ENFILE          = 23
  /// Too many open files.
  case EMFILE          = 24
  /// Inappropriate ioctl for device.
  case ENOTTY          = 25
  /// Text file busy.
  case ETXTBSY         = 26
  /// File too large.
  case EFBIG           = 27
  /// No space left on device.
  case ENOSPC          = 28
  /// Illegal seek.
  case ESPIPE          = 29
  /// Read-only file system.
  case EROFS           = 30
  /// Too many links.
  case EMLINK          = 31
  /// Broken pipe.
  case EPIPE           = 32

  /// Numerical argument out of domain.
  case EDOM            = 33
  /// Result too large.
  case ERANGE          = 34
    
  /// Resource deadlock would occur.
  case EDEADLK          = 35
    
  /// File name too long.
  case ENAMETOOLONG     = 36
    
  /// No record locks available
  case ENOLCK           = 37
    
  /// Function not implemented.
  case ENOSYS           = 38
    
  /// Directory not empty.
  case ENOTEMPTY        = 39
    
  /// Too many symbolic links encountered
  case ELOOP            = 40
    
  /// Operation would block.
  public static var EWOULDBLOCK: POSIXErrorCode { return .EAGAIN }

  /// No message of desired type.
  case ENOMSG          = 42
    
  /// Identifier removed.
  case EIDRM           = 43
    
  /// Channel number out of range.
  case ECHRNG          = 44
    
  /// Level 2 not synchronized.
  case EL2NSYNC        = 45
    
  /// Level 3 halted
  case EL3HLT          = 46
    
  /// Level 3 reset.
  case EL3RST          = 47
    
  /// Link number out of range.
  case ELNRNG          = 48
    
  /// Protocol driver not attached.
  case EUNATCH         = 49
    
  /// No CSI structure available.
  case ENOCSI          = 50
    
  /// Level 2 halted.
  case EL2HLT          = 51
  /// Invalid exchange
  case EBADE           = 52
  /// Invalid request descriptor
  case EBADR           = 53
  /// Exchange full
  case EXFULL          = 54
  /// No anode
  case ENOANO          = 55
  /// Invalid request code
  case EBADRQC         = 56
  /// Invalid slot
  case EBADSLT         = 57

  public static var EDEADLOCK: POSIXErrorCode { return .EDEADLK }

  /// Bad font file format
  case EBFONT          = 59
  /// Device not a stream
  case ENOSTR          = 60
  /// No data available
  case ENODATA         = 61
  /// Timer expired
  case ETIME           = 62
  /// Out of streams resources
  case ENOSR           = 63
  /// Machine is not on the network
  case ENONET          = 64
  /// Package not installed
  case ENOPKG          = 65
  /// Object is remote
  case EREMOTE         = 66
  /// Link has been severed
  case ENOLINK         = 67
  /// Advertise error
  case EADV            = 68
  /// Srmount error
  case ESRMNT          = 69
  /// Communication error on send
  case ECOMM           = 70
  /// Protocol error
  case EPROTO          = 71
  /// Multihop attempted
  case EMULTIHOP       = 72
  /// RFS specific error
  case EDOTDOT         = 73
  /// Not a data message
  case EBADMSG         = 74
  /// Value too large for defined data type
  case EOVERFLOW       = 75
  /// Name not unique on network
  case ENOTUNIQ        = 76
  /// File descriptor in bad state
  case EBADFD          = 77
  /// Remote address changed
  case EREMCHG         = 78
  /// Can not access a needed shared library
  case ELIBACC         = 79
  /// Accessing a corrupted shared library
  case ELIBBAD         = 80
  /// .lib section in a.out corrupted
  case ELIBSCN         = 81
  /// Attempting to link in too many shared libraries
  case ELIBMAX         = 82
  /// Cannot exec a shared library directly
  case ELIBEXEC        = 83
  /// Illegal byte sequence
  case EILSEQ          = 84
  /// Interrupted system call should be restarted
  case ERESTART        = 85
  /// Streams pipe error
  case ESTRPIPE        = 86
  /// Too many users
  case EUSERS          = 87
  /// Socket operation on non-socket
  case ENOTSOCK        = 88
  /// Destination address required
  case EDESTADDRREQ    = 89
  /// Message too long
  case EMSGSIZE        = 90
  /// Protocol wrong type for socket
  case EPROTOTYPE      = 91
  /// Protocol not available
  case ENOPROTOOPT     = 92
  /// Protocol not supported
  case EPROTONOSUPPORT = 93
  /// Socket type not supported
  case ESOCKTNOSUPPORT = 94
  /// Operation not supported on transport endpoint
  case EOPNOTSUPP      = 95
  /// Protocol family not supported
  case EPFNOSUPPORT    = 96
  /// Address family not supported by protocol
  case EAFNOSUPPORT    = 97
  /// Address already in use
  case EADDRINUSE      = 98
  /// Cannot assign requested address
  case EADDRNOTAVAIL   = 99
  /// Network is down
  case ENETDOWN        = 100
  /// Network is unreachable
  case ENETUNREACH     = 101
  /// Network dropped connection because of reset
  case ENETRESET       = 102
  /// Software caused connection abort
  case ECONNABORTED    = 103
  /// Connection reset by peer
  case ECONNRESET      = 104
  /// No buffer space available
  case ENOBUFS         = 105
  /// Transport endpoint is already connected
  case EISCONN         = 106
  /// Transport endpoint is not connected
  case ENOTCONN        = 107
  /// Cannot send after transport endpoint shutdown
  case ESHUTDOWN       = 108
  /// Too many references: cannot splice
  case ETOOMANYREFS    = 109
  /// Connection timed out
  case ETIMEDOUT       = 110
  /// Connection refused
  case ECONNREFUSED    = 111
  /// Host is down
  case EHOSTDOWN       = 112
  /// No route to host
  case EHOSTUNREACH    = 113
  /// Operation already in progress
  case EALREADY        = 114
  /// Operation now in progress
  case EINPROGRESS     = 115
  /// Stale NFS file handle
  case ESTALE          = 116
  /// Structure needs cleaning
  case EUCLEAN         = 117
  /// Not a XENIX named type file
  case ENOTNAM         = 118
  /// No XENIX semaphores available
  case ENAVAIL         = 119
  /// Is a named type file
  case EISNAM          = 120
  /// Remote I/O error
  case EREMOTEIO       = 121
  /// Quota exceeded
  case EDQUOT          = 122

  /// No medium found
  case ENOMEDIUM       = 123
  /// Wrong medium type
  case EMEDIUMTYPE     = 124
  /// Operation Canceled
  case ECANCELED       = 125
  /// Required key not available
  case ENOKEY          = 126
  /// Key has expired
  case EKEYEXPIRED     = 127
  /// Key has been revoked
  case EKEYREVOKED     = 128
  /// Key was rejected by service
  case EKEYREJECTED    = 129
  
  /// Owner died
  case EOWNERDEAD      = 130
  /// State not recoverable
  case ENOTRECOVERABLE = 131
  /// Operation not possible due to RF-kill
  case ERFKILL         = 132
  /// Memory page has hardware error
  case EHWPOISON       = 133
}

#elseif os(WASI)

// Matches WASI-libc declarations at https://github.com/WebAssembly/wasi-libc/blob/ad513341/libc-bottom-half/headers/public/wasi/api.h#L106

/// Enumeration describing POSIX error codes.
public enum POSIXErrorCode: Int32, Sendable {
  /// Argument list too long.
  case E2BIG           = 1
  /// Permission denied.
  case EACCES          = 2
  /// Address in use.
  case EADDRINUSE      = 3
  /// Address not available.
  case EADDRNOTAVAIL   = 4
  /// Address family not supported.
  case EAFNOSUPPORT    = 5
  /// Resource unavailable, or operation would block.
  case EAGAIN          = 6

  /// Operation would block.
  public static var EWOULDBLOCK: POSIXErrorCode { return .EAGAIN }

  /// Connection already in progress.
  case EALREADY        = 7
  /// Bad file descriptor.
  case EBADF           = 8
  /// Bad message.
  case EBADMSG         = 9
  /// Device or resource busy.
  case EBUSY           = 10
  /// Operation canceled.
  case ECANCELED       = 11
  /// No child processes.
  case ECHILD          = 12
  /// Connection aborted.
  case ECONNABORTED    = 13
  /// Connection refused.
  case ECONNREFUSED    = 14
  /// Connection reset.
  case ECONNRESET      = 15
  /// Resource deadlock would occur.
  case EDEADLK         = 16
  /// Destination address required.
  case EDESTADDRREQ    = 17
  /// Mathematics argument out of domain of function.
  case EDOM            = 18
  /// Reserved.
  case EDQUOT          = 19
  /// File exists.
  case EEXIST          = 20
  /// Bad address.
  case EFAULT          = 21
  /// File too large.
  case EFBIG           = 22
  /// Host is unreachable.
  case EHOSTUNREACH    = 23
  /// Identifier removed.
  case EIDRM           = 24
  /// Illegal byte sequence.
  case EILSEQ          = 25
  /// Operation in progress.
  case EINPROGRESS     = 26
  /// Interrupted function.
  case EINTR           = 27
  /// Invalid argument.
  case EINVAL          = 28
  /// I/O error.
  case EIO             = 29
  /// Socket is connected.
  case EISCONN         = 30
  /// Is a directory.
  case EISDIR          = 31
  /// Too many levels of symbolic links.
  case ELOOP           = 32
  /// File descriptor value too large.
  case EMFILE          = 33
  /// Too many links.
  case EMLINK          = 34
  /// Message too large.
  case EMSGSIZE        = 35
  /// Reserved.
  case EMULTIHOP       = 36
  /// Filename too long.
  case ENAMETOOLONG    = 37
  /// Network is down.
  case ENETDOWN        = 38
  /// Connection aborted by network.
  case ENETRESET       = 39
  /// Network unreachable.
  case ENETUNREACH     = 40
  /// Too many files open in system.
  case ENFILE          = 41
  /// No buffer space available.
  case ENOBUFS         = 42
  /// No such device.
  case ENODEV          = 43
  /// No such file or directory.
  case ENOENT          = 44
  /// Executable file format error.
  case ENOEXEC         = 45
  /// No locks available.
  case ENOLCK          = 46
  /// Reserved.
  case ENOLINK         = 47
  /// Not enough space.
  case ENOMEM          = 48
  /// No message of the desired type.
  case ENOMSG          = 49
  /// Protocol not available.
  case ENOPROTOOPT     = 50
  /// No space left on device.
  case ENOSPC          = 51
  /// Function not supported.
  case ENOSYS          = 52
  /// The socket is not connected.
  case ENOTCONN        = 53
  /// Not a directory or a symbolic link to a directory.
  case ENOTDIR         = 54
  /// Directory not empty.
  case ENOTEMPTY       = 55
  /// State not recoverable.
  case ENOTRECOVERABLE = 56
  /// Not a socket.
  case ENOTSOCK        = 57
  /// Not supported, or operation not supported on socket.
  case ENOTSUP         = 58

  /// Operation not supported on transport endpoint
  public static var EOPNOTSUPP: POSIXErrorCode { return .ENOTSUP }
  
  /// Inappropriate I/O control operation.
  case ENOTTY          = 59
  /// No such device or address.
  case ENXIO           = 60
  /// Value too large to be stored in data type.
  case EOVERFLOW       = 61
  /// Previous owner died.
  case EOWNERDEAD      = 62
  /// Operation not permitted.
  case EPERM           = 63
  /// Broken pipe.
  case EPIPE           = 64
  /// Protocol error.
  case EPROTO          = 65
  /// Protocol not supported.
  case EPROTONOSUPPORT = 66
  /// Protocol wrong type for socket.
  case EPROTOTYPE      = 67
  /// Result too large.
  case ERANGE          = 68
  /// Read-only file system.
  case EROFS           = 69
  /// Invalid seek.
  case ESPIPE          = 70
  /// No such process.
  case ESRCH           = 71
  /// Reserved.
  case ESTALE          = 72
  /// Connection timed out.
  case ETIMEDOUT       = 73
  /// Text file busy.
  case ETXTBSY         = 74
  /// Cross-device link.
  case EXDEV           = 75
  /// Extension: Capabilities insufficient.
  case ENOTCAPABLE     = 76
}

#elseif os(Windows)

/// Enumeration describing POSIX error codes.
public enum POSIXErrorCode: Int32, Sendable {
    
    /// Operation not permitted
    case EPERM          = 1
    
    /// No such file or directory
    case ENOENT         = 2
    
    /// No such process
    case ESRCH          = 3
    
    /// Interrupted function
    case EINTR          = 4
    
    /// I/O error
    case EIO            = 5
    
    /// No such device or address
    case ENXIO          = 6
    
    /// Argument list too long
    case E2BIG          = 7
    
    /// Exec format error
    case ENOEXEC        = 8
    
    /// Bad file number
    case EBADF          = 9
    
    /// No spawned processes
    case ECHILD         = 10
    
    /// No more processes or not enough memory or maximum nesting level reached
    case EAGAIN         = 11
    
    /// Not enough memory
    case ENOMEM         = 12
    
    /// Permission denied
    case EACCES         = 13
    
    /// Bad address
    case EFAULT         = 14
    
    /// Device or resource busy
    case EBUSY          = 16
    
    /// File exists
    case EEXIST         = 17
    
    /// Cross-device link
    case EXDEV          = 18
    
    /// No such device
    case ENODEV         = 19
    
    /// Not a directory
    case ENOTDIR        = 20
    
    /// Is a directory
    case EISDIR         = 21
    
    /// Invalid argument
    case EINVAL         = 22
    
    /// Too many files open in system
    case ENFILE         = 23
    
    /// Too many open files
    case EMFILE         = 24
    
    /// Inappropriate I/O control operation
    case ENOTTY         = 25
    
    /// File too large
    case EFBIG          = 27
    
    /// No space left on device
    case ENOSPC         = 28
    
    /// Invalid seek
    case ESPIPE         = 29
    
    /// Read-only file system
    case EROFS          = 30
    
    /// Too many links
    case EMLINK         = 31
    
    /// Broken pipe
    case EPIPE          = 32
    
    /// Math argument
    case EDOM           = 33
    
    /// Result too large
    case ERANGE         = 34
    
    /// Resource deadlock would occur
    case EDEADLK        = 36
    
    /// Same as EDEADLK for compatibility with older Microsoft C versions
    public static var EDEADLOCK: POSIXErrorCode { return .EDEADLK }
    
    /// Filename too long
    case ENAMETOOLONG   = 38
    
    /// No locks available
    case ENOLCK         = 39
    
    /// Function not supported
    case ENOSYS         = 40
    
    /// Directory not empty
    case ENOTEMPTY      = 41
    
    /// Illegal byte sequence
    case EILSEQ         = 42
    
    /// String was truncated
    case STRUNCATE      = 80
}

#elseif os(OpenBSD) || os(FreeBSD)

/// Enumeration describing POSIX error codes.
public enum POSIXErrorCode: Int32, Sendable {
    /// Operation not permitted
    case EPERM			= 1
    /// No such file or directory
    case ENOENT			= 2
    /// No such process
    case ESRCH			= 3
    /// Interrupted system call
    case EINTR			= 4
    /// Input/output error
    case EIO			= 5
    /// Device not configured
    case ENXIO			= 6
    /// Argument list too long
    case E2BIG			= 7
    /// Exec format error
    case ENOEXEC		= 8
    /// Bad file descriptor
    case EBADF			= 9
    /// No child processes
    case ECHILD			= 10
    /// Resource deadlock avoided
    case EDEADLK		= 11
    /// Cannot allocate memory
    case ENOMEM			= 12
    /// Permission denied
    case EACCES			= 13
    /// Bad address
    case EFAULT			= 14
    /// Block device required
    case ENOTBLK		= 15
    /// Device busy
    case EBUSY			= 16
    /// File exists
    case EEXIST			= 17
    /// Cross-device link
    case EXDEV			= 18
    /// Operation not supported by device
    case ENODEV			= 19
    /// Not a directory
    case ENOTDIR		= 20
    /// Is a directory
    case EISDIR			= 21
    /// Invalid argument
    case EINVAL			= 22
    /// Too many open files in system
    case ENFILE			= 23
    /// Too many open files
    case EMFILE			= 24
    /// Inappropriate ioctl for device
    case ENOTTY			= 25
    /// Text file busy
    case ETXTBSY		= 26
    /// File too large
    case EFBIG			= 27
    /// No space left on device
    case ENOSPC			= 28
    /// Illegal seek
    case ESPIPE			= 29
    /// Read-only file system
    case EROFS			= 30
    /// Too many links
    case EMLINK			= 31
    /// Broken pipe
    case EPIPE			= 32
    /// Numerical argument out of domain
    case EDOM			= 33
    /// Result too large
    case ERANGE			= 34
    /// Resource temporarily unavailable
    case EAGAIN			= 35
    /// Operation would block
    public static var EWOULDBLOCK: POSIXErrorCode { return .EAGAIN }
    /// Operation now in progress
    case EINPROGRESS		= 36
    /// Operation already in progress
    case EALREADY		= 37
    /// Socket operation on non-socket
    case ENOTSOCK		= 38
    /// Destination address required
    case EDESTADDRREQ		= 39
    /// Message too long
    case EMSGSIZE		= 40
    /// Protocol wrong type for socket
    case EPROTOTYPE		= 41
    /// Protocol not available
    case ENOPROTOOPT		= 42
    /// Protocol not supported
    case EPROTONOSUPPORT	= 43
    /// Socket type not supported
    case ESOCKTNOSUPPORT	= 44
    /// Operation not supported
    case EOPNOTSUPP		= 45
    /// Protocol family not supported
    case EPFNOSUPPORT		= 46
    /// Address family not supported by protocol family
    case EAFNOSUPPORT		= 47
    /// Address already in use
    case EADDRINUSE		= 48
    /// Can't assign requested address
    case EADDRNOTAVAIL		= 49
    /// Network is down
    case ENETDOWN		= 50
    /// Network is unreachable
    case ENETUNREACH		= 51
    /// Network dropped connection on reset
    case ENETRESET		= 52
    /// Software caused connection abort
    case ECONNABORTED		= 53
    /// Connection reset by peer
    case ECONNRESET		= 54
    /// No buffer space available
    case ENOBUFS		= 55
    /// Socket is already connected
    case EISCONN		= 56
    /// Socket is not connected
    case ENOTCONN		= 57
    /// Can't send after socket shutdown
    case ESHUTDOWN		= 58
    /// Too many references: can't splice
    case ETOOMANYREFS		= 59
    /// Operation timed out
    case ETIMEDOUT		= 60
    /// Connection refused
    case ECONNREFUSED		= 61
    /// Too many levels of symbolic links
    case ELOOP			= 62
    /// File name too long
    case ENAMETOOLONG		= 63
    /// Host is down
    case EHOSTDOWN		= 64
    /// No route to host
    case EHOSTUNREACH		= 65
    /// Directory not empty
    case ENOTEMPTY		= 66
    /// Too many processes
    case EPROCLIM		= 67
    /// Too many users
    case EUSERS			= 68
    /// Disk quota exceeded
    case EDQUOT			= 69
    /// Stale NFS file handle
    case ESTALE			= 70
    /// Too many levels of remote in path
    case EREMOTE		= 71
    /// RPC struct is bad
    case EBADRPC		= 72
    /// RPC version wrong
    case ERPCMISMATCH		= 73
    /// RPC program not available
    case EPROGUNAVAIL		= 74
    /// Program version wrong
    case EPROGMISMATCH		= 75
    /// Bad procedure for program
    case EPROCUNAVAIL		= 76
    /// No locks available
    case ENOLCK			= 77
    /// Function not implemented
    case ENOSYS			= 78
    /// Inappropriate file type or format
    case EFTYPE			= 79
    /// Authentication error
    case EAUTH			= 80
    /// Need authenticator
    case ENEEDAUTH		= 81

#if os(OpenBSD)
    /// IPsec processing failure
    case EIPSEC			= 82
    /// Attribute not found
    case ENOATTR		= 83
    /// Illegal byte sequence
    case EILSEQ			= 84
    /// No medium found
    case ENOMEDIUM		= 85
    /// Wrong medium type
    case EMEDIUMTYPE		= 86
    /// Value too large to be stored in data type
    case EOVERFLOW		= 87
    /// Operation canceled
    case ECANCELED		= 88
    /// Identifier removed
    case EIDRM			= 89
    /// No message of desired type
    case ENOMSG			= 90
    /// Not supported
    case ENOTSUP		= 91
    /// Bad message
    case EBADMSG		= 92
    /// State not recoverable
    case ENOTRECOVERABLE	= 93
    /// Previous owner died
    case EOWNERDEAD		= 94
    /// Protocol error
    case EPROTO			= 95
#elseif os(FreeBSD)
    /// Identifier removed
    case EIDRM                  = 82
    /// No message of desired type
    case ENOMSG                 = 83
    /// Value too large to be stored in data type
    case EOVERFLOW              = 84
    /// Operation canceled
    case ECANCELED              = 85
    /// Illegal byte sequence
    case EILSEQ                 = 86
    /// Attribute not found
    case ENOATTR                = 87
    /// Programming error
    case EDOOFUS                = 88
    /// Bad message
    case EBADMSG                = 89
    /// Multihop attempted
    case EMULTIHOP              = 90
    /// Link has been severed
    case ENOLINK                = 91
    /// Protocol error
    case EPROTO                 = 92
    /// Capabilities insufficient
    case ENOTCAPABLE            = 93
    /// Not permitted in capability mode
    case ECAPMODE               = 94
    /// State not recoverable
    case ENOTRECOVERABLE        = 95
    /// Previous owner died
    case EOWNERDEAD             = 96
    /// Integrity check failed
    case EINTEGRITY             = 97
#endif
}

#endif