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.
11 // These were originally used by Nacl, then later also used by
12 // js/wasm. Now that they're only used by js/wasm, these numbers are
15 // TODO: delete? replace with something meaningful?
35 sys_list_mappings
= 25
44 sys_clock_gettime
= 44
50 sys_imc_makeboundsock
= 60
55 sys_imc_mem_obj_create
= 65
56 sys_imc_socketpair
= 66
59 sys_mutex_trylock
= 72
64 sys_cond_broadcast
= 77
65 sys_cond_timed_wait_abs
= 79
66 sys_thread_create
= 80
71 sys_second_tls_set
= 85
72 sys_second_tls_get
= 86
73 sys_exception_handler
= 87
74 sys_exception_stack
= 88
75 sys_exception_clear_flag
= 89
79 sys_sem_get_value
= 103
80 sys_dyncode_create
= 104
81 sys_dyncode_modify
= 105
82 sys_dyncode_delete
= 106
83 sys_test_infoleak
= 109
85 sys_test_syscall_1
= 111
86 sys_test_syscall_2
= 112
87 sys_futex_wait_abs
= 120
99 sys_get_random_bytes
= 150
102 // TODO: Auto-generate some day. (Hard-coded in binaries so not likely to change.)
104 // native_client/src/trusted/service_runtime/include/sys/errno.h
105 // The errors are mainly copied from Linux.
106 EPERM Errno
= 1 /* Operation not permitted */
107 ENOENT Errno
= 2 /* No such file or directory */
108 ESRCH Errno
= 3 /* No such process */
109 EINTR Errno
= 4 /* Interrupted system call */
110 EIO Errno
= 5 /* I/O error */
111 ENXIO Errno
= 6 /* No such device or address */
112 E2BIG Errno
= 7 /* Argument list too long */
113 ENOEXEC Errno
= 8 /* Exec format error */
114 EBADF Errno
= 9 /* Bad file number */
115 ECHILD Errno
= 10 /* No child processes */
116 EAGAIN Errno
= 11 /* Try again */
117 ENOMEM Errno
= 12 /* Out of memory */
118 EACCES Errno
= 13 /* Permission denied */
119 EFAULT Errno
= 14 /* Bad address */
120 EBUSY Errno
= 16 /* Device or resource busy */
121 EEXIST Errno
= 17 /* File exists */
122 EXDEV Errno
= 18 /* Cross-device link */
123 ENODEV Errno
= 19 /* No such device */
124 ENOTDIR Errno
= 20 /* Not a directory */
125 EISDIR Errno
= 21 /* Is a directory */
126 EINVAL Errno
= 22 /* Invalid argument */
127 ENFILE Errno
= 23 /* File table overflow */
128 EMFILE Errno
= 24 /* Too many open files */
129 ENOTTY Errno
= 25 /* Not a typewriter */
130 EFBIG Errno
= 27 /* File too large */
131 ENOSPC Errno
= 28 /* No space left on device */
132 ESPIPE Errno
= 29 /* Illegal seek */
133 EROFS Errno
= 30 /* Read-only file system */
134 EMLINK Errno
= 31 /* Too many links */
135 EPIPE Errno
= 32 /* Broken pipe */
136 ENAMETOOLONG Errno
= 36 /* File name too long */
137 ENOSYS Errno
= 38 /* Function not implemented */
138 EDQUOT Errno
= 122 /* Quota exceeded */
139 EDOM Errno
= 33 /* Math arg out of domain of func */
140 ERANGE Errno
= 34 /* Math result not representable */
141 EDEADLK Errno
= 35 /* Deadlock condition */
142 ENOLCK Errno
= 37 /* No record locks available */
143 ENOTEMPTY Errno
= 39 /* Directory not empty */
144 ELOOP Errno
= 40 /* Too many symbolic links */
145 ENOMSG Errno
= 42 /* No message of desired type */
146 EIDRM Errno
= 43 /* Identifier removed */
147 ECHRNG Errno
= 44 /* Channel number out of range */
148 EL2NSYNC Errno
= 45 /* Level 2 not synchronized */
149 EL3HLT Errno
= 46 /* Level 3 halted */
150 EL3RST Errno
= 47 /* Level 3 reset */
151 ELNRNG Errno
= 48 /* Link number out of range */
152 EUNATCH Errno
= 49 /* Protocol driver not attached */
153 ENOCSI Errno
= 50 /* No CSI structure available */
154 EL2HLT Errno
= 51 /* Level 2 halted */
155 EBADE Errno
= 52 /* Invalid exchange */
156 EBADR Errno
= 53 /* Invalid request descriptor */
157 EXFULL Errno
= 54 /* Exchange full */
158 ENOANO Errno
= 55 /* No anode */
159 EBADRQC Errno
= 56 /* Invalid request code */
160 EBADSLT Errno
= 57 /* Invalid slot */
161 EDEADLOCK Errno
= EDEADLK
/* File locking deadlock error */
162 EBFONT Errno
= 59 /* Bad font file fmt */
163 ENOSTR Errno
= 60 /* Device not a stream */
164 ENODATA Errno
= 61 /* No data (for no delay io) */
165 ETIME Errno
= 62 /* Timer expired */
166 ENOSR Errno
= 63 /* Out of streams resources */
167 ENONET Errno
= 64 /* Machine is not on the network */
168 ENOPKG Errno
= 65 /* Package not installed */
169 EREMOTE Errno
= 66 /* The object is remote */
170 ENOLINK Errno
= 67 /* The link has been severed */
171 EADV Errno
= 68 /* Advertise error */
172 ESRMNT Errno
= 69 /* Srmount error */
173 ECOMM Errno
= 70 /* Communication error on send */
174 EPROTO Errno
= 71 /* Protocol error */
175 EMULTIHOP Errno
= 72 /* Multihop attempted */
176 EDOTDOT Errno
= 73 /* Cross mount point (not really error) */
177 EBADMSG Errno
= 74 /* Trying to read unreadable message */
178 EOVERFLOW Errno
= 75 /* Value too large for defined data type */
179 ENOTUNIQ Errno
= 76 /* Given log. name not unique */
180 EBADFD Errno
= 77 /* f.d. invalid for this operation */
181 EREMCHG Errno
= 78 /* Remote address changed */
182 ELIBACC Errno
= 79 /* Can't access a needed shared lib */
183 ELIBBAD Errno
= 80 /* Accessing a corrupted shared lib */
184 ELIBSCN Errno
= 81 /* .lib section in a.out corrupted */
185 ELIBMAX Errno
= 82 /* Attempting to link in too many libs */
186 ELIBEXEC Errno
= 83 /* Attempting to exec a shared library */
189 ENOTSOCK Errno
= 88 /* Socket operation on non-socket */
190 EDESTADDRREQ Errno
= 89 /* Destination address required */
191 EMSGSIZE Errno
= 90 /* Message too long */
192 EPROTOTYPE Errno
= 91 /* Protocol wrong type for socket */
193 ENOPROTOOPT Errno
= 92 /* Protocol not available */
194 EPROTONOSUPPORT Errno
= 93 /* Unknown protocol */
195 ESOCKTNOSUPPORT Errno
= 94 /* Socket type not supported */
196 EOPNOTSUPP Errno
= 95 /* Operation not supported on transport endpoint */
197 EPFNOSUPPORT Errno
= 96 /* Protocol family not supported */
198 EAFNOSUPPORT Errno
= 97 /* Address family not supported by protocol family */
199 EADDRINUSE Errno
= 98 /* Address already in use */
200 EADDRNOTAVAIL Errno
= 99 /* Address not available */
201 ENETDOWN Errno
= 100 /* Network interface is not configured */
202 ENETUNREACH Errno
= 101 /* Network is unreachable */
203 ENETRESET Errno
= 102
204 ECONNABORTED Errno
= 103 /* Connection aborted */
205 ECONNRESET Errno
= 104 /* Connection reset by peer */
206 ENOBUFS Errno
= 105 /* No buffer space available */
207 EISCONN Errno
= 106 /* Socket is already connected */
208 ENOTCONN Errno
= 107 /* Socket is not connected */
209 ESHUTDOWN Errno
= 108 /* Can't send after socket shutdown */
210 ETOOMANYREFS Errno
= 109
211 ETIMEDOUT Errno
= 110 /* Connection timed out */
212 ECONNREFUSED Errno
= 111 /* Connection refused */
213 EHOSTDOWN Errno
= 112 /* Host is down */
214 EHOSTUNREACH Errno
= 113 /* Host is unreachable */
215 EALREADY Errno
= 114 /* Socket already connected */
216 EINPROGRESS Errno
= 115 /* Connection already in progress */
218 ENOTSUP Errno
= EOPNOTSUPP
/* Not supported */
219 ENOMEDIUM Errno
= 123 /* No medium (in tape drive) */
220 ECANCELED Errno
= 125 /* Operation canceled. */
221 ELBIN Errno
= 2048 /* Inode is remote (not really error) */
222 EFTYPE Errno
= 2049 /* Inappropriate file type or format */
223 ENMFILE Errno
= 2050 /* No more files */
224 EPROCLIM Errno
= 2051
225 ENOSHARE Errno
= 2052 /* No such host or network path */
226 ECASECLASH Errno
= 2053 /* Filename exists with different case */
227 EWOULDBLOCK Errno
= EAGAIN
/* Operation would block */
230 // TODO: Auto-generate some day. (Hard-coded in binaries so not likely to change.)
231 var errorstr
= [...]string{
232 EPERM
: "Operation not permitted",
233 ENOENT
: "No such file or directory",
234 ESRCH
: "No such process",
235 EINTR
: "Interrupted system call",
237 ENXIO
: "No such device or address",
238 E2BIG
: "Argument list too long",
239 ENOEXEC
: "Exec format error",
240 EBADF
: "Bad file number",
241 ECHILD
: "No child processes",
243 ENOMEM
: "Out of memory",
244 EACCES
: "Permission denied",
245 EFAULT
: "Bad address",
246 EBUSY
: "Device or resource busy",
247 EEXIST
: "File exists",
248 EXDEV
: "Cross-device link",
249 ENODEV
: "No such device",
250 ENOTDIR
: "Not a directory",
251 EISDIR
: "Is a directory",
252 EINVAL
: "Invalid argument",
253 ENFILE
: "File table overflow",
254 EMFILE
: "Too many open files",
255 ENOTTY
: "Not a typewriter",
256 EFBIG
: "File too large",
257 ENOSPC
: "No space left on device",
258 ESPIPE
: "Illegal seek",
259 EROFS
: "Read-only file system",
260 EMLINK
: "Too many links",
261 EPIPE
: "Broken pipe",
262 ENAMETOOLONG
: "File name too long",
263 ENOSYS
: "not implemented on " + runtime
.GOOS
,
264 EDQUOT
: "Quota exceeded",
265 EDOM
: "Math arg out of domain of func",
266 ERANGE
: "Math result not representable",
267 EDEADLK
: "Deadlock condition",
268 ENOLCK
: "No record locks available",
269 ENOTEMPTY
: "Directory not empty",
270 ELOOP
: "Too many symbolic links",
271 ENOMSG
: "No message of desired type",
272 EIDRM
: "Identifier removed",
273 ECHRNG
: "Channel number out of range",
274 EL2NSYNC
: "Level 2 not synchronized",
275 EL3HLT
: "Level 3 halted",
276 EL3RST
: "Level 3 reset",
277 ELNRNG
: "Link number out of range",
278 EUNATCH
: "Protocol driver not attached",
279 ENOCSI
: "No CSI structure available",
280 EL2HLT
: "Level 2 halted",
281 EBADE
: "Invalid exchange",
282 EBADR
: "Invalid request descriptor",
283 EXFULL
: "Exchange full",
285 EBADRQC
: "Invalid request code",
286 EBADSLT
: "Invalid slot",
287 EBFONT
: "Bad font file fmt",
288 ENOSTR
: "Device not a stream",
289 ENODATA
: "No data (for no delay io)",
290 ETIME
: "Timer expired",
291 ENOSR
: "Out of streams resources",
292 ENONET
: "Machine is not on the network",
293 ENOPKG
: "Package not installed",
294 EREMOTE
: "The object is remote",
295 ENOLINK
: "The link has been severed",
296 EADV
: "Advertise error",
297 ESRMNT
: "Srmount error",
298 ECOMM
: "Communication error on send",
299 EPROTO
: "Protocol error",
300 EMULTIHOP
: "Multihop attempted",
301 EDOTDOT
: "Cross mount point (not really error)",
302 EBADMSG
: "Trying to read unreadable message",
303 EOVERFLOW
: "Value too large for defined data type",
304 ENOTUNIQ
: "Given log. name not unique",
305 EBADFD
: "f.d. invalid for this operation",
306 EREMCHG
: "Remote address changed",
307 ELIBACC
: "Can't access a needed shared lib",
308 ELIBBAD
: "Accessing a corrupted shared lib",
309 ELIBSCN
: ".lib section in a.out corrupted",
310 ELIBMAX
: "Attempting to link in too many libs",
311 ELIBEXEC
: "Attempting to exec a shared library",
312 ENOTSOCK
: "Socket operation on non-socket",
313 EDESTADDRREQ
: "Destination address required",
314 EMSGSIZE
: "Message too long",
315 EPROTOTYPE
: "Protocol wrong type for socket",
316 ENOPROTOOPT
: "Protocol not available",
317 EPROTONOSUPPORT
: "Unknown protocol",
318 ESOCKTNOSUPPORT
: "Socket type not supported",
319 EOPNOTSUPP
: "Operation not supported on transport endpoint",
320 EPFNOSUPPORT
: "Protocol family not supported",
321 EAFNOSUPPORT
: "Address family not supported by protocol family",
322 EADDRINUSE
: "Address already in use",
323 EADDRNOTAVAIL
: "Address not available",
324 ENETDOWN
: "Network interface is not configured",
325 ENETUNREACH
: "Network is unreachable",
326 ECONNABORTED
: "Connection aborted",
327 ECONNRESET
: "Connection reset by peer",
328 ENOBUFS
: "No buffer space available",
329 EISCONN
: "Socket is already connected",
330 ENOTCONN
: "Socket is not connected",
331 ESHUTDOWN
: "Can't send after socket shutdown",
332 ETIMEDOUT
: "Connection timed out",
333 ECONNREFUSED
: "Connection refused",
334 EHOSTDOWN
: "Host is down",
335 EHOSTUNREACH
: "Host is unreachable",
336 EALREADY
: "Socket already connected",
337 EINPROGRESS
: "Connection already in progress",
338 ENOMEDIUM
: "No medium (in tape drive)",
339 ECANCELED
: "Operation canceled.",
340 ELBIN
: "Inode is remote (not really error)",
341 EFTYPE
: "Inappropriate file type or format",
342 ENMFILE
: "No more files",
343 ENOSHARE
: "No such host or network path",
344 ECASECLASH
: "Filename exists with different case",
347 // Do the interface allocations only once for common
350 errEAGAIN error
= EAGAIN
351 errEINVAL error
= EINVAL
352 errENOENT error
= ENOENT
355 // errnoErr returns common boxed Errno values, to prevent
356 // allocations at runtime.
357 func errnoErr(e Errno
) error
{
371 var errnoByCode
= map[string]Errno
{
402 "ENAMETOOLONG": ENAMETOOLONG
,
409 "ENOTEMPTY": ENOTEMPTY
,
414 "EL2NSYNC": EL2NSYNC
,
427 "EDEADLOCK": EDEADLOCK
,
441 "EMULTIHOP": EMULTIHOP
,
444 "EOVERFLOW": EOVERFLOW
,
445 "ENOTUNIQ": ENOTUNIQ
,
452 "ELIBEXEC": ELIBEXEC
,
455 "ENOTSOCK": ENOTSOCK
,
456 "EDESTADDRREQ": EDESTADDRREQ
,
457 "EMSGSIZE": EMSGSIZE
,
458 "EPROTOTYPE": EPROTOTYPE
,
459 "ENOPROTOOPT": ENOPROTOOPT
,
460 "EPROTONOSUPPORT": EPROTONOSUPPORT
,
461 "ESOCKTNOSUPPORT": ESOCKTNOSUPPORT
,
462 "EOPNOTSUPP": EOPNOTSUPP
,
463 "EPFNOSUPPORT": EPFNOSUPPORT
,
464 "EAFNOSUPPORT": EAFNOSUPPORT
,
465 "EADDRINUSE": EADDRINUSE
,
466 "EADDRNOTAVAIL": EADDRNOTAVAIL
,
467 "ENETDOWN": ENETDOWN
,
468 "ENETUNREACH": ENETUNREACH
,
469 "ENETRESET": ENETRESET
,
470 "ECONNABORTED": ECONNABORTED
,
471 "ECONNRESET": ECONNRESET
,
474 "ENOTCONN": ENOTCONN
,
475 "ESHUTDOWN": ESHUTDOWN
,
476 "ETOOMANYREFS": ETOOMANYREFS
,
477 "ETIMEDOUT": ETIMEDOUT
,
478 "ECONNREFUSED": ECONNREFUSED
,
479 "EHOSTDOWN": EHOSTDOWN
,
480 "EHOSTUNREACH": EHOSTUNREACH
,
481 "EALREADY": EALREADY
,
482 "EINPROGRESS": EINPROGRESS
,
485 "ENOMEDIUM": ENOMEDIUM
,
486 "ECANCELED": ECANCELED
,
490 "EPROCLIM": EPROCLIM
,
491 "ENOSHARE": ENOSHARE
,
492 "ECASECLASH": ECASECLASH
,
493 "EWOULDBLOCK": EWOULDBLOCK
,