|
10 | 10 | //
|
11 | 11 | //===----------------------------------------------------------------------===//
|
12 | 12 |
|
13 |
| -// FIXME: Only defining POSIXErrorCode for Darwin and Linux at the moment. |
14 |
| - |
15 | 13 | #if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
|
16 | 14 |
|
17 | 15 | /// Enumeration describing POSIX error codes.
|
@@ -554,4 +552,130 @@ public enum POSIXErrorCode : Int32 {
|
554 | 552 | case ENOTRECOVERABLE = 131
|
555 | 553 | }
|
556 | 554 |
|
| 555 | +#elseif os(Windows) |
| 556 | + |
| 557 | +/// Enumeration describing POSIX error codes. |
| 558 | +public enum POSIXErrorCode : Int32 { |
| 559 | + |
| 560 | + /// Operation not permitted |
| 561 | + case EPERM = 1 |
| 562 | + |
| 563 | + /// No such file or directory |
| 564 | + case ENOENT = 2 |
| 565 | + |
| 566 | + /// No such process |
| 567 | + case ESRCH = 3 |
| 568 | + |
| 569 | + /// Interrupted function |
| 570 | + case EINTR = 4 |
| 571 | + |
| 572 | + /// I/O error |
| 573 | + case EIO = 5 |
| 574 | + |
| 575 | + /// No such device or address |
| 576 | + case ENXIO = 6 |
| 577 | + |
| 578 | + /// Argument list too long |
| 579 | + case E2BIG = 7 |
| 580 | + |
| 581 | + /// Exec format error |
| 582 | + case ENOEXEC = 8 |
| 583 | + |
| 584 | + /// Bad file number |
| 585 | + case EBADF = 9 |
| 586 | + |
| 587 | + /// No spawned processes |
| 588 | + case ECHILD = 10 |
| 589 | + |
| 590 | + /// No more processes or not enough memory or maximum nesting level reached |
| 591 | + case EAGAIN = 11 |
| 592 | + |
| 593 | + /// Not enough memory |
| 594 | + case ENOMEM = 12 |
| 595 | + |
| 596 | + /// Permission denied |
| 597 | + case EACCES = 13 |
| 598 | + |
| 599 | + /// Bad address |
| 600 | + case EFAULT = 14 |
| 601 | + |
| 602 | + /// Device or resource busy |
| 603 | + case EBUSY = 16 |
| 604 | + |
| 605 | + /// File exists |
| 606 | + case EEXIST = 17 |
| 607 | + |
| 608 | + /// Cross-device link |
| 609 | + case EXDEV = 18 |
| 610 | + |
| 611 | + /// No such device |
| 612 | + case ENODEV = 19 |
| 613 | + |
| 614 | + /// Not a directory |
| 615 | + case ENOTDIR = 20 |
| 616 | + |
| 617 | + /// Is a directory |
| 618 | + case EISDIR = 21 |
| 619 | + |
| 620 | + /// Invalid argument |
| 621 | + case EINVAL = 22 |
| 622 | + |
| 623 | + /// Too many files open in system |
| 624 | + case ENFILE = 23 |
| 625 | + |
| 626 | + /// Too many open files |
| 627 | + case EMFILE = 24 |
| 628 | + |
| 629 | + /// Inappropriate I/O control operation |
| 630 | + case ENOTTY = 25 |
| 631 | + |
| 632 | + /// File too large |
| 633 | + case EFBIG = 27 |
| 634 | + |
| 635 | + /// No space left on device |
| 636 | + case ENOSPC = 28 |
| 637 | + |
| 638 | + /// Invalid seek |
| 639 | + case ESPIPE = 29 |
| 640 | + |
| 641 | + /// Read-only file system |
| 642 | + case EROFS = 30 |
| 643 | + |
| 644 | + /// Too many links |
| 645 | + case EMLINK = 31 |
| 646 | + |
| 647 | + /// Broken pipe |
| 648 | + case EPIPE = 32 |
| 649 | + |
| 650 | + /// Math argument |
| 651 | + case EDOM = 33 |
| 652 | + |
| 653 | + /// Result too large |
| 654 | + case ERANGE = 34 |
| 655 | + |
| 656 | + /// Resource deadlock would occur |
| 657 | + case EDEADLK = 36 |
| 658 | + |
| 659 | + /// Same as EDEADLK for compatibility with older Microsoft C versions |
| 660 | + public static var EDEADLOCK: POSIXErrorCode { return .EDEADLK } |
| 661 | + |
| 662 | + /// Filename too long |
| 663 | + case ENAMETOOLONG = 38 |
| 664 | + |
| 665 | + /// No locks available |
| 666 | + case ENOLCK = 39 |
| 667 | + |
| 668 | + /// Function not supported |
| 669 | + case ENOSYS = 40 |
| 670 | + |
| 671 | + /// Directory not empty |
| 672 | + case ENOTEMPTY = 41 |
| 673 | + |
| 674 | + /// Illegal byte sequence |
| 675 | + case EILSEQ = 42 |
| 676 | + |
| 677 | + /// String was truncated |
| 678 | + case STRUNCATE = 80 |
| 679 | +} |
| 680 | + |
557 | 681 | #endif
|
0 commit comments