Source file
src/syscall/tables_js.go
1
2
3
4
5
6
7 package syscall
8
9 import "runtime"
10
11
12
13
14
15
16 const (
17 sys_null = 1
18 sys_nameservice = 2
19 sys_dup = 8
20 sys_dup2 = 9
21 sys_open = 10
22 sys_close = 11
23 sys_read = 12
24 sys_write = 13
25 sys_lseek = 14
26 sys_stat = 16
27 sys_fstat = 17
28 sys_chmod = 18
29 sys_isatty = 19
30 sys_brk = 20
31 sys_mmap = 21
32 sys_munmap = 22
33 sys_getdents = 23
34 sys_mprotect = 24
35 sys_list_mappings = 25
36 sys_exit = 30
37 sys_getpid = 31
38 sys_sched_yield = 32
39 sys_sysconf = 33
40 sys_gettimeofday = 40
41 sys_clock = 41
42 sys_nanosleep = 42
43 sys_clock_getres = 43
44 sys_clock_gettime = 44
45 sys_mkdir = 45
46 sys_rmdir = 46
47 sys_chdir = 47
48 sys_getcwd = 48
49 sys_unlink = 49
50 sys_imc_makeboundsock = 60
51 sys_imc_accept = 61
52 sys_imc_connect = 62
53 sys_imc_sendmsg = 63
54 sys_imc_recvmsg = 64
55 sys_imc_mem_obj_create = 65
56 sys_imc_socketpair = 66
57 sys_mutex_create = 70
58 sys_mutex_lock = 71
59 sys_mutex_trylock = 72
60 sys_mutex_unlock = 73
61 sys_cond_create = 74
62 sys_cond_wait = 75
63 sys_cond_signal = 76
64 sys_cond_broadcast = 77
65 sys_cond_timed_wait_abs = 79
66 sys_thread_create = 80
67 sys_thread_exit = 81
68 sys_tls_init = 82
69 sys_thread_nice = 83
70 sys_tls_get = 84
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
76 sys_sem_create = 100
77 sys_sem_wait = 101
78 sys_sem_post = 102
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
84 sys_test_crash = 110
85 sys_test_syscall_1 = 111
86 sys_test_syscall_2 = 112
87 sys_futex_wait_abs = 120
88 sys_futex_wake = 121
89 sys_pread = 130
90 sys_pwrite = 131
91 sys_truncate = 140
92 sys_lstat = 141
93 sys_link = 142
94 sys_rename = 143
95 sys_symlink = 144
96 sys_access = 145
97 sys_readlink = 146
98 sys_utimes = 147
99 sys_get_random_bytes = 150
100 )
101
102
103 const (
104
105
106 EPERM Errno = 1
107 ENOENT Errno = 2
108 ESRCH Errno = 3
109 EINTR Errno = 4
110 EIO Errno = 5
111 ENXIO Errno = 6
112 E2BIG Errno = 7
113 ENOEXEC Errno = 8
114 EBADF Errno = 9
115 ECHILD Errno = 10
116 EAGAIN Errno = 11
117 ENOMEM Errno = 12
118 EACCES Errno = 13
119 EFAULT Errno = 14
120 EBUSY Errno = 16
121 EEXIST Errno = 17
122 EXDEV Errno = 18
123 ENODEV Errno = 19
124 ENOTDIR Errno = 20
125 EISDIR Errno = 21
126 EINVAL Errno = 22
127 ENFILE Errno = 23
128 EMFILE Errno = 24
129 ENOTTY Errno = 25
130 EFBIG Errno = 27
131 ENOSPC Errno = 28
132 ESPIPE Errno = 29
133 EROFS Errno = 30
134 EMLINK Errno = 31
135 EPIPE Errno = 32
136 ENAMETOOLONG Errno = 36
137 ENOSYS Errno = 38
138 EDQUOT Errno = 122
139 EDOM Errno = 33
140 ERANGE Errno = 34
141 EDEADLK Errno = 35
142 ENOLCK Errno = 37
143 ENOTEMPTY Errno = 39
144 ELOOP Errno = 40
145 ENOMSG Errno = 42
146 EIDRM Errno = 43
147 ECHRNG Errno = 44
148 EL2NSYNC Errno = 45
149 EL3HLT Errno = 46
150 EL3RST Errno = 47
151 ELNRNG Errno = 48
152 EUNATCH Errno = 49
153 ENOCSI Errno = 50
154 EL2HLT Errno = 51
155 EBADE Errno = 52
156 EBADR Errno = 53
157 EXFULL Errno = 54
158 ENOANO Errno = 55
159 EBADRQC Errno = 56
160 EBADSLT Errno = 57
161 EDEADLOCK Errno = EDEADLK
162 EBFONT Errno = 59
163 ENOSTR Errno = 60
164 ENODATA Errno = 61
165 ETIME Errno = 62
166 ENOSR Errno = 63
167 ENONET Errno = 64
168 ENOPKG Errno = 65
169 EREMOTE Errno = 66
170 ENOLINK Errno = 67
171 EADV Errno = 68
172 ESRMNT Errno = 69
173 ECOMM Errno = 70
174 EPROTO Errno = 71
175 EMULTIHOP Errno = 72
176 EDOTDOT Errno = 73
177 EBADMSG Errno = 74
178 EOVERFLOW Errno = 75
179 ENOTUNIQ Errno = 76
180 EBADFD Errno = 77
181 EREMCHG Errno = 78
182 ELIBACC Errno = 79
183 ELIBBAD Errno = 80
184 ELIBSCN Errno = 81
185 ELIBMAX Errno = 82
186 ELIBEXEC Errno = 83
187 EILSEQ Errno = 84
188 EUSERS Errno = 87
189 ENOTSOCK Errno = 88
190 EDESTADDRREQ Errno = 89
191 EMSGSIZE Errno = 90
192 EPROTOTYPE Errno = 91
193 ENOPROTOOPT Errno = 92
194 EPROTONOSUPPORT Errno = 93
195 ESOCKTNOSUPPORT Errno = 94
196 EOPNOTSUPP Errno = 95
197 EPFNOSUPPORT Errno = 96
198 EAFNOSUPPORT Errno = 97
199 EADDRINUSE Errno = 98
200 EADDRNOTAVAIL Errno = 99
201 ENETDOWN Errno = 100
202 ENETUNREACH Errno = 101
203 ENETRESET Errno = 102
204 ECONNABORTED Errno = 103
205 ECONNRESET Errno = 104
206 ENOBUFS Errno = 105
207 EISCONN Errno = 106
208 ENOTCONN Errno = 107
209 ESHUTDOWN Errno = 108
210 ETOOMANYREFS Errno = 109
211 ETIMEDOUT Errno = 110
212 ECONNREFUSED Errno = 111
213 EHOSTDOWN Errno = 112
214 EHOSTUNREACH Errno = 113
215 EALREADY Errno = 114
216 EINPROGRESS Errno = 115
217 ESTALE Errno = 116
218 ENOTSUP Errno = EOPNOTSUPP
219 ENOMEDIUM Errno = 123
220 ECANCELED Errno = 125
221 ELBIN Errno = 2048
222 EFTYPE Errno = 2049
223 ENMFILE Errno = 2050
224 EPROCLIM Errno = 2051
225 ENOSHARE Errno = 2052
226 ECASECLASH Errno = 2053
227 EWOULDBLOCK Errno = EAGAIN
228 )
229
230
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",
236 EIO: "I/O error",
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",
242 EAGAIN: "Try again",
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",
284 ENOANO: "No anode",
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",
345 }
346
347
348
349 var (
350 errEAGAIN error = EAGAIN
351 errEINVAL error = EINVAL
352 errENOENT error = ENOENT
353 )
354
355
356
357 func errnoErr(e Errno) error {
358 switch e {
359 case 0:
360 return nil
361 case EAGAIN:
362 return errEAGAIN
363 case EINVAL:
364 return errEINVAL
365 case ENOENT:
366 return errENOENT
367 }
368 return e
369 }
370
371 var errnoByCode = map[string]Errno{
372 "EPERM": EPERM,
373 "ENOENT": ENOENT,
374 "ESRCH": ESRCH,
375 "EINTR": EINTR,
376 "EIO": EIO,
377 "ENXIO": ENXIO,
378 "E2BIG": E2BIG,
379 "ENOEXEC": ENOEXEC,
380 "EBADF": EBADF,
381 "ECHILD": ECHILD,
382 "EAGAIN": EAGAIN,
383 "ENOMEM": ENOMEM,
384 "EACCES": EACCES,
385 "EFAULT": EFAULT,
386 "EBUSY": EBUSY,
387 "EEXIST": EEXIST,
388 "EXDEV": EXDEV,
389 "ENODEV": ENODEV,
390 "ENOTDIR": ENOTDIR,
391 "EISDIR": EISDIR,
392 "EINVAL": EINVAL,
393 "ENFILE": ENFILE,
394 "EMFILE": EMFILE,
395 "ENOTTY": ENOTTY,
396 "EFBIG": EFBIG,
397 "ENOSPC": ENOSPC,
398 "ESPIPE": ESPIPE,
399 "EROFS": EROFS,
400 "EMLINK": EMLINK,
401 "EPIPE": EPIPE,
402 "ENAMETOOLONG": ENAMETOOLONG,
403 "ENOSYS": ENOSYS,
404 "EDQUOT": EDQUOT,
405 "EDOM": EDOM,
406 "ERANGE": ERANGE,
407 "EDEADLK": EDEADLK,
408 "ENOLCK": ENOLCK,
409 "ENOTEMPTY": ENOTEMPTY,
410 "ELOOP": ELOOP,
411 "ENOMSG": ENOMSG,
412 "EIDRM": EIDRM,
413 "ECHRNG": ECHRNG,
414 "EL2NSYNC": EL2NSYNC,
415 "EL3HLT": EL3HLT,
416 "EL3RST": EL3RST,
417 "ELNRNG": ELNRNG,
418 "EUNATCH": EUNATCH,
419 "ENOCSI": ENOCSI,
420 "EL2HLT": EL2HLT,
421 "EBADE": EBADE,
422 "EBADR": EBADR,
423 "EXFULL": EXFULL,
424 "ENOANO": ENOANO,
425 "EBADRQC": EBADRQC,
426 "EBADSLT": EBADSLT,
427 "EDEADLOCK": EDEADLOCK,
428 "EBFONT": EBFONT,
429 "ENOSTR": ENOSTR,
430 "ENODATA": ENODATA,
431 "ETIME": ETIME,
432 "ENOSR": ENOSR,
433 "ENONET": ENONET,
434 "ENOPKG": ENOPKG,
435 "EREMOTE": EREMOTE,
436 "ENOLINK": ENOLINK,
437 "EADV": EADV,
438 "ESRMNT": ESRMNT,
439 "ECOMM": ECOMM,
440 "EPROTO": EPROTO,
441 "EMULTIHOP": EMULTIHOP,
442 "EDOTDOT": EDOTDOT,
443 "EBADMSG": EBADMSG,
444 "EOVERFLOW": EOVERFLOW,
445 "ENOTUNIQ": ENOTUNIQ,
446 "EBADFD": EBADFD,
447 "EREMCHG": EREMCHG,
448 "ELIBACC": ELIBACC,
449 "ELIBBAD": ELIBBAD,
450 "ELIBSCN": ELIBSCN,
451 "ELIBMAX": ELIBMAX,
452 "ELIBEXEC": ELIBEXEC,
453 "EILSEQ": EILSEQ,
454 "EUSERS": EUSERS,
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,
472 "ENOBUFS": ENOBUFS,
473 "EISCONN": EISCONN,
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,
483 "ESTALE": ESTALE,
484 "ENOTSUP": ENOTSUP,
485 "ENOMEDIUM": ENOMEDIUM,
486 "ECANCELED": ECANCELED,
487 "ELBIN": ELBIN,
488 "EFTYPE": EFTYPE,
489 "ENMFILE": ENMFILE,
490 "EPROCLIM": EPROCLIM,
491 "ENOSHARE": ENOSHARE,
492 "ECASECLASH": ECASECLASH,
493 "EWOULDBLOCK": EWOULDBLOCK,
494 }
495
View as plain text