tables_nacl.go 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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 unix
  5. // TODO: generate with runtime/mknacl.sh, allow override with IRT.
  6. const (
  7. sys_null = 1
  8. sys_nameservice = 2
  9. sys_dup = 8
  10. sys_dup2 = 9
  11. sys_open = 10
  12. sys_close = 11
  13. sys_read = 12
  14. sys_write = 13
  15. sys_lseek = 14
  16. sys_ioctl = 15
  17. sys_stat = 16
  18. sys_fstat = 17
  19. sys_chmod = 18
  20. sys_brk = 20
  21. sys_mmap = 21
  22. sys_munmap = 22
  23. sys_getdents = 23
  24. sys_mprotect = 24
  25. sys_list_mappings = 25
  26. sys_exit = 30
  27. sys_getpid = 31
  28. sys_sched_yield = 32
  29. sys_sysconf = 33
  30. sys_gettimeofday = 40
  31. sys_clock = 41
  32. sys_nanosleep = 42
  33. sys_clock_getres = 43
  34. sys_clock_gettime = 44
  35. sys_mkdir = 45
  36. sys_rmdir = 46
  37. sys_chdir = 47
  38. sys_getcwd = 48
  39. sys_unlink = 49
  40. sys_imc_makeboundsock = 60
  41. sys_imc_accept = 61
  42. sys_imc_connect = 62
  43. sys_imc_sendmsg = 63
  44. sys_imc_recvmsg = 64
  45. sys_imc_mem_obj_create = 65
  46. sys_imc_socketpair = 66
  47. sys_mutex_create = 70
  48. sys_mutex_lock = 71
  49. sys_mutex_trylock = 72
  50. sys_mutex_unlock = 73
  51. sys_cond_create = 74
  52. sys_cond_wait = 75
  53. sys_cond_signal = 76
  54. sys_cond_broadcast = 77
  55. sys_cond_timed_wait_abs = 79
  56. sys_thread_create = 80
  57. sys_thread_exit = 81
  58. sys_tls_init = 82
  59. sys_thread_nice = 83
  60. sys_tls_get = 84
  61. sys_second_tls_set = 85
  62. sys_second_tls_get = 86
  63. sys_exception_handler = 87
  64. sys_exception_stack = 88
  65. sys_exception_clear_flag = 89
  66. sys_sem_create = 100
  67. sys_sem_wait = 101
  68. sys_sem_post = 102
  69. sys_sem_get_value = 103
  70. sys_dyncode_create = 104
  71. sys_dyncode_modify = 105
  72. sys_dyncode_delete = 106
  73. sys_test_infoleak = 109
  74. sys_test_crash = 110
  75. sys_test_syscall_1 = 111
  76. sys_test_syscall_2 = 112
  77. )
  78. // TODO: Auto-generate some day. (Hard-coded in binaries so not likely to change.)
  79. const (
  80. // native_client/src/trusted/service_runtime/include/sys/errno.h
  81. // The errors are mainly copied from Linux.
  82. EPERM Errno = 1 /* Operation not permitted */
  83. ENOENT Errno = 2 /* No such file or directory */
  84. ESRCH Errno = 3 /* No such process */
  85. EINTR Errno = 4 /* Interrupted system call */
  86. EIO Errno = 5 /* I/O error */
  87. ENXIO Errno = 6 /* No such device or address */
  88. E2BIG Errno = 7 /* Argument list too long */
  89. ENOEXEC Errno = 8 /* Exec format error */
  90. EBADF Errno = 9 /* Bad file number */
  91. ECHILD Errno = 10 /* No child processes */
  92. EAGAIN Errno = 11 /* Try again */
  93. ENOMEM Errno = 12 /* Out of memory */
  94. EACCES Errno = 13 /* Permission denied */
  95. EFAULT Errno = 14 /* Bad address */
  96. EBUSY Errno = 16 /* Device or resource busy */
  97. EEXIST Errno = 17 /* File exists */
  98. EXDEV Errno = 18 /* Cross-device link */
  99. ENODEV Errno = 19 /* No such device */
  100. ENOTDIR Errno = 20 /* Not a directory */
  101. EISDIR Errno = 21 /* Is a directory */
  102. EINVAL Errno = 22 /* Invalid argument */
  103. ENFILE Errno = 23 /* File table overflow */
  104. EMFILE Errno = 24 /* Too many open files */
  105. ENOTTY Errno = 25 /* Not a typewriter */
  106. EFBIG Errno = 27 /* File too large */
  107. ENOSPC Errno = 28 /* No space left on device */
  108. ESPIPE Errno = 29 /* Illegal seek */
  109. EROFS Errno = 30 /* Read-only file system */
  110. EMLINK Errno = 31 /* Too many links */
  111. EPIPE Errno = 32 /* Broken pipe */
  112. ENAMETOOLONG Errno = 36 /* File name too long */
  113. ENOSYS Errno = 38 /* Function not implemented */
  114. EDQUOT Errno = 122 /* Quota exceeded */
  115. EDOM Errno = 33 /* Math arg out of domain of func */
  116. ERANGE Errno = 34 /* Math result not representable */
  117. EDEADLK Errno = 35 /* Deadlock condition */
  118. ENOLCK Errno = 37 /* No record locks available */
  119. ENOTEMPTY Errno = 39 /* Directory not empty */
  120. ELOOP Errno = 40 /* Too many symbolic links */
  121. ENOMSG Errno = 42 /* No message of desired type */
  122. EIDRM Errno = 43 /* Identifier removed */
  123. ECHRNG Errno = 44 /* Channel number out of range */
  124. EL2NSYNC Errno = 45 /* Level 2 not synchronized */
  125. EL3HLT Errno = 46 /* Level 3 halted */
  126. EL3RST Errno = 47 /* Level 3 reset */
  127. ELNRNG Errno = 48 /* Link number out of range */
  128. EUNATCH Errno = 49 /* Protocol driver not attached */
  129. ENOCSI Errno = 50 /* No CSI structure available */
  130. EL2HLT Errno = 51 /* Level 2 halted */
  131. EBADE Errno = 52 /* Invalid exchange */
  132. EBADR Errno = 53 /* Invalid request descriptor */
  133. EXFULL Errno = 54 /* Exchange full */
  134. ENOANO Errno = 55 /* No anode */
  135. EBADRQC Errno = 56 /* Invalid request code */
  136. EBADSLT Errno = 57 /* Invalid slot */
  137. EDEADLOCK Errno = EDEADLK /* File locking deadlock error */
  138. EBFONT Errno = 59 /* Bad font file fmt */
  139. ENOSTR Errno = 60 /* Device not a stream */
  140. ENODATA Errno = 61 /* No data (for no delay io) */
  141. ETIME Errno = 62 /* Timer expired */
  142. ENOSR Errno = 63 /* Out of streams resources */
  143. ENONET Errno = 64 /* Machine is not on the network */
  144. ENOPKG Errno = 65 /* Package not installed */
  145. EREMOTE Errno = 66 /* The object is remote */
  146. ENOLINK Errno = 67 /* The link has been severed */
  147. EADV Errno = 68 /* Advertise error */
  148. ESRMNT Errno = 69 /* Srmount error */
  149. ECOMM Errno = 70 /* Communication error on send */
  150. EPROTO Errno = 71 /* Protocol error */
  151. EMULTIHOP Errno = 72 /* Multihop attempted */
  152. EDOTDOT Errno = 73 /* Cross mount point (not really error) */
  153. EBADMSG Errno = 74 /* Trying to read unreadable message */
  154. EOVERFLOW Errno = 75 /* Value too large for defined data type */
  155. ENOTUNIQ Errno = 76 /* Given log. name not unique */
  156. EBADFD Errno = 77 /* f.d. invalid for this operation */
  157. EREMCHG Errno = 78 /* Remote address changed */
  158. ELIBACC Errno = 79 /* Can't access a needed shared lib */
  159. ELIBBAD Errno = 80 /* Accessing a corrupted shared lib */
  160. ELIBSCN Errno = 81 /* .lib section in a.out corrupted */
  161. ELIBMAX Errno = 82 /* Attempting to link in too many libs */
  162. ELIBEXEC Errno = 83 /* Attempting to exec a shared library */
  163. EILSEQ Errno = 84
  164. EUSERS Errno = 87
  165. ENOTSOCK Errno = 88 /* Socket operation on non-socket */
  166. EDESTADDRREQ Errno = 89 /* Destination address required */
  167. EMSGSIZE Errno = 90 /* Message too long */
  168. EPROTOTYPE Errno = 91 /* Protocol wrong type for socket */
  169. ENOPROTOOPT Errno = 92 /* Protocol not available */
  170. EPROTONOSUPPORT Errno = 93 /* Unknown protocol */
  171. ESOCKTNOSUPPORT Errno = 94 /* Socket type not supported */
  172. EOPNOTSUPP Errno = 95 /* Operation not supported on transport endpoint */
  173. EPFNOSUPPORT Errno = 96 /* Protocol family not supported */
  174. EAFNOSUPPORT Errno = 97 /* Address family not supported by protocol family */
  175. EADDRINUSE Errno = 98 /* Address already in use */
  176. EADDRNOTAVAIL Errno = 99 /* Address not available */
  177. ENETDOWN Errno = 100 /* Network interface is not configured */
  178. ENETUNREACH Errno = 101 /* Network is unreachable */
  179. ENETRESET Errno = 102
  180. ECONNABORTED Errno = 103 /* Connection aborted */
  181. ECONNRESET Errno = 104 /* Connection reset by peer */
  182. ENOBUFS Errno = 105 /* No buffer space available */
  183. EISCONN Errno = 106 /* Socket is already connected */
  184. ENOTCONN Errno = 107 /* Socket is not connected */
  185. ESHUTDOWN Errno = 108 /* Can't send after socket shutdown */
  186. ETOOMANYREFS Errno = 109
  187. ETIMEDOUT Errno = 110 /* Connection timed out */
  188. ECONNREFUSED Errno = 111 /* Connection refused */
  189. EHOSTDOWN Errno = 112 /* Host is down */
  190. EHOSTUNREACH Errno = 113 /* Host is unreachable */
  191. EALREADY Errno = 114 /* Socket already connected */
  192. EINPROGRESS Errno = 115 /* Connection already in progress */
  193. ESTALE Errno = 116
  194. ENOTSUP Errno = EOPNOTSUPP /* Not supported */
  195. ENOMEDIUM Errno = 123 /* No medium (in tape drive) */
  196. ECANCELED Errno = 125 /* Operation canceled. */
  197. ELBIN Errno = 2048 /* Inode is remote (not really error) */
  198. EFTYPE Errno = 2049 /* Inappropriate file type or format */
  199. ENMFILE Errno = 2050 /* No more files */
  200. EPROCLIM Errno = 2051
  201. ENOSHARE Errno = 2052 /* No such host or network path */
  202. ECASECLASH Errno = 2053 /* Filename exists with different case */
  203. EWOULDBLOCK Errno = EAGAIN /* Operation would block */
  204. )
  205. // TODO: Auto-generate some day. (Hard-coded in binaries so not likely to change.)
  206. var errorstr = [...]string{
  207. EPERM: "Operation not permitted",
  208. ENOENT: "No such file or directory",
  209. ESRCH: "No such process",
  210. EINTR: "Interrupted system call",
  211. EIO: "I/O error",
  212. ENXIO: "No such device or address",
  213. E2BIG: "Argument list too long",
  214. ENOEXEC: "Exec format error",
  215. EBADF: "Bad file number",
  216. ECHILD: "No child processes",
  217. EAGAIN: "Try again",
  218. ENOMEM: "Out of memory",
  219. EACCES: "Permission denied",
  220. EFAULT: "Bad address",
  221. EBUSY: "Device or resource busy",
  222. EEXIST: "File exists",
  223. EXDEV: "Cross-device link",
  224. ENODEV: "No such device",
  225. ENOTDIR: "Not a directory",
  226. EISDIR: "Is a directory",
  227. EINVAL: "Invalid argument",
  228. ENFILE: "File table overflow",
  229. EMFILE: "Too many open files",
  230. ENOTTY: "Not a typewriter",
  231. EFBIG: "File too large",
  232. ENOSPC: "No space left on device",
  233. ESPIPE: "Illegal seek",
  234. EROFS: "Read-only file system",
  235. EMLINK: "Too many links",
  236. EPIPE: "Broken pipe",
  237. ENAMETOOLONG: "File name too long",
  238. ENOSYS: "not implemented on Native Client",
  239. EDQUOT: "Quota exceeded",
  240. EDOM: "Math arg out of domain of func",
  241. ERANGE: "Math result not representable",
  242. EDEADLK: "Deadlock condition",
  243. ENOLCK: "No record locks available",
  244. ENOTEMPTY: "Directory not empty",
  245. ELOOP: "Too many symbolic links",
  246. ENOMSG: "No message of desired type",
  247. EIDRM: "Identifier removed",
  248. ECHRNG: "Channel number out of range",
  249. EL2NSYNC: "Level 2 not synchronized",
  250. EL3HLT: "Level 3 halted",
  251. EL3RST: "Level 3 reset",
  252. ELNRNG: "Link number out of range",
  253. EUNATCH: "Protocol driver not attached",
  254. ENOCSI: "No CSI structure available",
  255. EL2HLT: "Level 2 halted",
  256. EBADE: "Invalid exchange",
  257. EBADR: "Invalid request descriptor",
  258. EXFULL: "Exchange full",
  259. ENOANO: "No anode",
  260. EBADRQC: "Invalid request code",
  261. EBADSLT: "Invalid slot",
  262. EBFONT: "Bad font file fmt",
  263. ENOSTR: "Device not a stream",
  264. ENODATA: "No data (for no delay io)",
  265. ETIME: "Timer expired",
  266. ENOSR: "Out of streams resources",
  267. ENONET: "Machine is not on the network",
  268. ENOPKG: "Package not installed",
  269. EREMOTE: "The object is remote",
  270. ENOLINK: "The link has been severed",
  271. EADV: "Advertise error",
  272. ESRMNT: "Srmount error",
  273. ECOMM: "Communication error on send",
  274. EPROTO: "Protocol error",
  275. EMULTIHOP: "Multihop attempted",
  276. EDOTDOT: "Cross mount point (not really error)",
  277. EBADMSG: "Trying to read unreadable message",
  278. EOVERFLOW: "Value too large for defined data type",
  279. ENOTUNIQ: "Given log. name not unique",
  280. EBADFD: "f.d. invalid for this operation",
  281. EREMCHG: "Remote address changed",
  282. ELIBACC: "Can't access a needed shared lib",
  283. ELIBBAD: "Accessing a corrupted shared lib",
  284. ELIBSCN: ".lib section in a.out corrupted",
  285. ELIBMAX: "Attempting to link in too many libs",
  286. ELIBEXEC: "Attempting to exec a shared library",
  287. ENOTSOCK: "Socket operation on non-socket",
  288. EDESTADDRREQ: "Destination address required",
  289. EMSGSIZE: "Message too long",
  290. EPROTOTYPE: "Protocol wrong type for socket",
  291. ENOPROTOOPT: "Protocol not available",
  292. EPROTONOSUPPORT: "Unknown protocol",
  293. ESOCKTNOSUPPORT: "Socket type not supported",
  294. EOPNOTSUPP: "Operation not supported on transport endpoint",
  295. EPFNOSUPPORT: "Protocol family not supported",
  296. EAFNOSUPPORT: "Address family not supported by protocol family",
  297. EADDRINUSE: "Address already in use",
  298. EADDRNOTAVAIL: "Address not available",
  299. ENETDOWN: "Network interface is not configured",
  300. ENETUNREACH: "Network is unreachable",
  301. ECONNABORTED: "Connection aborted",
  302. ECONNRESET: "Connection reset by peer",
  303. ENOBUFS: "No buffer space available",
  304. EISCONN: "Socket is already connected",
  305. ENOTCONN: "Socket is not connected",
  306. ESHUTDOWN: "Can't send after socket shutdown",
  307. ETIMEDOUT: "Connection timed out",
  308. ECONNREFUSED: "Connection refused",
  309. EHOSTDOWN: "Host is down",
  310. EHOSTUNREACH: "Host is unreachable",
  311. EALREADY: "Socket already connected",
  312. EINPROGRESS: "Connection already in progress",
  313. ENOMEDIUM: "No medium (in tape drive)",
  314. ECANCELED: "Operation canceled.",
  315. ELBIN: "Inode is remote (not really error)",
  316. EFTYPE: "Inappropriate file type or format",
  317. ENMFILE: "No more files",
  318. ENOSHARE: "No such host or network path",
  319. ECASECLASH: "Filename exists with different case",
  320. }