errors_linux.odin 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. //+private
  2. package os2
  3. import "core:sys/unix"
  4. EPERM :: 1
  5. ENOENT :: 2
  6. ESRCH :: 3
  7. EINTR :: 4
  8. EIO :: 5
  9. ENXIO :: 6
  10. EBADF :: 9
  11. EAGAIN :: 11
  12. ENOMEM :: 12
  13. EACCES :: 13
  14. EFAULT :: 14
  15. EEXIST :: 17
  16. ENODEV :: 19
  17. ENOTDIR :: 20
  18. EISDIR :: 21
  19. EINVAL :: 22
  20. ENFILE :: 23
  21. EMFILE :: 24
  22. ETXTBSY :: 26
  23. EFBIG :: 27
  24. ENOSPC :: 28
  25. ESPIPE :: 29
  26. EROFS :: 30
  27. EPIPE :: 32
  28. ERANGE :: 34 /* Result too large */
  29. EDEADLK :: 35 /* Resource deadlock would occur */
  30. ENAMETOOLONG :: 36 /* File name too long */
  31. ENOLCK :: 37 /* No record locks available */
  32. ENOSYS :: 38 /* Invalid system call number */
  33. ENOTEMPTY :: 39 /* Directory not empty */
  34. ELOOP :: 40 /* Too many symbolic links encountered */
  35. EWOULDBLOCK :: EAGAIN /* Operation would block */
  36. ENOMSG :: 42 /* No message of desired type */
  37. EIDRM :: 43 /* Identifier removed */
  38. ECHRNG :: 44 /* Channel number out of range */
  39. EL2NSYNC :: 45 /* Level 2 not synchronized */
  40. EL3HLT :: 46 /* Level 3 halted */
  41. EL3RST :: 47 /* Level 3 reset */
  42. ELNRNG :: 48 /* Link number out of range */
  43. EUNATCH :: 49 /* Protocol driver not attached */
  44. ENOCSI :: 50 /* No CSI structure available */
  45. EL2HLT :: 51 /* Level 2 halted */
  46. EBADE :: 52 /* Invalid exchange */
  47. EBADR :: 53 /* Invalid request descriptor */
  48. EXFULL :: 54 /* Exchange full */
  49. ENOANO :: 55 /* No anode */
  50. EBADRQC :: 56 /* Invalid request code */
  51. EBADSLT :: 57 /* Invalid slot */
  52. EDEADLOCK :: EDEADLK
  53. EBFONT :: 59 /* Bad font file format */
  54. ENOSTR :: 60 /* Device not a stream */
  55. ENODATA :: 61 /* No data available */
  56. ETIME :: 62 /* Timer expired */
  57. ENOSR :: 63 /* Out of streams resources */
  58. ENONET :: 64 /* Machine is not on the network */
  59. ENOPKG :: 65 /* Package not installed */
  60. EREMOTE :: 66 /* Object is remote */
  61. ENOLINK :: 67 /* Link has been severed */
  62. EADV :: 68 /* Advertise error */
  63. ESRMNT :: 69 /* Srmount error */
  64. ECOMM :: 70 /* Communication error on send */
  65. EPROTO :: 71 /* Protocol error */
  66. EMULTIHOP :: 72 /* Multihop attempted */
  67. EDOTDOT :: 73 /* RFS specific error */
  68. EBADMSG :: 74 /* Not a data message */
  69. EOVERFLOW :: 75 /* Value too large for defined data type */
  70. ENOTUNIQ :: 76 /* Name not unique on network */
  71. EBADFD :: 77 /* File descriptor in bad state */
  72. EREMCHG :: 78 /* Remote address changed */
  73. ELIBACC :: 79 /* Can not access a needed shared library */
  74. ELIBBAD :: 80 /* Accessing a corrupted shared library */
  75. ELIBSCN :: 81 /* .lib section in a.out corrupted */
  76. ELIBMAX :: 82 /* Attempting to link in too many shared libraries */
  77. ELIBEXEC :: 83 /* Cannot exec a shared library directly */
  78. EILSEQ :: 84 /* Illegal byte sequence */
  79. ERESTART :: 85 /* Interrupted system call should be restarted */
  80. ESTRPIPE :: 86 /* Streams pipe error */
  81. EUSERS :: 87 /* Too many users */
  82. ENOTSOCK :: 88 /* Socket operation on non-socket */
  83. EDESTADDRREQ :: 89 /* Destination address required */
  84. EMSGSIZE :: 90 /* Message too long */
  85. EPROTOTYPE :: 91 /* Protocol wrong type for socket */
  86. ENOPROTOOPT :: 92 /* Protocol not available */
  87. EPROTONOSUPPORT:: 93 /* Protocol not supported */
  88. ESOCKTNOSUPPORT:: 94 /* Socket type not supported */
  89. EOPNOTSUPP :: 95 /* Operation not supported on transport endpoint */
  90. EPFNOSUPPORT :: 96 /* Protocol family not supported */
  91. EAFNOSUPPORT :: 97 /* Address family not supported by protocol */
  92. EADDRINUSE :: 98 /* Address already in use */
  93. EADDRNOTAVAIL :: 99 /* Cannot assign requested address */
  94. ENETDOWN :: 100 /* Network is down */
  95. ENETUNREACH :: 101 /* Network is unreachable */
  96. ENETRESET :: 102 /* Network dropped connection because of reset */
  97. ECONNABORTED :: 103 /* Software caused connection abort */
  98. ECONNRESET :: 104 /* Connection reset by peer */
  99. ENOBUFS :: 105 /* No buffer space available */
  100. EISCONN :: 106 /* Transport endpoint is already connected */
  101. ENOTCONN :: 107 /* Transport endpoint is not connected */
  102. ESHUTDOWN :: 108 /* Cannot send after transport endpoint shutdown */
  103. ETOOMANYREFS :: 109 /* Too many references: cannot splice */
  104. ETIMEDOUT :: 110 /* Connection timed out */
  105. ECONNREFUSED :: 111 /* Connection refused */
  106. EHOSTDOWN :: 112 /* Host is down */
  107. EHOSTUNREACH :: 113 /* No route to host */
  108. EALREADY :: 114 /* Operation already in progress */
  109. EINPROGRESS :: 115 /* Operation now in progress */
  110. ESTALE :: 116 /* Stale file handle */
  111. EUCLEAN :: 117 /* Structure needs cleaning */
  112. ENOTNAM :: 118 /* Not a XENIX named type file */
  113. ENAVAIL :: 119 /* No XENIX semaphores available */
  114. EISNAM :: 120 /* Is a named type file */
  115. EREMOTEIO :: 121 /* Remote I/O error */
  116. EDQUOT :: 122 /* Quota exceeded */
  117. ENOMEDIUM :: 123 /* No medium found */
  118. EMEDIUMTYPE :: 124 /* Wrong medium type */
  119. ECANCELED :: 125 /* Operation Canceled */
  120. ENOKEY :: 126 /* Required key not available */
  121. EKEYEXPIRED :: 127 /* Key has expired */
  122. EKEYREVOKED :: 128 /* Key has been revoked */
  123. EKEYREJECTED :: 129 /* Key was rejected by service */
  124. EOWNERDEAD :: 130 /* Owner died */
  125. ENOTRECOVERABLE:: 131 /* State not recoverable */
  126. ERFKILL :: 132 /* Operation not possible due to RF-kill */
  127. EHWPOISON :: 133 /* Memory page has hardware error */
  128. _get_platform_error :: proc(res: int) -> Error {
  129. errno := unix.get_errno(res)
  130. return Platform_Error(i32(errno))
  131. }
  132. _ok_or_error :: proc(res: int) -> Error {
  133. return res >= 0 ? nil : _get_platform_error(res)
  134. }
  135. _error_string :: proc(errno: i32) -> string {
  136. if errno == 0 {
  137. return ""
  138. }
  139. return "Error"
  140. }