errors_windows.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. // Copyright 2013 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package windows
  5. import "syscall"
  6. // Go names for Windows errors.
  7. const (
  8. ENOENT syscall.Errno = ERROR_FILE_NOT_FOUND
  9. ENOTDIR syscall.Errno = ERROR_PATH_NOT_FOUND
  10. )
  11. // Windows reserves errors >= 1<<29 for application use.
  12. const APPLICATION_ERROR = 1 << 29
  13. // Invented values to support what package os and others expects.
  14. const (
  15. E2BIG syscall.Errno = APPLICATION_ERROR + iota
  16. EACCES
  17. EADDRINUSE
  18. EADDRNOTAVAIL
  19. EADV
  20. EAFNOSUPPORT
  21. EAGAIN
  22. EALREADY
  23. EBADE
  24. EBADF
  25. EBADFD
  26. EBADMSG
  27. EBADR
  28. EBADRQC
  29. EBADSLT
  30. EBFONT
  31. EBUSY
  32. ECANCELED
  33. ECHILD
  34. ECHRNG
  35. ECOMM
  36. ECONNABORTED
  37. ECONNREFUSED
  38. ECONNRESET
  39. EDEADLK
  40. EDEADLOCK
  41. EDESTADDRREQ
  42. EDOM
  43. EDOTDOT
  44. EDQUOT
  45. EEXIST
  46. EFAULT
  47. EFBIG
  48. EHOSTDOWN
  49. EHOSTUNREACH
  50. EIDRM
  51. EILSEQ
  52. EINPROGRESS
  53. EINTR
  54. EINVAL
  55. EIO
  56. EISCONN
  57. EISDIR
  58. EISNAM
  59. EKEYEXPIRED
  60. EKEYREJECTED
  61. EKEYREVOKED
  62. EL2HLT
  63. EL2NSYNC
  64. EL3HLT
  65. EL3RST
  66. ELIBACC
  67. ELIBBAD
  68. ELIBEXEC
  69. ELIBMAX
  70. ELIBSCN
  71. ELNRNG
  72. ELOOP
  73. EMEDIUMTYPE
  74. EMFILE
  75. EMLINK
  76. EMSGSIZE
  77. EMULTIHOP
  78. ENAMETOOLONG
  79. ENAVAIL
  80. ENETDOWN
  81. ENETRESET
  82. ENETUNREACH
  83. ENFILE
  84. ENOANO
  85. ENOBUFS
  86. ENOCSI
  87. ENODATA
  88. ENODEV
  89. ENOEXEC
  90. ENOKEY
  91. ENOLCK
  92. ENOLINK
  93. ENOMEDIUM
  94. ENOMEM
  95. ENOMSG
  96. ENONET
  97. ENOPKG
  98. ENOPROTOOPT
  99. ENOSPC
  100. ENOSR
  101. ENOSTR
  102. ENOSYS
  103. ENOTBLK
  104. ENOTCONN
  105. ENOTEMPTY
  106. ENOTNAM
  107. ENOTRECOVERABLE
  108. ENOTSOCK
  109. ENOTSUP
  110. ENOTTY
  111. ENOTUNIQ
  112. ENXIO
  113. EOPNOTSUPP
  114. EOVERFLOW
  115. EOWNERDEAD
  116. EPERM
  117. EPFNOSUPPORT
  118. EPIPE
  119. EPROTO
  120. EPROTONOSUPPORT
  121. EPROTOTYPE
  122. ERANGE
  123. EREMCHG
  124. EREMOTE
  125. EREMOTEIO
  126. ERESTART
  127. EROFS
  128. ESHUTDOWN
  129. ESOCKTNOSUPPORT
  130. ESPIPE
  131. ESRCH
  132. ESRMNT
  133. ESTALE
  134. ESTRPIPE
  135. ETIME
  136. ETIMEDOUT
  137. ETOOMANYREFS
  138. ETXTBSY
  139. EUCLEAN
  140. EUNATCH
  141. EUSERS
  142. EWOULDBLOCK
  143. EXDEV
  144. EXFULL
  145. EWINDOWS
  146. )
  147. // Error strings for invented errors
  148. var errors = [...]string{
  149. E2BIG - APPLICATION_ERROR: "argument list too long",
  150. EACCES - APPLICATION_ERROR: "permission denied",
  151. EADDRINUSE - APPLICATION_ERROR: "address already in use",
  152. EADDRNOTAVAIL - APPLICATION_ERROR: "cannot assign requested address",
  153. EADV - APPLICATION_ERROR: "advertise error",
  154. EAFNOSUPPORT - APPLICATION_ERROR: "address family not supported by protocol",
  155. EAGAIN - APPLICATION_ERROR: "resource temporarily unavailable",
  156. EALREADY - APPLICATION_ERROR: "operation already in progress",
  157. EBADE - APPLICATION_ERROR: "invalid exchange",
  158. EBADF - APPLICATION_ERROR: "bad file descriptor",
  159. EBADFD - APPLICATION_ERROR: "file descriptor in bad state",
  160. EBADMSG - APPLICATION_ERROR: "bad message",
  161. EBADR - APPLICATION_ERROR: "invalid request descriptor",
  162. EBADRQC - APPLICATION_ERROR: "invalid request code",
  163. EBADSLT - APPLICATION_ERROR: "invalid slot",
  164. EBFONT - APPLICATION_ERROR: "bad font file format",
  165. EBUSY - APPLICATION_ERROR: "device or resource busy",
  166. ECANCELED - APPLICATION_ERROR: "operation canceled",
  167. ECHILD - APPLICATION_ERROR: "no child processes",
  168. ECHRNG - APPLICATION_ERROR: "channel number out of range",
  169. ECOMM - APPLICATION_ERROR: "communication error on send",
  170. ECONNABORTED - APPLICATION_ERROR: "software caused connection abort",
  171. ECONNREFUSED - APPLICATION_ERROR: "connection refused",
  172. ECONNRESET - APPLICATION_ERROR: "connection reset by peer",
  173. EDEADLK - APPLICATION_ERROR: "resource deadlock avoided",
  174. EDEADLOCK - APPLICATION_ERROR: "resource deadlock avoided",
  175. EDESTADDRREQ - APPLICATION_ERROR: "destination address required",
  176. EDOM - APPLICATION_ERROR: "numerical argument out of domain",
  177. EDOTDOT - APPLICATION_ERROR: "RFS specific error",
  178. EDQUOT - APPLICATION_ERROR: "disk quota exceeded",
  179. EEXIST - APPLICATION_ERROR: "file exists",
  180. EFAULT - APPLICATION_ERROR: "bad address",
  181. EFBIG - APPLICATION_ERROR: "file too large",
  182. EHOSTDOWN - APPLICATION_ERROR: "host is down",
  183. EHOSTUNREACH - APPLICATION_ERROR: "no route to host",
  184. EIDRM - APPLICATION_ERROR: "identifier removed",
  185. EILSEQ - APPLICATION_ERROR: "invalid or incomplete multibyte or wide character",
  186. EINPROGRESS - APPLICATION_ERROR: "operation now in progress",
  187. EINTR - APPLICATION_ERROR: "interrupted system call",
  188. EINVAL - APPLICATION_ERROR: "invalid argument",
  189. EIO - APPLICATION_ERROR: "input/output error",
  190. EISCONN - APPLICATION_ERROR: "transport endpoint is already connected",
  191. EISDIR - APPLICATION_ERROR: "is a directory",
  192. EISNAM - APPLICATION_ERROR: "is a named type file",
  193. EKEYEXPIRED - APPLICATION_ERROR: "key has expired",
  194. EKEYREJECTED - APPLICATION_ERROR: "key was rejected by service",
  195. EKEYREVOKED - APPLICATION_ERROR: "key has been revoked",
  196. EL2HLT - APPLICATION_ERROR: "level 2 halted",
  197. EL2NSYNC - APPLICATION_ERROR: "level 2 not synchronized",
  198. EL3HLT - APPLICATION_ERROR: "level 3 halted",
  199. EL3RST - APPLICATION_ERROR: "level 3 reset",
  200. ELIBACC - APPLICATION_ERROR: "can not access a needed shared library",
  201. ELIBBAD - APPLICATION_ERROR: "accessing a corrupted shared library",
  202. ELIBEXEC - APPLICATION_ERROR: "cannot exec a shared library directly",
  203. ELIBMAX - APPLICATION_ERROR: "attempting to link in too many shared libraries",
  204. ELIBSCN - APPLICATION_ERROR: ".lib section in a.out corrupted",
  205. ELNRNG - APPLICATION_ERROR: "link number out of range",
  206. ELOOP - APPLICATION_ERROR: "too many levels of symbolic links",
  207. EMEDIUMTYPE - APPLICATION_ERROR: "wrong medium type",
  208. EMFILE - APPLICATION_ERROR: "too many open files",
  209. EMLINK - APPLICATION_ERROR: "too many links",
  210. EMSGSIZE - APPLICATION_ERROR: "message too long",
  211. EMULTIHOP - APPLICATION_ERROR: "multihop attempted",
  212. ENAMETOOLONG - APPLICATION_ERROR: "file name too long",
  213. ENAVAIL - APPLICATION_ERROR: "no XENIX semaphores available",
  214. ENETDOWN - APPLICATION_ERROR: "network is down",
  215. ENETRESET - APPLICATION_ERROR: "network dropped connection on reset",
  216. ENETUNREACH - APPLICATION_ERROR: "network is unreachable",
  217. ENFILE - APPLICATION_ERROR: "too many open files in system",
  218. ENOANO - APPLICATION_ERROR: "no anode",
  219. ENOBUFS - APPLICATION_ERROR: "no buffer space available",
  220. ENOCSI - APPLICATION_ERROR: "no CSI structure available",
  221. ENODATA - APPLICATION_ERROR: "no data available",
  222. ENODEV - APPLICATION_ERROR: "no such device",
  223. ENOEXEC - APPLICATION_ERROR: "exec format error",
  224. ENOKEY - APPLICATION_ERROR: "required key not available",
  225. ENOLCK - APPLICATION_ERROR: "no locks available",
  226. ENOLINK - APPLICATION_ERROR: "link has been severed",
  227. ENOMEDIUM - APPLICATION_ERROR: "no medium found",
  228. ENOMEM - APPLICATION_ERROR: "cannot allocate memory",
  229. ENOMSG - APPLICATION_ERROR: "no message of desired type",
  230. ENONET - APPLICATION_ERROR: "machine is not on the network",
  231. ENOPKG - APPLICATION_ERROR: "package not installed",
  232. ENOPROTOOPT - APPLICATION_ERROR: "protocol not available",
  233. ENOSPC - APPLICATION_ERROR: "no space left on device",
  234. ENOSR - APPLICATION_ERROR: "out of streams resources",
  235. ENOSTR - APPLICATION_ERROR: "device not a stream",
  236. ENOSYS - APPLICATION_ERROR: "function not implemented",
  237. ENOTBLK - APPLICATION_ERROR: "block device required",
  238. ENOTCONN - APPLICATION_ERROR: "transport endpoint is not connected",
  239. ENOTEMPTY - APPLICATION_ERROR: "directory not empty",
  240. ENOTNAM - APPLICATION_ERROR: "not a XENIX named type file",
  241. ENOTRECOVERABLE - APPLICATION_ERROR: "state not recoverable",
  242. ENOTSOCK - APPLICATION_ERROR: "socket operation on non-socket",
  243. ENOTSUP - APPLICATION_ERROR: "operation not supported",
  244. ENOTTY - APPLICATION_ERROR: "inappropriate ioctl for device",
  245. ENOTUNIQ - APPLICATION_ERROR: "name not unique on network",
  246. ENXIO - APPLICATION_ERROR: "no such device or address",
  247. EOPNOTSUPP - APPLICATION_ERROR: "operation not supported",
  248. EOVERFLOW - APPLICATION_ERROR: "value too large for defined data type",
  249. EOWNERDEAD - APPLICATION_ERROR: "owner died",
  250. EPERM - APPLICATION_ERROR: "operation not permitted",
  251. EPFNOSUPPORT - APPLICATION_ERROR: "protocol family not supported",
  252. EPIPE - APPLICATION_ERROR: "broken pipe",
  253. EPROTO - APPLICATION_ERROR: "protocol error",
  254. EPROTONOSUPPORT - APPLICATION_ERROR: "protocol not supported",
  255. EPROTOTYPE - APPLICATION_ERROR: "protocol wrong type for socket",
  256. ERANGE - APPLICATION_ERROR: "numerical result out of range",
  257. EREMCHG - APPLICATION_ERROR: "remote address changed",
  258. EREMOTE - APPLICATION_ERROR: "object is remote",
  259. EREMOTEIO - APPLICATION_ERROR: "remote I/O error",
  260. ERESTART - APPLICATION_ERROR: "interrupted system call should be restarted",
  261. EROFS - APPLICATION_ERROR: "read-only file system",
  262. ESHUTDOWN - APPLICATION_ERROR: "cannot send after transport endpoint shutdown",
  263. ESOCKTNOSUPPORT - APPLICATION_ERROR: "socket type not supported",
  264. ESPIPE - APPLICATION_ERROR: "illegal seek",
  265. ESRCH - APPLICATION_ERROR: "no such process",
  266. ESRMNT - APPLICATION_ERROR: "srmount error",
  267. ESTALE - APPLICATION_ERROR: "stale NFS file handle",
  268. ESTRPIPE - APPLICATION_ERROR: "streams pipe error",
  269. ETIME - APPLICATION_ERROR: "timer expired",
  270. ETIMEDOUT - APPLICATION_ERROR: "connection timed out",
  271. ETOOMANYREFS - APPLICATION_ERROR: "too many references: cannot splice",
  272. ETXTBSY - APPLICATION_ERROR: "text file busy",
  273. EUCLEAN - APPLICATION_ERROR: "structure needs cleaning",
  274. EUNATCH - APPLICATION_ERROR: "protocol driver not attached",
  275. EUSERS - APPLICATION_ERROR: "too many users",
  276. EWOULDBLOCK - APPLICATION_ERROR: "resource temporarily unavailable",
  277. EXDEV - APPLICATION_ERROR: "invalid cross-device link",
  278. EXFULL - APPLICATION_ERROR: "exchange full",
  279. EWINDOWS - APPLICATION_ERROR: "not supported by windows",
  280. }