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