Skip to content

Instantly share code, notes, and snippets.

@temoki
Created July 21, 2020 06:56
Show Gist options
  • Save temoki/37aec58bfc5bbdcffefafc1cf9a93050 to your computer and use it in GitHub Desktop.
Save temoki/37aec58bfc5bbdcffefafc1cf9a93050 to your computer and use it in GitHub Desktop.
All POSIXErrorCode
import Foundation
let allCodes: [(POSIXErrorCode, String)] = [
(.E2BIG,"E2BIG"),
(.EACCES,"EACCES"),
(.EADDRINUSE,"EADDRINUSE"),
(.EADDRNOTAVAIL,"EADDRNOTAVAIL"),
(.EAFNOSUPPORT,"EAFNOSUPPORT"),
(.EAGAIN,"EAGAIN"),
(.EALREADY,"EALREADY"),
(.EAUTH,"EAUTH"),
(.EBADARCH,"EBADARCH"),
(.EBADEXEC,"EBADEXEC"),
(.EBADF,"EBADF"),
(.EBADMACHO,"EBADMACHO"),
(.EBADMSG,"EBADMSG"),
(.EBADRPC,"EBADRPC"),
(.EBUSY,"EBUSY"),
(.ECANCELED,"ECANCELED"),
(.ECHILD,"ECHILD"),
(.ECONNABORTED,"ECONNABORTED"),
(.ECONNREFUSED,"ECONNREFUSED"),
(.ECONNRESET,"ECONNRESET"),
(.EDEADLK,"EDEADLK"),
(.EDESTADDRREQ,"EDESTADDRREQ"),
(.EDEVERR,"EDEVERR"),
(.EDOM,"EDOM"),
(.EDQUOT,"EDQUOT"),
(.EEXIST,"EEXIST"),
(.EFAULT,"EFAULT"),
(.EFBIG,"EFBIG"),
(.EFTYPE,"EFTYPE"),
(.EHOSTDOWN,"EHOSTDOWN"),
(.EHOSTUNREACH,"EHOSTUNREACH"),
(.EIDRM,"EIDRM"),
(.EILSEQ,"EILSEQ"),
(.EINPROGRESS,"EINPROGRESS"),
(.EINTR,"EINTR"),
(.EINVAL,"EINVAL"),
(.EIO,"EIO"),
(.EISCONN,"EISCONN"),
(.EISDIR,"EISDIR"),
(.ELOOP,"ELOOP"),
(.EMFILE,"EMFILE"),
(.EMLINK,"EMLINK"),
(.EMSGSIZE,"EMSGSIZE"),
(.EMULTIHOP,"EMULTIHOP"),
(.ENAMETOOLONG,"ENAMETOOLONG"),
(.ENEEDAUTH,"ENEEDAUTH"),
(.ENETDOWN,"ENETDOWN"),
(.ENETRESET,"ENETRESET"),
(.ENETUNREACH,"ENETUNREACH"),
(.ENFILE,"ENFILE"),
(.ENOATTR,"ENOATTR"),
(.ENOBUFS,"ENOBUFS"),
(.ENODATA,"ENODATA"),
(.ENODEV,"ENODEV"),
(.ENOENT,"ENOENT"),
(.ENOEXEC,"ENOEXEC"),
(.ENOLCK,"ENOLCK"),
(.ENOLINK,"ENOLINK"),
(.ENOMEM,"ENOMEM"),
(.ENOMSG,"ENOMSG"),
(.ENOPOLICY,"ENOPOLICY"),
(.ENOPROTOOPT,"ENOPROTOOPT"),
(.ENOSPC,"ENOSPC"),
(.ENOSR,"ENOSR"),
(.ENOSTR,"ENOSTR"),
(.ENOSYS,"ENOSYS"),
(.ENOTBLK,"ENOTBLK"),
(.ENOTCONN,"ENOTCONN"),
(.ENOTDIR,"ENOTDIR"),
(.ENOTEMPTY,"ENOTEMPTY"),
(.ENOTRECOVERABLE,"ENOTRECOVERABLE"),
(.ENOTSOCK,"ENOTSOCK"),
(.ENOTSUP,"ENOTSUP"),
(.ENOTTY,"ENOTTY"),
(.ENXIO,"ENXIO"),
(.EOVERFLOW,"EOVERFLOW"),
(.EOWNERDEAD,"EOWNERDEAD"),
(.EPERM,"EPERM"),
(.EPFNOSUPPORT,"EPFNOSUPPORT"),
(.EPIPE,"EPIPE"),
(.EPROCLIM,"EPROCLIM"),
(.EPROCUNAVAIL,"EPROCUNAVAIL"),
(.EPROGMISMATCH,"EPROGMISMATCH"),
(.EPROGUNAVAIL,"EPROGUNAVAIL"),
(.EPROTO,"EPROTO"),
(.EPROTONOSUPPORT,"EPROTONOSUPPORT"),
(.EPROTOTYPE,"EPROTOTYPE"),
(.EPWROFF,"EPWROFF"),
(.EQFULL,"EQFULL"),
(.ERANGE,"ERANGE"),
(.EREMOTE,"EREMOTE"),
(.EROFS,"EROFS"),
(.ERPCMISMATCH,"ERPCMISMATCH"),
(.ESHLIBVERS,"ESHLIBVERS"),
(.ESHUTDOWN,"ESHUTDOWN"),
(.ESOCKTNOSUPPORT,"ESOCKTNOSUPPORT"),
(.ESPIPE,"ESPIPE"),
(.ESRCH,"ESRCH"),
(.ESTALE,"ESTALE"),
(.ETIME,"ETIME"),
(.ETIMEDOUT,"ETIMEDOUT"),
(.ETOOMANYREFS,"ETOOMANYREFS"),
(.ETXTBSY,"ETXTBSY"),
(.EUSERS,"EUSERS"),
(.EWOULDBLOCK,"EWOULDBLOCK"),
(.EXDEV,"EXDEV"),
]
allCodes
.sorted { $0.0.rawValue < $1.0.rawValue }
.forEach { print("\($0.1),\($0.0.rawValue)") }
EPERM 1
ENOENT 2
ESRCH 3
EINTR 4
EIO 5
ENXIO 6
E2BIG 7
ENOEXEC 8
EBADF 9
ECHILD 10
EDEADLK 11
ENOMEM 12
EACCES 13
EFAULT 14
ENOTBLK 15
EBUSY 16
EEXIST 17
EXDEV 18
ENODEV 19
ENOTDIR 20
EISDIR 21
EINVAL 22
ENFILE 23
EMFILE 24
ENOTTY 25
ETXTBSY 26
EFBIG 27
ENOSPC 28
ESPIPE 29
EROFS 30
EMLINK 31
EPIPE 32
EDOM 33
ERANGE 34
EAGAIN 35
EWOULDBLOCK 35
EINPROGRESS 36
EALREADY 37
ENOTSOCK 38
EDESTADDRREQ 39
EMSGSIZE 40
EPROTOTYPE 41
ENOPROTOOPT 42
EPROTONOSUPPORT 43
ESOCKTNOSUPPORT 44
ENOTSUP 45
EPFNOSUPPORT 46
EAFNOSUPPORT 47
EADDRINUSE 48
EADDRNOTAVAIL 49
ENETDOWN 50
ENETUNREACH 51
ENETRESET 52
ECONNABORTED 53
ECONNRESET 54
ENOBUFS 55
EISCONN 56
ENOTCONN 57
ESHUTDOWN 58
ETOOMANYREFS 59
ETIMEDOUT 60
ECONNREFUSED 61
ELOOP 62
ENAMETOOLONG 63
EHOSTDOWN 64
EHOSTUNREACH 65
ENOTEMPTY 66
EPROCLIM 67
EUSERS 68
EDQUOT 69
ESTALE 70
EREMOTE 71
EBADRPC 72
ERPCMISMATCH 73
EPROGUNAVAIL 74
EPROGMISMATCH 75
EPROCUNAVAIL 76
ENOLCK 77
ENOSYS 78
EFTYPE 79
EAUTH 80
ENEEDAUTH 81
EPWROFF 82
EDEVERR 83
EOVERFLOW 84
EBADEXEC 85
EBADARCH 86
ESHLIBVERS 87
EBADMACHO 88
ECANCELED 89
EIDRM 90
ENOMSG 91
EILSEQ 92
ENOATTR 93
EBADMSG 94
EMULTIHOP 95
ENODATA 96
ENOLINK 97
ENOSR 98
ENOSTR 99
EPROTO 100
ETIME 101
ENOPOLICY 103
ENOTRECOVERABLE 104
EOWNERDEAD 105
EQFULL 106
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment