authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-08-24 18:35:01-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-09-01 17:54:06-07:00
logc09ba8796c64a0bd3a39d6545b852c1b2e91f473
tree0faa9526b406e0ab2631989c9cf476811a9b1b11
parent1bbfcb95abc471374e5f8d74e04f0a002cc85c95

std.os.linux: remove the "bits" namespace altogether

Now there is only 1 architecture-specific file for Linux kernel bits.

21 files changed, 4751 insertions(+), 4741 deletions(-)

lib/std/c/generic.zig+1
......@@ -3,6 +3,7 @@ const Stat = std.c.Stat;
33const timespec = std.c.timespec;
44const Sigaction = std.c.Sigaction;
55const sigset_t = std.c.sigset_t;
6const rusage = std.c.rusage;
67
78pub extern "c" fn realpath(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8;
89pub extern "c" fn fstatat(dirfd: fd_t, path: [*:0]const u8, stat_buf: *Stat, flags: u32) c_int;
lib/std/os/bits/linux/arm-eabi.zig deleted-633
......@@ -1,633 +0,0 @@
1// arm-eabi-specific declarations that are intended to be imported into the POSIX namespace.
2const std = @import("../../../std.zig");
3const linux = std.os.linux;
4const socklen_t = linux.socklen_t;
5const iovec = linux.iovec;
6const iovec_const = linux.iovec_const;
7const stack_t = linux.stack_t;
8const sigset_t = linux.sigset_t;
9const uid_t = linux.uid_t;
10const gid_t = linux.gid_t;
11const pid_t = linux.pid_t;
12
13pub const SYS = enum(usize) {
14 restart_syscall = 0,
15 exit = 1,
16 fork = 2,
17 read = 3,
18 write = 4,
19 open = 5,
20 close = 6,
21 creat = 8,
22 link = 9,
23 unlink = 10,
24 execve = 11,
25 chdir = 12,
26 mknod = 14,
27 chmod = 15,
28 lchown = 16,
29 lseek = 19,
30 getpid = 20,
31 mount = 21,
32 setuid = 23,
33 getuid = 24,
34 ptrace = 26,
35 pause = 29,
36 access = 33,
37 nice = 34,
38 sync = 36,
39 kill = 37,
40 rename = 38,
41 mkdir = 39,
42 rmdir = 40,
43 dup = 41,
44 pipe = 42,
45 times = 43,
46 brk = 45,
47 setgid = 46,
48 getgid = 47,
49 geteuid = 49,
50 getegid = 50,
51 acct = 51,
52 umount2 = 52,
53 ioctl = 54,
54 fcntl = 55,
55 setpgid = 57,
56 umask = 60,
57 chroot = 61,
58 ustat = 62,
59 dup2 = 63,
60 getppid = 64,
61 getpgrp = 65,
62 setsid = 66,
63 sigaction = 67,
64 setreuid = 70,
65 setregid = 71,
66 sigsuspend = 72,
67 sigpending = 73,
68 sethostname = 74,
69 setrlimit = 75,
70 getrusage = 77,
71 gettimeofday = 78,
72 settimeofday = 79,
73 getgroups = 80,
74 setgroups = 81,
75 symlink = 83,
76 readlink = 85,
77 uselib = 86,
78 swapon = 87,
79 reboot = 88,
80 munmap = 91,
81 truncate = 92,
82 ftruncate = 93,
83 fchmod = 94,
84 fchown = 95,
85 getpriority = 96,
86 setpriority = 97,
87 statfs = 99,
88 fstatfs = 100,
89 syslog = 103,
90 setitimer = 104,
91 getitimer = 105,
92 stat = 106,
93 lstat = 107,
94 fstat = 108,
95 vhangup = 111,
96 wait4 = 114,
97 swapoff = 115,
98 sysinfo = 116,
99 fsync = 118,
100 sigreturn = 119,
101 clone = 120,
102 setdomainname = 121,
103 uname = 122,
104 adjtimex = 124,
105 mprotect = 125,
106 sigprocmask = 126,
107 init_module = 128,
108 delete_module = 129,
109 quotactl = 131,
110 getpgid = 132,
111 fchdir = 133,
112 bdflush = 134,
113 sysfs = 135,
114 personality = 136,
115 setfsuid = 138,
116 setfsgid = 139,
117 _llseek = 140,
118 getdents = 141,
119 _newselect = 142,
120 flock = 143,
121 msync = 144,
122 readv = 145,
123 writev = 146,
124 getsid = 147,
125 fdatasync = 148,
126 _sysctl = 149,
127 mlock = 150,
128 munlock = 151,
129 mlockall = 152,
130 munlockall = 153,
131 sched_setparam = 154,
132 sched_getparam = 155,
133 sched_setscheduler = 156,
134 sched_getscheduler = 157,
135 sched_yield = 158,
136 sched_get_priority_max = 159,
137 sched_get_priority_min = 160,
138 sched_rr_get_interval = 161,
139 nanosleep = 162,
140 mremap = 163,
141 setresuid = 164,
142 getresuid = 165,
143 poll = 168,
144 nfsservctl = 169,
145 setresgid = 170,
146 getresgid = 171,
147 prctl = 172,
148 rt_sigreturn = 173,
149 rt_sigaction = 174,
150 rt_sigprocmask = 175,
151 rt_sigpending = 176,
152 rt_sigtimedwait = 177,
153 rt_sigqueueinfo = 178,
154 rt_sigsuspend = 179,
155 pread64 = 180,
156 pwrite64 = 181,
157 chown = 182,
158 getcwd = 183,
159 capget = 184,
160 capset = 185,
161 sigaltstack = 186,
162 sendfile = 187,
163 vfork = 190,
164 ugetrlimit = 191,
165 mmap2 = 192,
166 truncate64 = 193,
167 ftruncate64 = 194,
168 stat64 = 195,
169 lstat64 = 196,
170 fstat64 = 197,
171 lchown32 = 198,
172 getuid32 = 199,
173 getgid32 = 200,
174 geteuid32 = 201,
175 getegid32 = 202,
176 setreuid32 = 203,
177 setregid32 = 204,
178 getgroups32 = 205,
179 setgroups32 = 206,
180 fchown32 = 207,
181 setresuid32 = 208,
182 getresuid32 = 209,
183 setresgid32 = 210,
184 getresgid32 = 211,
185 chown32 = 212,
186 setuid32 = 213,
187 setgid32 = 214,
188 setfsuid32 = 215,
189 setfsgid32 = 216,
190 getdents64 = 217,
191 pivot_root = 218,
192 mincore = 219,
193 madvise = 220,
194 fcntl64 = 221,
195 gettid = 224,
196 readahead = 225,
197 setxattr = 226,
198 lsetxattr = 227,
199 fsetxattr = 228,
200 getxattr = 229,
201 lgetxattr = 230,
202 fgetxattr = 231,
203 listxattr = 232,
204 llistxattr = 233,
205 flistxattr = 234,
206 removexattr = 235,
207 lremovexattr = 236,
208 fremovexattr = 237,
209 tkill = 238,
210 sendfile64 = 239,
211 futex = 240,
212 sched_setaffinity = 241,
213 sched_getaffinity = 242,
214 io_setup = 243,
215 io_destroy = 244,
216 io_getevents = 245,
217 io_submit = 246,
218 io_cancel = 247,
219 exit_group = 248,
220 lookup_dcookie = 249,
221 epoll_create = 250,
222 epoll_ctl = 251,
223 epoll_wait = 252,
224 remap_file_pages = 253,
225 set_tid_address = 256,
226 timer_create = 257,
227 timer_settime = 258,
228 timer_gettime = 259,
229 timer_getoverrun = 260,
230 timer_delete = 261,
231 clock_settime = 262,
232 clock_gettime = 263,
233 clock_getres = 264,
234 clock_nanosleep = 265,
235 statfs64 = 266,
236 fstatfs64 = 267,
237 tgkill = 268,
238 utimes = 269,
239 fadvise64_64 = 270,
240 pciconfig_iobase = 271,
241 pciconfig_read = 272,
242 pciconfig_write = 273,
243 mq_open = 274,
244 mq_unlink = 275,
245 mq_timedsend = 276,
246 mq_timedreceive = 277,
247 mq_notify = 278,
248 mq_getsetattr = 279,
249 waitid = 280,
250 socket = 281,
251 bind = 282,
252 connect = 283,
253 listen = 284,
254 accept = 285,
255 getsockname = 286,
256 getpeername = 287,
257 socketpair = 288,
258 send = 289,
259 sendto = 290,
260 recv = 291,
261 recvfrom = 292,
262 shutdown = 293,
263 setsockopt = 294,
264 getsockopt = 295,
265 sendmsg = 296,
266 recvmsg = 297,
267 semop = 298,
268 semget = 299,
269 semctl = 300,
270 msgsnd = 301,
271 msgrcv = 302,
272 msgget = 303,
273 msgctl = 304,
274 shmat = 305,
275 shmdt = 306,
276 shmget = 307,
277 shmctl = 308,
278 add_key = 309,
279 request_key = 310,
280 keyctl = 311,
281 semtimedop = 312,
282 vserver = 313,
283 ioprio_set = 314,
284 ioprio_get = 315,
285 inotify_init = 316,
286 inotify_add_watch = 317,
287 inotify_rm_watch = 318,
288 mbind = 319,
289 get_mempolicy = 320,
290 set_mempolicy = 321,
291 openat = 322,
292 mkdirat = 323,
293 mknodat = 324,
294 fchownat = 325,
295 futimesat = 326,
296 fstatat64 = 327,
297 unlinkat = 328,
298 renameat = 329,
299 linkat = 330,
300 symlinkat = 331,
301 readlinkat = 332,
302 fchmodat = 333,
303 faccessat = 334,
304 pselect6 = 335,
305 ppoll = 336,
306 unshare = 337,
307 set_robust_list = 338,
308 get_robust_list = 339,
309 splice = 340,
310 sync_file_range = 341,
311 tee = 342,
312 vmsplice = 343,
313 move_pages = 344,
314 getcpu = 345,
315 epoll_pwait = 346,
316 kexec_load = 347,
317 utimensat = 348,
318 signalfd = 349,
319 timerfd_create = 350,
320 eventfd = 351,
321 fallocate = 352,
322 timerfd_settime = 353,
323 timerfd_gettime = 354,
324 signalfd4 = 355,
325 eventfd2 = 356,
326 epoll_create1 = 357,
327 dup3 = 358,
328 pipe2 = 359,
329 inotify_init1 = 360,
330 preadv = 361,
331 pwritev = 362,
332 rt_tgsigqueueinfo = 363,
333 perf_event_open = 364,
334 recvmmsg = 365,
335 accept4 = 366,
336 fanotify_init = 367,
337 fanotify_mark = 368,
338 prlimit64 = 369,
339 name_to_handle_at = 370,
340 open_by_handle_at = 371,
341 clock_adjtime = 372,
342 syncfs = 373,
343 sendmmsg = 374,
344 setns = 375,
345 process_vm_readv = 376,
346 process_vm_writev = 377,
347 kcmp = 378,
348 finit_module = 379,
349 sched_setattr = 380,
350 sched_getattr = 381,
351 renameat2 = 382,
352 seccomp = 383,
353 getrandom = 384,
354 memfd_create = 385,
355 bpf = 386,
356 execveat = 387,
357 userfaultfd = 388,
358 membarrier = 389,
359 mlock2 = 390,
360 copy_file_range = 391,
361 preadv2 = 392,
362 pwritev2 = 393,
363 pkey_mprotect = 394,
364 pkey_alloc = 395,
365 pkey_free = 396,
366 statx = 397,
367 rseq = 398,
368 io_pgetevents = 399,
369 migrate_pages = 400,
370 kexec_file_load = 401,
371 clock_gettime64 = 403,
372 clock_settime64 = 404,
373 clock_adjtime64 = 405,
374 clock_getres_time64 = 406,
375 clock_nanosleep_time64 = 407,
376 timer_gettime64 = 408,
377 timer_settime64 = 409,
378 timerfd_gettime64 = 410,
379 timerfd_settime64 = 411,
380 utimensat_time64 = 412,
381 pselect6_time64 = 413,
382 ppoll_time64 = 414,
383 io_pgetevents_time64 = 416,
384 recvmmsg_time64 = 417,
385 mq_timedsend_time64 = 418,
386 mq_timedreceive_time64 = 419,
387 semtimedop_time64 = 420,
388 rt_sigtimedwait_time64 = 421,
389 futex_time64 = 422,
390 sched_rr_get_interval_time64 = 423,
391 pidfd_send_signal = 424,
392 io_uring_setup = 425,
393 io_uring_enter = 426,
394 io_uring_register = 427,
395 open_tree = 428,
396 move_mount = 429,
397 fsopen = 430,
398 fsconfig = 431,
399 fsmount = 432,
400 fspick = 433,
401 pidfd_open = 434,
402 clone3 = 435,
403 close_range = 436,
404 openat2 = 437,
405 pidfd_getfd = 438,
406 faccessat2 = 439,
407 process_madvise = 440,
408 epoll_pwait2 = 441,
409
410 breakpoint = 0x0f0001,
411 cacheflush = 0x0f0002,
412 usr26 = 0x0f0003,
413 usr32 = 0x0f0004,
414 set_tls = 0x0f0005,
415 get_tls = 0x0f0006,
416
417 _,
418};
419
420pub const MMAP2_UNIT = 4096;
421
422pub const O_CREAT = 0o100;
423pub const O_EXCL = 0o200;
424pub const O_NOCTTY = 0o400;
425pub const O_TRUNC = 0o1000;
426pub const O_APPEND = 0o2000;
427pub const O_NONBLOCK = 0o4000;
428pub const O_DSYNC = 0o10000;
429pub const O_SYNC = 0o4010000;
430pub const O_RSYNC = 0o4010000;
431pub const O_DIRECTORY = 0o40000;
432pub const O_NOFOLLOW = 0o100000;
433pub const O_CLOEXEC = 0o2000000;
434
435pub const O_ASYNC = 0o20000;
436pub const O_DIRECT = 0o200000;
437pub const O_LARGEFILE = 0o400000;
438pub const O_NOATIME = 0o1000000;
439pub const O_PATH = 0o10000000;
440pub const O_TMPFILE = 0o20040000;
441pub const O_NDELAY = O_NONBLOCK;
442
443pub const F_DUPFD = 0;
444pub const F_GETFD = 1;
445pub const F_SETFD = 2;
446pub const F_GETFL = 3;
447pub const F_SETFL = 4;
448
449pub const F_SETOWN = 8;
450pub const F_GETOWN = 9;
451pub const F_SETSIG = 10;
452pub const F_GETSIG = 11;
453
454pub const F_GETLK = 12;
455pub const F_SETLK = 13;
456pub const F_SETLKW = 14;
457
458pub const F_RDLCK = 0;
459pub const F_WRLCK = 1;
460pub const F_UNLCK = 2;
461
462pub const F_SETOWN_EX = 15;
463pub const F_GETOWN_EX = 16;
464
465pub const F_GETOWNER_UIDS = 17;
466
467pub const LOCK_SH = 1;
468pub const LOCK_EX = 2;
469pub const LOCK_UN = 8;
470pub const LOCK_NB = 4;
471
472/// stack-like segment
473pub const MAP_GROWSDOWN = 0x0100;
474
475/// ETXTBSY
476pub const MAP_DENYWRITE = 0x0800;
477
478/// mark it as an executable
479pub const MAP_EXECUTABLE = 0x1000;
480
481/// pages are locked
482pub const MAP_LOCKED = 0x2000;
483
484/// don't check for reservations
485pub const MAP_NORESERVE = 0x4000;
486
487pub const VDSO_CGT_SYM = "__vdso_clock_gettime";
488pub const VDSO_CGT_VER = "LINUX_2.6";
489
490pub const HWCAP_SWP = 1 << 0;
491pub const HWCAP_HALF = 1 << 1;
492pub const HWCAP_THUMB = 1 << 2;
493pub const HWCAP_26BIT = 1 << 3;
494pub const HWCAP_FAST_MULT = 1 << 4;
495pub const HWCAP_FPA = 1 << 5;
496pub const HWCAP_VFP = 1 << 6;
497pub const HWCAP_EDSP = 1 << 7;
498pub const HWCAP_JAVA = 1 << 8;
499pub const HWCAP_IWMMXT = 1 << 9;
500pub const HWCAP_CRUNCH = 1 << 10;
501pub const HWCAP_THUMBEE = 1 << 11;
502pub const HWCAP_NEON = 1 << 12;
503pub const HWCAP_VFPv3 = 1 << 13;
504pub const HWCAP_VFPv3D16 = 1 << 14;
505pub const HWCAP_TLS = 1 << 15;
506pub const HWCAP_VFPv4 = 1 << 16;
507pub const HWCAP_IDIVA = 1 << 17;
508pub const HWCAP_IDIVT = 1 << 18;
509pub const HWCAP_VFPD32 = 1 << 19;
510pub const HWCAP_IDIV = HWCAP_IDIVA | HWCAP_IDIVT;
511pub const HWCAP_LPAE = 1 << 20;
512pub const HWCAP_EVTSTRM = 1 << 21;
513
514pub const Flock = extern struct {
515 l_type: i16,
516 l_whence: i16,
517 __pad0: [4]u8,
518 l_start: off_t,
519 l_len: off_t,
520 l_pid: pid_t,
521 __unused: [4]u8,
522};
523
524pub const msghdr = extern struct {
525 msg_name: ?*sockaddr,
526 msg_namelen: socklen_t,
527 msg_iov: [*]iovec,
528 msg_iovlen: i32,
529 msg_control: ?*c_void,
530 msg_controllen: socklen_t,
531 msg_flags: i32,
532};
533
534pub const msghdr_const = extern struct {
535 msg_name: ?*const sockaddr,
536 msg_namelen: socklen_t,
537 msg_iov: [*]iovec_const,
538 msg_iovlen: i32,
539 msg_control: ?*c_void,
540 msg_controllen: socklen_t,
541 msg_flags: i32,
542};
543
544pub const blksize_t = i32;
545pub const nlink_t = u32;
546pub const time_t = isize;
547pub const mode_t = u32;
548pub const off_t = i64;
549pub const ino_t = u64;
550pub const dev_t = u64;
551pub const blkcnt_t = i64;
552
553// The `stat` definition used by the Linux kernel.
554pub const Stat = extern struct {
555 dev: dev_t,
556 __dev_padding: u32,
557 __ino_truncated: u32,
558 mode: mode_t,
559 nlink: nlink_t,
560 uid: uid_t,
561 gid: gid_t,
562 rdev: dev_t,
563 __rdev_padding: u32,
564 size: off_t,
565 blksize: blksize_t,
566 blocks: blkcnt_t,
567 atim: timespec,
568 mtim: timespec,
569 ctim: timespec,
570 ino: ino_t,
571
572 pub fn atime(self: @This()) timespec {
573 return self.atim;
574 }
575
576 pub fn mtime(self: @This()) timespec {
577 return self.mtim;
578 }
579
580 pub fn ctime(self: @This()) timespec {
581 return self.ctim;
582 }
583};
584
585pub const timespec = extern struct {
586 tv_sec: i32,
587 tv_nsec: i32,
588};
589
590pub const timeval = extern struct {
591 tv_sec: i32,
592 tv_usec: i32,
593};
594
595pub const timezone = extern struct {
596 tz_minuteswest: i32,
597 tz_dsttime: i32,
598};
599
600pub const mcontext_t = extern struct {
601 trap_no: usize,
602 error_code: usize,
603 oldmask: usize,
604 arm_r0: usize,
605 arm_r1: usize,
606 arm_r2: usize,
607 arm_r3: usize,
608 arm_r4: usize,
609 arm_r5: usize,
610 arm_r6: usize,
611 arm_r7: usize,
612 arm_r8: usize,
613 arm_r9: usize,
614 arm_r10: usize,
615 arm_fp: usize,
616 arm_ip: usize,
617 arm_sp: usize,
618 arm_lr: usize,
619 arm_pc: usize,
620 arm_cpsr: usize,
621 fault_address: usize,
622};
623
624pub const ucontext_t = extern struct {
625 flags: usize,
626 link: *ucontext_t,
627 stack: stack_t,
628 mcontext: mcontext_t,
629 sigmask: sigset_t,
630 regspace: [64]u64,
631};
632
633pub const Elf_Symndx = u32;
lib/std/os/bits/linux/arm64.zig deleted-492
......@@ -1,492 +0,0 @@
1// arm64-specific declarations that are intended to be imported into the POSIX namespace.
2// This does include Linux-only APIs.
3
4const std = @import("../../../std.zig");
5const linux = std.os.linux;
6const socklen_t = linux.socklen_t;
7const sockaddr = linux.sockaddr;
8const iovec = linux.iovec;
9const iovec_const = linux.iovec_const;
10const uid_t = linux.uid_t;
11const gid_t = linux.gid_t;
12const pid_t = linux.pid_t;
13const stack_t = linux.stack_t;
14const sigset_t = linux.sigset_t;
15pub const SYS = enum(usize) {
16 io_setup = 0,
17 io_destroy = 1,
18 io_submit = 2,
19 io_cancel = 3,
20 io_getevents = 4,
21 setxattr = 5,
22 lsetxattr = 6,
23 fsetxattr = 7,
24 getxattr = 8,
25 lgetxattr = 9,
26 fgetxattr = 10,
27 listxattr = 11,
28 llistxattr = 12,
29 flistxattr = 13,
30 removexattr = 14,
31 lremovexattr = 15,
32 fremovexattr = 16,
33 getcwd = 17,
34 lookup_dcookie = 18,
35 eventfd2 = 19,
36 epoll_create1 = 20,
37 epoll_ctl = 21,
38 epoll_pwait = 22,
39 dup = 23,
40 dup3 = 24,
41 fcntl = 25,
42 inotify_init1 = 26,
43 inotify_add_watch = 27,
44 inotify_rm_watch = 28,
45 ioctl = 29,
46 ioprio_set = 30,
47 ioprio_get = 31,
48 flock = 32,
49 mknodat = 33,
50 mkdirat = 34,
51 unlinkat = 35,
52 symlinkat = 36,
53 linkat = 37,
54 renameat = 38,
55 umount2 = 39,
56 mount = 40,
57 pivot_root = 41,
58 nfsservctl = 42,
59 statfs = 43,
60 fstatfs = 44,
61 truncate = 45,
62 ftruncate = 46,
63 fallocate = 47,
64 faccessat = 48,
65 chdir = 49,
66 fchdir = 50,
67 chroot = 51,
68 fchmod = 52,
69 fchmodat = 53,
70 fchownat = 54,
71 fchown = 55,
72 openat = 56,
73 close = 57,
74 vhangup = 58,
75 pipe2 = 59,
76 quotactl = 60,
77 getdents64 = 61,
78 lseek = 62,
79 read = 63,
80 write = 64,
81 readv = 65,
82 writev = 66,
83 pread64 = 67,
84 pwrite64 = 68,
85 preadv = 69,
86 pwritev = 70,
87 sendfile = 71,
88 pselect6 = 72,
89 ppoll = 73,
90 signalfd4 = 74,
91 vmsplice = 75,
92 splice = 76,
93 tee = 77,
94 readlinkat = 78,
95 fstatat = 79,
96 fstat = 80,
97 sync = 81,
98 fsync = 82,
99 fdatasync = 83,
100 sync_file_range = 84,
101 timerfd_create = 85,
102 timerfd_settime = 86,
103 timerfd_gettime = 87,
104 utimensat = 88,
105 acct = 89,
106 capget = 90,
107 capset = 91,
108 personality = 92,
109 exit = 93,
110 exit_group = 94,
111 waitid = 95,
112 set_tid_address = 96,
113 unshare = 97,
114 futex = 98,
115 set_robust_list = 99,
116 get_robust_list = 100,
117 nanosleep = 101,
118 getitimer = 102,
119 setitimer = 103,
120 kexec_load = 104,
121 init_module = 105,
122 delete_module = 106,
123 timer_create = 107,
124 timer_gettime = 108,
125 timer_getoverrun = 109,
126 timer_settime = 110,
127 timer_delete = 111,
128 clock_settime = 112,
129 clock_gettime = 113,
130 clock_getres = 114,
131 clock_nanosleep = 115,
132 syslog = 116,
133 ptrace = 117,
134 sched_setparam = 118,
135 sched_setscheduler = 119,
136 sched_getscheduler = 120,
137 sched_getparam = 121,
138 sched_setaffinity = 122,
139 sched_getaffinity = 123,
140 sched_yield = 124,
141 sched_get_priority_max = 125,
142 sched_get_priority_min = 126,
143 sched_rr_get_interval = 127,
144 restart_syscall = 128,
145 kill = 129,
146 tkill = 130,
147 tgkill = 131,
148 sigaltstack = 132,
149 rt_sigsuspend = 133,
150 rt_sigaction = 134,
151 rt_sigprocmask = 135,
152 rt_sigpending = 136,
153 rt_sigtimedwait = 137,
154 rt_sigqueueinfo = 138,
155 rt_sigreturn = 139,
156 setpriority = 140,
157 getpriority = 141,
158 reboot = 142,
159 setregid = 143,
160 setgid = 144,
161 setreuid = 145,
162 setuid = 146,
163 setresuid = 147,
164 getresuid = 148,
165 setresgid = 149,
166 getresgid = 150,
167 setfsuid = 151,
168 setfsgid = 152,
169 times = 153,
170 setpgid = 154,
171 getpgid = 155,
172 getsid = 156,
173 setsid = 157,
174 getgroups = 158,
175 setgroups = 159,
176 uname = 160,
177 sethostname = 161,
178 setdomainname = 162,
179 getrlimit = 163,
180 setrlimit = 164,
181 getrusage = 165,
182 umask = 166,
183 prctl = 167,
184 getcpu = 168,
185 gettimeofday = 169,
186 settimeofday = 170,
187 adjtimex = 171,
188 getpid = 172,
189 getppid = 173,
190 getuid = 174,
191 geteuid = 175,
192 getgid = 176,
193 getegid = 177,
194 gettid = 178,
195 sysinfo = 179,
196 mq_open = 180,
197 mq_unlink = 181,
198 mq_timedsend = 182,
199 mq_timedreceive = 183,
200 mq_notify = 184,
201 mq_getsetattr = 185,
202 msgget = 186,
203 msgctl = 187,
204 msgrcv = 188,
205 msgsnd = 189,
206 semget = 190,
207 semctl = 191,
208 semtimedop = 192,
209 semop = 193,
210 shmget = 194,
211 shmctl = 195,
212 shmat = 196,
213 shmdt = 197,
214 socket = 198,
215 socketpair = 199,
216 bind = 200,
217 listen = 201,
218 accept = 202,
219 connect = 203,
220 getsockname = 204,
221 getpeername = 205,
222 sendto = 206,
223 recvfrom = 207,
224 setsockopt = 208,
225 getsockopt = 209,
226 shutdown = 210,
227 sendmsg = 211,
228 recvmsg = 212,
229 readahead = 213,
230 brk = 214,
231 munmap = 215,
232 mremap = 216,
233 add_key = 217,
234 request_key = 218,
235 keyctl = 219,
236 clone = 220,
237 execve = 221,
238 mmap = 222,
239 fadvise64 = 223,
240 swapon = 224,
241 swapoff = 225,
242 mprotect = 226,
243 msync = 227,
244 mlock = 228,
245 munlock = 229,
246 mlockall = 230,
247 munlockall = 231,
248 mincore = 232,
249 madvise = 233,
250 remap_file_pages = 234,
251 mbind = 235,
252 get_mempolicy = 236,
253 set_mempolicy = 237,
254 migrate_pages = 238,
255 move_pages = 239,
256 rt_tgsigqueueinfo = 240,
257 perf_event_open = 241,
258 accept4 = 242,
259 recvmmsg = 243,
260 arch_specific_syscall = 244,
261 wait4 = 260,
262 prlimit64 = 261,
263 fanotify_init = 262,
264 fanotify_mark = 263,
265 clock_adjtime = 266,
266 syncfs = 267,
267 setns = 268,
268 sendmmsg = 269,
269 process_vm_readv = 270,
270 process_vm_writev = 271,
271 kcmp = 272,
272 finit_module = 273,
273 sched_setattr = 274,
274 sched_getattr = 275,
275 renameat2 = 276,
276 seccomp = 277,
277 getrandom = 278,
278 memfd_create = 279,
279 bpf = 280,
280 execveat = 281,
281 userfaultfd = 282,
282 membarrier = 283,
283 mlock2 = 284,
284 copy_file_range = 285,
285 preadv2 = 286,
286 pwritev2 = 287,
287 pkey_mprotect = 288,
288 pkey_alloc = 289,
289 pkey_free = 290,
290 statx = 291,
291 io_pgetevents = 292,
292 rseq = 293,
293 kexec_file_load = 294,
294 pidfd_send_signal = 424,
295 io_uring_setup = 425,
296 io_uring_enter = 426,
297 io_uring_register = 427,
298 open_tree = 428,
299 move_mount = 429,
300 fsopen = 430,
301 fsconfig = 431,
302 fsmount = 432,
303 fspick = 433,
304 pidfd_open = 434,
305 clone3 = 435,
306 close_range = 436,
307 openat2 = 437,
308 pidfd_getfd = 438,
309 faccessat2 = 439,
310 process_madvise = 440,
311 epoll_pwait2 = 441,
312
313 _,
314};
315
316pub const O_CREAT = 0o100;
317pub const O_EXCL = 0o200;
318pub const O_NOCTTY = 0o400;
319pub const O_TRUNC = 0o1000;
320pub const O_APPEND = 0o2000;
321pub const O_NONBLOCK = 0o4000;
322pub const O_DSYNC = 0o10000;
323pub const O_SYNC = 0o4010000;
324pub const O_RSYNC = 0o4010000;
325pub const O_DIRECTORY = 0o40000;
326pub const O_NOFOLLOW = 0o100000;
327pub const O_CLOEXEC = 0o2000000;
328
329pub const O_ASYNC = 0o20000;
330pub const O_DIRECT = 0o200000;
331pub const O_LARGEFILE = 0o400000;
332pub const O_NOATIME = 0o1000000;
333pub const O_PATH = 0o10000000;
334pub const O_TMPFILE = 0o20040000;
335pub const O_NDELAY = O_NONBLOCK;
336
337pub const F_DUPFD = 0;
338pub const F_GETFD = 1;
339pub const F_SETFD = 2;
340pub const F_GETFL = 3;
341pub const F_SETFL = 4;
342
343pub const F_SETOWN = 8;
344pub const F_GETOWN = 9;
345pub const F_SETSIG = 10;
346pub const F_GETSIG = 11;
347
348pub const F_GETLK = 5;
349pub const F_SETLK = 6;
350pub const F_SETLKW = 7;
351
352pub const F_RDLCK = 0;
353pub const F_WRLCK = 1;
354pub const F_UNLCK = 2;
355
356pub const LOCK_SH = 1;
357pub const LOCK_EX = 2;
358pub const LOCK_UN = 8;
359pub const LOCK_NB = 4;
360
361pub const F_SETOWN_EX = 15;
362pub const F_GETOWN_EX = 16;
363
364pub const F_GETOWNER_UIDS = 17;
365
366/// stack-like segment
367pub const MAP_GROWSDOWN = 0x0100;
368
369/// ETXTBSY
370pub const MAP_DENYWRITE = 0x0800;
371
372/// mark it as an executable
373pub const MAP_EXECUTABLE = 0x1000;
374
375/// pages are locked
376pub const MAP_LOCKED = 0x2000;
377
378/// don't check for reservations
379pub const MAP_NORESERVE = 0x4000;
380
381pub const VDSO_CGT_SYM = "__kernel_clock_gettime";
382pub const VDSO_CGT_VER = "LINUX_2.6.39";
383
384pub const Flock = extern struct {
385 l_type: i16,
386 l_whence: i16,
387 l_start: off_t,
388 l_len: off_t,
389 l_pid: pid_t,
390 __unused: [4]u8,
391};
392
393pub const msghdr = extern struct {
394 msg_name: ?*sockaddr,
395 msg_namelen: socklen_t,
396 msg_iov: [*]iovec,
397 msg_iovlen: i32,
398 __pad1: i32 = 0,
399 msg_control: ?*c_void,
400 msg_controllen: socklen_t,
401 __pad2: socklen_t = 0,
402 msg_flags: i32,
403};
404
405pub const msghdr_const = extern struct {
406 msg_name: ?*const sockaddr,
407 msg_namelen: socklen_t,
408 msg_iov: [*]iovec_const,
409 msg_iovlen: i32,
410 __pad1: i32 = 0,
411 msg_control: ?*c_void,
412 msg_controllen: socklen_t,
413 __pad2: socklen_t = 0,
414 msg_flags: i32,
415};
416
417pub const blksize_t = i32;
418pub const nlink_t = u32;
419pub const time_t = isize;
420pub const mode_t = u32;
421pub const off_t = isize;
422pub const ino_t = usize;
423pub const dev_t = usize;
424pub const blkcnt_t = isize;
425
426// The `stat` definition used by the Linux kernel.
427pub const Stat = extern struct {
428 dev: dev_t,
429 ino: ino_t,
430 mode: mode_t,
431 nlink: nlink_t,
432 uid: uid_t,
433 gid: gid_t,
434 rdev: dev_t,
435 __pad: usize,
436 size: off_t,
437 blksize: blksize_t,
438 __pad2: i32,
439 blocks: blkcnt_t,
440 atim: timespec,
441 mtim: timespec,
442 ctim: timespec,
443 __unused: [2]u32,
444
445 pub fn atime(self: @This()) timespec {
446 return self.atim;
447 }
448
449 pub fn mtime(self: @This()) timespec {
450 return self.mtim;
451 }
452
453 pub fn ctime(self: @This()) timespec {
454 return self.ctim;
455 }
456};
457
458pub const timespec = extern struct {
459 tv_sec: time_t,
460 tv_nsec: isize,
461};
462
463pub const timeval = extern struct {
464 tv_sec: isize,
465 tv_usec: isize,
466};
467
468pub const timezone = extern struct {
469 tz_minuteswest: i32,
470 tz_dsttime: i32,
471};
472
473pub const mcontext_t = extern struct {
474 fault_address: usize,
475 regs: [31]usize,
476 sp: usize,
477 pc: usize,
478 pstate: usize,
479 // Make sure the field is correctly aligned since this area
480 // holds various FP/vector registers
481 reserved1: [256 * 16]u8 align(16),
482};
483
484pub const ucontext_t = extern struct {
485 flags: usize,
486 link: *ucontext_t,
487 stack: stack_t,
488 sigmask: sigset_t,
489 mcontext: mcontext_t,
490};
491
492pub const Elf_Symndx = u32;
lib/std/os/bits/linux/i386.zig deleted-722
......@@ -1,722 +0,0 @@
1// i386-specific declarations that are intended to be imported into the POSIX namespace.
2// This does include Linux-only APIs.
3
4const std = @import("../../../std.zig");
5const linux = std.os.linux;
6const socklen_t = linux.socklen_t;
7const iovec = linux.iovec;
8const iovec_const = linux.iovec_const;
9const uid_t = linux.uid_t;
10const gid_t = linux.gid_t;
11const pid_t = linux.pid_t;
12const stack_t = linux.stack_t;
13const sigset_t = linux.sigset_t;
14
15pub const SYS = enum(usize) {
16 restart_syscall = 0,
17 exit = 1,
18 fork = 2,
19 read = 3,
20 write = 4,
21 open = 5,
22 close = 6,
23 waitpid = 7,
24 creat = 8,
25 link = 9,
26 unlink = 10,
27 execve = 11,
28 chdir = 12,
29 time = 13,
30 mknod = 14,
31 chmod = 15,
32 lchown = 16,
33 @"break" = 17,
34 oldstat = 18,
35 lseek = 19,
36 getpid = 20,
37 mount = 21,
38 umount = 22,
39 setuid = 23,
40 getuid = 24,
41 stime = 25,
42 ptrace = 26,
43 alarm = 27,
44 oldfstat = 28,
45 pause = 29,
46 utime = 30,
47 stty = 31,
48 gtty = 32,
49 access = 33,
50 nice = 34,
51 ftime = 35,
52 sync = 36,
53 kill = 37,
54 rename = 38,
55 mkdir = 39,
56 rmdir = 40,
57 dup = 41,
58 pipe = 42,
59 times = 43,
60 prof = 44,
61 brk = 45,
62 setgid = 46,
63 getgid = 47,
64 signal = 48,
65 geteuid = 49,
66 getegid = 50,
67 acct = 51,
68 umount2 = 52,
69 lock = 53,
70 ioctl = 54,
71 fcntl = 55,
72 mpx = 56,
73 setpgid = 57,
74 ulimit = 58,
75 oldolduname = 59,
76 umask = 60,
77 chroot = 61,
78 ustat = 62,
79 dup2 = 63,
80 getppid = 64,
81 getpgrp = 65,
82 setsid = 66,
83 sigaction = 67,
84 sgetmask = 68,
85 ssetmask = 69,
86 setreuid = 70,
87 setregid = 71,
88 sigsuspend = 72,
89 sigpending = 73,
90 sethostname = 74,
91 setrlimit = 75,
92 getrlimit = 76,
93 getrusage = 77,
94 gettimeofday = 78,
95 settimeofday = 79,
96 getgroups = 80,
97 setgroups = 81,
98 select = 82,
99 symlink = 83,
100 oldlstat = 84,
101 readlink = 85,
102 uselib = 86,
103 swapon = 87,
104 reboot = 88,
105 readdir = 89,
106 mmap = 90,
107 munmap = 91,
108 truncate = 92,
109 ftruncate = 93,
110 fchmod = 94,
111 fchown = 95,
112 getpriority = 96,
113 setpriority = 97,
114 profil = 98,
115 statfs = 99,
116 fstatfs = 100,
117 ioperm = 101,
118 socketcall = 102,
119 syslog = 103,
120 setitimer = 104,
121 getitimer = 105,
122 stat = 106,
123 lstat = 107,
124 fstat = 108,
125 olduname = 109,
126 iopl = 110,
127 vhangup = 111,
128 idle = 112,
129 vm86old = 113,
130 wait4 = 114,
131 swapoff = 115,
132 sysinfo = 116,
133 ipc = 117,
134 fsync = 118,
135 sigreturn = 119,
136 clone = 120,
137 setdomainname = 121,
138 uname = 122,
139 modify_ldt = 123,
140 adjtimex = 124,
141 mprotect = 125,
142 sigprocmask = 126,
143 create_module = 127,
144 init_module = 128,
145 delete_module = 129,
146 get_kernel_syms = 130,
147 quotactl = 131,
148 getpgid = 132,
149 fchdir = 133,
150 bdflush = 134,
151 sysfs = 135,
152 personality = 136,
153 afs_syscall = 137,
154 setfsuid = 138,
155 setfsgid = 139,
156 _llseek = 140,
157 getdents = 141,
158 _newselect = 142,
159 flock = 143,
160 msync = 144,
161 readv = 145,
162 writev = 146,
163 getsid = 147,
164 fdatasync = 148,
165 _sysctl = 149,
166 mlock = 150,
167 munlock = 151,
168 mlockall = 152,
169 munlockall = 153,
170 sched_setparam = 154,
171 sched_getparam = 155,
172 sched_setscheduler = 156,
173 sched_getscheduler = 157,
174 sched_yield = 158,
175 sched_get_priority_max = 159,
176 sched_get_priority_min = 160,
177 sched_rr_get_interval = 161,
178 nanosleep = 162,
179 mremap = 163,
180 setresuid = 164,
181 getresuid = 165,
182 vm86 = 166,
183 query_module = 167,
184 poll = 168,
185 nfsservctl = 169,
186 setresgid = 170,
187 getresgid = 171,
188 prctl = 172,
189 rt_sigreturn = 173,
190 rt_sigaction = 174,
191 rt_sigprocmask = 175,
192 rt_sigpending = 176,
193 rt_sigtimedwait = 177,
194 rt_sigqueueinfo = 178,
195 rt_sigsuspend = 179,
196 pread64 = 180,
197 pwrite64 = 181,
198 chown = 182,
199 getcwd = 183,
200 capget = 184,
201 capset = 185,
202 sigaltstack = 186,
203 sendfile = 187,
204 getpmsg = 188,
205 putpmsg = 189,
206 vfork = 190,
207 ugetrlimit = 191,
208 mmap2 = 192,
209 truncate64 = 193,
210 ftruncate64 = 194,
211 stat64 = 195,
212 lstat64 = 196,
213 fstat64 = 197,
214 lchown32 = 198,
215 getuid32 = 199,
216 getgid32 = 200,
217 geteuid32 = 201,
218 getegid32 = 202,
219 setreuid32 = 203,
220 setregid32 = 204,
221 getgroups32 = 205,
222 setgroups32 = 206,
223 fchown32 = 207,
224 setresuid32 = 208,
225 getresuid32 = 209,
226 setresgid32 = 210,
227 getresgid32 = 211,
228 chown32 = 212,
229 setuid32 = 213,
230 setgid32 = 214,
231 setfsuid32 = 215,
232 setfsgid32 = 216,
233 pivot_root = 217,
234 mincore = 218,
235 madvise = 219,
236 getdents64 = 220,
237 fcntl64 = 221,
238 gettid = 224,
239 readahead = 225,
240 setxattr = 226,
241 lsetxattr = 227,
242 fsetxattr = 228,
243 getxattr = 229,
244 lgetxattr = 230,
245 fgetxattr = 231,
246 listxattr = 232,
247 llistxattr = 233,
248 flistxattr = 234,
249 removexattr = 235,
250 lremovexattr = 236,
251 fremovexattr = 237,
252 tkill = 238,
253 sendfile64 = 239,
254 futex = 240,
255 sched_setaffinity = 241,
256 sched_getaffinity = 242,
257 set_thread_area = 243,
258 get_thread_area = 244,
259 io_setup = 245,
260 io_destroy = 246,
261 io_getevents = 247,
262 io_submit = 248,
263 io_cancel = 249,
264 fadvise64 = 250,
265 exit_group = 252,
266 lookup_dcookie = 253,
267 epoll_create = 254,
268 epoll_ctl = 255,
269 epoll_wait = 256,
270 remap_file_pages = 257,
271 set_tid_address = 258,
272 timer_create = 259,
273 timer_settime, // SYS_timer_create + 1
274 timer_gettime, // SYS_timer_create + 2
275 timer_getoverrun, // SYS_timer_create + 3
276 timer_delete, // SYS_timer_create + 4
277 clock_settime, // SYS_timer_create + 5
278 clock_gettime, // SYS_timer_create + 6
279 clock_getres, // SYS_timer_create + 7
280 clock_nanosleep, // SYS_timer_create + 8
281 statfs64 = 268,
282 fstatfs64 = 269,
283 tgkill = 270,
284 utimes = 271,
285 fadvise64_64 = 272,
286 vserver = 273,
287 mbind = 274,
288 get_mempolicy = 275,
289 set_mempolicy = 276,
290 mq_open = 277,
291 mq_unlink, // SYS_mq_open + 1
292 mq_timedsend, // SYS_mq_open + 2
293 mq_timedreceive, // SYS_mq_open + 3
294 mq_notify, // SYS_mq_open + 4
295 mq_getsetattr, // SYS_mq_open + 5
296 kexec_load = 283,
297 waitid = 284,
298 add_key = 286,
299 request_key = 287,
300 keyctl = 288,
301 ioprio_set = 289,
302 ioprio_get = 290,
303 inotify_init = 291,
304 inotify_add_watch = 292,
305 inotify_rm_watch = 293,
306 migrate_pages = 294,
307 openat = 295,
308 mkdirat = 296,
309 mknodat = 297,
310 fchownat = 298,
311 futimesat = 299,
312 fstatat64 = 300,
313 unlinkat = 301,
314 renameat = 302,
315 linkat = 303,
316 symlinkat = 304,
317 readlinkat = 305,
318 fchmodat = 306,
319 faccessat = 307,
320 pselect6 = 308,
321 ppoll = 309,
322 unshare = 310,
323 set_robust_list = 311,
324 get_robust_list = 312,
325 splice = 313,
326 sync_file_range = 314,
327 tee = 315,
328 vmsplice = 316,
329 move_pages = 317,
330 getcpu = 318,
331 epoll_pwait = 319,
332 utimensat = 320,
333 signalfd = 321,
334 timerfd_create = 322,
335 eventfd = 323,
336 fallocate = 324,
337 timerfd_settime = 325,
338 timerfd_gettime = 326,
339 signalfd4 = 327,
340 eventfd2 = 328,
341 epoll_create1 = 329,
342 dup3 = 330,
343 pipe2 = 331,
344 inotify_init1 = 332,
345 preadv = 333,
346 pwritev = 334,
347 rt_tgsigqueueinfo = 335,
348 perf_event_open = 336,
349 recvmmsg = 337,
350 fanotify_init = 338,
351 fanotify_mark = 339,
352 prlimit64 = 340,
353 name_to_handle_at = 341,
354 open_by_handle_at = 342,
355 clock_adjtime = 343,
356 syncfs = 344,
357 sendmmsg = 345,
358 setns = 346,
359 process_vm_readv = 347,
360 process_vm_writev = 348,
361 kcmp = 349,
362 finit_module = 350,
363 sched_setattr = 351,
364 sched_getattr = 352,
365 renameat2 = 353,
366 seccomp = 354,
367 getrandom = 355,
368 memfd_create = 356,
369 bpf = 357,
370 execveat = 358,
371 socket = 359,
372 socketpair = 360,
373 bind = 361,
374 connect = 362,
375 listen = 363,
376 accept4 = 364,
377 getsockopt = 365,
378 setsockopt = 366,
379 getsockname = 367,
380 getpeername = 368,
381 sendto = 369,
382 sendmsg = 370,
383 recvfrom = 371,
384 recvmsg = 372,
385 shutdown = 373,
386 userfaultfd = 374,
387 membarrier = 375,
388 mlock2 = 376,
389 copy_file_range = 377,
390 preadv2 = 378,
391 pwritev2 = 379,
392 pkey_mprotect = 380,
393 pkey_alloc = 381,
394 pkey_free = 382,
395 statx = 383,
396 arch_prctl = 384,
397 io_pgetevents = 385,
398 rseq = 386,
399 semget = 393,
400 semctl = 394,
401 shmget = 395,
402 shmctl = 396,
403 shmat = 397,
404 shmdt = 398,
405 msgget = 399,
406 msgsnd = 400,
407 msgrcv = 401,
408 msgctl = 402,
409 clock_gettime64 = 403,
410 clock_settime64 = 404,
411 clock_adjtime64 = 405,
412 clock_getres_time64 = 406,
413 clock_nanosleep_time64 = 407,
414 timer_gettime64 = 408,
415 timer_settime64 = 409,
416 timerfd_gettime64 = 410,
417 timerfd_settime64 = 411,
418 utimensat_time64 = 412,
419 pselect6_time64 = 413,
420 ppoll_time64 = 414,
421 io_pgetevents_time64 = 416,
422 recvmmsg_time64 = 417,
423 mq_timedsend_time64 = 418,
424 mq_timedreceive_time64 = 419,
425 semtimedop_time64 = 420,
426 rt_sigtimedwait_time64 = 421,
427 futex_time64 = 422,
428 sched_rr_get_interval_time64 = 423,
429 pidfd_send_signal = 424,
430 io_uring_setup = 425,
431 io_uring_enter = 426,
432 io_uring_register = 427,
433 open_tree = 428,
434 move_mount = 429,
435 fsopen = 430,
436 fsconfig = 431,
437 fsmount = 432,
438 fspick = 433,
439 pidfd_open = 434,
440 clone3 = 435,
441 close_range = 436,
442 openat2 = 437,
443 pidfd_getfd = 438,
444 faccessat2 = 439,
445 process_madvise = 440,
446 epoll_pwait2 = 441,
447
448 _,
449};
450
451pub const O = struct {
452 pub const RDONLY = 0o0;
453 pub const WRONLY = 0o1;
454 pub const RDWR = 0o2;
455
456 pub const CREAT = 0o100;
457 pub const EXCL = 0o200;
458 pub const NOCTTY = 0o400;
459 pub const TRUNC = 0o1000;
460 pub const APPEND = 0o2000;
461 pub const NONBLOCK = 0o4000;
462 pub const DSYNC = 0o10000;
463 pub const SYNC = 0o4010000;
464 pub const RSYNC = 0o4010000;
465 pub const DIRECTORY = 0o200000;
466 pub const NOFOLLOW = 0o400000;
467 pub const CLOEXEC = 0o2000000;
468
469 pub const ASYNC = 0o20000;
470 pub const DIRECT = 0o40000;
471 pub const LARGEFILE = 0o100000;
472 pub const NOATIME = 0o1000000;
473 pub const PATH = 0o10000000;
474 pub const TMPFILE = 0o20200000;
475 pub const NDELAY = NONBLOCK;
476};
477
478pub const F = struct {
479 pub const DUPFD = 0;
480 pub const GETFD = 1;
481 pub const SETFD = 2;
482 pub const GETFL = 3;
483 pub const SETFL = 4;
484 pub const SETOWN = 8;
485 pub const GETOWN = 9;
486 pub const SETSIG = 10;
487 pub const GETSIG = 11;
488 pub const GETLK = 12;
489 pub const SETLK = 13;
490 pub const SETLKW = 14;
491 pub const SETOWN_EX = 15;
492 pub const GETOWN_EX = 16;
493 pub const GETOWNER_UIDS = 17;
494
495 pub const RDLCK = 0;
496 pub const WRLCK = 1;
497 pub const UNLCK = 2;
498};
499
500pub const LOCK = struct {
501 pub const SH = 1;
502 pub const EX = 2;
503 pub const NB = 4;
504 pub const UN = 8;
505};
506
507pub const MAP = struct {
508 /// Share changes
509 pub const SHARED = 0x01;
510
511 /// Changes are private
512 pub const PRIVATE = 0x02;
513
514 /// share + validate extension flags
515 pub const SHARED_VALIDATE = 0x03;
516
517 /// Mask for type of mapping
518 pub const TYPE = 0x0f;
519
520 /// Interpret addr exactly
521 pub const FIXED = 0x10;
522
523 /// don't use a file
524 pub const ANONYMOUS = if (is_mips) 0x800 else 0x20;
525
526 /// populate (prefault) pagetables
527 pub const POPULATE = if (is_mips) 0x10000 else 0x8000;
528
529 /// do not block on IO
530 pub const NONBLOCK = if (is_mips) 0x20000 else 0x10000;
531
532 /// give out an address that is best suited for process/thread stacks
533 pub const STACK = if (is_mips) 0x40000 else 0x20000;
534
535 /// create a huge page mapping
536 pub const HUGETLB = if (is_mips) 0x80000 else 0x40000;
537
538 /// perform synchronous page faults for the mapping
539 pub const SYNC = 0x80000;
540
541 /// FIXED which doesn't unmap underlying mapping
542 pub const FIXED_NOREPLACE = 0x100000;
543
544 /// For anonymous mmap, memory could be uninitialized
545 pub const UNINITIALIZED = 0x4000000;
546
547 pub const NORESERVE = 0x4000;
548 pub const GROWSDOWN = 0x0100;
549 pub const DENYWRITE = 0x0800;
550 pub const EXECUTABLE = 0x1000;
551 pub const LOCKED = 0x2000;
552 pub const @"32BIT" = 0x40;
553};
554
555pub const MMAP2_UNIT = 4096;
556
557pub const VDSO = struct {
558 pub const CGT_SYM = "__vdso_clock_gettime";
559 pub const CGT_VER = "LINUX_2.6";
560};
561
562pub const ARCH = struct {};
563
564pub const Flock = extern struct {
565 type: i16,
566 whence: i16,
567 start: off_t,
568 len: off_t,
569 pid: pid_t,
570};
571
572pub const msghdr = extern struct {
573 name: ?*sockaddr,
574 namelen: socklen_t,
575 iov: [*]iovec,
576 iovlen: i32,
577 control: ?*c_void,
578 controllen: socklen_t,
579 flags: i32,
580};
581
582pub const msghdr_const = extern struct {
583 name: ?*const sockaddr,
584 namelen: socklen_t,
585 iov: [*]iovec_const,
586 iovlen: i32,
587 control: ?*c_void,
588 controllen: socklen_t,
589 flags: i32,
590};
591
592pub const blksize_t = i32;
593pub const nlink_t = u32;
594pub const time_t = isize;
595pub const mode_t = u32;
596pub const off_t = i64;
597pub const ino_t = u64;
598pub const dev_t = u64;
599pub const blkcnt_t = i64;
600
601// The `stat` definition used by the Linux kernel.
602pub const Stat = extern struct {
603 dev: dev_t,
604 __dev_padding: u32,
605 __ino_truncated: u32,
606 mode: mode_t,
607 nlink: nlink_t,
608 uid: uid_t,
609 gid: gid_t,
610 rdev: dev_t,
611 __rdev_padding: u32,
612 size: off_t,
613 blksize: blksize_t,
614 blocks: blkcnt_t,
615 atim: timespec,
616 mtim: timespec,
617 ctim: timespec,
618 ino: ino_t,
619
620 pub fn atime(self: @This()) timespec {
621 return self.atim;
622 }
623
624 pub fn mtime(self: @This()) timespec {
625 return self.mtim;
626 }
627
628 pub fn ctime(self: @This()) timespec {
629 return self.ctim;
630 }
631};
632
633pub const timespec = extern struct {
634 tv_sec: i32,
635 tv_nsec: i32,
636};
637
638pub const timeval = extern struct {
639 tv_sec: i32,
640 tv_usec: i32,
641};
642
643pub const timezone = extern struct {
644 tz_minuteswest: i32,
645 tz_dsttime: i32,
646};
647
648pub const mcontext_t = extern struct {
649 gregs: [19]usize,
650 fpregs: [*]u8,
651 oldmask: usize,
652 cr2: usize,
653};
654
655pub const REG = struct {
656 pub const GS = 0;
657 pub const FS = 1;
658 pub const ES = 2;
659 pub const DS = 3;
660 pub const EDI = 4;
661 pub const ESI = 5;
662 pub const EBP = 6;
663 pub const ESP = 7;
664 pub const EBX = 8;
665 pub const EDX = 9;
666 pub const ECX = 10;
667 pub const EAX = 11;
668 pub const TRAPNO = 12;
669 pub const ERR = 13;
670 pub const EIP = 14;
671 pub const CS = 15;
672 pub const EFL = 16;
673 pub const UESP = 17;
674 pub const SS = 18;
675};
676
677pub const ucontext_t = extern struct {
678 flags: usize,
679 link: *ucontext_t,
680 stack: stack_t,
681 mcontext: mcontext_t,
682 sigmask: sigset_t,
683 regspace: [64]u64,
684};
685
686pub const Elf_Symndx = u32;
687
688pub const user_desc = packed struct {
689 entry_number: u32,
690 base_addr: u32,
691 limit: u32,
692 seg_32bit: u1,
693 contents: u2,
694 read_exec_only: u1,
695 limit_in_pages: u1,
696 seg_not_present: u1,
697 useable: u1,
698};
699
700/// socketcall() call numbers
701pub const SC = struct {
702 pub const socket = 1;
703 pub const bind = 2;
704 pub const connect = 3;
705 pub const listen = 4;
706 pub const accept = 5;
707 pub const getsockname = 6;
708 pub const getpeername = 7;
709 pub const socketpair = 8;
710 pub const send = 9;
711 pub const recv = 10;
712 pub const sendto = 11;
713 pub const recvfrom = 12;
714 pub const shutdown = 13;
715 pub const setsockopt = 14;
716 pub const getsockopt = 15;
717 pub const sendmsg = 16;
718 pub const recvmsg = 17;
719 pub const accept4 = 18;
720 pub const recvmmsg = 19;
721 pub const sendmmsg = 20;
722};
lib/std/os/bits/linux/mips.zig deleted-590
......@@ -1,590 +0,0 @@
1const std = @import("../../../std.zig");
2const linux = std.os.linux;
3const socklen_t = linux.socklen_t;
4const iovec = linux.iovec;
5const iovec_const = linux.iovec_const;
6const uid_t = linux.uid_t;
7const gid_t = linux.gid_t;
8const pid_t = linux.pid_t;
9
10pub const SYS = enum(usize) {
11 pub const Linux = 4000;
12
13 syscall = Linux + 0,
14 exit = Linux + 1,
15 fork = Linux + 2,
16 read = Linux + 3,
17 write = Linux + 4,
18 open = Linux + 5,
19 close = Linux + 6,
20 waitpid = Linux + 7,
21 creat = Linux + 8,
22 link = Linux + 9,
23 unlink = Linux + 10,
24 execve = Linux + 11,
25 chdir = Linux + 12,
26 time = Linux + 13,
27 mknod = Linux + 14,
28 chmod = Linux + 15,
29 lchown = Linux + 16,
30 @"break" = Linux + 17,
31 unused18 = Linux + 18,
32 lseek = Linux + 19,
33 getpid = Linux + 20,
34 mount = Linux + 21,
35 umount = Linux + 22,
36 setuid = Linux + 23,
37 getuid = Linux + 24,
38 stime = Linux + 25,
39 ptrace = Linux + 26,
40 alarm = Linux + 27,
41 unused28 = Linux + 28,
42 pause = Linux + 29,
43 utime = Linux + 30,
44 stty = Linux + 31,
45 gtty = Linux + 32,
46 access = Linux + 33,
47 nice = Linux + 34,
48 ftime = Linux + 35,
49 sync = Linux + 36,
50 kill = Linux + 37,
51 rename = Linux + 38,
52 mkdir = Linux + 39,
53 rmdir = Linux + 40,
54 dup = Linux + 41,
55 pipe = Linux + 42,
56 times = Linux + 43,
57 prof = Linux + 44,
58 brk = Linux + 45,
59 setgid = Linux + 46,
60 getgid = Linux + 47,
61 signal = Linux + 48,
62 geteuid = Linux + 49,
63 getegid = Linux + 50,
64 acct = Linux + 51,
65 umount2 = Linux + 52,
66 lock = Linux + 53,
67 ioctl = Linux + 54,
68 fcntl = Linux + 55,
69 mpx = Linux + 56,
70 setpgid = Linux + 57,
71 ulimit = Linux + 58,
72 unused59 = Linux + 59,
73 umask = Linux + 60,
74 chroot = Linux + 61,
75 ustat = Linux + 62,
76 dup2 = Linux + 63,
77 getppid = Linux + 64,
78 getpgrp = Linux + 65,
79 setsid = Linux + 66,
80 sigaction = Linux + 67,
81 sgetmask = Linux + 68,
82 ssetmask = Linux + 69,
83 setreuid = Linux + 70,
84 setregid = Linux + 71,
85 sigsuspend = Linux + 72,
86 sigpending = Linux + 73,
87 sethostname = Linux + 74,
88 setrlimit = Linux + 75,
89 getrlimit = Linux + 76,
90 getrusage = Linux + 77,
91 gettimeofday = Linux + 78,
92 settimeofday = Linux + 79,
93 getgroups = Linux + 80,
94 setgroups = Linux + 81,
95 reserved82 = Linux + 82,
96 symlink = Linux + 83,
97 unused84 = Linux + 84,
98 readlink = Linux + 85,
99 uselib = Linux + 86,
100 swapon = Linux + 87,
101 reboot = Linux + 88,
102 readdir = Linux + 89,
103 mmap = Linux + 90,
104 munmap = Linux + 91,
105 truncate = Linux + 92,
106 ftruncate = Linux + 93,
107 fchmod = Linux + 94,
108 fchown = Linux + 95,
109 getpriority = Linux + 96,
110 setpriority = Linux + 97,
111 profil = Linux + 98,
112 statfs = Linux + 99,
113 fstatfs = Linux + 100,
114 ioperm = Linux + 101,
115 socketcall = Linux + 102,
116 syslog = Linux + 103,
117 setitimer = Linux + 104,
118 getitimer = Linux + 105,
119 stat = Linux + 106,
120 lstat = Linux + 107,
121 fstat = Linux + 108,
122 unused109 = Linux + 109,
123 iopl = Linux + 110,
124 vhangup = Linux + 111,
125 idle = Linux + 112,
126 vm86 = Linux + 113,
127 wait4 = Linux + 114,
128 swapoff = Linux + 115,
129 sysinfo = Linux + 116,
130 ipc = Linux + 117,
131 fsync = Linux + 118,
132 sigreturn = Linux + 119,
133 clone = Linux + 120,
134 setdomainname = Linux + 121,
135 uname = Linux + 122,
136 modify_ldt = Linux + 123,
137 adjtimex = Linux + 124,
138 mprotect = Linux + 125,
139 sigprocmask = Linux + 126,
140 create_module = Linux + 127,
141 init_module = Linux + 128,
142 delete_module = Linux + 129,
143 get_kernel_syms = Linux + 130,
144 quotactl = Linux + 131,
145 getpgid = Linux + 132,
146 fchdir = Linux + 133,
147 bdflush = Linux + 134,
148 sysfs = Linux + 135,
149 personality = Linux + 136,
150 afs_syscall = Linux + 137,
151 setfsuid = Linux + 138,
152 setfsgid = Linux + 139,
153 _llseek = Linux + 140,
154 getdents = Linux + 141,
155 _newselect = Linux + 142,
156 flock = Linux + 143,
157 msync = Linux + 144,
158 readv = Linux + 145,
159 writev = Linux + 146,
160 cacheflush = Linux + 147,
161 cachectl = Linux + 148,
162 sysmips = Linux + 149,
163 unused150 = Linux + 150,
164 getsid = Linux + 151,
165 fdatasync = Linux + 152,
166 _sysctl = Linux + 153,
167 mlock = Linux + 154,
168 munlock = Linux + 155,
169 mlockall = Linux + 156,
170 munlockall = Linux + 157,
171 sched_setparam = Linux + 158,
172 sched_getparam = Linux + 159,
173 sched_setscheduler = Linux + 160,
174 sched_getscheduler = Linux + 161,
175 sched_yield = Linux + 162,
176 sched_get_priority_max = Linux + 163,
177 sched_get_priority_min = Linux + 164,
178 sched_rr_get_interval = Linux + 165,
179 nanosleep = Linux + 166,
180 mremap = Linux + 167,
181 accept = Linux + 168,
182 bind = Linux + 169,
183 connect = Linux + 170,
184 getpeername = Linux + 171,
185 getsockname = Linux + 172,
186 getsockopt = Linux + 173,
187 listen = Linux + 174,
188 recv = Linux + 175,
189 recvfrom = Linux + 176,
190 recvmsg = Linux + 177,
191 send = Linux + 178,
192 sendmsg = Linux + 179,
193 sendto = Linux + 180,
194 setsockopt = Linux + 181,
195 shutdown = Linux + 182,
196 socket = Linux + 183,
197 socketpair = Linux + 184,
198 setresuid = Linux + 185,
199 getresuid = Linux + 186,
200 query_module = Linux + 187,
201 poll = Linux + 188,
202 nfsservctl = Linux + 189,
203 setresgid = Linux + 190,
204 getresgid = Linux + 191,
205 prctl = Linux + 192,
206 rt_sigreturn = Linux + 193,
207 rt_sigaction = Linux + 194,
208 rt_sigprocmask = Linux + 195,
209 rt_sigpending = Linux + 196,
210 rt_sigtimedwait = Linux + 197,
211 rt_sigqueueinfo = Linux + 198,
212 rt_sigsuspend = Linux + 199,
213 pread64 = Linux + 200,
214 pwrite64 = Linux + 201,
215 chown = Linux + 202,
216 getcwd = Linux + 203,
217 capget = Linux + 204,
218 capset = Linux + 205,
219 sigaltstack = Linux + 206,
220 sendfile = Linux + 207,
221 getpmsg = Linux + 208,
222 putpmsg = Linux + 209,
223 mmap2 = Linux + 210,
224 truncate64 = Linux + 211,
225 ftruncate64 = Linux + 212,
226 stat64 = Linux + 213,
227 lstat64 = Linux + 214,
228 fstat64 = Linux + 215,
229 pivot_root = Linux + 216,
230 mincore = Linux + 217,
231 madvise = Linux + 218,
232 getdents64 = Linux + 219,
233 fcntl64 = Linux + 220,
234 reserved221 = Linux + 221,
235 gettid = Linux + 222,
236 readahead = Linux + 223,
237 setxattr = Linux + 224,
238 lsetxattr = Linux + 225,
239 fsetxattr = Linux + 226,
240 getxattr = Linux + 227,
241 lgetxattr = Linux + 228,
242 fgetxattr = Linux + 229,
243 listxattr = Linux + 230,
244 llistxattr = Linux + 231,
245 flistxattr = Linux + 232,
246 removexattr = Linux + 233,
247 lremovexattr = Linux + 234,
248 fremovexattr = Linux + 235,
249 tkill = Linux + 236,
250 sendfile64 = Linux + 237,
251 futex = Linux + 238,
252 sched_setaffinity = Linux + 239,
253 sched_getaffinity = Linux + 240,
254 io_setup = Linux + 241,
255 io_destroy = Linux + 242,
256 io_getevents = Linux + 243,
257 io_submit = Linux + 244,
258 io_cancel = Linux + 245,
259 exit_group = Linux + 246,
260 lookup_dcookie = Linux + 247,
261 epoll_create = Linux + 248,
262 epoll_ctl = Linux + 249,
263 epoll_wait = Linux + 250,
264 remap_file_pages = Linux + 251,
265 set_tid_address = Linux + 252,
266 restart_syscall = Linux + 253,
267 fadvise64 = Linux + 254,
268 statfs64 = Linux + 255,
269 fstatfs64 = Linux + 256,
270 timer_create = Linux + 257,
271 timer_settime = Linux + 258,
272 timer_gettime = Linux + 259,
273 timer_getoverrun = Linux + 260,
274 timer_delete = Linux + 261,
275 clock_settime = Linux + 262,
276 clock_gettime = Linux + 263,
277 clock_getres = Linux + 264,
278 clock_nanosleep = Linux + 265,
279 tgkill = Linux + 266,
280 utimes = Linux + 267,
281 mbind = Linux + 268,
282 get_mempolicy = Linux + 269,
283 set_mempolicy = Linux + 270,
284 mq_open = Linux + 271,
285 mq_unlink = Linux + 272,
286 mq_timedsend = Linux + 273,
287 mq_timedreceive = Linux + 274,
288 mq_notify = Linux + 275,
289 mq_getsetattr = Linux + 276,
290 vserver = Linux + 277,
291 waitid = Linux + 278,
292 add_key = Linux + 280,
293 request_key = Linux + 281,
294 keyctl = Linux + 282,
295 set_thread_area = Linux + 283,
296 inotify_init = Linux + 284,
297 inotify_add_watch = Linux + 285,
298 inotify_rm_watch = Linux + 286,
299 migrate_pages = Linux + 287,
300 openat = Linux + 288,
301 mkdirat = Linux + 289,
302 mknodat = Linux + 290,
303 fchownat = Linux + 291,
304 futimesat = Linux + 292,
305 fstatat64 = Linux + 293,
306 unlinkat = Linux + 294,
307 renameat = Linux + 295,
308 linkat = Linux + 296,
309 symlinkat = Linux + 297,
310 readlinkat = Linux + 298,
311 fchmodat = Linux + 299,
312 faccessat = Linux + 300,
313 pselect6 = Linux + 301,
314 ppoll = Linux + 302,
315 unshare = Linux + 303,
316 splice = Linux + 304,
317 sync_file_range = Linux + 305,
318 tee = Linux + 306,
319 vmsplice = Linux + 307,
320 move_pages = Linux + 308,
321 set_robust_list = Linux + 309,
322 get_robust_list = Linux + 310,
323 kexec_load = Linux + 311,
324 getcpu = Linux + 312,
325 epoll_pwait = Linux + 313,
326 ioprio_set = Linux + 314,
327 ioprio_get = Linux + 315,
328 utimensat = Linux + 316,
329 signalfd = Linux + 317,
330 timerfd = Linux + 318,
331 eventfd = Linux + 319,
332 fallocate = Linux + 320,
333 timerfd_create = Linux + 321,
334 timerfd_gettime = Linux + 322,
335 timerfd_settime = Linux + 323,
336 signalfd4 = Linux + 324,
337 eventfd2 = Linux + 325,
338 epoll_create1 = Linux + 326,
339 dup3 = Linux + 327,
340 pipe2 = Linux + 328,
341 inotify_init1 = Linux + 329,
342 preadv = Linux + 330,
343 pwritev = Linux + 331,
344 rt_tgsigqueueinfo = Linux + 332,
345 perf_event_open = Linux + 333,
346 accept4 = Linux + 334,
347 recvmmsg = Linux + 335,
348 fanotify_init = Linux + 336,
349 fanotify_mark = Linux + 337,
350 prlimit64 = Linux + 338,
351 name_to_handle_at = Linux + 339,
352 open_by_handle_at = Linux + 340,
353 clock_adjtime = Linux + 341,
354 syncfs = Linux + 342,
355 sendmmsg = Linux + 343,
356 setns = Linux + 344,
357 process_vm_readv = Linux + 345,
358 process_vm_writev = Linux + 346,
359 kcmp = Linux + 347,
360 finit_module = Linux + 348,
361 sched_setattr = Linux + 349,
362 sched_getattr = Linux + 350,
363 renameat2 = Linux + 351,
364 seccomp = Linux + 352,
365 getrandom = Linux + 353,
366 memfd_create = Linux + 354,
367 bpf = Linux + 355,
368 execveat = Linux + 356,
369 userfaultfd = Linux + 357,
370 membarrier = Linux + 358,
371 mlock2 = Linux + 359,
372 copy_file_range = Linux + 360,
373 preadv2 = Linux + 361,
374 pwritev2 = Linux + 362,
375 pkey_mprotect = Linux + 363,
376 pkey_alloc = Linux + 364,
377 pkey_free = Linux + 365,
378 statx = Linux + 366,
379 rseq = Linux + 367,
380 io_pgetevents = Linux + 368,
381 semget = Linux + 393,
382 semctl = Linux + 394,
383 shmget = Linux + 395,
384 shmctl = Linux + 396,
385 shmat = Linux + 397,
386 shmdt = Linux + 398,
387 msgget = Linux + 399,
388 msgsnd = Linux + 400,
389 msgrcv = Linux + 401,
390 msgctl = Linux + 402,
391 clock_gettime64 = Linux + 403,
392 clock_settime64 = Linux + 404,
393 clock_adjtime64 = Linux + 405,
394 clock_getres_time64 = Linux + 406,
395 clock_nanosleep_time64 = Linux + 407,
396 timer_gettime64 = Linux + 408,
397 timer_settime64 = Linux + 409,
398 timerfd_gettime64 = Linux + 410,
399 timerfd_settime64 = Linux + 411,
400 utimensat_time64 = Linux + 412,
401 pselect6_time64 = Linux + 413,
402 ppoll_time64 = Linux + 414,
403 io_pgetevents_time64 = Linux + 416,
404 recvmmsg_time64 = Linux + 417,
405 mq_timedsend_time64 = Linux + 418,
406 mq_timedreceive_time64 = Linux + 419,
407 semtimedop_time64 = Linux + 420,
408 rt_sigtimedwait_time64 = Linux + 421,
409 futex_time64 = Linux + 422,
410 sched_rr_get_interval_time64 = Linux + 423,
411 pidfd_send_signal = Linux + 424,
412 io_uring_setup = Linux + 425,
413 io_uring_enter = Linux + 426,
414 io_uring_register = Linux + 427,
415 open_tree = Linux + 428,
416 move_mount = Linux + 429,
417 fsopen = Linux + 430,
418 fsconfig = Linux + 431,
419 fsmount = Linux + 432,
420 fspick = Linux + 433,
421 pidfd_open = Linux + 434,
422 clone3 = Linux + 435,
423 close_range = Linux + 436,
424 openat2 = Linux + 437,
425 pidfd_getfd = Linux + 438,
426 faccessat2 = Linux + 439,
427 process_madvise = Linux + 440,
428 epoll_pwait2 = Linux + 441,
429
430 _,
431};
432
433pub const O_CREAT = 0o0400;
434pub const O_EXCL = 0o02000;
435pub const O_NOCTTY = 0o04000;
436pub const O_TRUNC = 0o01000;
437pub const O_APPEND = 0o0010;
438pub const O_NONBLOCK = 0o0200;
439pub const O_DSYNC = 0o0020;
440pub const O_SYNC = 0o040020;
441pub const O_RSYNC = 0o040020;
442pub const O_DIRECTORY = 0o0200000;
443pub const O_NOFOLLOW = 0o0400000;
444pub const O_CLOEXEC = 0o02000000;
445
446pub const O_ASYNC = 0o010000;
447pub const O_DIRECT = 0o0100000;
448pub const O_LARGEFILE = 0o020000;
449pub const O_NOATIME = 0o01000000;
450pub const O_PATH = 0o010000000;
451pub const O_TMPFILE = 0o020200000;
452pub const O_NDELAY = O_NONBLOCK;
453
454pub const F_DUPFD = 0;
455pub const F_GETFD = 1;
456pub const F_SETFD = 2;
457pub const F_GETFL = 3;
458pub const F_SETFL = 4;
459
460pub const F_SETOWN = 24;
461pub const F_GETOWN = 23;
462pub const F_SETSIG = 10;
463pub const F_GETSIG = 11;
464
465pub const F_GETLK = 33;
466pub const F_SETLK = 34;
467pub const F_SETLKW = 35;
468
469pub const F_RDLCK = 0;
470pub const F_WRLCK = 1;
471pub const F_UNLCK = 2;
472
473pub const LOCK_SH = 1;
474pub const LOCK_EX = 2;
475pub const LOCK_UN = 8;
476pub const LOCK_NB = 4;
477
478pub const F_SETOWN_EX = 15;
479pub const F_GETOWN_EX = 16;
480
481pub const F_GETOWNER_UIDS = 17;
482
483pub const MMAP2_UNIT = 4096;
484
485pub const MAP_NORESERVE = 0x0400;
486pub const MAP_GROWSDOWN = 0x1000;
487pub const MAP_DENYWRITE = 0x2000;
488pub const MAP_EXECUTABLE = 0x4000;
489pub const MAP_LOCKED = 0x8000;
490pub const MAP_32BIT = 0x40;
491
492pub const SO_DEBUG = 1;
493pub const SO_REUSEADDR = 0x0004;
494pub const SO_KEEPALIVE = 0x0008;
495pub const SO_DONTROUTE = 0x0010;
496pub const SO_BROADCAST = 0x0020;
497pub const SO_LINGER = 0x0080;
498pub const SO_OOBINLINE = 0x0100;
499pub const SO_REUSEPORT = 0x0200;
500pub const SO_SNDBUF = 0x1001;
501pub const SO_RCVBUF = 0x1002;
502pub const SO_SNDLOWAT = 0x1003;
503pub const SO_RCVLOWAT = 0x1004;
504pub const SO_RCVTIMEO = 0x1006;
505pub const SO_SNDTIMEO = 0x1005;
506pub const SO_ERROR = 0x1007;
507pub const SO_TYPE = 0x1008;
508pub const SO_ACCEPTCONN = 0x1009;
509pub const SO_PROTOCOL = 0x1028;
510pub const SO_DOMAIN = 0x1029;
511pub const SO_NO_CHECK = 11;
512pub const SO_PRIORITY = 12;
513pub const SO_BSDCOMPAT = 14;
514pub const SO_PASSCRED = 17;
515pub const SO_PEERCRED = 18;
516pub const SO_PEERSEC = 30;
517pub const SO_SNDBUFFORCE = 31;
518pub const SO_RCVBUFFORCE = 33;
519
520pub const VDSO_CGT_SYM = "__kernel_clock_gettime";
521pub const VDSO_CGT_VER = "LINUX_2.6.39";
522
523pub const Flock = extern struct {
524 l_type: i16,
525 l_whence: i16,
526 __pad0: [4]u8,
527 l_start: off_t,
528 l_len: off_t,
529 l_pid: pid_t,
530 __unused: [4]u8,
531};
532
533pub const blksize_t = i32;
534pub const nlink_t = u32;
535pub const time_t = i32;
536pub const mode_t = u32;
537pub const off_t = i64;
538pub const ino_t = u64;
539pub const dev_t = u64;
540pub const blkcnt_t = i64;
541
542// The `stat` definition used by the Linux kernel.
543pub const Stat = extern struct {
544 dev: u32,
545 __pad0: [3]u32, // Reserved for st_dev expansion
546 ino: ino_t,
547 mode: mode_t,
548 nlink: nlink_t,
549 uid: uid_t,
550 gid: gid_t,
551 rdev: u32,
552 __pad1: [3]u32,
553 size: off_t,
554 atim: timespec,
555 mtim: timespec,
556 ctim: timespec,
557 blksize: blksize_t,
558 __pad3: u32,
559 blocks: blkcnt_t,
560 __pad4: [14]usize,
561
562 pub fn atime(self: @This()) timespec {
563 return self.atim;
564 }
565
566 pub fn mtime(self: @This()) timespec {
567 return self.mtim;
568 }
569
570 pub fn ctime(self: @This()) timespec {
571 return self.ctim;
572 }
573};
574
575pub const timespec = extern struct {
576 tv_sec: isize,
577 tv_nsec: isize,
578};
579
580pub const timeval = extern struct {
581 tv_sec: isize,
582 tv_usec: isize,
583};
584
585pub const timezone = extern struct {
586 tz_minuteswest: i32,
587 tz_dsttime: i32,
588};
589
590pub const Elf_Symndx = u32;
lib/std/os/bits/linux/powerpc.zig deleted-618
......@@ -1,618 +0,0 @@
1const std = @import("../../../std.zig");
2const linux = std.os.linux;
3const socklen_t = linux.socklen_t;
4const iovec = linux.iovec;
5const iovec_const = linux.iovec_const;
6const uid_t = linux.uid_t;
7const gid_t = linux.gid_t;
8const pid_t = linux.pid_t;
9const stack_t = linux.stack_t;
10const sigset_t = linux.sigset_t;
11pub const SYS = enum(usize) {
12 restart_syscall = 0,
13 exit = 1,
14 fork = 2,
15 read = 3,
16 write = 4,
17 open = 5,
18 close = 6,
19 waitpid = 7,
20 creat = 8,
21 link = 9,
22 unlink = 10,
23 execve = 11,
24 chdir = 12,
25 time = 13,
26 mknod = 14,
27 chmod = 15,
28 lchown = 16,
29 @"break" = 17,
30 oldstat = 18,
31 lseek = 19,
32 getpid = 20,
33 mount = 21,
34 umount = 22,
35 setuid = 23,
36 getuid = 24,
37 stime = 25,
38 ptrace = 26,
39 alarm = 27,
40 oldfstat = 28,
41 pause = 29,
42 utime = 30,
43 stty = 31,
44 gtty = 32,
45 access = 33,
46 nice = 34,
47 ftime = 35,
48 sync = 36,
49 kill = 37,
50 rename = 38,
51 mkdir = 39,
52 rmdir = 40,
53 dup = 41,
54 pipe = 42,
55 times = 43,
56 prof = 44,
57 brk = 45,
58 setgid = 46,
59 getgid = 47,
60 signal = 48,
61 geteuid = 49,
62 getegid = 50,
63 acct = 51,
64 umount2 = 52,
65 lock = 53,
66 ioctl = 54,
67 fcntl = 55,
68 mpx = 56,
69 setpgid = 57,
70 ulimit = 58,
71 oldolduname = 59,
72 umask = 60,
73 chroot = 61,
74 ustat = 62,
75 dup2 = 63,
76 getppid = 64,
77 getpgrp = 65,
78 setsid = 66,
79 sigaction = 67,
80 sgetmask = 68,
81 ssetmask = 69,
82 setreuid = 70,
83 setregid = 71,
84 sigsuspend = 72,
85 sigpending = 73,
86 sethostname = 74,
87 setrlimit = 75,
88 getrlimit = 76,
89 getrusage = 77,
90 gettimeofday = 78,
91 settimeofday = 79,
92 getgroups = 80,
93 setgroups = 81,
94 select = 82,
95 symlink = 83,
96 oldlstat = 84,
97 readlink = 85,
98 uselib = 86,
99 swapon = 87,
100 reboot = 88,
101 readdir = 89,
102 mmap = 90,
103 munmap = 91,
104 truncate = 92,
105 ftruncate = 93,
106 fchmod = 94,
107 fchown = 95,
108 getpriority = 96,
109 setpriority = 97,
110 profil = 98,
111 statfs = 99,
112 fstatfs = 100,
113 ioperm = 101,
114 socketcall = 102,
115 syslog = 103,
116 setitimer = 104,
117 getitimer = 105,
118 stat = 106,
119 lstat = 107,
120 fstat = 108,
121 olduname = 109,
122 iopl = 110,
123 vhangup = 111,
124 idle = 112,
125 vm86 = 113,
126 wait4 = 114,
127 swapoff = 115,
128 sysinfo = 116,
129 ipc = 117,
130 fsync = 118,
131 sigreturn = 119,
132 clone = 120,
133 setdomainname = 121,
134 uname = 122,
135 modify_ldt = 123,
136 adjtimex = 124,
137 mprotect = 125,
138 sigprocmask = 126,
139 create_module = 127,
140 init_module = 128,
141 delete_module = 129,
142 get_kernel_syms = 130,
143 quotactl = 131,
144 getpgid = 132,
145 fchdir = 133,
146 bdflush = 134,
147 sysfs = 135,
148 personality = 136,
149 afs_syscall = 137,
150 setfsuid = 138,
151 setfsgid = 139,
152 _llseek = 140,
153 getdents = 141,
154 _newselect = 142,
155 flock = 143,
156 msync = 144,
157 readv = 145,
158 writev = 146,
159 getsid = 147,
160 fdatasync = 148,
161 _sysctl = 149,
162 mlock = 150,
163 munlock = 151,
164 mlockall = 152,
165 munlockall = 153,
166 sched_setparam = 154,
167 sched_getparam = 155,
168 sched_setscheduler = 156,
169 sched_getscheduler = 157,
170 sched_yield = 158,
171 sched_get_priority_max = 159,
172 sched_get_priority_min = 160,
173 sched_rr_get_interval = 161,
174 nanosleep = 162,
175 mremap = 163,
176 setresuid = 164,
177 getresuid = 165,
178 query_module = 166,
179 poll = 167,
180 nfsservctl = 168,
181 setresgid = 169,
182 getresgid = 170,
183 prctl = 171,
184 rt_sigreturn = 172,
185 rt_sigaction = 173,
186 rt_sigprocmask = 174,
187 rt_sigpending = 175,
188 rt_sigtimedwait = 176,
189 rt_sigqueueinfo = 177,
190 rt_sigsuspend = 178,
191 pread64 = 179,
192 pwrite64 = 180,
193 chown = 181,
194 getcwd = 182,
195 capget = 183,
196 capset = 184,
197 sigaltstack = 185,
198 sendfile = 186,
199 getpmsg = 187,
200 putpmsg = 188,
201 vfork = 189,
202 ugetrlimit = 190,
203 readahead = 191,
204 mmap2 = 192,
205 truncate64 = 193,
206 ftruncate64 = 194,
207 stat64 = 195,
208 lstat64 = 196,
209 fstat64 = 197,
210 pciconfig_read = 198,
211 pciconfig_write = 199,
212 pciconfig_iobase = 200,
213 multiplexer = 201,
214 getdents64 = 202,
215 pivot_root = 203,
216 fcntl64 = 204,
217 madvise = 205,
218 mincore = 206,
219 gettid = 207,
220 tkill = 208,
221 setxattr = 209,
222 lsetxattr = 210,
223 fsetxattr = 211,
224 getxattr = 212,
225 lgetxattr = 213,
226 fgetxattr = 214,
227 listxattr = 215,
228 llistxattr = 216,
229 flistxattr = 217,
230 removexattr = 218,
231 lremovexattr = 219,
232 fremovexattr = 220,
233 futex = 221,
234 sched_setaffinity = 222,
235 sched_getaffinity = 223,
236 tuxcall = 225,
237 sendfile64 = 226,
238 io_setup = 227,
239 io_destroy = 228,
240 io_getevents = 229,
241 io_submit = 230,
242 io_cancel = 231,
243 set_tid_address = 232,
244 fadvise64 = 233,
245 exit_group = 234,
246 lookup_dcookie = 235,
247 epoll_create = 236,
248 epoll_ctl = 237,
249 epoll_wait = 238,
250 remap_file_pages = 239,
251 timer_create = 240,
252 timer_settime = 241,
253 timer_gettime = 242,
254 timer_getoverrun = 243,
255 timer_delete = 244,
256 clock_settime = 245,
257 clock_gettime = 246,
258 clock_getres = 247,
259 clock_nanosleep = 248,
260 swapcontext = 249,
261 tgkill = 250,
262 utimes = 251,
263 statfs64 = 252,
264 fstatfs64 = 253,
265 fadvise64_64 = 254,
266 rtas = 255,
267 sys_debug_setcontext = 256,
268 migrate_pages = 258,
269 mbind = 259,
270 get_mempolicy = 260,
271 set_mempolicy = 261,
272 mq_open = 262,
273 mq_unlink = 263,
274 mq_timedsend = 264,
275 mq_timedreceive = 265,
276 mq_notify = 266,
277 mq_getsetattr = 267,
278 kexec_load = 268,
279 add_key = 269,
280 request_key = 270,
281 keyctl = 271,
282 waitid = 272,
283 ioprio_set = 273,
284 ioprio_get = 274,
285 inotify_init = 275,
286 inotify_add_watch = 276,
287 inotify_rm_watch = 277,
288 spu_run = 278,
289 spu_create = 279,
290 pselect6 = 280,
291 ppoll = 281,
292 unshare = 282,
293 splice = 283,
294 tee = 284,
295 vmsplice = 285,
296 openat = 286,
297 mkdirat = 287,
298 mknodat = 288,
299 fchownat = 289,
300 futimesat = 290,
301 fstatat64 = 291,
302 unlinkat = 292,
303 renameat = 293,
304 linkat = 294,
305 symlinkat = 295,
306 readlinkat = 296,
307 fchmodat = 297,
308 faccessat = 298,
309 get_robust_list = 299,
310 set_robust_list = 300,
311 move_pages = 301,
312 getcpu = 302,
313 epoll_pwait = 303,
314 utimensat = 304,
315 signalfd = 305,
316 timerfd_create = 306,
317 eventfd = 307,
318 sync_file_range = 308,
319 fallocate = 309,
320 subpage_prot = 310,
321 timerfd_settime = 311,
322 timerfd_gettime = 312,
323 signalfd4 = 313,
324 eventfd2 = 314,
325 epoll_create1 = 315,
326 dup3 = 316,
327 pipe2 = 317,
328 inotify_init1 = 318,
329 perf_event_open = 319,
330 preadv = 320,
331 pwritev = 321,
332 rt_tgsigqueueinfo = 322,
333 fanotify_init = 323,
334 fanotify_mark = 324,
335 prlimit64 = 325,
336 socket = 326,
337 bind = 327,
338 connect = 328,
339 listen = 329,
340 accept = 330,
341 getsockname = 331,
342 getpeername = 332,
343 socketpair = 333,
344 send = 334,
345 sendto = 335,
346 recv = 336,
347 recvfrom = 337,
348 shutdown = 338,
349 setsockopt = 339,
350 getsockopt = 340,
351 sendmsg = 341,
352 recvmsg = 342,
353 recvmmsg = 343,
354 accept4 = 344,
355 name_to_handle_at = 345,
356 open_by_handle_at = 346,
357 clock_adjtime = 347,
358 syncfs = 348,
359 sendmmsg = 349,
360 setns = 350,
361 process_vm_readv = 351,
362 process_vm_writev = 352,
363 finit_module = 353,
364 kcmp = 354,
365 sched_setattr = 355,
366 sched_getattr = 356,
367 renameat2 = 357,
368 seccomp = 358,
369 getrandom = 359,
370 memfd_create = 360,
371 bpf = 361,
372 execveat = 362,
373 switch_endian = 363,
374 userfaultfd = 364,
375 membarrier = 365,
376 mlock2 = 378,
377 copy_file_range = 379,
378 preadv2 = 380,
379 pwritev2 = 381,
380 kexec_file_load = 382,
381 statx = 383,
382 pkey_alloc = 384,
383 pkey_free = 385,
384 pkey_mprotect = 386,
385 rseq = 387,
386 io_pgetevents = 388,
387 semget = 393,
388 semctl = 394,
389 shmget = 395,
390 shmctl = 396,
391 shmat = 397,
392 shmdt = 398,
393 msgget = 399,
394 msgsnd = 400,
395 msgrcv = 401,
396 msgctl = 402,
397 clock_gettime64 = 403,
398 clock_settime64 = 404,
399 clock_adjtime64 = 405,
400 clock_getres_time64 = 406,
401 clock_nanosleep_time64 = 407,
402 timer_gettime64 = 408,
403 timer_settime64 = 409,
404 timerfd_gettime64 = 410,
405 timerfd_settime64 = 411,
406 utimensat_time64 = 412,
407 pselect6_time64 = 413,
408 ppoll_time64 = 414,
409 io_pgetevents_time64 = 416,
410 recvmmsg_time64 = 417,
411 mq_timedsend_time64 = 418,
412 mq_timedreceive_time64 = 419,
413 semtimedop_time64 = 420,
414 rt_sigtimedwait_time64 = 421,
415 futex_time64 = 422,
416 sched_rr_get_interval_time64 = 423,
417 pidfd_send_signal = 424,
418 io_uring_setup = 425,
419 io_uring_enter = 426,
420 io_uring_register = 427,
421 open_tree = 428,
422 move_mount = 429,
423 fsopen = 430,
424 fsconfig = 431,
425 fsmount = 432,
426 fspick = 433,
427 pidfd_open = 434,
428 clone3 = 435,
429 close_range = 436,
430 openat2 = 437,
431 pidfd_getfd = 438,
432 faccessat2 = 439,
433 process_madvise = 440,
434};
435
436pub const O_CREAT = 0o100;
437pub const O_EXCL = 0o200;
438pub const O_NOCTTY = 0o400;
439pub const O_TRUNC = 0o1000;
440pub const O_APPEND = 0o2000;
441pub const O_NONBLOCK = 0o4000;
442pub const O_DSYNC = 0o10000;
443pub const O_SYNC = 0o4010000;
444pub const O_RSYNC = 0o4010000;
445pub const O_DIRECTORY = 0o40000;
446pub const O_NOFOLLOW = 0o100000;
447pub const O_CLOEXEC = 0o2000000;
448
449pub const O_ASYNC = 0o20000;
450pub const O_DIRECT = 0o400000;
451pub const O_LARGEFILE = 0o200000;
452pub const O_NOATIME = 0o1000000;
453pub const O_PATH = 0o10000000;
454pub const O_TMPFILE = 0o20040000;
455pub const O_NDELAY = O_NONBLOCK;
456
457pub const F_DUPFD = 0;
458pub const F_GETFD = 1;
459pub const F_SETFD = 2;
460pub const F_GETFL = 3;
461pub const F_SETFL = 4;
462
463pub const F_SETOWN = 8;
464pub const F_GETOWN = 9;
465pub const F_SETSIG = 10;
466pub const F_GETSIG = 11;
467
468pub const F_GETLK = 12;
469pub const F_SETLK = 13;
470pub const F_SETLKW = 14;
471
472pub const F_SETOWN_EX = 15;
473pub const F_GETOWN_EX = 16;
474
475pub const F_GETOWNER_UIDS = 17;
476
477pub const F_RDLCK = 0;
478pub const F_WRLCK = 1;
479pub const F_UNLCK = 2;
480
481pub const LOCK_SH = 1;
482pub const LOCK_EX = 2;
483pub const LOCK_UN = 8;
484pub const LOCK_NB = 4;
485
486/// stack-like segment
487pub const MAP_GROWSDOWN = 0x0100;
488
489/// ETXTBSY
490pub const MAP_DENYWRITE = 0x0800;
491
492/// mark it as an executable
493pub const MAP_EXECUTABLE = 0x1000;
494
495/// pages are locked
496pub const MAP_LOCKED = 0x0080;
497
498/// don't check for reservations
499pub const MAP_NORESERVE = 0x0040;
500
501pub const VDSO_CGT_SYM = "__kernel_clock_gettime";
502pub const VDSO_CGT_VER = "LINUX_2.6.15";
503
504pub const Flock = extern struct {
505 l_type: i16,
506 l_whence: i16,
507 l_start: off_t,
508 l_len: off_t,
509 l_pid: pid_t,
510};
511
512pub const msghdr = extern struct {
513 msg_name: ?*sockaddr,
514 msg_namelen: socklen_t,
515 msg_iov: [*]iovec,
516 msg_iovlen: usize,
517 msg_control: ?*c_void,
518 msg_controllen: socklen_t,
519 msg_flags: i32,
520};
521
522pub const msghdr_const = extern struct {
523 msg_name: ?*const sockaddr,
524 msg_namelen: socklen_t,
525 msg_iov: [*]iovec_const,
526 msg_iovlen: usize,
527 msg_control: ?*c_void,
528 msg_controllen: socklen_t,
529 msg_flags: i32,
530};
531
532pub const blksize_t = i32;
533pub const nlink_t = u32;
534pub const time_t = isize;
535pub const mode_t = u32;
536pub const off_t = i64;
537pub const ino_t = u64;
538pub const dev_t = u64;
539pub const blkcnt_t = i64;
540
541// The `stat` definition used by the Linux kernel.
542pub const Stat = extern struct {
543 dev: dev_t,
544 ino: ino_t,
545 mode: mode_t,
546 nlink: nlink_t,
547 uid: uid_t,
548 gid: gid_t,
549 rdev: dev_t,
550 __rdev_padding: i16,
551 size: off_t,
552 blksize: blksize_t,
553 blocks: blkcnt_t,
554 atim: timespec,
555 mtim: timespec,
556 ctim: timespec,
557 __unused: [2]u32,
558
559 pub fn atime(self: @This()) timespec {
560 return self.atim;
561 }
562
563 pub fn mtime(self: @This()) timespec {
564 return self.mtim;
565 }
566
567 pub fn ctime(self: @This()) timespec {
568 return self.ctim;
569 }
570};
571
572pub const timespec = extern struct {
573 tv_sec: time_t,
574 tv_nsec: isize,
575};
576
577pub const timeval = extern struct {
578 tv_sec: time_t,
579 tv_usec: isize,
580};
581
582pub const timezone = extern struct {
583 tz_minuteswest: i32,
584 tz_dsttime: i32,
585};
586
587pub const greg_t = u32;
588pub const gregset_t = [48]greg_t;
589pub const fpregset_t = [33]f64;
590
591pub const vrregset = extern struct {
592 vrregs: [32][4]u32,
593 vrsave: u32,
594 _pad: [2]u32,
595 vscr: u32,
596};
597pub const vrregset_t = vrregset;
598
599pub const mcontext_t = extern struct {
600 gp_regs: gregset_t,
601 fp_regs: fpregset_t,
602 v_regs: vrregset_t align(16),
603};
604
605pub const ucontext_t = extern struct {
606 flags: u32,
607 link: *ucontext_t,
608 stack: stack_t,
609 pad: [7]i32,
610 regs: *mcontext_t,
611 sigmask: sigset_t,
612 pad2: [3]i32,
613 mcontext: mcontext_t,
614};
615
616pub const Elf_Symndx = u32;
617
618pub const MMAP2_UNIT = 4096;
lib/std/os/bits/linux/powerpc64.zig deleted-601
......@@ -1,601 +0,0 @@
1const std = @import("../../../std.zig");
2const linux = std.os.linux;
3const socklen_t = linux.socklen_t;
4const iovec = linux.iovec;
5const iovec_const = linux.iovec_const;
6const uid_t = linux.uid_t;
7const gid_t = linux.gid_t;
8const pid_t = linux.pid_t;
9const stack_t = linux.stack_t;
10const sigset_t = linux.sigset_t;
11pub const SYS = enum(usize) {
12 restart_syscall = 0,
13 exit = 1,
14 fork = 2,
15 read = 3,
16 write = 4,
17 open = 5,
18 close = 6,
19 waitpid = 7,
20 creat = 8,
21 link = 9,
22 unlink = 10,
23 execve = 11,
24 chdir = 12,
25 time = 13,
26 mknod = 14,
27 chmod = 15,
28 lchown = 16,
29 @"break" = 17,
30 oldstat = 18,
31 lseek = 19,
32 getpid = 20,
33 mount = 21,
34 umount = 22,
35 setuid = 23,
36 getuid = 24,
37 stime = 25,
38 ptrace = 26,
39 alarm = 27,
40 oldfstat = 28,
41 pause = 29,
42 utime = 30,
43 stty = 31,
44 gtty = 32,
45 access = 33,
46 nice = 34,
47 ftime = 35,
48 sync = 36,
49 kill = 37,
50 rename = 38,
51 mkdir = 39,
52 rmdir = 40,
53 dup = 41,
54 pipe = 42,
55 times = 43,
56 prof = 44,
57 brk = 45,
58 setgid = 46,
59 getgid = 47,
60 signal = 48,
61 geteuid = 49,
62 getegid = 50,
63 acct = 51,
64 umount2 = 52,
65 lock = 53,
66 ioctl = 54,
67 fcntl = 55,
68 mpx = 56,
69 setpgid = 57,
70 ulimit = 58,
71 oldolduname = 59,
72 umask = 60,
73 chroot = 61,
74 ustat = 62,
75 dup2 = 63,
76 getppid = 64,
77 getpgrp = 65,
78 setsid = 66,
79 sigaction = 67,
80 sgetmask = 68,
81 ssetmask = 69,
82 setreuid = 70,
83 setregid = 71,
84 sigsuspend = 72,
85 sigpending = 73,
86 sethostname = 74,
87 setrlimit = 75,
88 getrlimit = 76,
89 getrusage = 77,
90 gettimeofday = 78,
91 settimeofday = 79,
92 getgroups = 80,
93 setgroups = 81,
94 select = 82,
95 symlink = 83,
96 oldlstat = 84,
97 readlink = 85,
98 uselib = 86,
99 swapon = 87,
100 reboot = 88,
101 readdir = 89,
102 mmap = 90,
103 munmap = 91,
104 truncate = 92,
105 ftruncate = 93,
106 fchmod = 94,
107 fchown = 95,
108 getpriority = 96,
109 setpriority = 97,
110 profil = 98,
111 statfs = 99,
112 fstatfs = 100,
113 ioperm = 101,
114 socketcall = 102,
115 syslog = 103,
116 setitimer = 104,
117 getitimer = 105,
118 stat = 106,
119 lstat = 107,
120 fstat = 108,
121 olduname = 109,
122 iopl = 110,
123 vhangup = 111,
124 idle = 112,
125 vm86 = 113,
126 wait4 = 114,
127 swapoff = 115,
128 sysinfo = 116,
129 ipc = 117,
130 fsync = 118,
131 sigreturn = 119,
132 clone = 120,
133 setdomainname = 121,
134 uname = 122,
135 modify_ldt = 123,
136 adjtimex = 124,
137 mprotect = 125,
138 sigprocmask = 126,
139 create_module = 127,
140 init_module = 128,
141 delete_module = 129,
142 get_kernel_syms = 130,
143 quotactl = 131,
144 getpgid = 132,
145 fchdir = 133,
146 bdflush = 134,
147 sysfs = 135,
148 personality = 136,
149 afs_syscall = 137,
150 setfsuid = 138,
151 setfsgid = 139,
152 _llseek = 140,
153 getdents = 141,
154 _newselect = 142,
155 flock = 143,
156 msync = 144,
157 readv = 145,
158 writev = 146,
159 getsid = 147,
160 fdatasync = 148,
161 _sysctl = 149,
162 mlock = 150,
163 munlock = 151,
164 mlockall = 152,
165 munlockall = 153,
166 sched_setparam = 154,
167 sched_getparam = 155,
168 sched_setscheduler = 156,
169 sched_getscheduler = 157,
170 sched_yield = 158,
171 sched_get_priority_max = 159,
172 sched_get_priority_min = 160,
173 sched_rr_get_interval = 161,
174 nanosleep = 162,
175 mremap = 163,
176 setresuid = 164,
177 getresuid = 165,
178 query_module = 166,
179 poll = 167,
180 nfsservctl = 168,
181 setresgid = 169,
182 getresgid = 170,
183 prctl = 171,
184 rt_sigreturn = 172,
185 rt_sigaction = 173,
186 rt_sigprocmask = 174,
187 rt_sigpending = 175,
188 rt_sigtimedwait = 176,
189 rt_sigqueueinfo = 177,
190 rt_sigsuspend = 178,
191 pread64 = 179,
192 pwrite64 = 180,
193 chown = 181,
194 getcwd = 182,
195 capget = 183,
196 capset = 184,
197 sigaltstack = 185,
198 sendfile = 186,
199 getpmsg = 187,
200 putpmsg = 188,
201 vfork = 189,
202 ugetrlimit = 190,
203 readahead = 191,
204 pciconfig_read = 198,
205 pciconfig_write = 199,
206 pciconfig_iobase = 200,
207 multiplexer = 201,
208 getdents64 = 202,
209 pivot_root = 203,
210 madvise = 205,
211 mincore = 206,
212 gettid = 207,
213 tkill = 208,
214 setxattr = 209,
215 lsetxattr = 210,
216 fsetxattr = 211,
217 getxattr = 212,
218 lgetxattr = 213,
219 fgetxattr = 214,
220 listxattr = 215,
221 llistxattr = 216,
222 flistxattr = 217,
223 removexattr = 218,
224 lremovexattr = 219,
225 fremovexattr = 220,
226 futex = 221,
227 sched_setaffinity = 222,
228 sched_getaffinity = 223,
229 tuxcall = 225,
230 io_setup = 227,
231 io_destroy = 228,
232 io_getevents = 229,
233 io_submit = 230,
234 io_cancel = 231,
235 set_tid_address = 232,
236 fadvise64 = 233,
237 exit_group = 234,
238 lookup_dcookie = 235,
239 epoll_create = 236,
240 epoll_ctl = 237,
241 epoll_wait = 238,
242 remap_file_pages = 239,
243 timer_create = 240,
244 timer_settime = 241,
245 timer_gettime = 242,
246 timer_getoverrun = 243,
247 timer_delete = 244,
248 clock_settime = 245,
249 clock_gettime = 246,
250 clock_getres = 247,
251 clock_nanosleep = 248,
252 swapcontext = 249,
253 tgkill = 250,
254 utimes = 251,
255 statfs64 = 252,
256 fstatfs64 = 253,
257 rtas = 255,
258 sys_debug_setcontext = 256,
259 migrate_pages = 258,
260 mbind = 259,
261 get_mempolicy = 260,
262 set_mempolicy = 261,
263 mq_open = 262,
264 mq_unlink = 263,
265 mq_timedsend = 264,
266 mq_timedreceive = 265,
267 mq_notify = 266,
268 mq_getsetattr = 267,
269 kexec_load = 268,
270 add_key = 269,
271 request_key = 270,
272 keyctl = 271,
273 waitid = 272,
274 ioprio_set = 273,
275 ioprio_get = 274,
276 inotify_init = 275,
277 inotify_add_watch = 276,
278 inotify_rm_watch = 277,
279 spu_run = 278,
280 spu_create = 279,
281 pselect6 = 280,
282 ppoll = 281,
283 unshare = 282,
284 splice = 283,
285 tee = 284,
286 vmsplice = 285,
287 openat = 286,
288 mkdirat = 287,
289 mknodat = 288,
290 fchownat = 289,
291 futimesat = 290,
292 fstatat = 291,
293 unlinkat = 292,
294 renameat = 293,
295 linkat = 294,
296 symlinkat = 295,
297 readlinkat = 296,
298 fchmodat = 297,
299 faccessat = 298,
300 get_robust_list = 299,
301 set_robust_list = 300,
302 move_pages = 301,
303 getcpu = 302,
304 epoll_pwait = 303,
305 utimensat = 304,
306 signalfd = 305,
307 timerfd_create = 306,
308 eventfd = 307,
309 sync_file_range = 308,
310 fallocate = 309,
311 subpage_prot = 310,
312 timerfd_settime = 311,
313 timerfd_gettime = 312,
314 signalfd4 = 313,
315 eventfd2 = 314,
316 epoll_create1 = 315,
317 dup3 = 316,
318 pipe2 = 317,
319 inotify_init1 = 318,
320 perf_event_open = 319,
321 preadv = 320,
322 pwritev = 321,
323 rt_tgsigqueueinfo = 322,
324 fanotify_init = 323,
325 fanotify_mark = 324,
326 prlimit64 = 325,
327 socket = 326,
328 bind = 327,
329 connect = 328,
330 listen = 329,
331 accept = 330,
332 getsockname = 331,
333 getpeername = 332,
334 socketpair = 333,
335 send = 334,
336 sendto = 335,
337 recv = 336,
338 recvfrom = 337,
339 shutdown = 338,
340 setsockopt = 339,
341 getsockopt = 340,
342 sendmsg = 341,
343 recvmsg = 342,
344 recvmmsg = 343,
345 accept4 = 344,
346 name_to_handle_at = 345,
347 open_by_handle_at = 346,
348 clock_adjtime = 347,
349 syncfs = 348,
350 sendmmsg = 349,
351 setns = 350,
352 process_vm_readv = 351,
353 process_vm_writev = 352,
354 finit_module = 353,
355 kcmp = 354,
356 sched_setattr = 355,
357 sched_getattr = 356,
358 renameat2 = 357,
359 seccomp = 358,
360 getrandom = 359,
361 memfd_create = 360,
362 bpf = 361,
363 execveat = 362,
364 switch_endian = 363,
365 userfaultfd = 364,
366 membarrier = 365,
367 mlock2 = 378,
368 copy_file_range = 379,
369 preadv2 = 380,
370 pwritev2 = 381,
371 kexec_file_load = 382,
372 statx = 383,
373 pkey_alloc = 384,
374 pkey_free = 385,
375 pkey_mprotect = 386,
376 rseq = 387,
377 io_pgetevents = 388,
378 semtimedop = 392,
379 semget = 393,
380 semctl = 394,
381 shmget = 395,
382 shmctl = 396,
383 shmat = 397,
384 shmdt = 398,
385 msgget = 399,
386 msgsnd = 400,
387 msgrcv = 401,
388 msgctl = 402,
389 pidfd_send_signal = 424,
390 io_uring_setup = 425,
391 io_uring_enter = 426,
392 io_uring_register = 427,
393 open_tree = 428,
394 move_mount = 429,
395 fsopen = 430,
396 fsconfig = 431,
397 fsmount = 432,
398 fspick = 433,
399 pidfd_open = 434,
400 clone3 = 435,
401 close_range = 436,
402 openat2 = 437,
403 pidfd_getfd = 438,
404 faccessat2 = 439,
405 process_madvise = 440,
406 epoll_pwait2 = 441,
407
408 _,
409};
410
411pub const O_CREAT = 0o100;
412pub const O_EXCL = 0o200;
413pub const O_NOCTTY = 0o400;
414pub const O_TRUNC = 0o1000;
415pub const O_APPEND = 0o2000;
416pub const O_NONBLOCK = 0o4000;
417pub const O_DSYNC = 0o10000;
418pub const O_SYNC = 0o4010000;
419pub const O_RSYNC = 0o4010000;
420pub const O_DIRECTORY = 0o40000;
421pub const O_NOFOLLOW = 0o100000;
422pub const O_CLOEXEC = 0o2000000;
423
424pub const O_ASYNC = 0o20000;
425pub const O_DIRECT = 0o400000;
426pub const O_LARGEFILE = 0o200000;
427pub const O_NOATIME = 0o1000000;
428pub const O_PATH = 0o10000000;
429pub const O_TMPFILE = 0o20200000;
430pub const O_NDELAY = O_NONBLOCK;
431
432pub const F_DUPFD = 0;
433pub const F_GETFD = 1;
434pub const F_SETFD = 2;
435pub const F_GETFL = 3;
436pub const F_SETFL = 4;
437
438pub const F_SETOWN = 8;
439pub const F_GETOWN = 9;
440pub const F_SETSIG = 10;
441pub const F_GETSIG = 11;
442
443pub const F_GETLK = 5;
444pub const F_SETLK = 6;
445pub const F_SETLKW = 7;
446
447pub const F_RDLCK = 0;
448pub const F_WRLCK = 1;
449pub const F_UNLCK = 2;
450
451pub const LOCK_SH = 1;
452pub const LOCK_EX = 2;
453pub const LOCK_UN = 8;
454pub const LOCK_NB = 4;
455
456pub const F_SETOWN_EX = 15;
457pub const F_GETOWN_EX = 16;
458
459pub const F_GETOWNER_UIDS = 17;
460
461/// stack-like segment
462pub const MAP_GROWSDOWN = 0x0100;
463
464/// ETXTBSY
465pub const MAP_DENYWRITE = 0x0800;
466
467/// mark it as an executable
468pub const MAP_EXECUTABLE = 0x1000;
469
470/// pages are locked
471pub const MAP_LOCKED = 0x0080;
472
473/// don't check for reservations
474pub const MAP_NORESERVE = 0x0040;
475
476pub const VDSO_CGT_SYM = "__kernel_clock_gettime";
477pub const VDSO_CGT_VER = "LINUX_2.6.15";
478
479pub const Flock = extern struct {
480 l_type: i16,
481 l_whence: i16,
482 l_start: off_t,
483 l_len: off_t,
484 l_pid: pid_t,
485 __unused: [4]u8,
486};
487
488pub const msghdr = extern struct {
489 msg_name: ?*sockaddr,
490 msg_namelen: socklen_t,
491 msg_iov: [*]iovec,
492 msg_iovlen: usize,
493 msg_control: ?*c_void,
494 msg_controllen: usize,
495 msg_flags: i32,
496};
497
498pub const msghdr_const = extern struct {
499 msg_name: ?*const sockaddr,
500 msg_namelen: socklen_t,
501 msg_iov: [*]iovec_const,
502 msg_iovlen: usize,
503 msg_control: ?*c_void,
504 msg_controllen: usize,
505 msg_flags: i32,
506};
507
508pub const blksize_t = i64;
509pub const nlink_t = u64;
510pub const time_t = i64;
511pub const mode_t = u32;
512pub const off_t = i64;
513pub const ino_t = u64;
514pub const dev_t = u64;
515pub const blkcnt_t = i64;
516
517// The `stat` definition used by the Linux kernel.
518pub const Stat = extern struct {
519 dev: dev_t,
520 ino: ino_t,
521 nlink: nlink_t,
522 mode: mode_t,
523 uid: uid_t,
524 gid: gid_t,
525 rdev: dev_t,
526 size: off_t,
527 blksize: blksize_t,
528 blocks: blkcnt_t,
529 atim: timespec,
530 mtim: timespec,
531 ctim: timespec,
532 __unused: [3]u64,
533
534 pub fn atime(self: @This()) timespec {
535 return self.atim;
536 }
537
538 pub fn mtime(self: @This()) timespec {
539 return self.mtim;
540 }
541
542 pub fn ctime(self: @This()) timespec {
543 return self.ctim;
544 }
545};
546
547pub const timespec = extern struct {
548 tv_sec: time_t,
549 tv_nsec: isize,
550};
551
552pub const timeval = extern struct {
553 tv_sec: isize,
554 tv_usec: isize,
555};
556
557pub const timezone = extern struct {
558 tz_minuteswest: i32,
559 tz_dsttime: i32,
560};
561
562pub const greg_t = u64;
563pub const gregset_t = [48]greg_t;
564pub const fpregset_t = [33]f64;
565
566/// The position of the vscr register depends on endianness.
567/// On C, macros are used to change vscr_word's offset to
568/// account for this. Here we'll just define vscr_word_le
569/// and vscr_word_be. Code must take care to use the correct one.
570pub const vrregset = extern struct {
571 vrregs: [32][4]u32 align(16),
572 vscr_word_le: u32,
573 _pad1: [2]u32,
574 vscr_word_be: u32,
575 vrsave: u32,
576 _pad2: [3]u32,
577};
578pub const vrregset_t = vrregset;
579
580pub const mcontext_t = extern struct {
581 __unused: [4]u64,
582 signal: i32,
583 _pad0: i32,
584 handler: u64,
585 oldmask: u64,
586 regs: ?*c_void,
587 gp_regs: gregset_t,
588 fp_regs: fpregset_t,
589 v_regs: *vrregset_t,
590 vmx_reserve: [34 + 34 + 32 + 1]i64,
591};
592
593pub const ucontext_t = extern struct {
594 flags: u32,
595 link: *ucontext_t,
596 stack: stack_t,
597 sigmask: sigset_t,
598 mcontext: mcontext_t,
599};
600
601pub const Elf_Symndx = u32;
lib/std/os/bits/linux/riscv64.zig deleted-420
......@@ -1,420 +0,0 @@
1// riscv64-specific declarations that are intended to be imported into the POSIX namespace.
2const std = @import("../../../std.zig");
3const uid_t = std.os.linux.uid_t;
4const gid_t = std.os.linux.gid_t;
5const pid_t = std.os.linux.pid_t;
6
7pub const SYS = enum(usize) {
8 pub const arch_specific_syscall = 244;
9
10 io_setup = 0,
11 io_destroy = 1,
12 io_submit = 2,
13 io_cancel = 3,
14 io_getevents = 4,
15 setxattr = 5,
16 lsetxattr = 6,
17 fsetxattr = 7,
18 getxattr = 8,
19 lgetxattr = 9,
20 fgetxattr = 10,
21 listxattr = 11,
22 llistxattr = 12,
23 flistxattr = 13,
24 removexattr = 14,
25 lremovexattr = 15,
26 fremovexattr = 16,
27 getcwd = 17,
28 lookup_dcookie = 18,
29 eventfd2 = 19,
30 epoll_create1 = 20,
31 epoll_ctl = 21,
32 epoll_pwait = 22,
33 dup = 23,
34 dup3 = 24,
35 fcntl = 25,
36 inotify_init1 = 26,
37 inotify_add_watch = 27,
38 inotify_rm_watch = 28,
39 ioctl = 29,
40 ioprio_set = 30,
41 ioprio_get = 31,
42 flock = 32,
43 mknodat = 33,
44 mkdirat = 34,
45 unlinkat = 35,
46 symlinkat = 36,
47 linkat = 37,
48 umount2 = 39,
49 mount = 40,
50 pivot_root = 41,
51 nfsservctl = 42,
52 statfs = 43,
53 fstatfs = 44,
54 truncate = 45,
55 ftruncate = 46,
56 fallocate = 47,
57 faccessat = 48,
58 chdir = 49,
59 fchdir = 50,
60 chroot = 51,
61 fchmod = 52,
62 fchmodat = 53,
63 fchownat = 54,
64 fchown = 55,
65 openat = 56,
66 close = 57,
67 vhangup = 58,
68 pipe2 = 59,
69 quotactl = 60,
70 getdents64 = 61,
71 lseek = 62,
72 read = 63,
73 write = 64,
74 readv = 65,
75 writev = 66,
76 pread64 = 67,
77 pwrite64 = 68,
78 preadv = 69,
79 pwritev = 70,
80 sendfile = 71,
81 pselect6 = 72,
82 ppoll = 73,
83 signalfd4 = 74,
84 vmsplice = 75,
85 splice = 76,
86 tee = 77,
87 readlinkat = 78,
88 fstatat = 79,
89 fstat = 80,
90 sync = 81,
91 fsync = 82,
92 fdatasync = 83,
93 sync_file_range = 84,
94 timerfd_create = 85,
95 timerfd_settime = 86,
96 timerfd_gettime = 87,
97 utimensat = 88,
98 acct = 89,
99 capget = 90,
100 capset = 91,
101 personality = 92,
102 exit = 93,
103 exit_group = 94,
104 waitid = 95,
105 set_tid_address = 96,
106 unshare = 97,
107 futex = 98,
108 set_robust_list = 99,
109 get_robust_list = 100,
110 nanosleep = 101,
111 getitimer = 102,
112 setitimer = 103,
113 kexec_load = 104,
114 init_module = 105,
115 delete_module = 106,
116 timer_create = 107,
117 timer_gettime = 108,
118 timer_getoverrun = 109,
119 timer_settime = 110,
120 timer_delete = 111,
121 clock_settime = 112,
122 clock_gettime = 113,
123 clock_getres = 114,
124 clock_nanosleep = 115,
125 syslog = 116,
126 ptrace = 117,
127 sched_setparam = 118,
128 sched_setscheduler = 119,
129 sched_getscheduler = 120,
130 sched_getparam = 121,
131 sched_setaffinity = 122,
132 sched_getaffinity = 123,
133 sched_yield = 124,
134 sched_get_priority_max = 125,
135 sched_get_priority_min = 126,
136 sched_rr_get_interval = 127,
137 restart_syscall = 128,
138 kill = 129,
139 tkill = 130,
140 tgkill = 131,
141 sigaltstack = 132,
142 rt_sigsuspend = 133,
143 rt_sigaction = 134,
144 rt_sigprocmask = 135,
145 rt_sigpending = 136,
146 rt_sigtimedwait = 137,
147 rt_sigqueueinfo = 138,
148 rt_sigreturn = 139,
149 setpriority = 140,
150 getpriority = 141,
151 reboot = 142,
152 setregid = 143,
153 setgid = 144,
154 setreuid = 145,
155 setuid = 146,
156 setresuid = 147,
157 getresuid = 148,
158 setresgid = 149,
159 getresgid = 150,
160 setfsuid = 151,
161 setfsgid = 152,
162 times = 153,
163 setpgid = 154,
164 getpgid = 155,
165 getsid = 156,
166 setsid = 157,
167 getgroups = 158,
168 setgroups = 159,
169 uname = 160,
170 sethostname = 161,
171 setdomainname = 162,
172 getrlimit = 163,
173 setrlimit = 164,
174 getrusage = 165,
175 umask = 166,
176 prctl = 167,
177 getcpu = 168,
178 gettimeofday = 169,
179 settimeofday = 170,
180 adjtimex = 171,
181 getpid = 172,
182 getppid = 173,
183 getuid = 174,
184 geteuid = 175,
185 getgid = 176,
186 getegid = 177,
187 gettid = 178,
188 sysinfo = 179,
189 mq_open = 180,
190 mq_unlink = 181,
191 mq_timedsend = 182,
192 mq_timedreceive = 183,
193 mq_notify = 184,
194 mq_getsetattr = 185,
195 msgget = 186,
196 msgctl = 187,
197 msgrcv = 188,
198 msgsnd = 189,
199 semget = 190,
200 semctl = 191,
201 semtimedop = 192,
202 semop = 193,
203 shmget = 194,
204 shmctl = 195,
205 shmat = 196,
206 shmdt = 197,
207 socket = 198,
208 socketpair = 199,
209 bind = 200,
210 listen = 201,
211 accept = 202,
212 connect = 203,
213 getsockname = 204,
214 getpeername = 205,
215 sendto = 206,
216 recvfrom = 207,
217 setsockopt = 208,
218 getsockopt = 209,
219 shutdown = 210,
220 sendmsg = 211,
221 recvmsg = 212,
222 readahead = 213,
223 brk = 214,
224 munmap = 215,
225 mremap = 216,
226 add_key = 217,
227 request_key = 218,
228 keyctl = 219,
229 clone = 220,
230 execve = 221,
231 mmap = 222,
232 fadvise64 = 223,
233 swapon = 224,
234 swapoff = 225,
235 mprotect = 226,
236 msync = 227,
237 mlock = 228,
238 munlock = 229,
239 mlockall = 230,
240 munlockall = 231,
241 mincore = 232,
242 madvise = 233,
243 remap_file_pages = 234,
244 mbind = 235,
245 get_mempolicy = 236,
246 set_mempolicy = 237,
247 migrate_pages = 238,
248 move_pages = 239,
249 rt_tgsigqueueinfo = 240,
250 perf_event_open = 241,
251 accept4 = 242,
252 recvmmsg = 243,
253
254 riscv_flush_icache = arch_specific_syscall + 15,
255
256 wait4 = 260,
257 prlimit64 = 261,
258 fanotify_init = 262,
259 fanotify_mark = 263,
260 name_to_handle_at = 264,
261 open_by_handle_at = 265,
262 clock_adjtime = 266,
263 syncfs = 267,
264 setns = 268,
265 sendmmsg = 269,
266 process_vm_readv = 270,
267 process_vm_writev = 271,
268 kcmp = 272,
269 finit_module = 273,
270 sched_setattr = 274,
271 sched_getattr = 275,
272 renameat2 = 276,
273 seccomp = 277,
274 getrandom = 278,
275 memfd_create = 279,
276 bpf = 280,
277 execveat = 281,
278 userfaultfd = 282,
279 membarrier = 283,
280 mlock2 = 284,
281 copy_file_range = 285,
282 preadv2 = 286,
283 pwritev2 = 287,
284 pkey_mprotect = 288,
285 pkey_alloc = 289,
286 pkey_free = 290,
287 statx = 291,
288 io_pgetevents = 292,
289 rseq = 293,
290 kexec_file_load = 294,
291 pidfd_send_signal = 424,
292 io_uring_setup = 425,
293 io_uring_enter = 426,
294 io_uring_register = 427,
295 open_tree = 428,
296 move_mount = 429,
297 fsopen = 430,
298 fsconfig = 431,
299 fsmount = 432,
300 fspick = 433,
301 pidfd_open = 434,
302 clone3 = 435,
303 close_range = 436,
304 openat2 = 437,
305 pidfd_getfd = 438,
306 faccessat2 = 439,
307 process_madvise = 440,
308 epoll_pwait2 = 441,
309
310 _,
311};
312
313pub const O_CREAT = 0o100;
314pub const O_EXCL = 0o200;
315pub const O_NOCTTY = 0o400;
316pub const O_TRUNC = 0o1000;
317pub const O_APPEND = 0o2000;
318pub const O_NONBLOCK = 0o4000;
319pub const O_DSYNC = 0o10000;
320pub const O_SYNC = 0o4010000;
321pub const O_RSYNC = 0o4010000;
322pub const O_DIRECTORY = 0o200000;
323pub const O_NOFOLLOW = 0o400000;
324pub const O_CLOEXEC = 0o2000000;
325
326pub const O_ASYNC = 0o20000;
327pub const O_DIRECT = 0o40000;
328pub const O_LARGEFILE = 0o100000;
329pub const O_NOATIME = 0o1000000;
330pub const O_PATH = 0o10000000;
331pub const O_TMPFILE = 0o20200000;
332pub const O_NDELAY = O_NONBLOCK;
333
334pub const F_DUPFD = 0;
335pub const F_GETFD = 1;
336pub const F_SETFD = 2;
337pub const F_GETFL = 3;
338pub const F_SETFL = 4;
339pub const F_GETLK = 5;
340pub const F_SETLK = 6;
341pub const F_SETLKW = 7;
342pub const F_SETOWN = 8;
343pub const F_GETOWN = 9;
344pub const F_SETSIG = 10;
345pub const F_GETSIG = 11;
346
347pub const F_RDLCK = 0;
348pub const F_WRLCK = 1;
349pub const F_UNLCK = 2;
350
351pub const LOCK_SH = 1;
352pub const LOCK_EX = 2;
353pub const LOCK_UN = 8;
354pub const LOCK_NB = 4;
355
356pub const F_SETOWN_EX = 15;
357pub const F_GETOWN_EX = 16;
358
359pub const F_GETOWNER_UIDS = 17;
360
361pub const blksize_t = i32;
362pub const nlink_t = u32;
363pub const time_t = isize;
364pub const mode_t = u32;
365pub const off_t = isize;
366pub const ino_t = usize;
367pub const dev_t = usize;
368pub const blkcnt_t = isize;
369pub const timespec = extern struct {
370 tv_sec: time_t,
371 tv_nsec: isize,
372};
373
374pub const timeval = extern struct {
375 tv_sec: time_t,
376 tv_usec: i64,
377};
378
379pub const Flock = extern struct {
380 l_type: i16,
381 l_whence: i16,
382 l_start: off_t,
383 l_len: off_t,
384 l_pid: pid_t,
385 __unused: [4]u8,
386};
387
388// The `stat` definition used by the Linux kernel.
389pub const Stat = extern struct {
390 dev: dev_t,
391 ino: ino_t,
392 mode: mode_t,
393 nlink: nlink_t,
394 uid: uid_t,
395 gid: gid_t,
396 rdev: dev_t,
397 __pad: usize,
398 size: off_t,
399 blksize: blksize_t,
400 __pad2: i32,
401 blocks: blkcnt_t,
402 atim: timespec,
403 mtim: timespec,
404 ctim: timespec,
405 __unused: [2]u32,
406
407 pub fn atime(self: @This()) timespec {
408 return self.atim;
409 }
410
411 pub fn mtime(self: @This()) timespec {
412 return self.mtim;
413 }
414
415 pub fn ctime(self: @This()) timespec {
416 return self.ctim;
417 }
418};
419
420pub const Elf_Symndx = u32;
lib/std/os/bits/linux/sparc64.zig deleted-641
......@@ -1,641 +0,0 @@
1// sparc64-specific declarations that are intended to be imported into the POSIX namespace.
2const std = @import("../../../std.zig");
3const pid_t = linux.pid_t;
4const uid_t = linux.uid_t;
5const clock_t = linux.clock_t;
6const stack_t = linux.stack_t;
7const sigset_t = linux.sigset_t;
8
9const linux = std.os.linux;
10const sockaddr = linux.sockaddr;
11const socklen_t = linux.socklen_t;
12const iovec = linux.iovec;
13const iovec_const = linux.iovec_const;
14
15pub const SYS = enum(usize) {
16 restart_syscall = 0,
17 exit = 1,
18 fork = 2,
19 read = 3,
20 write = 4,
21 open = 5,
22 close = 6,
23 wait4 = 7,
24 creat = 8,
25 link = 9,
26 unlink = 10,
27 execv = 11,
28 chdir = 12,
29 chown = 13,
30 mknod = 14,
31 chmod = 15,
32 lchown = 16,
33 brk = 17,
34 perfctr = 18,
35 lseek = 19,
36 getpid = 20,
37 capget = 21,
38 capset = 22,
39 setuid = 23,
40 getuid = 24,
41 vmsplice = 25,
42 ptrace = 26,
43 alarm = 27,
44 sigaltstack = 28,
45 pause = 29,
46 utime = 30,
47 access = 33,
48 nice = 34,
49 sync = 36,
50 kill = 37,
51 stat = 38,
52 sendfile = 39,
53 lstat = 40,
54 dup = 41,
55 pipe = 42,
56 times = 43,
57 umount2 = 45,
58 setgid = 46,
59 getgid = 47,
60 signal = 48,
61 geteuid = 49,
62 getegid = 50,
63 acct = 51,
64 memory_ordering = 52,
65 ioctl = 54,
66 reboot = 55,
67 symlink = 57,
68 readlink = 58,
69 execve = 59,
70 umask = 60,
71 chroot = 61,
72 fstat = 62,
73 fstat64 = 63,
74 getpagesize = 64,
75 msync = 65,
76 vfork = 66,
77 pread64 = 67,
78 pwrite64 = 68,
79 mmap = 71,
80 munmap = 73,
81 mprotect = 74,
82 madvise = 75,
83 vhangup = 76,
84 mincore = 78,
85 getgroups = 79,
86 setgroups = 80,
87 getpgrp = 81,
88 setitimer = 83,
89 swapon = 85,
90 getitimer = 86,
91 sethostname = 88,
92 dup2 = 90,
93 fcntl = 92,
94 select = 93,
95 fsync = 95,
96 setpriority = 96,
97 socket = 97,
98 connect = 98,
99 accept = 99,
100 getpriority = 100,
101 rt_sigreturn = 101,
102 rt_sigaction = 102,
103 rt_sigprocmask = 103,
104 rt_sigpending = 104,
105 rt_sigtimedwait = 105,
106 rt_sigqueueinfo = 106,
107 rt_sigsuspend = 107,
108 setresuid = 108,
109 getresuid = 109,
110 setresgid = 110,
111 getresgid = 111,
112 recvmsg = 113,
113 sendmsg = 114,
114 gettimeofday = 116,
115 getrusage = 117,
116 getsockopt = 118,
117 getcwd = 119,
118 readv = 120,
119 writev = 121,
120 settimeofday = 122,
121 fchown = 123,
122 fchmod = 124,
123 recvfrom = 125,
124 setreuid = 126,
125 setregid = 127,
126 rename = 128,
127 truncate = 129,
128 ftruncate = 130,
129 flock = 131,
130 lstat64 = 132,
131 sendto = 133,
132 shutdown = 134,
133 socketpair = 135,
134 mkdir = 136,
135 rmdir = 137,
136 utimes = 138,
137 stat64 = 139,
138 sendfile64 = 140,
139 getpeername = 141,
140 futex = 142,
141 gettid = 143,
142 getrlimit = 144,
143 setrlimit = 145,
144 pivot_root = 146,
145 prctl = 147,
146 pciconfig_read = 148,
147 pciconfig_write = 149,
148 getsockname = 150,
149 inotify_init = 151,
150 inotify_add_watch = 152,
151 poll = 153,
152 getdents64 = 154,
153 inotify_rm_watch = 156,
154 statfs = 157,
155 fstatfs = 158,
156 umount = 159,
157 sched_set_affinity = 160,
158 sched_get_affinity = 161,
159 getdomainname = 162,
160 setdomainname = 163,
161 utrap_install = 164,
162 quotactl = 165,
163 set_tid_address = 166,
164 mount = 167,
165 ustat = 168,
166 setxattr = 169,
167 lsetxattr = 170,
168 fsetxattr = 171,
169 getxattr = 172,
170 lgetxattr = 173,
171 getdents = 174,
172 setsid = 175,
173 fchdir = 176,
174 fgetxattr = 177,
175 listxattr = 178,
176 llistxattr = 179,
177 flistxattr = 180,
178 removexattr = 181,
179 lremovexattr = 182,
180 sigpending = 183,
181 query_module = 184,
182 setpgid = 185,
183 fremovexattr = 186,
184 tkill = 187,
185 exit_group = 188,
186 uname = 189,
187 init_module = 190,
188 personality = 191,
189 remap_file_pages = 192,
190 epoll_create = 193,
191 epoll_ctl = 194,
192 epoll_wait = 195,
193 ioprio_set = 196,
194 getppid = 197,
195 sigaction = 198,
196 sgetmask = 199,
197 ssetmask = 200,
198 sigsuspend = 201,
199 oldlstat = 202,
200 uselib = 203,
201 readdir = 204,
202 readahead = 205,
203 socketcall = 206,
204 syslog = 207,
205 lookup_dcookie = 208,
206 fadvise64 = 209,
207 fadvise64_64 = 210,
208 tgkill = 211,
209 waitpid = 212,
210 swapoff = 213,
211 sysinfo = 214,
212 ipc = 215,
213 sigreturn = 216,
214 clone = 217,
215 ioprio_get = 218,
216 adjtimex = 219,
217 sigprocmask = 220,
218 create_module = 221,
219 delete_module = 222,
220 get_kernel_syms = 223,
221 getpgid = 224,
222 bdflush = 225,
223 sysfs = 226,
224 afs_syscall = 227,
225 setfsuid = 228,
226 setfsgid = 229,
227 _newselect = 230,
228 splice = 232,
229 stime = 233,
230 statfs64 = 234,
231 fstatfs64 = 235,
232 _llseek = 236,
233 mlock = 237,
234 munlock = 238,
235 mlockall = 239,
236 munlockall = 240,
237 sched_setparam = 241,
238 sched_getparam = 242,
239 sched_setscheduler = 243,
240 sched_getscheduler = 244,
241 sched_yield = 245,
242 sched_get_priority_max = 246,
243 sched_get_priority_min = 247,
244 sched_rr_get_interval = 248,
245 nanosleep = 249,
246 mremap = 250,
247 _sysctl = 251,
248 getsid = 252,
249 fdatasync = 253,
250 nfsservctl = 254,
251 sync_file_range = 255,
252 clock_settime = 256,
253 clock_gettime = 257,
254 clock_getres = 258,
255 clock_nanosleep = 259,
256 sched_getaffinity = 260,
257 sched_setaffinity = 261,
258 timer_settime = 262,
259 timer_gettime = 263,
260 timer_getoverrun = 264,
261 timer_delete = 265,
262 timer_create = 266,
263 vserver = 267,
264 io_setup = 268,
265 io_destroy = 269,
266 io_submit = 270,
267 io_cancel = 271,
268 io_getevents = 272,
269 mq_open = 273,
270 mq_unlink = 274,
271 mq_timedsend = 275,
272 mq_timedreceive = 276,
273 mq_notify = 277,
274 mq_getsetattr = 278,
275 waitid = 279,
276 tee = 280,
277 add_key = 281,
278 request_key = 282,
279 keyctl = 283,
280 openat = 284,
281 mkdirat = 285,
282 mknodat = 286,
283 fchownat = 287,
284 futimesat = 288,
285 fstatat64 = 289,
286 unlinkat = 290,
287 renameat = 291,
288 linkat = 292,
289 symlinkat = 293,
290 readlinkat = 294,
291 fchmodat = 295,
292 faccessat = 296,
293 pselect6 = 297,
294 ppoll = 298,
295 unshare = 299,
296 set_robust_list = 300,
297 get_robust_list = 301,
298 migrate_pages = 302,
299 mbind = 303,
300 get_mempolicy = 304,
301 set_mempolicy = 305,
302 kexec_load = 306,
303 move_pages = 307,
304 getcpu = 308,
305 epoll_pwait = 309,
306 utimensat = 310,
307 signalfd = 311,
308 timerfd_create = 312,
309 eventfd = 313,
310 fallocate = 314,
311 timerfd_settime = 315,
312 timerfd_gettime = 316,
313 signalfd4 = 317,
314 eventfd2 = 318,
315 epoll_create1 = 319,
316 dup3 = 320,
317 pipe2 = 321,
318 inotify_init1 = 322,
319 accept4 = 323,
320 preadv = 324,
321 pwritev = 325,
322 rt_tgsigqueueinfo = 326,
323 perf_event_open = 327,
324 recvmmsg = 328,
325 fanotify_init = 329,
326 fanotify_mark = 330,
327 prlimit64 = 331,
328 name_to_handle_at = 332,
329 open_by_handle_at = 333,
330 clock_adjtime = 334,
331 syncfs = 335,
332 sendmmsg = 336,
333 setns = 337,
334 process_vm_readv = 338,
335 process_vm_writev = 339,
336 kern_features = 340,
337 kcmp = 341,
338 finit_module = 342,
339 sched_setattr = 343,
340 sched_getattr = 344,
341 renameat2 = 345,
342 seccomp = 346,
343 getrandom = 347,
344 memfd_create = 348,
345 bpf = 349,
346 execveat = 350,
347 membarrier = 351,
348 userfaultfd = 352,
349 bind = 353,
350 listen = 354,
351 setsockopt = 355,
352 mlock2 = 356,
353 copy_file_range = 357,
354 preadv2 = 358,
355 pwritev2 = 359,
356 statx = 360,
357 io_pgetevents = 361,
358 pkey_mprotect = 362,
359 pkey_alloc = 363,
360 pkey_free = 364,
361 rseq = 365,
362 semtimedop = 392,
363 semget = 393,
364 semctl = 394,
365 shmget = 395,
366 shmctl = 396,
367 shmat = 397,
368 shmdt = 398,
369 msgget = 399,
370 msgsnd = 400,
371 msgrcv = 401,
372 msgctl = 402,
373 pidfd_send_signal = 424,
374 io_uring_setup = 425,
375 io_uring_enter = 426,
376 io_uring_register = 427,
377 open_tree = 428,
378 move_mount = 429,
379 fsopen = 430,
380 fsconfig = 431,
381 fsmount = 432,
382 fspick = 433,
383 pidfd_open = 434,
384 clone3 = 435,
385 close_range = 436,
386 openat2 = 437,
387 pidfd_getfd = 438,
388 faccessat2 = 439,
389 process_madvise = 440,
390 epoll_pwait2 = 441,
391
392 _,
393};
394
395pub const O_CREAT = 0x200;
396pub const O_EXCL = 0x800;
397pub const O_NOCTTY = 0x8000;
398pub const O_TRUNC = 0x400;
399pub const O_APPEND = 0x8;
400pub const O_NONBLOCK = 0x4000;
401pub const O_SYNC = 0x802000;
402pub const O_DSYNC = 0x2000;
403pub const O_RSYNC = O_SYNC;
404pub const O_DIRECTORY = 0x10000;
405pub const O_NOFOLLOW = 0x20000;
406pub const O_CLOEXEC = 0x400000;
407
408pub const O_ASYNC = 0x40;
409pub const O_DIRECT = 0x100000;
410pub const O_LARGEFILE = 0;
411pub const O_NOATIME = 0x200000;
412pub const O_PATH = 0x1000000;
413pub const O_TMPFILE = 0x2010000;
414pub const O_NDELAY = O_NONBLOCK | 0x4;
415
416pub const F_DUPFD = 0;
417pub const F_GETFD = 1;
418pub const F_SETFD = 2;
419pub const F_GETFL = 3;
420pub const F_SETFL = 4;
421
422pub const F_SETOWN = 5;
423pub const F_GETOWN = 6;
424pub const F_GETLK = 7;
425pub const F_SETLK = 8;
426pub const F_SETLKW = 9;
427
428pub const F_RDLCK = 1;
429pub const F_WRLCK = 2;
430pub const F_UNLCK = 3;
431
432pub const F_SETOWN_EX = 15;
433pub const F_GETOWN_EX = 16;
434
435pub const F_GETOWNER_UIDS = 17;
436
437pub const LOCK_SH = 1;
438pub const LOCK_EX = 2;
439pub const LOCK_NB = 4;
440pub const LOCK_UN = 8;
441
442/// stack-like segment
443pub const MAP_GROWSDOWN = 0x0200;
444
445/// ETXTBSY
446pub const MAP_DENYWRITE = 0x0800;
447
448/// mark it as an executable
449pub const MAP_EXECUTABLE = 0x1000;
450
451/// pages are locked
452pub const MAP_LOCKED = 0x0100;
453
454/// don't check for reservations
455pub const MAP_NORESERVE = 0x0040;
456
457pub const VDSO_CGT_SYM = "__vdso_clock_gettime";
458pub const VDSO_CGT_VER = "LINUX_2.6";
459
460pub const Flock = extern struct {
461 l_type: i16,
462 l_whence: i16,
463 l_start: off_t,
464 l_len: off_t,
465 l_pid: pid_t,
466};
467
468pub const msghdr = extern struct {
469 msg_name: ?*sockaddr,
470 msg_namelen: socklen_t,
471 msg_iov: [*]iovec,
472 msg_iovlen: u64,
473 msg_control: ?*c_void,
474 msg_controllen: u64,
475 msg_flags: i32,
476};
477
478pub const msghdr_const = extern struct {
479 msg_name: ?*const sockaddr,
480 msg_namelen: socklen_t,
481 msg_iov: [*]iovec_const,
482 msg_iovlen: u64,
483 msg_control: ?*c_void,
484 msg_controllen: u64,
485 msg_flags: i32,
486};
487
488pub const off_t = i64;
489pub const ino_t = u64;
490pub const mode_t = u32;
491
492// The `stat64` definition used by the kernel.
493pub const Stat = extern struct {
494 dev: u64,
495 ino: u64,
496 nlink: u64,
497
498 mode: u32,
499 uid: u32,
500 gid: u32,
501 __pad0: u32,
502
503 rdev: u64,
504 size: i64,
505 blksize: i64,
506 blocks: i64,
507
508 atim: timespec,
509 mtim: timespec,
510 ctim: timespec,
511 __unused: [3]u64,
512
513 pub fn atime(self: @This()) timespec {
514 return self.atim;
515 }
516
517 pub fn mtime(self: @This()) timespec {
518 return self.mtim;
519 }
520
521 pub fn ctime(self: @This()) timespec {
522 return self.ctim;
523 }
524};
525
526pub const timespec = extern struct {
527 tv_sec: isize,
528 tv_nsec: isize,
529};
530
531pub const timeval = extern struct {
532 tv_sec: isize,
533 tv_usec: isize,
534};
535
536pub const timezone = extern struct {
537 tz_minuteswest: i32,
538 tz_dsttime: i32,
539};
540
541// TODO I'm not sure if the code below is correct, need someone with more
542// knowledge about sparc64 linux internals to look into.
543
544pub const Elf_Symndx = u32;
545
546pub const fpstate = extern struct {
547 regs: [32]u64,
548 fsr: u64,
549 gsr: u64,
550 fprs: u64,
551};
552
553pub const __fpq = extern struct {
554 fpq_addr: *u32,
555 fpq_instr: u32,
556};
557
558pub const __fq = extern struct {
559 FQu: extern union {
560 whole: f64,
561 fpq: __fpq,
562 },
563};
564
565pub const fpregset_t = extern struct {
566 fpu_fr: extern union {
567 fpu_regs: [32]u32,
568 fpu_dregs: [32]f64,
569 fpu_qregs: [16]c_longdouble,
570 },
571 fpu_q: *__fq,
572 fpu_fsr: u64,
573 fpu_qcnt: u8,
574 fpu_q_entrysize: u8,
575 fpu_en: u8,
576};
577
578pub const siginfo_fpu_t = extern struct {
579 float_regs: [64]u32,
580 fsr: u64,
581 gsr: u64,
582 fprs: u64,
583};
584
585pub const sigcontext = extern struct {
586 info: [128]i8,
587 regs: extern struct {
588 u_regs: [16]u64,
589 tstate: u64,
590 tpc: u64,
591 tnpc: u64,
592 y: u64,
593 fprs: u64,
594 },
595 fpu_save: *siginfo_fpu_t,
596 stack: extern struct {
597 sp: usize,
598 flags: i32,
599 size: u64,
600 },
601 mask: u64,
602};
603
604pub const greg_t = u64;
605pub const gregset_t = [19]greg_t;
606
607pub const fq = extern struct {
608 addr: *u64,
609 insn: u32,
610};
611
612pub const fpu_t = extern struct {
613 fregs: extern union {
614 sregs: [32]u32,
615 dregs: [32]u64,
616 qregs: [16]c_longdouble,
617 },
618 fsr: u64,
619 fprs: u64,
620 gsr: u64,
621 fq: *fq,
622 qcnt: u8,
623 qentsz: u8,
624 enab: u8,
625};
626
627pub const mcontext_t = extern struct {
628 gregs: gregset_t,
629 fp: greg_t,
630 @"i7": greg_t,
631 fpregs: fpu_t,
632};
633
634pub const ucontext_t = extern struct {
635 link: *ucontext_t,
636 flags: u64,
637 sigmask: u64,
638 mcontext: mcontext_t,
639 stack: stack_t,
640 sigmask: sigset_t,
641};
lib/std/os/linux.zig+15-10
......@@ -24,6 +24,11 @@ test {
2424 }
2525}
2626
27const syscall_bits = switch (native_arch) {
28 .thumb => @import("linux/thumb.zig"),
29 else => arch_bits,
30};
31
2732const arch_bits = switch (native_arch) {
2833 .i386 => @import("linux/i386.zig"),
2934 .x86_64 => @import("linux/x86_64.zig"),
......@@ -36,17 +41,17 @@ const arch_bits = switch (native_arch) {
3641 .powerpc64, .powerpc64le => @import("linux/powerpc64.zig"),
3742 else => struct {},
3843};
39pub const syscall0 = arch_bits.syscall0;
40pub const syscall1 = arch_bits.syscall1;
41pub const syscall2 = arch_bits.syscall2;
42pub const syscall3 = arch_bits.syscall3;
43pub const syscall4 = arch_bits.syscall4;
44pub const syscall5 = arch_bits.syscall5;
45pub const syscall6 = arch_bits.syscall6;
46pub const clone = arch_bits.clone;
47pub const restore = arch_bits.restore;
48pub const restore_rt = arch_bits.restore_rt;
44pub const syscall0 = syscall_bits.syscall0;
45pub const syscall1 = syscall_bits.syscall1;
46pub const syscall2 = syscall_bits.syscall2;
47pub const syscall3 = syscall_bits.syscall3;
48pub const syscall4 = syscall_bits.syscall4;
49pub const syscall5 = syscall_bits.syscall5;
50pub const syscall6 = syscall_bits.syscall6;
51pub const restore = syscall_bits.restore;
52pub const restore_rt = syscall_bits.restore_rt;
4953
54pub const clone = arch_bits.clone;
5055pub const ARCH = arch_bits.ARCH;
5156pub const Elf_Symndx = arch_bits.Elf_Symndx;
5257pub const F = arch_bits.F;
lib/std/os/linux/arm-eabi.zig+642-1
......@@ -1,3 +1,14 @@
1const std = @import("../../std.zig");
2const linux = std.os.linux;
3const iovec = std.os.iovec;
4const iovec_const = std.os.iovec_const;
5const socklen_t = linux.socklen_t;
6const stack_t = linux.stack_t;
7const sigset_t = linux.sigset_t;
8const uid_t = linux.uid_t;
9const gid_t = linux.gid_t;
10const pid_t = linux.pid_t;
11
112pub fn syscall0(number: SYS) usize {
213 return asm volatile ("svc #0"
314 : [ret] "={r0}" (-> usize),
......@@ -84,7 +95,15 @@ pub fn syscall6(
8495}
8596
8697/// This matches the libc clone function.
87pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
98pub extern fn clone(
99 func: fn (arg: usize) callconv(.C) u8,
100 stack: usize,
101 flags: u32,
102 arg: usize,
103 ptid: *i32,
104 tls: usize,
105 ctid: *i32,
106) usize;
88107
89108pub fn restore() callconv(.Naked) void {
90109 return asm volatile ("svc #0"
......@@ -101,3 +120,625 @@ pub fn restore_rt() callconv(.Naked) void {
101120 : "memory"
102121 );
103122}
123
124pub const SYS = enum(usize) {
125 restart_syscall = 0,
126 exit = 1,
127 fork = 2,
128 read = 3,
129 write = 4,
130 open = 5,
131 close = 6,
132 creat = 8,
133 link = 9,
134 unlink = 10,
135 execve = 11,
136 chdir = 12,
137 mknod = 14,
138 chmod = 15,
139 lchown = 16,
140 lseek = 19,
141 getpid = 20,
142 mount = 21,
143 setuid = 23,
144 getuid = 24,
145 ptrace = 26,
146 pause = 29,
147 access = 33,
148 nice = 34,
149 sync = 36,
150 kill = 37,
151 rename = 38,
152 mkdir = 39,
153 rmdir = 40,
154 dup = 41,
155 pipe = 42,
156 times = 43,
157 brk = 45,
158 setgid = 46,
159 getgid = 47,
160 geteuid = 49,
161 getegid = 50,
162 acct = 51,
163 umount2 = 52,
164 ioctl = 54,
165 fcntl = 55,
166 setpgid = 57,
167 umask = 60,
168 chroot = 61,
169 ustat = 62,
170 dup2 = 63,
171 getppid = 64,
172 getpgrp = 65,
173 setsid = 66,
174 sigaction = 67,
175 setreuid = 70,
176 setregid = 71,
177 sigsuspend = 72,
178 sigpending = 73,
179 sethostname = 74,
180 setrlimit = 75,
181 getrusage = 77,
182 gettimeofday = 78,
183 settimeofday = 79,
184 getgroups = 80,
185 setgroups = 81,
186 symlink = 83,
187 readlink = 85,
188 uselib = 86,
189 swapon = 87,
190 reboot = 88,
191 munmap = 91,
192 truncate = 92,
193 ftruncate = 93,
194 fchmod = 94,
195 fchown = 95,
196 getpriority = 96,
197 setpriority = 97,
198 statfs = 99,
199 fstatfs = 100,
200 syslog = 103,
201 setitimer = 104,
202 getitimer = 105,
203 stat = 106,
204 lstat = 107,
205 fstat = 108,
206 vhangup = 111,
207 wait4 = 114,
208 swapoff = 115,
209 sysinfo = 116,
210 fsync = 118,
211 sigreturn = 119,
212 clone = 120,
213 setdomainname = 121,
214 uname = 122,
215 adjtimex = 124,
216 mprotect = 125,
217 sigprocmask = 126,
218 init_module = 128,
219 delete_module = 129,
220 quotactl = 131,
221 getpgid = 132,
222 fchdir = 133,
223 bdflush = 134,
224 sysfs = 135,
225 personality = 136,
226 setfsuid = 138,
227 setfsgid = 139,
228 _llseek = 140,
229 getdents = 141,
230 _newselect = 142,
231 flock = 143,
232 msync = 144,
233 readv = 145,
234 writev = 146,
235 getsid = 147,
236 fdatasync = 148,
237 _sysctl = 149,
238 mlock = 150,
239 munlock = 151,
240 mlockall = 152,
241 munlockall = 153,
242 sched_setparam = 154,
243 sched_getparam = 155,
244 sched_setscheduler = 156,
245 sched_getscheduler = 157,
246 sched_yield = 158,
247 sched_get_priority_max = 159,
248 sched_get_priority_min = 160,
249 sched_rr_get_interval = 161,
250 nanosleep = 162,
251 mremap = 163,
252 setresuid = 164,
253 getresuid = 165,
254 poll = 168,
255 nfsservctl = 169,
256 setresgid = 170,
257 getresgid = 171,
258 prctl = 172,
259 rt_sigreturn = 173,
260 rt_sigaction = 174,
261 rt_sigprocmask = 175,
262 rt_sigpending = 176,
263 rt_sigtimedwait = 177,
264 rt_sigqueueinfo = 178,
265 rt_sigsuspend = 179,
266 pread64 = 180,
267 pwrite64 = 181,
268 chown = 182,
269 getcwd = 183,
270 capget = 184,
271 capset = 185,
272 sigaltstack = 186,
273 sendfile = 187,
274 vfork = 190,
275 ugetrlimit = 191,
276 mmap2 = 192,
277 truncate64 = 193,
278 ftruncate64 = 194,
279 stat64 = 195,
280 lstat64 = 196,
281 fstat64 = 197,
282 lchown32 = 198,
283 getuid32 = 199,
284 getgid32 = 200,
285 geteuid32 = 201,
286 getegid32 = 202,
287 setreuid32 = 203,
288 setregid32 = 204,
289 getgroups32 = 205,
290 setgroups32 = 206,
291 fchown32 = 207,
292 setresuid32 = 208,
293 getresuid32 = 209,
294 setresgid32 = 210,
295 getresgid32 = 211,
296 chown32 = 212,
297 setuid32 = 213,
298 setgid32 = 214,
299 setfsuid32 = 215,
300 setfsgid32 = 216,
301 getdents64 = 217,
302 pivot_root = 218,
303 mincore = 219,
304 madvise = 220,
305 fcntl64 = 221,
306 gettid = 224,
307 readahead = 225,
308 setxattr = 226,
309 lsetxattr = 227,
310 fsetxattr = 228,
311 getxattr = 229,
312 lgetxattr = 230,
313 fgetxattr = 231,
314 listxattr = 232,
315 llistxattr = 233,
316 flistxattr = 234,
317 removexattr = 235,
318 lremovexattr = 236,
319 fremovexattr = 237,
320 tkill = 238,
321 sendfile64 = 239,
322 futex = 240,
323 sched_setaffinity = 241,
324 sched_getaffinity = 242,
325 io_setup = 243,
326 io_destroy = 244,
327 io_getevents = 245,
328 io_submit = 246,
329 io_cancel = 247,
330 exit_group = 248,
331 lookup_dcookie = 249,
332 epoll_create = 250,
333 epoll_ctl = 251,
334 epoll_wait = 252,
335 remap_file_pages = 253,
336 set_tid_address = 256,
337 timer_create = 257,
338 timer_settime = 258,
339 timer_gettime = 259,
340 timer_getoverrun = 260,
341 timer_delete = 261,
342 clock_settime = 262,
343 clock_gettime = 263,
344 clock_getres = 264,
345 clock_nanosleep = 265,
346 statfs64 = 266,
347 fstatfs64 = 267,
348 tgkill = 268,
349 utimes = 269,
350 fadvise64_64 = 270,
351 pciconfig_iobase = 271,
352 pciconfig_read = 272,
353 pciconfig_write = 273,
354 mq_open = 274,
355 mq_unlink = 275,
356 mq_timedsend = 276,
357 mq_timedreceive = 277,
358 mq_notify = 278,
359 mq_getsetattr = 279,
360 waitid = 280,
361 socket = 281,
362 bind = 282,
363 connect = 283,
364 listen = 284,
365 accept = 285,
366 getsockname = 286,
367 getpeername = 287,
368 socketpair = 288,
369 send = 289,
370 sendto = 290,
371 recv = 291,
372 recvfrom = 292,
373 shutdown = 293,
374 setsockopt = 294,
375 getsockopt = 295,
376 sendmsg = 296,
377 recvmsg = 297,
378 semop = 298,
379 semget = 299,
380 semctl = 300,
381 msgsnd = 301,
382 msgrcv = 302,
383 msgget = 303,
384 msgctl = 304,
385 shmat = 305,
386 shmdt = 306,
387 shmget = 307,
388 shmctl = 308,
389 add_key = 309,
390 request_key = 310,
391 keyctl = 311,
392 semtimedop = 312,
393 vserver = 313,
394 ioprio_set = 314,
395 ioprio_get = 315,
396 inotify_init = 316,
397 inotify_add_watch = 317,
398 inotify_rm_watch = 318,
399 mbind = 319,
400 get_mempolicy = 320,
401 set_mempolicy = 321,
402 openat = 322,
403 mkdirat = 323,
404 mknodat = 324,
405 fchownat = 325,
406 futimesat = 326,
407 fstatat64 = 327,
408 unlinkat = 328,
409 renameat = 329,
410 linkat = 330,
411 symlinkat = 331,
412 readlinkat = 332,
413 fchmodat = 333,
414 faccessat = 334,
415 pselect6 = 335,
416 ppoll = 336,
417 unshare = 337,
418 set_robust_list = 338,
419 get_robust_list = 339,
420 splice = 340,
421 sync_file_range = 341,
422 tee = 342,
423 vmsplice = 343,
424 move_pages = 344,
425 getcpu = 345,
426 epoll_pwait = 346,
427 kexec_load = 347,
428 utimensat = 348,
429 signalfd = 349,
430 timerfd_create = 350,
431 eventfd = 351,
432 fallocate = 352,
433 timerfd_settime = 353,
434 timerfd_gettime = 354,
435 signalfd4 = 355,
436 eventfd2 = 356,
437 epoll_create1 = 357,
438 dup3 = 358,
439 pipe2 = 359,
440 inotify_init1 = 360,
441 preadv = 361,
442 pwritev = 362,
443 rt_tgsigqueueinfo = 363,
444 perf_event_open = 364,
445 recvmmsg = 365,
446 accept4 = 366,
447 fanotify_init = 367,
448 fanotify_mark = 368,
449 prlimit64 = 369,
450 name_to_handle_at = 370,
451 open_by_handle_at = 371,
452 clock_adjtime = 372,
453 syncfs = 373,
454 sendmmsg = 374,
455 setns = 375,
456 process_vm_readv = 376,
457 process_vm_writev = 377,
458 kcmp = 378,
459 finit_module = 379,
460 sched_setattr = 380,
461 sched_getattr = 381,
462 renameat2 = 382,
463 seccomp = 383,
464 getrandom = 384,
465 memfd_create = 385,
466 bpf = 386,
467 execveat = 387,
468 userfaultfd = 388,
469 membarrier = 389,
470 mlock2 = 390,
471 copy_file_range = 391,
472 preadv2 = 392,
473 pwritev2 = 393,
474 pkey_mprotect = 394,
475 pkey_alloc = 395,
476 pkey_free = 396,
477 statx = 397,
478 rseq = 398,
479 io_pgetevents = 399,
480 migrate_pages = 400,
481 kexec_file_load = 401,
482 clock_gettime64 = 403,
483 clock_settime64 = 404,
484 clock_adjtime64 = 405,
485 clock_getres_time64 = 406,
486 clock_nanosleep_time64 = 407,
487 timer_gettime64 = 408,
488 timer_settime64 = 409,
489 timerfd_gettime64 = 410,
490 timerfd_settime64 = 411,
491 utimensat_time64 = 412,
492 pselect6_time64 = 413,
493 ppoll_time64 = 414,
494 io_pgetevents_time64 = 416,
495 recvmmsg_time64 = 417,
496 mq_timedsend_time64 = 418,
497 mq_timedreceive_time64 = 419,
498 semtimedop_time64 = 420,
499 rt_sigtimedwait_time64 = 421,
500 futex_time64 = 422,
501 sched_rr_get_interval_time64 = 423,
502 pidfd_send_signal = 424,
503 io_uring_setup = 425,
504 io_uring_enter = 426,
505 io_uring_register = 427,
506 open_tree = 428,
507 move_mount = 429,
508 fsopen = 430,
509 fsconfig = 431,
510 fsmount = 432,
511 fspick = 433,
512 pidfd_open = 434,
513 clone3 = 435,
514 close_range = 436,
515 openat2 = 437,
516 pidfd_getfd = 438,
517 faccessat2 = 439,
518 process_madvise = 440,
519 epoll_pwait2 = 441,
520
521 breakpoint = 0x0f0001,
522 cacheflush = 0x0f0002,
523 usr26 = 0x0f0003,
524 usr32 = 0x0f0004,
525 set_tls = 0x0f0005,
526 get_tls = 0x0f0006,
527
528 _,
529};
530
531pub const MMAP2_UNIT = 4096;
532
533pub const O_CREAT = 0o100;
534pub const O_EXCL = 0o200;
535pub const O_NOCTTY = 0o400;
536pub const O_TRUNC = 0o1000;
537pub const O_APPEND = 0o2000;
538pub const O_NONBLOCK = 0o4000;
539pub const O_DSYNC = 0o10000;
540pub const O_SYNC = 0o4010000;
541pub const O_RSYNC = 0o4010000;
542pub const O_DIRECTORY = 0o40000;
543pub const O_NOFOLLOW = 0o100000;
544pub const O_CLOEXEC = 0o2000000;
545
546pub const O_ASYNC = 0o20000;
547pub const O_DIRECT = 0o200000;
548pub const O_LARGEFILE = 0o400000;
549pub const O_NOATIME = 0o1000000;
550pub const O_PATH = 0o10000000;
551pub const O_TMPFILE = 0o20040000;
552pub const O_NDELAY = O_NONBLOCK;
553
554pub const F_DUPFD = 0;
555pub const F_GETFD = 1;
556pub const F_SETFD = 2;
557pub const F_GETFL = 3;
558pub const F_SETFL = 4;
559
560pub const F_SETOWN = 8;
561pub const F_GETOWN = 9;
562pub const F_SETSIG = 10;
563pub const F_GETSIG = 11;
564
565pub const F_GETLK = 12;
566pub const F_SETLK = 13;
567pub const F_SETLKW = 14;
568
569pub const F_RDLCK = 0;
570pub const F_WRLCK = 1;
571pub const F_UNLCK = 2;
572
573pub const F_SETOWN_EX = 15;
574pub const F_GETOWN_EX = 16;
575
576pub const F_GETOWNER_UIDS = 17;
577
578pub const LOCK_SH = 1;
579pub const LOCK_EX = 2;
580pub const LOCK_UN = 8;
581pub const LOCK_NB = 4;
582
583/// stack-like segment
584pub const MAP_GROWSDOWN = 0x0100;
585
586/// ETXTBSY
587pub const MAP_DENYWRITE = 0x0800;
588
589/// mark it as an executable
590pub const MAP_EXECUTABLE = 0x1000;
591
592/// pages are locked
593pub const MAP_LOCKED = 0x2000;
594
595/// don't check for reservations
596pub const MAP_NORESERVE = 0x4000;
597
598pub const VDSO_CGT_SYM = "__vdso_clock_gettime";
599pub const VDSO_CGT_VER = "LINUX_2.6";
600
601pub const HWCAP_SWP = 1 << 0;
602pub const HWCAP_HALF = 1 << 1;
603pub const HWCAP_THUMB = 1 << 2;
604pub const HWCAP_26BIT = 1 << 3;
605pub const HWCAP_FAST_MULT = 1 << 4;
606pub const HWCAP_FPA = 1 << 5;
607pub const HWCAP_VFP = 1 << 6;
608pub const HWCAP_EDSP = 1 << 7;
609pub const HWCAP_JAVA = 1 << 8;
610pub const HWCAP_IWMMXT = 1 << 9;
611pub const HWCAP_CRUNCH = 1 << 10;
612pub const HWCAP_THUMBEE = 1 << 11;
613pub const HWCAP_NEON = 1 << 12;
614pub const HWCAP_VFPv3 = 1 << 13;
615pub const HWCAP_VFPv3D16 = 1 << 14;
616pub const HWCAP_TLS = 1 << 15;
617pub const HWCAP_VFPv4 = 1 << 16;
618pub const HWCAP_IDIVA = 1 << 17;
619pub const HWCAP_IDIVT = 1 << 18;
620pub const HWCAP_VFPD32 = 1 << 19;
621pub const HWCAP_IDIV = HWCAP_IDIVA | HWCAP_IDIVT;
622pub const HWCAP_LPAE = 1 << 20;
623pub const HWCAP_EVTSTRM = 1 << 21;
624
625pub const Flock = extern struct {
626 l_type: i16,
627 l_whence: i16,
628 __pad0: [4]u8,
629 l_start: off_t,
630 l_len: off_t,
631 l_pid: pid_t,
632 __unused: [4]u8,
633};
634
635pub const msghdr = extern struct {
636 msg_name: ?*sockaddr,
637 msg_namelen: socklen_t,
638 msg_iov: [*]iovec,
639 msg_iovlen: i32,
640 msg_control: ?*c_void,
641 msg_controllen: socklen_t,
642 msg_flags: i32,
643};
644
645pub const msghdr_const = extern struct {
646 msg_name: ?*const sockaddr,
647 msg_namelen: socklen_t,
648 msg_iov: [*]iovec_const,
649 msg_iovlen: i32,
650 msg_control: ?*c_void,
651 msg_controllen: socklen_t,
652 msg_flags: i32,
653};
654
655pub const blksize_t = i32;
656pub const nlink_t = u32;
657pub const time_t = isize;
658pub const mode_t = u32;
659pub const off_t = i64;
660pub const ino_t = u64;
661pub const dev_t = u64;
662pub const blkcnt_t = i64;
663
664// The `stat` definition used by the Linux kernel.
665pub const Stat = extern struct {
666 dev: dev_t,
667 __dev_padding: u32,
668 __ino_truncated: u32,
669 mode: mode_t,
670 nlink: nlink_t,
671 uid: uid_t,
672 gid: gid_t,
673 rdev: dev_t,
674 __rdev_padding: u32,
675 size: off_t,
676 blksize: blksize_t,
677 blocks: blkcnt_t,
678 atim: timespec,
679 mtim: timespec,
680 ctim: timespec,
681 ino: ino_t,
682
683 pub fn atime(self: @This()) timespec {
684 return self.atim;
685 }
686
687 pub fn mtime(self: @This()) timespec {
688 return self.mtim;
689 }
690
691 pub fn ctime(self: @This()) timespec {
692 return self.ctim;
693 }
694};
695
696pub const timespec = extern struct {
697 tv_sec: i32,
698 tv_nsec: i32,
699};
700
701pub const timeval = extern struct {
702 tv_sec: i32,
703 tv_usec: i32,
704};
705
706pub const timezone = extern struct {
707 tz_minuteswest: i32,
708 tz_dsttime: i32,
709};
710
711pub const mcontext_t = extern struct {
712 trap_no: usize,
713 error_code: usize,
714 oldmask: usize,
715 arm_r0: usize,
716 arm_r1: usize,
717 arm_r2: usize,
718 arm_r3: usize,
719 arm_r4: usize,
720 arm_r5: usize,
721 arm_r6: usize,
722 arm_r7: usize,
723 arm_r8: usize,
724 arm_r9: usize,
725 arm_r10: usize,
726 arm_fp: usize,
727 arm_ip: usize,
728 arm_sp: usize,
729 arm_lr: usize,
730 arm_pc: usize,
731 arm_cpsr: usize,
732 fault_address: usize,
733};
734
735pub const ucontext_t = extern struct {
736 flags: usize,
737 link: *ucontext_t,
738 stack: stack_t,
739 mcontext: mcontext_t,
740 sigmask: sigset_t,
741 regspace: [64]u64,
742};
743
744pub const Elf_Symndx = u32;
lib/std/os/linux/arm64.zig+491
......@@ -1,3 +1,15 @@
1const std = @import("../../std.zig");
2const linux = std.os.linux;
3const socklen_t = linux.socklen_t;
4const sockaddr = linux.sockaddr;
5const iovec = linux.iovec;
6const iovec_const = linux.iovec_const;
7const uid_t = linux.uid_t;
8const gid_t = linux.gid_t;
9const pid_t = linux.pid_t;
10const stack_t = linux.stack_t;
11const sigset_t = linux.sigset_t;
12
113pub fn syscall0(number: SYS) usize {
214 return asm volatile ("svc #0"
315 : [ret] "={x0}" (-> usize),
......@@ -95,3 +107,482 @@ pub fn restore_rt() callconv(.Naked) void {
95107 : "memory", "cc"
96108 );
97109}
110
111pub const SYS = enum(usize) {
112 io_setup = 0,
113 io_destroy = 1,
114 io_submit = 2,
115 io_cancel = 3,
116 io_getevents = 4,
117 setxattr = 5,
118 lsetxattr = 6,
119 fsetxattr = 7,
120 getxattr = 8,
121 lgetxattr = 9,
122 fgetxattr = 10,
123 listxattr = 11,
124 llistxattr = 12,
125 flistxattr = 13,
126 removexattr = 14,
127 lremovexattr = 15,
128 fremovexattr = 16,
129 getcwd = 17,
130 lookup_dcookie = 18,
131 eventfd2 = 19,
132 epoll_create1 = 20,
133 epoll_ctl = 21,
134 epoll_pwait = 22,
135 dup = 23,
136 dup3 = 24,
137 fcntl = 25,
138 inotify_init1 = 26,
139 inotify_add_watch = 27,
140 inotify_rm_watch = 28,
141 ioctl = 29,
142 ioprio_set = 30,
143 ioprio_get = 31,
144 flock = 32,
145 mknodat = 33,
146 mkdirat = 34,
147 unlinkat = 35,
148 symlinkat = 36,
149 linkat = 37,
150 renameat = 38,
151 umount2 = 39,
152 mount = 40,
153 pivot_root = 41,
154 nfsservctl = 42,
155 statfs = 43,
156 fstatfs = 44,
157 truncate = 45,
158 ftruncate = 46,
159 fallocate = 47,
160 faccessat = 48,
161 chdir = 49,
162 fchdir = 50,
163 chroot = 51,
164 fchmod = 52,
165 fchmodat = 53,
166 fchownat = 54,
167 fchown = 55,
168 openat = 56,
169 close = 57,
170 vhangup = 58,
171 pipe2 = 59,
172 quotactl = 60,
173 getdents64 = 61,
174 lseek = 62,
175 read = 63,
176 write = 64,
177 readv = 65,
178 writev = 66,
179 pread64 = 67,
180 pwrite64 = 68,
181 preadv = 69,
182 pwritev = 70,
183 sendfile = 71,
184 pselect6 = 72,
185 ppoll = 73,
186 signalfd4 = 74,
187 vmsplice = 75,
188 splice = 76,
189 tee = 77,
190 readlinkat = 78,
191 fstatat = 79,
192 fstat = 80,
193 sync = 81,
194 fsync = 82,
195 fdatasync = 83,
196 sync_file_range = 84,
197 timerfd_create = 85,
198 timerfd_settime = 86,
199 timerfd_gettime = 87,
200 utimensat = 88,
201 acct = 89,
202 capget = 90,
203 capset = 91,
204 personality = 92,
205 exit = 93,
206 exit_group = 94,
207 waitid = 95,
208 set_tid_address = 96,
209 unshare = 97,
210 futex = 98,
211 set_robust_list = 99,
212 get_robust_list = 100,
213 nanosleep = 101,
214 getitimer = 102,
215 setitimer = 103,
216 kexec_load = 104,
217 init_module = 105,
218 delete_module = 106,
219 timer_create = 107,
220 timer_gettime = 108,
221 timer_getoverrun = 109,
222 timer_settime = 110,
223 timer_delete = 111,
224 clock_settime = 112,
225 clock_gettime = 113,
226 clock_getres = 114,
227 clock_nanosleep = 115,
228 syslog = 116,
229 ptrace = 117,
230 sched_setparam = 118,
231 sched_setscheduler = 119,
232 sched_getscheduler = 120,
233 sched_getparam = 121,
234 sched_setaffinity = 122,
235 sched_getaffinity = 123,
236 sched_yield = 124,
237 sched_get_priority_max = 125,
238 sched_get_priority_min = 126,
239 sched_rr_get_interval = 127,
240 restart_syscall = 128,
241 kill = 129,
242 tkill = 130,
243 tgkill = 131,
244 sigaltstack = 132,
245 rt_sigsuspend = 133,
246 rt_sigaction = 134,
247 rt_sigprocmask = 135,
248 rt_sigpending = 136,
249 rt_sigtimedwait = 137,
250 rt_sigqueueinfo = 138,
251 rt_sigreturn = 139,
252 setpriority = 140,
253 getpriority = 141,
254 reboot = 142,
255 setregid = 143,
256 setgid = 144,
257 setreuid = 145,
258 setuid = 146,
259 setresuid = 147,
260 getresuid = 148,
261 setresgid = 149,
262 getresgid = 150,
263 setfsuid = 151,
264 setfsgid = 152,
265 times = 153,
266 setpgid = 154,
267 getpgid = 155,
268 getsid = 156,
269 setsid = 157,
270 getgroups = 158,
271 setgroups = 159,
272 uname = 160,
273 sethostname = 161,
274 setdomainname = 162,
275 getrlimit = 163,
276 setrlimit = 164,
277 getrusage = 165,
278 umask = 166,
279 prctl = 167,
280 getcpu = 168,
281 gettimeofday = 169,
282 settimeofday = 170,
283 adjtimex = 171,
284 getpid = 172,
285 getppid = 173,
286 getuid = 174,
287 geteuid = 175,
288 getgid = 176,
289 getegid = 177,
290 gettid = 178,
291 sysinfo = 179,
292 mq_open = 180,
293 mq_unlink = 181,
294 mq_timedsend = 182,
295 mq_timedreceive = 183,
296 mq_notify = 184,
297 mq_getsetattr = 185,
298 msgget = 186,
299 msgctl = 187,
300 msgrcv = 188,
301 msgsnd = 189,
302 semget = 190,
303 semctl = 191,
304 semtimedop = 192,
305 semop = 193,
306 shmget = 194,
307 shmctl = 195,
308 shmat = 196,
309 shmdt = 197,
310 socket = 198,
311 socketpair = 199,
312 bind = 200,
313 listen = 201,
314 accept = 202,
315 connect = 203,
316 getsockname = 204,
317 getpeername = 205,
318 sendto = 206,
319 recvfrom = 207,
320 setsockopt = 208,
321 getsockopt = 209,
322 shutdown = 210,
323 sendmsg = 211,
324 recvmsg = 212,
325 readahead = 213,
326 brk = 214,
327 munmap = 215,
328 mremap = 216,
329 add_key = 217,
330 request_key = 218,
331 keyctl = 219,
332 clone = 220,
333 execve = 221,
334 mmap = 222,
335 fadvise64 = 223,
336 swapon = 224,
337 swapoff = 225,
338 mprotect = 226,
339 msync = 227,
340 mlock = 228,
341 munlock = 229,
342 mlockall = 230,
343 munlockall = 231,
344 mincore = 232,
345 madvise = 233,
346 remap_file_pages = 234,
347 mbind = 235,
348 get_mempolicy = 236,
349 set_mempolicy = 237,
350 migrate_pages = 238,
351 move_pages = 239,
352 rt_tgsigqueueinfo = 240,
353 perf_event_open = 241,
354 accept4 = 242,
355 recvmmsg = 243,
356 arch_specific_syscall = 244,
357 wait4 = 260,
358 prlimit64 = 261,
359 fanotify_init = 262,
360 fanotify_mark = 263,
361 clock_adjtime = 266,
362 syncfs = 267,
363 setns = 268,
364 sendmmsg = 269,
365 process_vm_readv = 270,
366 process_vm_writev = 271,
367 kcmp = 272,
368 finit_module = 273,
369 sched_setattr = 274,
370 sched_getattr = 275,
371 renameat2 = 276,
372 seccomp = 277,
373 getrandom = 278,
374 memfd_create = 279,
375 bpf = 280,
376 execveat = 281,
377 userfaultfd = 282,
378 membarrier = 283,
379 mlock2 = 284,
380 copy_file_range = 285,
381 preadv2 = 286,
382 pwritev2 = 287,
383 pkey_mprotect = 288,
384 pkey_alloc = 289,
385 pkey_free = 290,
386 statx = 291,
387 io_pgetevents = 292,
388 rseq = 293,
389 kexec_file_load = 294,
390 pidfd_send_signal = 424,
391 io_uring_setup = 425,
392 io_uring_enter = 426,
393 io_uring_register = 427,
394 open_tree = 428,
395 move_mount = 429,
396 fsopen = 430,
397 fsconfig = 431,
398 fsmount = 432,
399 fspick = 433,
400 pidfd_open = 434,
401 clone3 = 435,
402 close_range = 436,
403 openat2 = 437,
404 pidfd_getfd = 438,
405 faccessat2 = 439,
406 process_madvise = 440,
407 epoll_pwait2 = 441,
408
409 _,
410};
411
412pub const O_CREAT = 0o100;
413pub const O_EXCL = 0o200;
414pub const O_NOCTTY = 0o400;
415pub const O_TRUNC = 0o1000;
416pub const O_APPEND = 0o2000;
417pub const O_NONBLOCK = 0o4000;
418pub const O_DSYNC = 0o10000;
419pub const O_SYNC = 0o4010000;
420pub const O_RSYNC = 0o4010000;
421pub const O_DIRECTORY = 0o40000;
422pub const O_NOFOLLOW = 0o100000;
423pub const O_CLOEXEC = 0o2000000;
424
425pub const O_ASYNC = 0o20000;
426pub const O_DIRECT = 0o200000;
427pub const O_LARGEFILE = 0o400000;
428pub const O_NOATIME = 0o1000000;
429pub const O_PATH = 0o10000000;
430pub const O_TMPFILE = 0o20040000;
431pub const O_NDELAY = O_NONBLOCK;
432
433pub const F_DUPFD = 0;
434pub const F_GETFD = 1;
435pub const F_SETFD = 2;
436pub const F_GETFL = 3;
437pub const F_SETFL = 4;
438
439pub const F_SETOWN = 8;
440pub const F_GETOWN = 9;
441pub const F_SETSIG = 10;
442pub const F_GETSIG = 11;
443
444pub const F_GETLK = 5;
445pub const F_SETLK = 6;
446pub const F_SETLKW = 7;
447
448pub const F_RDLCK = 0;
449pub const F_WRLCK = 1;
450pub const F_UNLCK = 2;
451
452pub const LOCK_SH = 1;
453pub const LOCK_EX = 2;
454pub const LOCK_UN = 8;
455pub const LOCK_NB = 4;
456
457pub const F_SETOWN_EX = 15;
458pub const F_GETOWN_EX = 16;
459
460pub const F_GETOWNER_UIDS = 17;
461
462/// stack-like segment
463pub const MAP_GROWSDOWN = 0x0100;
464
465/// ETXTBSY
466pub const MAP_DENYWRITE = 0x0800;
467
468/// mark it as an executable
469pub const MAP_EXECUTABLE = 0x1000;
470
471/// pages are locked
472pub const MAP_LOCKED = 0x2000;
473
474/// don't check for reservations
475pub const MAP_NORESERVE = 0x4000;
476
477pub const VDSO_CGT_SYM = "__kernel_clock_gettime";
478pub const VDSO_CGT_VER = "LINUX_2.6.39";
479
480pub const Flock = extern struct {
481 l_type: i16,
482 l_whence: i16,
483 l_start: off_t,
484 l_len: off_t,
485 l_pid: pid_t,
486 __unused: [4]u8,
487};
488
489pub const msghdr = extern struct {
490 msg_name: ?*sockaddr,
491 msg_namelen: socklen_t,
492 msg_iov: [*]iovec,
493 msg_iovlen: i32,
494 __pad1: i32 = 0,
495 msg_control: ?*c_void,
496 msg_controllen: socklen_t,
497 __pad2: socklen_t = 0,
498 msg_flags: i32,
499};
500
501pub const msghdr_const = extern struct {
502 msg_name: ?*const sockaddr,
503 msg_namelen: socklen_t,
504 msg_iov: [*]iovec_const,
505 msg_iovlen: i32,
506 __pad1: i32 = 0,
507 msg_control: ?*c_void,
508 msg_controllen: socklen_t,
509 __pad2: socklen_t = 0,
510 msg_flags: i32,
511};
512
513pub const blksize_t = i32;
514pub const nlink_t = u32;
515pub const time_t = isize;
516pub const mode_t = u32;
517pub const off_t = isize;
518pub const ino_t = usize;
519pub const dev_t = usize;
520pub const blkcnt_t = isize;
521
522// The `stat` definition used by the Linux kernel.
523pub const Stat = extern struct {
524 dev: dev_t,
525 ino: ino_t,
526 mode: mode_t,
527 nlink: nlink_t,
528 uid: uid_t,
529 gid: gid_t,
530 rdev: dev_t,
531 __pad: usize,
532 size: off_t,
533 blksize: blksize_t,
534 __pad2: i32,
535 blocks: blkcnt_t,
536 atim: timespec,
537 mtim: timespec,
538 ctim: timespec,
539 __unused: [2]u32,
540
541 pub fn atime(self: @This()) timespec {
542 return self.atim;
543 }
544
545 pub fn mtime(self: @This()) timespec {
546 return self.mtim;
547 }
548
549 pub fn ctime(self: @This()) timespec {
550 return self.ctim;
551 }
552};
553
554pub const timespec = extern struct {
555 tv_sec: time_t,
556 tv_nsec: isize,
557};
558
559pub const timeval = extern struct {
560 tv_sec: isize,
561 tv_usec: isize,
562};
563
564pub const timezone = extern struct {
565 tz_minuteswest: i32,
566 tz_dsttime: i32,
567};
568
569pub const mcontext_t = extern struct {
570 fault_address: usize,
571 regs: [31]usize,
572 sp: usize,
573 pc: usize,
574 pstate: usize,
575 // Make sure the field is correctly aligned since this area
576 // holds various FP/vector registers
577 reserved1: [256 * 16]u8 align(16),
578};
579
580pub const ucontext_t = extern struct {
581 flags: usize,
582 link: *ucontext_t,
583 stack: stack_t,
584 sigmask: sigset_t,
585 mcontext: mcontext_t,
586};
587
588pub const Elf_Symndx = u32;
lib/std/os/linux/bpf.zig-1
......@@ -1,4 +1,3 @@
1usingnamespace std.os.linux;
21const std = @import("../../std.zig");
32const errno = getErrno;
43const unexpectedErrno = std.os.unexpectedErrno;
lib/std/os/linux/i386.zig+720
......@@ -1,3 +1,14 @@
1const std = @import("../../std.zig");
2const linux = std.os.linux;
3const socklen_t = linux.socklen_t;
4const iovec = linux.iovec;
5const iovec_const = linux.iovec_const;
6const uid_t = linux.uid_t;
7const gid_t = linux.gid_t;
8const pid_t = linux.pid_t;
9const stack_t = linux.stack_t;
10const sigset_t = linux.sigset_t;
11
112pub fn syscall0(number: SYS) usize {
213 return asm volatile ("int $0x80"
314 : [ret] "={eax}" (-> usize),
......@@ -121,3 +132,712 @@ pub fn restore_rt() callconv(.Naked) void {
121132 : "memory"
122133 );
123134}
135
136pub const SYS = enum(usize) {
137 restart_syscall = 0,
138 exit = 1,
139 fork = 2,
140 read = 3,
141 write = 4,
142 open = 5,
143 close = 6,
144 waitpid = 7,
145 creat = 8,
146 link = 9,
147 unlink = 10,
148 execve = 11,
149 chdir = 12,
150 time = 13,
151 mknod = 14,
152 chmod = 15,
153 lchown = 16,
154 @"break" = 17,
155 oldstat = 18,
156 lseek = 19,
157 getpid = 20,
158 mount = 21,
159 umount = 22,
160 setuid = 23,
161 getuid = 24,
162 stime = 25,
163 ptrace = 26,
164 alarm = 27,
165 oldfstat = 28,
166 pause = 29,
167 utime = 30,
168 stty = 31,
169 gtty = 32,
170 access = 33,
171 nice = 34,
172 ftime = 35,
173 sync = 36,
174 kill = 37,
175 rename = 38,
176 mkdir = 39,
177 rmdir = 40,
178 dup = 41,
179 pipe = 42,
180 times = 43,
181 prof = 44,
182 brk = 45,
183 setgid = 46,
184 getgid = 47,
185 signal = 48,
186 geteuid = 49,
187 getegid = 50,
188 acct = 51,
189 umount2 = 52,
190 lock = 53,
191 ioctl = 54,
192 fcntl = 55,
193 mpx = 56,
194 setpgid = 57,
195 ulimit = 58,
196 oldolduname = 59,
197 umask = 60,
198 chroot = 61,
199 ustat = 62,
200 dup2 = 63,
201 getppid = 64,
202 getpgrp = 65,
203 setsid = 66,
204 sigaction = 67,
205 sgetmask = 68,
206 ssetmask = 69,
207 setreuid = 70,
208 setregid = 71,
209 sigsuspend = 72,
210 sigpending = 73,
211 sethostname = 74,
212 setrlimit = 75,
213 getrlimit = 76,
214 getrusage = 77,
215 gettimeofday = 78,
216 settimeofday = 79,
217 getgroups = 80,
218 setgroups = 81,
219 select = 82,
220 symlink = 83,
221 oldlstat = 84,
222 readlink = 85,
223 uselib = 86,
224 swapon = 87,
225 reboot = 88,
226 readdir = 89,
227 mmap = 90,
228 munmap = 91,
229 truncate = 92,
230 ftruncate = 93,
231 fchmod = 94,
232 fchown = 95,
233 getpriority = 96,
234 setpriority = 97,
235 profil = 98,
236 statfs = 99,
237 fstatfs = 100,
238 ioperm = 101,
239 socketcall = 102,
240 syslog = 103,
241 setitimer = 104,
242 getitimer = 105,
243 stat = 106,
244 lstat = 107,
245 fstat = 108,
246 olduname = 109,
247 iopl = 110,
248 vhangup = 111,
249 idle = 112,
250 vm86old = 113,
251 wait4 = 114,
252 swapoff = 115,
253 sysinfo = 116,
254 ipc = 117,
255 fsync = 118,
256 sigreturn = 119,
257 clone = 120,
258 setdomainname = 121,
259 uname = 122,
260 modify_ldt = 123,
261 adjtimex = 124,
262 mprotect = 125,
263 sigprocmask = 126,
264 create_module = 127,
265 init_module = 128,
266 delete_module = 129,
267 get_kernel_syms = 130,
268 quotactl = 131,
269 getpgid = 132,
270 fchdir = 133,
271 bdflush = 134,
272 sysfs = 135,
273 personality = 136,
274 afs_syscall = 137,
275 setfsuid = 138,
276 setfsgid = 139,
277 _llseek = 140,
278 getdents = 141,
279 _newselect = 142,
280 flock = 143,
281 msync = 144,
282 readv = 145,
283 writev = 146,
284 getsid = 147,
285 fdatasync = 148,
286 _sysctl = 149,
287 mlock = 150,
288 munlock = 151,
289 mlockall = 152,
290 munlockall = 153,
291 sched_setparam = 154,
292 sched_getparam = 155,
293 sched_setscheduler = 156,
294 sched_getscheduler = 157,
295 sched_yield = 158,
296 sched_get_priority_max = 159,
297 sched_get_priority_min = 160,
298 sched_rr_get_interval = 161,
299 nanosleep = 162,
300 mremap = 163,
301 setresuid = 164,
302 getresuid = 165,
303 vm86 = 166,
304 query_module = 167,
305 poll = 168,
306 nfsservctl = 169,
307 setresgid = 170,
308 getresgid = 171,
309 prctl = 172,
310 rt_sigreturn = 173,
311 rt_sigaction = 174,
312 rt_sigprocmask = 175,
313 rt_sigpending = 176,
314 rt_sigtimedwait = 177,
315 rt_sigqueueinfo = 178,
316 rt_sigsuspend = 179,
317 pread64 = 180,
318 pwrite64 = 181,
319 chown = 182,
320 getcwd = 183,
321 capget = 184,
322 capset = 185,
323 sigaltstack = 186,
324 sendfile = 187,
325 getpmsg = 188,
326 putpmsg = 189,
327 vfork = 190,
328 ugetrlimit = 191,
329 mmap2 = 192,
330 truncate64 = 193,
331 ftruncate64 = 194,
332 stat64 = 195,
333 lstat64 = 196,
334 fstat64 = 197,
335 lchown32 = 198,
336 getuid32 = 199,
337 getgid32 = 200,
338 geteuid32 = 201,
339 getegid32 = 202,
340 setreuid32 = 203,
341 setregid32 = 204,
342 getgroups32 = 205,
343 setgroups32 = 206,
344 fchown32 = 207,
345 setresuid32 = 208,
346 getresuid32 = 209,
347 setresgid32 = 210,
348 getresgid32 = 211,
349 chown32 = 212,
350 setuid32 = 213,
351 setgid32 = 214,
352 setfsuid32 = 215,
353 setfsgid32 = 216,
354 pivot_root = 217,
355 mincore = 218,
356 madvise = 219,
357 getdents64 = 220,
358 fcntl64 = 221,
359 gettid = 224,
360 readahead = 225,
361 setxattr = 226,
362 lsetxattr = 227,
363 fsetxattr = 228,
364 getxattr = 229,
365 lgetxattr = 230,
366 fgetxattr = 231,
367 listxattr = 232,
368 llistxattr = 233,
369 flistxattr = 234,
370 removexattr = 235,
371 lremovexattr = 236,
372 fremovexattr = 237,
373 tkill = 238,
374 sendfile64 = 239,
375 futex = 240,
376 sched_setaffinity = 241,
377 sched_getaffinity = 242,
378 set_thread_area = 243,
379 get_thread_area = 244,
380 io_setup = 245,
381 io_destroy = 246,
382 io_getevents = 247,
383 io_submit = 248,
384 io_cancel = 249,
385 fadvise64 = 250,
386 exit_group = 252,
387 lookup_dcookie = 253,
388 epoll_create = 254,
389 epoll_ctl = 255,
390 epoll_wait = 256,
391 remap_file_pages = 257,
392 set_tid_address = 258,
393 timer_create = 259,
394 timer_settime, // SYS_timer_create + 1
395 timer_gettime, // SYS_timer_create + 2
396 timer_getoverrun, // SYS_timer_create + 3
397 timer_delete, // SYS_timer_create + 4
398 clock_settime, // SYS_timer_create + 5
399 clock_gettime, // SYS_timer_create + 6
400 clock_getres, // SYS_timer_create + 7
401 clock_nanosleep, // SYS_timer_create + 8
402 statfs64 = 268,
403 fstatfs64 = 269,
404 tgkill = 270,
405 utimes = 271,
406 fadvise64_64 = 272,
407 vserver = 273,
408 mbind = 274,
409 get_mempolicy = 275,
410 set_mempolicy = 276,
411 mq_open = 277,
412 mq_unlink, // SYS_mq_open + 1
413 mq_timedsend, // SYS_mq_open + 2
414 mq_timedreceive, // SYS_mq_open + 3
415 mq_notify, // SYS_mq_open + 4
416 mq_getsetattr, // SYS_mq_open + 5
417 kexec_load = 283,
418 waitid = 284,
419 add_key = 286,
420 request_key = 287,
421 keyctl = 288,
422 ioprio_set = 289,
423 ioprio_get = 290,
424 inotify_init = 291,
425 inotify_add_watch = 292,
426 inotify_rm_watch = 293,
427 migrate_pages = 294,
428 openat = 295,
429 mkdirat = 296,
430 mknodat = 297,
431 fchownat = 298,
432 futimesat = 299,
433 fstatat64 = 300,
434 unlinkat = 301,
435 renameat = 302,
436 linkat = 303,
437 symlinkat = 304,
438 readlinkat = 305,
439 fchmodat = 306,
440 faccessat = 307,
441 pselect6 = 308,
442 ppoll = 309,
443 unshare = 310,
444 set_robust_list = 311,
445 get_robust_list = 312,
446 splice = 313,
447 sync_file_range = 314,
448 tee = 315,
449 vmsplice = 316,
450 move_pages = 317,
451 getcpu = 318,
452 epoll_pwait = 319,
453 utimensat = 320,
454 signalfd = 321,
455 timerfd_create = 322,
456 eventfd = 323,
457 fallocate = 324,
458 timerfd_settime = 325,
459 timerfd_gettime = 326,
460 signalfd4 = 327,
461 eventfd2 = 328,
462 epoll_create1 = 329,
463 dup3 = 330,
464 pipe2 = 331,
465 inotify_init1 = 332,
466 preadv = 333,
467 pwritev = 334,
468 rt_tgsigqueueinfo = 335,
469 perf_event_open = 336,
470 recvmmsg = 337,
471 fanotify_init = 338,
472 fanotify_mark = 339,
473 prlimit64 = 340,
474 name_to_handle_at = 341,
475 open_by_handle_at = 342,
476 clock_adjtime = 343,
477 syncfs = 344,
478 sendmmsg = 345,
479 setns = 346,
480 process_vm_readv = 347,
481 process_vm_writev = 348,
482 kcmp = 349,
483 finit_module = 350,
484 sched_setattr = 351,
485 sched_getattr = 352,
486 renameat2 = 353,
487 seccomp = 354,
488 getrandom = 355,
489 memfd_create = 356,
490 bpf = 357,
491 execveat = 358,
492 socket = 359,
493 socketpair = 360,
494 bind = 361,
495 connect = 362,
496 listen = 363,
497 accept4 = 364,
498 getsockopt = 365,
499 setsockopt = 366,
500 getsockname = 367,
501 getpeername = 368,
502 sendto = 369,
503 sendmsg = 370,
504 recvfrom = 371,
505 recvmsg = 372,
506 shutdown = 373,
507 userfaultfd = 374,
508 membarrier = 375,
509 mlock2 = 376,
510 copy_file_range = 377,
511 preadv2 = 378,
512 pwritev2 = 379,
513 pkey_mprotect = 380,
514 pkey_alloc = 381,
515 pkey_free = 382,
516 statx = 383,
517 arch_prctl = 384,
518 io_pgetevents = 385,
519 rseq = 386,
520 semget = 393,
521 semctl = 394,
522 shmget = 395,
523 shmctl = 396,
524 shmat = 397,
525 shmdt = 398,
526 msgget = 399,
527 msgsnd = 400,
528 msgrcv = 401,
529 msgctl = 402,
530 clock_gettime64 = 403,
531 clock_settime64 = 404,
532 clock_adjtime64 = 405,
533 clock_getres_time64 = 406,
534 clock_nanosleep_time64 = 407,
535 timer_gettime64 = 408,
536 timer_settime64 = 409,
537 timerfd_gettime64 = 410,
538 timerfd_settime64 = 411,
539 utimensat_time64 = 412,
540 pselect6_time64 = 413,
541 ppoll_time64 = 414,
542 io_pgetevents_time64 = 416,
543 recvmmsg_time64 = 417,
544 mq_timedsend_time64 = 418,
545 mq_timedreceive_time64 = 419,
546 semtimedop_time64 = 420,
547 rt_sigtimedwait_time64 = 421,
548 futex_time64 = 422,
549 sched_rr_get_interval_time64 = 423,
550 pidfd_send_signal = 424,
551 io_uring_setup = 425,
552 io_uring_enter = 426,
553 io_uring_register = 427,
554 open_tree = 428,
555 move_mount = 429,
556 fsopen = 430,
557 fsconfig = 431,
558 fsmount = 432,
559 fspick = 433,
560 pidfd_open = 434,
561 clone3 = 435,
562 close_range = 436,
563 openat2 = 437,
564 pidfd_getfd = 438,
565 faccessat2 = 439,
566 process_madvise = 440,
567 epoll_pwait2 = 441,
568
569 _,
570};
571
572pub const O = struct {
573 pub const RDONLY = 0o0;
574 pub const WRONLY = 0o1;
575 pub const RDWR = 0o2;
576
577 pub const CREAT = 0o100;
578 pub const EXCL = 0o200;
579 pub const NOCTTY = 0o400;
580 pub const TRUNC = 0o1000;
581 pub const APPEND = 0o2000;
582 pub const NONBLOCK = 0o4000;
583 pub const DSYNC = 0o10000;
584 pub const SYNC = 0o4010000;
585 pub const RSYNC = 0o4010000;
586 pub const DIRECTORY = 0o200000;
587 pub const NOFOLLOW = 0o400000;
588 pub const CLOEXEC = 0o2000000;
589
590 pub const ASYNC = 0o20000;
591 pub const DIRECT = 0o40000;
592 pub const LARGEFILE = 0o100000;
593 pub const NOATIME = 0o1000000;
594 pub const PATH = 0o10000000;
595 pub const TMPFILE = 0o20200000;
596 pub const NDELAY = NONBLOCK;
597};
598
599pub const F = struct {
600 pub const DUPFD = 0;
601 pub const GETFD = 1;
602 pub const SETFD = 2;
603 pub const GETFL = 3;
604 pub const SETFL = 4;
605 pub const SETOWN = 8;
606 pub const GETOWN = 9;
607 pub const SETSIG = 10;
608 pub const GETSIG = 11;
609 pub const GETLK = 12;
610 pub const SETLK = 13;
611 pub const SETLKW = 14;
612 pub const SETOWN_EX = 15;
613 pub const GETOWN_EX = 16;
614 pub const GETOWNER_UIDS = 17;
615
616 pub const RDLCK = 0;
617 pub const WRLCK = 1;
618 pub const UNLCK = 2;
619};
620
621pub const LOCK = struct {
622 pub const SH = 1;
623 pub const EX = 2;
624 pub const NB = 4;
625 pub const UN = 8;
626};
627
628pub const MAP = struct {
629 /// Share changes
630 pub const SHARED = 0x01;
631
632 /// Changes are private
633 pub const PRIVATE = 0x02;
634
635 /// share + validate extension flags
636 pub const SHARED_VALIDATE = 0x03;
637
638 /// Mask for type of mapping
639 pub const TYPE = 0x0f;
640
641 /// Interpret addr exactly
642 pub const FIXED = 0x10;
643
644 /// don't use a file
645 pub const ANONYMOUS = if (is_mips) 0x800 else 0x20;
646
647 /// populate (prefault) pagetables
648 pub const POPULATE = if (is_mips) 0x10000 else 0x8000;
649
650 /// do not block on IO
651 pub const NONBLOCK = if (is_mips) 0x20000 else 0x10000;
652
653 /// give out an address that is best suited for process/thread stacks
654 pub const STACK = if (is_mips) 0x40000 else 0x20000;
655
656 /// create a huge page mapping
657 pub const HUGETLB = if (is_mips) 0x80000 else 0x40000;
658
659 /// perform synchronous page faults for the mapping
660 pub const SYNC = 0x80000;
661
662 /// FIXED which doesn't unmap underlying mapping
663 pub const FIXED_NOREPLACE = 0x100000;
664
665 /// For anonymous mmap, memory could be uninitialized
666 pub const UNINITIALIZED = 0x4000000;
667
668 pub const NORESERVE = 0x4000;
669 pub const GROWSDOWN = 0x0100;
670 pub const DENYWRITE = 0x0800;
671 pub const EXECUTABLE = 0x1000;
672 pub const LOCKED = 0x2000;
673 pub const @"32BIT" = 0x40;
674};
675
676pub const MMAP2_UNIT = 4096;
677
678pub const VDSO = struct {
679 pub const CGT_SYM = "__vdso_clock_gettime";
680 pub const CGT_VER = "LINUX_2.6";
681};
682
683pub const ARCH = struct {};
684
685pub const Flock = extern struct {
686 type: i16,
687 whence: i16,
688 start: off_t,
689 len: off_t,
690 pid: pid_t,
691};
692
693pub const msghdr = extern struct {
694 name: ?*sockaddr,
695 namelen: socklen_t,
696 iov: [*]iovec,
697 iovlen: i32,
698 control: ?*c_void,
699 controllen: socklen_t,
700 flags: i32,
701};
702
703pub const msghdr_const = extern struct {
704 name: ?*const sockaddr,
705 namelen: socklen_t,
706 iov: [*]iovec_const,
707 iovlen: i32,
708 control: ?*c_void,
709 controllen: socklen_t,
710 flags: i32,
711};
712
713pub const blksize_t = i32;
714pub const nlink_t = u32;
715pub const time_t = isize;
716pub const mode_t = u32;
717pub const off_t = i64;
718pub const ino_t = u64;
719pub const dev_t = u64;
720pub const blkcnt_t = i64;
721
722// The `stat` definition used by the Linux kernel.
723pub const Stat = extern struct {
724 dev: dev_t,
725 __dev_padding: u32,
726 __ino_truncated: u32,
727 mode: mode_t,
728 nlink: nlink_t,
729 uid: uid_t,
730 gid: gid_t,
731 rdev: dev_t,
732 __rdev_padding: u32,
733 size: off_t,
734 blksize: blksize_t,
735 blocks: blkcnt_t,
736 atim: timespec,
737 mtim: timespec,
738 ctim: timespec,
739 ino: ino_t,
740
741 pub fn atime(self: @This()) timespec {
742 return self.atim;
743 }
744
745 pub fn mtime(self: @This()) timespec {
746 return self.mtim;
747 }
748
749 pub fn ctime(self: @This()) timespec {
750 return self.ctim;
751 }
752};
753
754pub const timespec = extern struct {
755 tv_sec: i32,
756 tv_nsec: i32,
757};
758
759pub const timeval = extern struct {
760 tv_sec: i32,
761 tv_usec: i32,
762};
763
764pub const timezone = extern struct {
765 tz_minuteswest: i32,
766 tz_dsttime: i32,
767};
768
769pub const mcontext_t = extern struct {
770 gregs: [19]usize,
771 fpregs: [*]u8,
772 oldmask: usize,
773 cr2: usize,
774};
775
776pub const REG = struct {
777 pub const GS = 0;
778 pub const FS = 1;
779 pub const ES = 2;
780 pub const DS = 3;
781 pub const EDI = 4;
782 pub const ESI = 5;
783 pub const EBP = 6;
784 pub const ESP = 7;
785 pub const EBX = 8;
786 pub const EDX = 9;
787 pub const ECX = 10;
788 pub const EAX = 11;
789 pub const TRAPNO = 12;
790 pub const ERR = 13;
791 pub const EIP = 14;
792 pub const CS = 15;
793 pub const EFL = 16;
794 pub const UESP = 17;
795 pub const SS = 18;
796};
797
798pub const ucontext_t = extern struct {
799 flags: usize,
800 link: *ucontext_t,
801 stack: stack_t,
802 mcontext: mcontext_t,
803 sigmask: sigset_t,
804 regspace: [64]u64,
805};
806
807pub const Elf_Symndx = u32;
808
809pub const user_desc = packed struct {
810 entry_number: u32,
811 base_addr: u32,
812 limit: u32,
813 seg_32bit: u1,
814 contents: u2,
815 read_exec_only: u1,
816 limit_in_pages: u1,
817 seg_not_present: u1,
818 useable: u1,
819};
820
821/// socketcall() call numbers
822pub const SC = struct {
823 pub const socket = 1;
824 pub const bind = 2;
825 pub const connect = 3;
826 pub const listen = 4;
827 pub const accept = 5;
828 pub const getsockname = 6;
829 pub const getpeername = 7;
830 pub const socketpair = 8;
831 pub const send = 9;
832 pub const recv = 10;
833 pub const sendto = 11;
834 pub const recvfrom = 12;
835 pub const shutdown = 13;
836 pub const setsockopt = 14;
837 pub const getsockopt = 15;
838 pub const sendmsg = 16;
839 pub const recvmsg = 17;
840 pub const accept4 = 18;
841 pub const recvmmsg = 19;
842 pub const sendmmsg = 20;
843};
lib/std/os/linux/mips.zig+591
......@@ -1,3 +1,12 @@
1const std = @import("../../std.zig");
2const linux = std.os.linux;
3const socklen_t = linux.socklen_t;
4const iovec = linux.iovec;
5const iovec_const = linux.iovec_const;
6const uid_t = linux.uid_t;
7const gid_t = linux.gid_t;
8const pid_t = linux.pid_t;
9
110pub fn syscall0(number: SYS) usize {
211 return asm volatile (
312 \\ syscall
......@@ -195,3 +204,585 @@ pub fn restore_rt() callconv(.Naked) void {
195204 : "memory", "cc", "$7"
196205 );
197206}
207
208pub const SYS = enum(usize) {
209 pub const Linux = 4000;
210
211 syscall = Linux + 0,
212 exit = Linux + 1,
213 fork = Linux + 2,
214 read = Linux + 3,
215 write = Linux + 4,
216 open = Linux + 5,
217 close = Linux + 6,
218 waitpid = Linux + 7,
219 creat = Linux + 8,
220 link = Linux + 9,
221 unlink = Linux + 10,
222 execve = Linux + 11,
223 chdir = Linux + 12,
224 time = Linux + 13,
225 mknod = Linux + 14,
226 chmod = Linux + 15,
227 lchown = Linux + 16,
228 @"break" = Linux + 17,
229 unused18 = Linux + 18,
230 lseek = Linux + 19,
231 getpid = Linux + 20,
232 mount = Linux + 21,
233 umount = Linux + 22,
234 setuid = Linux + 23,
235 getuid = Linux + 24,
236 stime = Linux + 25,
237 ptrace = Linux + 26,
238 alarm = Linux + 27,
239 unused28 = Linux + 28,
240 pause = Linux + 29,
241 utime = Linux + 30,
242 stty = Linux + 31,
243 gtty = Linux + 32,
244 access = Linux + 33,
245 nice = Linux + 34,
246 ftime = Linux + 35,
247 sync = Linux + 36,
248 kill = Linux + 37,
249 rename = Linux + 38,
250 mkdir = Linux + 39,
251 rmdir = Linux + 40,
252 dup = Linux + 41,
253 pipe = Linux + 42,
254 times = Linux + 43,
255 prof = Linux + 44,
256 brk = Linux + 45,
257 setgid = Linux + 46,
258 getgid = Linux + 47,
259 signal = Linux + 48,
260 geteuid = Linux + 49,
261 getegid = Linux + 50,
262 acct = Linux + 51,
263 umount2 = Linux + 52,
264 lock = Linux + 53,
265 ioctl = Linux + 54,
266 fcntl = Linux + 55,
267 mpx = Linux + 56,
268 setpgid = Linux + 57,
269 ulimit = Linux + 58,
270 unused59 = Linux + 59,
271 umask = Linux + 60,
272 chroot = Linux + 61,
273 ustat = Linux + 62,
274 dup2 = Linux + 63,
275 getppid = Linux + 64,
276 getpgrp = Linux + 65,
277 setsid = Linux + 66,
278 sigaction = Linux + 67,
279 sgetmask = Linux + 68,
280 ssetmask = Linux + 69,
281 setreuid = Linux + 70,
282 setregid = Linux + 71,
283 sigsuspend = Linux + 72,
284 sigpending = Linux + 73,
285 sethostname = Linux + 74,
286 setrlimit = Linux + 75,
287 getrlimit = Linux + 76,
288 getrusage = Linux + 77,
289 gettimeofday = Linux + 78,
290 settimeofday = Linux + 79,
291 getgroups = Linux + 80,
292 setgroups = Linux + 81,
293 reserved82 = Linux + 82,
294 symlink = Linux + 83,
295 unused84 = Linux + 84,
296 readlink = Linux + 85,
297 uselib = Linux + 86,
298 swapon = Linux + 87,
299 reboot = Linux + 88,
300 readdir = Linux + 89,
301 mmap = Linux + 90,
302 munmap = Linux + 91,
303 truncate = Linux + 92,
304 ftruncate = Linux + 93,
305 fchmod = Linux + 94,
306 fchown = Linux + 95,
307 getpriority = Linux + 96,
308 setpriority = Linux + 97,
309 profil = Linux + 98,
310 statfs = Linux + 99,
311 fstatfs = Linux + 100,
312 ioperm = Linux + 101,
313 socketcall = Linux + 102,
314 syslog = Linux + 103,
315 setitimer = Linux + 104,
316 getitimer = Linux + 105,
317 stat = Linux + 106,
318 lstat = Linux + 107,
319 fstat = Linux + 108,
320 unused109 = Linux + 109,
321 iopl = Linux + 110,
322 vhangup = Linux + 111,
323 idle = Linux + 112,
324 vm86 = Linux + 113,
325 wait4 = Linux + 114,
326 swapoff = Linux + 115,
327 sysinfo = Linux + 116,
328 ipc = Linux + 117,
329 fsync = Linux + 118,
330 sigreturn = Linux + 119,
331 clone = Linux + 120,
332 setdomainname = Linux + 121,
333 uname = Linux + 122,
334 modify_ldt = Linux + 123,
335 adjtimex = Linux + 124,
336 mprotect = Linux + 125,
337 sigprocmask = Linux + 126,
338 create_module = Linux + 127,
339 init_module = Linux + 128,
340 delete_module = Linux + 129,
341 get_kernel_syms = Linux + 130,
342 quotactl = Linux + 131,
343 getpgid = Linux + 132,
344 fchdir = Linux + 133,
345 bdflush = Linux + 134,
346 sysfs = Linux + 135,
347 personality = Linux + 136,
348 afs_syscall = Linux + 137,
349 setfsuid = Linux + 138,
350 setfsgid = Linux + 139,
351 _llseek = Linux + 140,
352 getdents = Linux + 141,
353 _newselect = Linux + 142,
354 flock = Linux + 143,
355 msync = Linux + 144,
356 readv = Linux + 145,
357 writev = Linux + 146,
358 cacheflush = Linux + 147,
359 cachectl = Linux + 148,
360 sysmips = Linux + 149,
361 unused150 = Linux + 150,
362 getsid = Linux + 151,
363 fdatasync = Linux + 152,
364 _sysctl = Linux + 153,
365 mlock = Linux + 154,
366 munlock = Linux + 155,
367 mlockall = Linux + 156,
368 munlockall = Linux + 157,
369 sched_setparam = Linux + 158,
370 sched_getparam = Linux + 159,
371 sched_setscheduler = Linux + 160,
372 sched_getscheduler = Linux + 161,
373 sched_yield = Linux + 162,
374 sched_get_priority_max = Linux + 163,
375 sched_get_priority_min = Linux + 164,
376 sched_rr_get_interval = Linux + 165,
377 nanosleep = Linux + 166,
378 mremap = Linux + 167,
379 accept = Linux + 168,
380 bind = Linux + 169,
381 connect = Linux + 170,
382 getpeername = Linux + 171,
383 getsockname = Linux + 172,
384 getsockopt = Linux + 173,
385 listen = Linux + 174,
386 recv = Linux + 175,
387 recvfrom = Linux + 176,
388 recvmsg = Linux + 177,
389 send = Linux + 178,
390 sendmsg = Linux + 179,
391 sendto = Linux + 180,
392 setsockopt = Linux + 181,
393 shutdown = Linux + 182,
394 socket = Linux + 183,
395 socketpair = Linux + 184,
396 setresuid = Linux + 185,
397 getresuid = Linux + 186,
398 query_module = Linux + 187,
399 poll = Linux + 188,
400 nfsservctl = Linux + 189,
401 setresgid = Linux + 190,
402 getresgid = Linux + 191,
403 prctl = Linux + 192,
404 rt_sigreturn = Linux + 193,
405 rt_sigaction = Linux + 194,
406 rt_sigprocmask = Linux + 195,
407 rt_sigpending = Linux + 196,
408 rt_sigtimedwait = Linux + 197,
409 rt_sigqueueinfo = Linux + 198,
410 rt_sigsuspend = Linux + 199,
411 pread64 = Linux + 200,
412 pwrite64 = Linux + 201,
413 chown = Linux + 202,
414 getcwd = Linux + 203,
415 capget = Linux + 204,
416 capset = Linux + 205,
417 sigaltstack = Linux + 206,
418 sendfile = Linux + 207,
419 getpmsg = Linux + 208,
420 putpmsg = Linux + 209,
421 mmap2 = Linux + 210,
422 truncate64 = Linux + 211,
423 ftruncate64 = Linux + 212,
424 stat64 = Linux + 213,
425 lstat64 = Linux + 214,
426 fstat64 = Linux + 215,
427 pivot_root = Linux + 216,
428 mincore = Linux + 217,
429 madvise = Linux + 218,
430 getdents64 = Linux + 219,
431 fcntl64 = Linux + 220,
432 reserved221 = Linux + 221,
433 gettid = Linux + 222,
434 readahead = Linux + 223,
435 setxattr = Linux + 224,
436 lsetxattr = Linux + 225,
437 fsetxattr = Linux + 226,
438 getxattr = Linux + 227,
439 lgetxattr = Linux + 228,
440 fgetxattr = Linux + 229,
441 listxattr = Linux + 230,
442 llistxattr = Linux + 231,
443 flistxattr = Linux + 232,
444 removexattr = Linux + 233,
445 lremovexattr = Linux + 234,
446 fremovexattr = Linux + 235,
447 tkill = Linux + 236,
448 sendfile64 = Linux + 237,
449 futex = Linux + 238,
450 sched_setaffinity = Linux + 239,
451 sched_getaffinity = Linux + 240,
452 io_setup = Linux + 241,
453 io_destroy = Linux + 242,
454 io_getevents = Linux + 243,
455 io_submit = Linux + 244,
456 io_cancel = Linux + 245,
457 exit_group = Linux + 246,
458 lookup_dcookie = Linux + 247,
459 epoll_create = Linux + 248,
460 epoll_ctl = Linux + 249,
461 epoll_wait = Linux + 250,
462 remap_file_pages = Linux + 251,
463 set_tid_address = Linux + 252,
464 restart_syscall = Linux + 253,
465 fadvise64 = Linux + 254,
466 statfs64 = Linux + 255,
467 fstatfs64 = Linux + 256,
468 timer_create = Linux + 257,
469 timer_settime = Linux + 258,
470 timer_gettime = Linux + 259,
471 timer_getoverrun = Linux + 260,
472 timer_delete = Linux + 261,
473 clock_settime = Linux + 262,
474 clock_gettime = Linux + 263,
475 clock_getres = Linux + 264,
476 clock_nanosleep = Linux + 265,
477 tgkill = Linux + 266,
478 utimes = Linux + 267,
479 mbind = Linux + 268,
480 get_mempolicy = Linux + 269,
481 set_mempolicy = Linux + 270,
482 mq_open = Linux + 271,
483 mq_unlink = Linux + 272,
484 mq_timedsend = Linux + 273,
485 mq_timedreceive = Linux + 274,
486 mq_notify = Linux + 275,
487 mq_getsetattr = Linux + 276,
488 vserver = Linux + 277,
489 waitid = Linux + 278,
490 add_key = Linux + 280,
491 request_key = Linux + 281,
492 keyctl = Linux + 282,
493 set_thread_area = Linux + 283,
494 inotify_init = Linux + 284,
495 inotify_add_watch = Linux + 285,
496 inotify_rm_watch = Linux + 286,
497 migrate_pages = Linux + 287,
498 openat = Linux + 288,
499 mkdirat = Linux + 289,
500 mknodat = Linux + 290,
501 fchownat = Linux + 291,
502 futimesat = Linux + 292,
503 fstatat64 = Linux + 293,
504 unlinkat = Linux + 294,
505 renameat = Linux + 295,
506 linkat = Linux + 296,
507 symlinkat = Linux + 297,
508 readlinkat = Linux + 298,
509 fchmodat = Linux + 299,
510 faccessat = Linux + 300,
511 pselect6 = Linux + 301,
512 ppoll = Linux + 302,
513 unshare = Linux + 303,
514 splice = Linux + 304,
515 sync_file_range = Linux + 305,
516 tee = Linux + 306,
517 vmsplice = Linux + 307,
518 move_pages = Linux + 308,
519 set_robust_list = Linux + 309,
520 get_robust_list = Linux + 310,
521 kexec_load = Linux + 311,
522 getcpu = Linux + 312,
523 epoll_pwait = Linux + 313,
524 ioprio_set = Linux + 314,
525 ioprio_get = Linux + 315,
526 utimensat = Linux + 316,
527 signalfd = Linux + 317,
528 timerfd = Linux + 318,
529 eventfd = Linux + 319,
530 fallocate = Linux + 320,
531 timerfd_create = Linux + 321,
532 timerfd_gettime = Linux + 322,
533 timerfd_settime = Linux + 323,
534 signalfd4 = Linux + 324,
535 eventfd2 = Linux + 325,
536 epoll_create1 = Linux + 326,
537 dup3 = Linux + 327,
538 pipe2 = Linux + 328,
539 inotify_init1 = Linux + 329,
540 preadv = Linux + 330,
541 pwritev = Linux + 331,
542 rt_tgsigqueueinfo = Linux + 332,
543 perf_event_open = Linux + 333,
544 accept4 = Linux + 334,
545 recvmmsg = Linux + 335,
546 fanotify_init = Linux + 336,
547 fanotify_mark = Linux + 337,
548 prlimit64 = Linux + 338,
549 name_to_handle_at = Linux + 339,
550 open_by_handle_at = Linux + 340,
551 clock_adjtime = Linux + 341,
552 syncfs = Linux + 342,
553 sendmmsg = Linux + 343,
554 setns = Linux + 344,
555 process_vm_readv = Linux + 345,
556 process_vm_writev = Linux + 346,
557 kcmp = Linux + 347,
558 finit_module = Linux + 348,
559 sched_setattr = Linux + 349,
560 sched_getattr = Linux + 350,
561 renameat2 = Linux + 351,
562 seccomp = Linux + 352,
563 getrandom = Linux + 353,
564 memfd_create = Linux + 354,
565 bpf = Linux + 355,
566 execveat = Linux + 356,
567 userfaultfd = Linux + 357,
568 membarrier = Linux + 358,
569 mlock2 = Linux + 359,
570 copy_file_range = Linux + 360,
571 preadv2 = Linux + 361,
572 pwritev2 = Linux + 362,
573 pkey_mprotect = Linux + 363,
574 pkey_alloc = Linux + 364,
575 pkey_free = Linux + 365,
576 statx = Linux + 366,
577 rseq = Linux + 367,
578 io_pgetevents = Linux + 368,
579 semget = Linux + 393,
580 semctl = Linux + 394,
581 shmget = Linux + 395,
582 shmctl = Linux + 396,
583 shmat = Linux + 397,
584 shmdt = Linux + 398,
585 msgget = Linux + 399,
586 msgsnd = Linux + 400,
587 msgrcv = Linux + 401,
588 msgctl = Linux + 402,
589 clock_gettime64 = Linux + 403,
590 clock_settime64 = Linux + 404,
591 clock_adjtime64 = Linux + 405,
592 clock_getres_time64 = Linux + 406,
593 clock_nanosleep_time64 = Linux + 407,
594 timer_gettime64 = Linux + 408,
595 timer_settime64 = Linux + 409,
596 timerfd_gettime64 = Linux + 410,
597 timerfd_settime64 = Linux + 411,
598 utimensat_time64 = Linux + 412,
599 pselect6_time64 = Linux + 413,
600 ppoll_time64 = Linux + 414,
601 io_pgetevents_time64 = Linux + 416,
602 recvmmsg_time64 = Linux + 417,
603 mq_timedsend_time64 = Linux + 418,
604 mq_timedreceive_time64 = Linux + 419,
605 semtimedop_time64 = Linux + 420,
606 rt_sigtimedwait_time64 = Linux + 421,
607 futex_time64 = Linux + 422,
608 sched_rr_get_interval_time64 = Linux + 423,
609 pidfd_send_signal = Linux + 424,
610 io_uring_setup = Linux + 425,
611 io_uring_enter = Linux + 426,
612 io_uring_register = Linux + 427,
613 open_tree = Linux + 428,
614 move_mount = Linux + 429,
615 fsopen = Linux + 430,
616 fsconfig = Linux + 431,
617 fsmount = Linux + 432,
618 fspick = Linux + 433,
619 pidfd_open = Linux + 434,
620 clone3 = Linux + 435,
621 close_range = Linux + 436,
622 openat2 = Linux + 437,
623 pidfd_getfd = Linux + 438,
624 faccessat2 = Linux + 439,
625 process_madvise = Linux + 440,
626 epoll_pwait2 = Linux + 441,
627
628 _,
629};
630
631pub const O_CREAT = 0o0400;
632pub const O_EXCL = 0o02000;
633pub const O_NOCTTY = 0o04000;
634pub const O_TRUNC = 0o01000;
635pub const O_APPEND = 0o0010;
636pub const O_NONBLOCK = 0o0200;
637pub const O_DSYNC = 0o0020;
638pub const O_SYNC = 0o040020;
639pub const O_RSYNC = 0o040020;
640pub const O_DIRECTORY = 0o0200000;
641pub const O_NOFOLLOW = 0o0400000;
642pub const O_CLOEXEC = 0o02000000;
643
644pub const O_ASYNC = 0o010000;
645pub const O_DIRECT = 0o0100000;
646pub const O_LARGEFILE = 0o020000;
647pub const O_NOATIME = 0o01000000;
648pub const O_PATH = 0o010000000;
649pub const O_TMPFILE = 0o020200000;
650pub const O_NDELAY = O_NONBLOCK;
651
652pub const F_DUPFD = 0;
653pub const F_GETFD = 1;
654pub const F_SETFD = 2;
655pub const F_GETFL = 3;
656pub const F_SETFL = 4;
657
658pub const F_SETOWN = 24;
659pub const F_GETOWN = 23;
660pub const F_SETSIG = 10;
661pub const F_GETSIG = 11;
662
663pub const F_GETLK = 33;
664pub const F_SETLK = 34;
665pub const F_SETLKW = 35;
666
667pub const F_RDLCK = 0;
668pub const F_WRLCK = 1;
669pub const F_UNLCK = 2;
670
671pub const LOCK_SH = 1;
672pub const LOCK_EX = 2;
673pub const LOCK_UN = 8;
674pub const LOCK_NB = 4;
675
676pub const F_SETOWN_EX = 15;
677pub const F_GETOWN_EX = 16;
678
679pub const F_GETOWNER_UIDS = 17;
680
681pub const MMAP2_UNIT = 4096;
682
683pub const MAP_NORESERVE = 0x0400;
684pub const MAP_GROWSDOWN = 0x1000;
685pub const MAP_DENYWRITE = 0x2000;
686pub const MAP_EXECUTABLE = 0x4000;
687pub const MAP_LOCKED = 0x8000;
688pub const MAP_32BIT = 0x40;
689
690pub const SO_DEBUG = 1;
691pub const SO_REUSEADDR = 0x0004;
692pub const SO_KEEPALIVE = 0x0008;
693pub const SO_DONTROUTE = 0x0010;
694pub const SO_BROADCAST = 0x0020;
695pub const SO_LINGER = 0x0080;
696pub const SO_OOBINLINE = 0x0100;
697pub const SO_REUSEPORT = 0x0200;
698pub const SO_SNDBUF = 0x1001;
699pub const SO_RCVBUF = 0x1002;
700pub const SO_SNDLOWAT = 0x1003;
701pub const SO_RCVLOWAT = 0x1004;
702pub const SO_RCVTIMEO = 0x1006;
703pub const SO_SNDTIMEO = 0x1005;
704pub const SO_ERROR = 0x1007;
705pub const SO_TYPE = 0x1008;
706pub const SO_ACCEPTCONN = 0x1009;
707pub const SO_PROTOCOL = 0x1028;
708pub const SO_DOMAIN = 0x1029;
709pub const SO_NO_CHECK = 11;
710pub const SO_PRIORITY = 12;
711pub const SO_BSDCOMPAT = 14;
712pub const SO_PASSCRED = 17;
713pub const SO_PEERCRED = 18;
714pub const SO_PEERSEC = 30;
715pub const SO_SNDBUFFORCE = 31;
716pub const SO_RCVBUFFORCE = 33;
717
718pub const VDSO_CGT_SYM = "__kernel_clock_gettime";
719pub const VDSO_CGT_VER = "LINUX_2.6.39";
720
721pub const Flock = extern struct {
722 l_type: i16,
723 l_whence: i16,
724 __pad0: [4]u8,
725 l_start: off_t,
726 l_len: off_t,
727 l_pid: pid_t,
728 __unused: [4]u8,
729};
730
731pub const blksize_t = i32;
732pub const nlink_t = u32;
733pub const time_t = i32;
734pub const mode_t = u32;
735pub const off_t = i64;
736pub const ino_t = u64;
737pub const dev_t = u64;
738pub const blkcnt_t = i64;
739
740// The `stat` definition used by the Linux kernel.
741pub const Stat = extern struct {
742 dev: u32,
743 __pad0: [3]u32, // Reserved for st_dev expansion
744 ino: ino_t,
745 mode: mode_t,
746 nlink: nlink_t,
747 uid: uid_t,
748 gid: gid_t,
749 rdev: u32,
750 __pad1: [3]u32,
751 size: off_t,
752 atim: timespec,
753 mtim: timespec,
754 ctim: timespec,
755 blksize: blksize_t,
756 __pad3: u32,
757 blocks: blkcnt_t,
758 __pad4: [14]usize,
759
760 pub fn atime(self: @This()) timespec {
761 return self.atim;
762 }
763
764 pub fn mtime(self: @This()) timespec {
765 return self.mtim;
766 }
767
768 pub fn ctime(self: @This()) timespec {
769 return self.ctim;
770 }
771};
772
773pub const timespec = extern struct {
774 tv_sec: isize,
775 tv_nsec: isize,
776};
777
778pub const timeval = extern struct {
779 tv_sec: isize,
780 tv_usec: isize,
781};
782
783pub const timezone = extern struct {
784 tz_minuteswest: i32,
785 tz_dsttime: i32,
786};
787
788pub const Elf_Symndx = u32;
lib/std/os/linux/powerpc.zig+620
......@@ -1,3 +1,14 @@
1const std = @import("../../std.zig");
2const linux = std.os.linux;
3const socklen_t = linux.socklen_t;
4const iovec = linux.iovec;
5const iovec_const = linux.iovec_const;
6const uid_t = linux.uid_t;
7const gid_t = linux.gid_t;
8const pid_t = linux.pid_t;
9const stack_t = linux.stack_t;
10const sigset_t = linux.sigset_t;
11
112pub fn syscall0(number: SYS) usize {
213 return asm volatile (
314 \\ sc
......@@ -123,3 +134,612 @@ pub fn restore_rt() callconv(.Naked) void {
123134 : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
124135 );
125136}
137
138pub const SYS = enum(usize) {
139 restart_syscall = 0,
140 exit = 1,
141 fork = 2,
142 read = 3,
143 write = 4,
144 open = 5,
145 close = 6,
146 waitpid = 7,
147 creat = 8,
148 link = 9,
149 unlink = 10,
150 execve = 11,
151 chdir = 12,
152 time = 13,
153 mknod = 14,
154 chmod = 15,
155 lchown = 16,
156 @"break" = 17,
157 oldstat = 18,
158 lseek = 19,
159 getpid = 20,
160 mount = 21,
161 umount = 22,
162 setuid = 23,
163 getuid = 24,
164 stime = 25,
165 ptrace = 26,
166 alarm = 27,
167 oldfstat = 28,
168 pause = 29,
169 utime = 30,
170 stty = 31,
171 gtty = 32,
172 access = 33,
173 nice = 34,
174 ftime = 35,
175 sync = 36,
176 kill = 37,
177 rename = 38,
178 mkdir = 39,
179 rmdir = 40,
180 dup = 41,
181 pipe = 42,
182 times = 43,
183 prof = 44,
184 brk = 45,
185 setgid = 46,
186 getgid = 47,
187 signal = 48,
188 geteuid = 49,
189 getegid = 50,
190 acct = 51,
191 umount2 = 52,
192 lock = 53,
193 ioctl = 54,
194 fcntl = 55,
195 mpx = 56,
196 setpgid = 57,
197 ulimit = 58,
198 oldolduname = 59,
199 umask = 60,
200 chroot = 61,
201 ustat = 62,
202 dup2 = 63,
203 getppid = 64,
204 getpgrp = 65,
205 setsid = 66,
206 sigaction = 67,
207 sgetmask = 68,
208 ssetmask = 69,
209 setreuid = 70,
210 setregid = 71,
211 sigsuspend = 72,
212 sigpending = 73,
213 sethostname = 74,
214 setrlimit = 75,
215 getrlimit = 76,
216 getrusage = 77,
217 gettimeofday = 78,
218 settimeofday = 79,
219 getgroups = 80,
220 setgroups = 81,
221 select = 82,
222 symlink = 83,
223 oldlstat = 84,
224 readlink = 85,
225 uselib = 86,
226 swapon = 87,
227 reboot = 88,
228 readdir = 89,
229 mmap = 90,
230 munmap = 91,
231 truncate = 92,
232 ftruncate = 93,
233 fchmod = 94,
234 fchown = 95,
235 getpriority = 96,
236 setpriority = 97,
237 profil = 98,
238 statfs = 99,
239 fstatfs = 100,
240 ioperm = 101,
241 socketcall = 102,
242 syslog = 103,
243 setitimer = 104,
244 getitimer = 105,
245 stat = 106,
246 lstat = 107,
247 fstat = 108,
248 olduname = 109,
249 iopl = 110,
250 vhangup = 111,
251 idle = 112,
252 vm86 = 113,
253 wait4 = 114,
254 swapoff = 115,
255 sysinfo = 116,
256 ipc = 117,
257 fsync = 118,
258 sigreturn = 119,
259 clone = 120,
260 setdomainname = 121,
261 uname = 122,
262 modify_ldt = 123,
263 adjtimex = 124,
264 mprotect = 125,
265 sigprocmask = 126,
266 create_module = 127,
267 init_module = 128,
268 delete_module = 129,
269 get_kernel_syms = 130,
270 quotactl = 131,
271 getpgid = 132,
272 fchdir = 133,
273 bdflush = 134,
274 sysfs = 135,
275 personality = 136,
276 afs_syscall = 137,
277 setfsuid = 138,
278 setfsgid = 139,
279 _llseek = 140,
280 getdents = 141,
281 _newselect = 142,
282 flock = 143,
283 msync = 144,
284 readv = 145,
285 writev = 146,
286 getsid = 147,
287 fdatasync = 148,
288 _sysctl = 149,
289 mlock = 150,
290 munlock = 151,
291 mlockall = 152,
292 munlockall = 153,
293 sched_setparam = 154,
294 sched_getparam = 155,
295 sched_setscheduler = 156,
296 sched_getscheduler = 157,
297 sched_yield = 158,
298 sched_get_priority_max = 159,
299 sched_get_priority_min = 160,
300 sched_rr_get_interval = 161,
301 nanosleep = 162,
302 mremap = 163,
303 setresuid = 164,
304 getresuid = 165,
305 query_module = 166,
306 poll = 167,
307 nfsservctl = 168,
308 setresgid = 169,
309 getresgid = 170,
310 prctl = 171,
311 rt_sigreturn = 172,
312 rt_sigaction = 173,
313 rt_sigprocmask = 174,
314 rt_sigpending = 175,
315 rt_sigtimedwait = 176,
316 rt_sigqueueinfo = 177,
317 rt_sigsuspend = 178,
318 pread64 = 179,
319 pwrite64 = 180,
320 chown = 181,
321 getcwd = 182,
322 capget = 183,
323 capset = 184,
324 sigaltstack = 185,
325 sendfile = 186,
326 getpmsg = 187,
327 putpmsg = 188,
328 vfork = 189,
329 ugetrlimit = 190,
330 readahead = 191,
331 mmap2 = 192,
332 truncate64 = 193,
333 ftruncate64 = 194,
334 stat64 = 195,
335 lstat64 = 196,
336 fstat64 = 197,
337 pciconfig_read = 198,
338 pciconfig_write = 199,
339 pciconfig_iobase = 200,
340 multiplexer = 201,
341 getdents64 = 202,
342 pivot_root = 203,
343 fcntl64 = 204,
344 madvise = 205,
345 mincore = 206,
346 gettid = 207,
347 tkill = 208,
348 setxattr = 209,
349 lsetxattr = 210,
350 fsetxattr = 211,
351 getxattr = 212,
352 lgetxattr = 213,
353 fgetxattr = 214,
354 listxattr = 215,
355 llistxattr = 216,
356 flistxattr = 217,
357 removexattr = 218,
358 lremovexattr = 219,
359 fremovexattr = 220,
360 futex = 221,
361 sched_setaffinity = 222,
362 sched_getaffinity = 223,
363 tuxcall = 225,
364 sendfile64 = 226,
365 io_setup = 227,
366 io_destroy = 228,
367 io_getevents = 229,
368 io_submit = 230,
369 io_cancel = 231,
370 set_tid_address = 232,
371 fadvise64 = 233,
372 exit_group = 234,
373 lookup_dcookie = 235,
374 epoll_create = 236,
375 epoll_ctl = 237,
376 epoll_wait = 238,
377 remap_file_pages = 239,
378 timer_create = 240,
379 timer_settime = 241,
380 timer_gettime = 242,
381 timer_getoverrun = 243,
382 timer_delete = 244,
383 clock_settime = 245,
384 clock_gettime = 246,
385 clock_getres = 247,
386 clock_nanosleep = 248,
387 swapcontext = 249,
388 tgkill = 250,
389 utimes = 251,
390 statfs64 = 252,
391 fstatfs64 = 253,
392 fadvise64_64 = 254,
393 rtas = 255,
394 sys_debug_setcontext = 256,
395 migrate_pages = 258,
396 mbind = 259,
397 get_mempolicy = 260,
398 set_mempolicy = 261,
399 mq_open = 262,
400 mq_unlink = 263,
401 mq_timedsend = 264,
402 mq_timedreceive = 265,
403 mq_notify = 266,
404 mq_getsetattr = 267,
405 kexec_load = 268,
406 add_key = 269,
407 request_key = 270,
408 keyctl = 271,
409 waitid = 272,
410 ioprio_set = 273,
411 ioprio_get = 274,
412 inotify_init = 275,
413 inotify_add_watch = 276,
414 inotify_rm_watch = 277,
415 spu_run = 278,
416 spu_create = 279,
417 pselect6 = 280,
418 ppoll = 281,
419 unshare = 282,
420 splice = 283,
421 tee = 284,
422 vmsplice = 285,
423 openat = 286,
424 mkdirat = 287,
425 mknodat = 288,
426 fchownat = 289,
427 futimesat = 290,
428 fstatat64 = 291,
429 unlinkat = 292,
430 renameat = 293,
431 linkat = 294,
432 symlinkat = 295,
433 readlinkat = 296,
434 fchmodat = 297,
435 faccessat = 298,
436 get_robust_list = 299,
437 set_robust_list = 300,
438 move_pages = 301,
439 getcpu = 302,
440 epoll_pwait = 303,
441 utimensat = 304,
442 signalfd = 305,
443 timerfd_create = 306,
444 eventfd = 307,
445 sync_file_range = 308,
446 fallocate = 309,
447 subpage_prot = 310,
448 timerfd_settime = 311,
449 timerfd_gettime = 312,
450 signalfd4 = 313,
451 eventfd2 = 314,
452 epoll_create1 = 315,
453 dup3 = 316,
454 pipe2 = 317,
455 inotify_init1 = 318,
456 perf_event_open = 319,
457 preadv = 320,
458 pwritev = 321,
459 rt_tgsigqueueinfo = 322,
460 fanotify_init = 323,
461 fanotify_mark = 324,
462 prlimit64 = 325,
463 socket = 326,
464 bind = 327,
465 connect = 328,
466 listen = 329,
467 accept = 330,
468 getsockname = 331,
469 getpeername = 332,
470 socketpair = 333,
471 send = 334,
472 sendto = 335,
473 recv = 336,
474 recvfrom = 337,
475 shutdown = 338,
476 setsockopt = 339,
477 getsockopt = 340,
478 sendmsg = 341,
479 recvmsg = 342,
480 recvmmsg = 343,
481 accept4 = 344,
482 name_to_handle_at = 345,
483 open_by_handle_at = 346,
484 clock_adjtime = 347,
485 syncfs = 348,
486 sendmmsg = 349,
487 setns = 350,
488 process_vm_readv = 351,
489 process_vm_writev = 352,
490 finit_module = 353,
491 kcmp = 354,
492 sched_setattr = 355,
493 sched_getattr = 356,
494 renameat2 = 357,
495 seccomp = 358,
496 getrandom = 359,
497 memfd_create = 360,
498 bpf = 361,
499 execveat = 362,
500 switch_endian = 363,
501 userfaultfd = 364,
502 membarrier = 365,
503 mlock2 = 378,
504 copy_file_range = 379,
505 preadv2 = 380,
506 pwritev2 = 381,
507 kexec_file_load = 382,
508 statx = 383,
509 pkey_alloc = 384,
510 pkey_free = 385,
511 pkey_mprotect = 386,
512 rseq = 387,
513 io_pgetevents = 388,
514 semget = 393,
515 semctl = 394,
516 shmget = 395,
517 shmctl = 396,
518 shmat = 397,
519 shmdt = 398,
520 msgget = 399,
521 msgsnd = 400,
522 msgrcv = 401,
523 msgctl = 402,
524 clock_gettime64 = 403,
525 clock_settime64 = 404,
526 clock_adjtime64 = 405,
527 clock_getres_time64 = 406,
528 clock_nanosleep_time64 = 407,
529 timer_gettime64 = 408,
530 timer_settime64 = 409,
531 timerfd_gettime64 = 410,
532 timerfd_settime64 = 411,
533 utimensat_time64 = 412,
534 pselect6_time64 = 413,
535 ppoll_time64 = 414,
536 io_pgetevents_time64 = 416,
537 recvmmsg_time64 = 417,
538 mq_timedsend_time64 = 418,
539 mq_timedreceive_time64 = 419,
540 semtimedop_time64 = 420,
541 rt_sigtimedwait_time64 = 421,
542 futex_time64 = 422,
543 sched_rr_get_interval_time64 = 423,
544 pidfd_send_signal = 424,
545 io_uring_setup = 425,
546 io_uring_enter = 426,
547 io_uring_register = 427,
548 open_tree = 428,
549 move_mount = 429,
550 fsopen = 430,
551 fsconfig = 431,
552 fsmount = 432,
553 fspick = 433,
554 pidfd_open = 434,
555 clone3 = 435,
556 close_range = 436,
557 openat2 = 437,
558 pidfd_getfd = 438,
559 faccessat2 = 439,
560 process_madvise = 440,
561};
562
563pub const O_CREAT = 0o100;
564pub const O_EXCL = 0o200;
565pub const O_NOCTTY = 0o400;
566pub const O_TRUNC = 0o1000;
567pub const O_APPEND = 0o2000;
568pub const O_NONBLOCK = 0o4000;
569pub const O_DSYNC = 0o10000;
570pub const O_SYNC = 0o4010000;
571pub const O_RSYNC = 0o4010000;
572pub const O_DIRECTORY = 0o40000;
573pub const O_NOFOLLOW = 0o100000;
574pub const O_CLOEXEC = 0o2000000;
575
576pub const O_ASYNC = 0o20000;
577pub const O_DIRECT = 0o400000;
578pub const O_LARGEFILE = 0o200000;
579pub const O_NOATIME = 0o1000000;
580pub const O_PATH = 0o10000000;
581pub const O_TMPFILE = 0o20040000;
582pub const O_NDELAY = O_NONBLOCK;
583
584pub const F_DUPFD = 0;
585pub const F_GETFD = 1;
586pub const F_SETFD = 2;
587pub const F_GETFL = 3;
588pub const F_SETFL = 4;
589
590pub const F_SETOWN = 8;
591pub const F_GETOWN = 9;
592pub const F_SETSIG = 10;
593pub const F_GETSIG = 11;
594
595pub const F_GETLK = 12;
596pub const F_SETLK = 13;
597pub const F_SETLKW = 14;
598
599pub const F_SETOWN_EX = 15;
600pub const F_GETOWN_EX = 16;
601
602pub const F_GETOWNER_UIDS = 17;
603
604pub const F_RDLCK = 0;
605pub const F_WRLCK = 1;
606pub const F_UNLCK = 2;
607
608pub const LOCK_SH = 1;
609pub const LOCK_EX = 2;
610pub const LOCK_UN = 8;
611pub const LOCK_NB = 4;
612
613/// stack-like segment
614pub const MAP_GROWSDOWN = 0x0100;
615
616/// ETXTBSY
617pub const MAP_DENYWRITE = 0x0800;
618
619/// mark it as an executable
620pub const MAP_EXECUTABLE = 0x1000;
621
622/// pages are locked
623pub const MAP_LOCKED = 0x0080;
624
625/// don't check for reservations
626pub const MAP_NORESERVE = 0x0040;
627
628pub const VDSO_CGT_SYM = "__kernel_clock_gettime";
629pub const VDSO_CGT_VER = "LINUX_2.6.15";
630
631pub const Flock = extern struct {
632 l_type: i16,
633 l_whence: i16,
634 l_start: off_t,
635 l_len: off_t,
636 l_pid: pid_t,
637};
638
639pub const msghdr = extern struct {
640 msg_name: ?*sockaddr,
641 msg_namelen: socklen_t,
642 msg_iov: [*]iovec,
643 msg_iovlen: usize,
644 msg_control: ?*c_void,
645 msg_controllen: socklen_t,
646 msg_flags: i32,
647};
648
649pub const msghdr_const = extern struct {
650 msg_name: ?*const sockaddr,
651 msg_namelen: socklen_t,
652 msg_iov: [*]iovec_const,
653 msg_iovlen: usize,
654 msg_control: ?*c_void,
655 msg_controllen: socklen_t,
656 msg_flags: i32,
657};
658
659pub const blksize_t = i32;
660pub const nlink_t = u32;
661pub const time_t = isize;
662pub const mode_t = u32;
663pub const off_t = i64;
664pub const ino_t = u64;
665pub const dev_t = u64;
666pub const blkcnt_t = i64;
667
668// The `stat` definition used by the Linux kernel.
669pub const Stat = extern struct {
670 dev: dev_t,
671 ino: ino_t,
672 mode: mode_t,
673 nlink: nlink_t,
674 uid: uid_t,
675 gid: gid_t,
676 rdev: dev_t,
677 __rdev_padding: i16,
678 size: off_t,
679 blksize: blksize_t,
680 blocks: blkcnt_t,
681 atim: timespec,
682 mtim: timespec,
683 ctim: timespec,
684 __unused: [2]u32,
685
686 pub fn atime(self: @This()) timespec {
687 return self.atim;
688 }
689
690 pub fn mtime(self: @This()) timespec {
691 return self.mtim;
692 }
693
694 pub fn ctime(self: @This()) timespec {
695 return self.ctim;
696 }
697};
698
699pub const timespec = extern struct {
700 tv_sec: time_t,
701 tv_nsec: isize,
702};
703
704pub const timeval = extern struct {
705 tv_sec: time_t,
706 tv_usec: isize,
707};
708
709pub const timezone = extern struct {
710 tz_minuteswest: i32,
711 tz_dsttime: i32,
712};
713
714pub const greg_t = u32;
715pub const gregset_t = [48]greg_t;
716pub const fpregset_t = [33]f64;
717
718pub const vrregset = extern struct {
719 vrregs: [32][4]u32,
720 vrsave: u32,
721 _pad: [2]u32,
722 vscr: u32,
723};
724pub const vrregset_t = vrregset;
725
726pub const mcontext_t = extern struct {
727 gp_regs: gregset_t,
728 fp_regs: fpregset_t,
729 v_regs: vrregset_t align(16),
730};
731
732pub const ucontext_t = extern struct {
733 flags: u32,
734 link: *ucontext_t,
735 stack: stack_t,
736 pad: [7]i32,
737 regs: *mcontext_t,
738 sigmask: sigset_t,
739 pad2: [3]i32,
740 mcontext: mcontext_t,
741};
742
743pub const Elf_Symndx = u32;
744
745pub const MMAP2_UNIT = 4096;
lib/std/os/linux/powerpc64.zig+603
......@@ -1,3 +1,14 @@
1const std = @import("../../std.zig");
2const linux = std.os.linux;
3const socklen_t = linux.socklen_t;
4const iovec = linux.iovec;
5const iovec_const = linux.iovec_const;
6const uid_t = linux.uid_t;
7const gid_t = linux.gid_t;
8const pid_t = linux.pid_t;
9const stack_t = linux.stack_t;
10const sigset_t = linux.sigset_t;
11
112pub fn syscall0(number: SYS) usize {
213 return asm volatile (
314 \\ sc
......@@ -123,3 +134,595 @@ pub fn restore_rt() callconv(.Naked) void {
123134 : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
124135 );
125136}
137
138pub const SYS = enum(usize) {
139 restart_syscall = 0,
140 exit = 1,
141 fork = 2,
142 read = 3,
143 write = 4,
144 open = 5,
145 close = 6,
146 waitpid = 7,
147 creat = 8,
148 link = 9,
149 unlink = 10,
150 execve = 11,
151 chdir = 12,
152 time = 13,
153 mknod = 14,
154 chmod = 15,
155 lchown = 16,
156 @"break" = 17,
157 oldstat = 18,
158 lseek = 19,
159 getpid = 20,
160 mount = 21,
161 umount = 22,
162 setuid = 23,
163 getuid = 24,
164 stime = 25,
165 ptrace = 26,
166 alarm = 27,
167 oldfstat = 28,
168 pause = 29,
169 utime = 30,
170 stty = 31,
171 gtty = 32,
172 access = 33,
173 nice = 34,
174 ftime = 35,
175 sync = 36,
176 kill = 37,
177 rename = 38,
178 mkdir = 39,
179 rmdir = 40,
180 dup = 41,
181 pipe = 42,
182 times = 43,
183 prof = 44,
184 brk = 45,
185 setgid = 46,
186 getgid = 47,
187 signal = 48,
188 geteuid = 49,
189 getegid = 50,
190 acct = 51,
191 umount2 = 52,
192 lock = 53,
193 ioctl = 54,
194 fcntl = 55,
195 mpx = 56,
196 setpgid = 57,
197 ulimit = 58,
198 oldolduname = 59,
199 umask = 60,
200 chroot = 61,
201 ustat = 62,
202 dup2 = 63,
203 getppid = 64,
204 getpgrp = 65,
205 setsid = 66,
206 sigaction = 67,
207 sgetmask = 68,
208 ssetmask = 69,
209 setreuid = 70,
210 setregid = 71,
211 sigsuspend = 72,
212 sigpending = 73,
213 sethostname = 74,
214 setrlimit = 75,
215 getrlimit = 76,
216 getrusage = 77,
217 gettimeofday = 78,
218 settimeofday = 79,
219 getgroups = 80,
220 setgroups = 81,
221 select = 82,
222 symlink = 83,
223 oldlstat = 84,
224 readlink = 85,
225 uselib = 86,
226 swapon = 87,
227 reboot = 88,
228 readdir = 89,
229 mmap = 90,
230 munmap = 91,
231 truncate = 92,
232 ftruncate = 93,
233 fchmod = 94,
234 fchown = 95,
235 getpriority = 96,
236 setpriority = 97,
237 profil = 98,
238 statfs = 99,
239 fstatfs = 100,
240 ioperm = 101,
241 socketcall = 102,
242 syslog = 103,
243 setitimer = 104,
244 getitimer = 105,
245 stat = 106,
246 lstat = 107,
247 fstat = 108,
248 olduname = 109,
249 iopl = 110,
250 vhangup = 111,
251 idle = 112,
252 vm86 = 113,
253 wait4 = 114,
254 swapoff = 115,
255 sysinfo = 116,
256 ipc = 117,
257 fsync = 118,
258 sigreturn = 119,
259 clone = 120,
260 setdomainname = 121,
261 uname = 122,
262 modify_ldt = 123,
263 adjtimex = 124,
264 mprotect = 125,
265 sigprocmask = 126,
266 create_module = 127,
267 init_module = 128,
268 delete_module = 129,
269 get_kernel_syms = 130,
270 quotactl = 131,
271 getpgid = 132,
272 fchdir = 133,
273 bdflush = 134,
274 sysfs = 135,
275 personality = 136,
276 afs_syscall = 137,
277 setfsuid = 138,
278 setfsgid = 139,
279 _llseek = 140,
280 getdents = 141,
281 _newselect = 142,
282 flock = 143,
283 msync = 144,
284 readv = 145,
285 writev = 146,
286 getsid = 147,
287 fdatasync = 148,
288 _sysctl = 149,
289 mlock = 150,
290 munlock = 151,
291 mlockall = 152,
292 munlockall = 153,
293 sched_setparam = 154,
294 sched_getparam = 155,
295 sched_setscheduler = 156,
296 sched_getscheduler = 157,
297 sched_yield = 158,
298 sched_get_priority_max = 159,
299 sched_get_priority_min = 160,
300 sched_rr_get_interval = 161,
301 nanosleep = 162,
302 mremap = 163,
303 setresuid = 164,
304 getresuid = 165,
305 query_module = 166,
306 poll = 167,
307 nfsservctl = 168,
308 setresgid = 169,
309 getresgid = 170,
310 prctl = 171,
311 rt_sigreturn = 172,
312 rt_sigaction = 173,
313 rt_sigprocmask = 174,
314 rt_sigpending = 175,
315 rt_sigtimedwait = 176,
316 rt_sigqueueinfo = 177,
317 rt_sigsuspend = 178,
318 pread64 = 179,
319 pwrite64 = 180,
320 chown = 181,
321 getcwd = 182,
322 capget = 183,
323 capset = 184,
324 sigaltstack = 185,
325 sendfile = 186,
326 getpmsg = 187,
327 putpmsg = 188,
328 vfork = 189,
329 ugetrlimit = 190,
330 readahead = 191,
331 pciconfig_read = 198,
332 pciconfig_write = 199,
333 pciconfig_iobase = 200,
334 multiplexer = 201,
335 getdents64 = 202,
336 pivot_root = 203,
337 madvise = 205,
338 mincore = 206,
339 gettid = 207,
340 tkill = 208,
341 setxattr = 209,
342 lsetxattr = 210,
343 fsetxattr = 211,
344 getxattr = 212,
345 lgetxattr = 213,
346 fgetxattr = 214,
347 listxattr = 215,
348 llistxattr = 216,
349 flistxattr = 217,
350 removexattr = 218,
351 lremovexattr = 219,
352 fremovexattr = 220,
353 futex = 221,
354 sched_setaffinity = 222,
355 sched_getaffinity = 223,
356 tuxcall = 225,
357 io_setup = 227,
358 io_destroy = 228,
359 io_getevents = 229,
360 io_submit = 230,
361 io_cancel = 231,
362 set_tid_address = 232,
363 fadvise64 = 233,
364 exit_group = 234,
365 lookup_dcookie = 235,
366 epoll_create = 236,
367 epoll_ctl = 237,
368 epoll_wait = 238,
369 remap_file_pages = 239,
370 timer_create = 240,
371 timer_settime = 241,
372 timer_gettime = 242,
373 timer_getoverrun = 243,
374 timer_delete = 244,
375 clock_settime = 245,
376 clock_gettime = 246,
377 clock_getres = 247,
378 clock_nanosleep = 248,
379 swapcontext = 249,
380 tgkill = 250,
381 utimes = 251,
382 statfs64 = 252,
383 fstatfs64 = 253,
384 rtas = 255,
385 sys_debug_setcontext = 256,
386 migrate_pages = 258,
387 mbind = 259,
388 get_mempolicy = 260,
389 set_mempolicy = 261,
390 mq_open = 262,
391 mq_unlink = 263,
392 mq_timedsend = 264,
393 mq_timedreceive = 265,
394 mq_notify = 266,
395 mq_getsetattr = 267,
396 kexec_load = 268,
397 add_key = 269,
398 request_key = 270,
399 keyctl = 271,
400 waitid = 272,
401 ioprio_set = 273,
402 ioprio_get = 274,
403 inotify_init = 275,
404 inotify_add_watch = 276,
405 inotify_rm_watch = 277,
406 spu_run = 278,
407 spu_create = 279,
408 pselect6 = 280,
409 ppoll = 281,
410 unshare = 282,
411 splice = 283,
412 tee = 284,
413 vmsplice = 285,
414 openat = 286,
415 mkdirat = 287,
416 mknodat = 288,
417 fchownat = 289,
418 futimesat = 290,
419 fstatat = 291,
420 unlinkat = 292,
421 renameat = 293,
422 linkat = 294,
423 symlinkat = 295,
424 readlinkat = 296,
425 fchmodat = 297,
426 faccessat = 298,
427 get_robust_list = 299,
428 set_robust_list = 300,
429 move_pages = 301,
430 getcpu = 302,
431 epoll_pwait = 303,
432 utimensat = 304,
433 signalfd = 305,
434 timerfd_create = 306,
435 eventfd = 307,
436 sync_file_range = 308,
437 fallocate = 309,
438 subpage_prot = 310,
439 timerfd_settime = 311,
440 timerfd_gettime = 312,
441 signalfd4 = 313,
442 eventfd2 = 314,
443 epoll_create1 = 315,
444 dup3 = 316,
445 pipe2 = 317,
446 inotify_init1 = 318,
447 perf_event_open = 319,
448 preadv = 320,
449 pwritev = 321,
450 rt_tgsigqueueinfo = 322,
451 fanotify_init = 323,
452 fanotify_mark = 324,
453 prlimit64 = 325,
454 socket = 326,
455 bind = 327,
456 connect = 328,
457 listen = 329,
458 accept = 330,
459 getsockname = 331,
460 getpeername = 332,
461 socketpair = 333,
462 send = 334,
463 sendto = 335,
464 recv = 336,
465 recvfrom = 337,
466 shutdown = 338,
467 setsockopt = 339,
468 getsockopt = 340,
469 sendmsg = 341,
470 recvmsg = 342,
471 recvmmsg = 343,
472 accept4 = 344,
473 name_to_handle_at = 345,
474 open_by_handle_at = 346,
475 clock_adjtime = 347,
476 syncfs = 348,
477 sendmmsg = 349,
478 setns = 350,
479 process_vm_readv = 351,
480 process_vm_writev = 352,
481 finit_module = 353,
482 kcmp = 354,
483 sched_setattr = 355,
484 sched_getattr = 356,
485 renameat2 = 357,
486 seccomp = 358,
487 getrandom = 359,
488 memfd_create = 360,
489 bpf = 361,
490 execveat = 362,
491 switch_endian = 363,
492 userfaultfd = 364,
493 membarrier = 365,
494 mlock2 = 378,
495 copy_file_range = 379,
496 preadv2 = 380,
497 pwritev2 = 381,
498 kexec_file_load = 382,
499 statx = 383,
500 pkey_alloc = 384,
501 pkey_free = 385,
502 pkey_mprotect = 386,
503 rseq = 387,
504 io_pgetevents = 388,
505 semtimedop = 392,
506 semget = 393,
507 semctl = 394,
508 shmget = 395,
509 shmctl = 396,
510 shmat = 397,
511 shmdt = 398,
512 msgget = 399,
513 msgsnd = 400,
514 msgrcv = 401,
515 msgctl = 402,
516 pidfd_send_signal = 424,
517 io_uring_setup = 425,
518 io_uring_enter = 426,
519 io_uring_register = 427,
520 open_tree = 428,
521 move_mount = 429,
522 fsopen = 430,
523 fsconfig = 431,
524 fsmount = 432,
525 fspick = 433,
526 pidfd_open = 434,
527 clone3 = 435,
528 close_range = 436,
529 openat2 = 437,
530 pidfd_getfd = 438,
531 faccessat2 = 439,
532 process_madvise = 440,
533 epoll_pwait2 = 441,
534
535 _,
536};
537
538pub const O_CREAT = 0o100;
539pub const O_EXCL = 0o200;
540pub const O_NOCTTY = 0o400;
541pub const O_TRUNC = 0o1000;
542pub const O_APPEND = 0o2000;
543pub const O_NONBLOCK = 0o4000;
544pub const O_DSYNC = 0o10000;
545pub const O_SYNC = 0o4010000;
546pub const O_RSYNC = 0o4010000;
547pub const O_DIRECTORY = 0o40000;
548pub const O_NOFOLLOW = 0o100000;
549pub const O_CLOEXEC = 0o2000000;
550
551pub const O_ASYNC = 0o20000;
552pub const O_DIRECT = 0o400000;
553pub const O_LARGEFILE = 0o200000;
554pub const O_NOATIME = 0o1000000;
555pub const O_PATH = 0o10000000;
556pub const O_TMPFILE = 0o20200000;
557pub const O_NDELAY = O_NONBLOCK;
558
559pub const F_DUPFD = 0;
560pub const F_GETFD = 1;
561pub const F_SETFD = 2;
562pub const F_GETFL = 3;
563pub const F_SETFL = 4;
564
565pub const F_SETOWN = 8;
566pub const F_GETOWN = 9;
567pub const F_SETSIG = 10;
568pub const F_GETSIG = 11;
569
570pub const F_GETLK = 5;
571pub const F_SETLK = 6;
572pub const F_SETLKW = 7;
573
574pub const F_RDLCK = 0;
575pub const F_WRLCK = 1;
576pub const F_UNLCK = 2;
577
578pub const LOCK_SH = 1;
579pub const LOCK_EX = 2;
580pub const LOCK_UN = 8;
581pub const LOCK_NB = 4;
582
583pub const F_SETOWN_EX = 15;
584pub const F_GETOWN_EX = 16;
585
586pub const F_GETOWNER_UIDS = 17;
587
588/// stack-like segment
589pub const MAP_GROWSDOWN = 0x0100;
590
591/// ETXTBSY
592pub const MAP_DENYWRITE = 0x0800;
593
594/// mark it as an executable
595pub const MAP_EXECUTABLE = 0x1000;
596
597/// pages are locked
598pub const MAP_LOCKED = 0x0080;
599
600/// don't check for reservations
601pub const MAP_NORESERVE = 0x0040;
602
603pub const VDSO_CGT_SYM = "__kernel_clock_gettime";
604pub const VDSO_CGT_VER = "LINUX_2.6.15";
605
606pub const Flock = extern struct {
607 l_type: i16,
608 l_whence: i16,
609 l_start: off_t,
610 l_len: off_t,
611 l_pid: pid_t,
612 __unused: [4]u8,
613};
614
615pub const msghdr = extern struct {
616 msg_name: ?*sockaddr,
617 msg_namelen: socklen_t,
618 msg_iov: [*]iovec,
619 msg_iovlen: usize,
620 msg_control: ?*c_void,
621 msg_controllen: usize,
622 msg_flags: i32,
623};
624
625pub const msghdr_const = extern struct {
626 msg_name: ?*const sockaddr,
627 msg_namelen: socklen_t,
628 msg_iov: [*]iovec_const,
629 msg_iovlen: usize,
630 msg_control: ?*c_void,
631 msg_controllen: usize,
632 msg_flags: i32,
633};
634
635pub const blksize_t = i64;
636pub const nlink_t = u64;
637pub const time_t = i64;
638pub const mode_t = u32;
639pub const off_t = i64;
640pub const ino_t = u64;
641pub const dev_t = u64;
642pub const blkcnt_t = i64;
643
644// The `stat` definition used by the Linux kernel.
645pub const Stat = extern struct {
646 dev: dev_t,
647 ino: ino_t,
648 nlink: nlink_t,
649 mode: mode_t,
650 uid: uid_t,
651 gid: gid_t,
652 rdev: dev_t,
653 size: off_t,
654 blksize: blksize_t,
655 blocks: blkcnt_t,
656 atim: timespec,
657 mtim: timespec,
658 ctim: timespec,
659 __unused: [3]u64,
660
661 pub fn atime(self: @This()) timespec {
662 return self.atim;
663 }
664
665 pub fn mtime(self: @This()) timespec {
666 return self.mtim;
667 }
668
669 pub fn ctime(self: @This()) timespec {
670 return self.ctim;
671 }
672};
673
674pub const timespec = extern struct {
675 tv_sec: time_t,
676 tv_nsec: isize,
677};
678
679pub const timeval = extern struct {
680 tv_sec: isize,
681 tv_usec: isize,
682};
683
684pub const timezone = extern struct {
685 tz_minuteswest: i32,
686 tz_dsttime: i32,
687};
688
689pub const greg_t = u64;
690pub const gregset_t = [48]greg_t;
691pub const fpregset_t = [33]f64;
692
693/// The position of the vscr register depends on endianness.
694/// On C, macros are used to change vscr_word's offset to
695/// account for this. Here we'll just define vscr_word_le
696/// and vscr_word_be. Code must take care to use the correct one.
697pub const vrregset = extern struct {
698 vrregs: [32][4]u32 align(16),
699 vscr_word_le: u32,
700 _pad1: [2]u32,
701 vscr_word_be: u32,
702 vrsave: u32,
703 _pad2: [3]u32,
704};
705pub const vrregset_t = vrregset;
706
707pub const mcontext_t = extern struct {
708 __unused: [4]u64,
709 signal: i32,
710 _pad0: i32,
711 handler: u64,
712 oldmask: u64,
713 regs: ?*c_void,
714 gp_regs: gregset_t,
715 fp_regs: fpregset_t,
716 v_regs: *vrregset_t,
717 vmx_reserve: [34 + 34 + 32 + 1]i64,
718};
719
720pub const ucontext_t = extern struct {
721 flags: u32,
722 link: *ucontext_t,
723 stack: stack_t,
724 sigmask: sigset_t,
725 mcontext: mcontext_t,
726};
727
728pub const Elf_Symndx = u32;
lib/std/os/linux/riscv64.zig+420
......@@ -1,3 +1,8 @@
1const std = @import("../../std.zig");
2const uid_t = std.os.linux.uid_t;
3const gid_t = std.os.linux.gid_t;
4const pid_t = std.os.linux.pid_t;
5
16pub fn syscall0(number: SYS) usize {
27 return asm volatile ("ecall"
38 : [ret] "={x10}" (-> usize),
......@@ -94,3 +99,418 @@ pub fn restore_rt() callconv(.Naked) void {
9499 : "memory"
95100 );
96101}
102
103pub const SYS = enum(usize) {
104 pub const arch_specific_syscall = 244;
105
106 io_setup = 0,
107 io_destroy = 1,
108 io_submit = 2,
109 io_cancel = 3,
110 io_getevents = 4,
111 setxattr = 5,
112 lsetxattr = 6,
113 fsetxattr = 7,
114 getxattr = 8,
115 lgetxattr = 9,
116 fgetxattr = 10,
117 listxattr = 11,
118 llistxattr = 12,
119 flistxattr = 13,
120 removexattr = 14,
121 lremovexattr = 15,
122 fremovexattr = 16,
123 getcwd = 17,
124 lookup_dcookie = 18,
125 eventfd2 = 19,
126 epoll_create1 = 20,
127 epoll_ctl = 21,
128 epoll_pwait = 22,
129 dup = 23,
130 dup3 = 24,
131 fcntl = 25,
132 inotify_init1 = 26,
133 inotify_add_watch = 27,
134 inotify_rm_watch = 28,
135 ioctl = 29,
136 ioprio_set = 30,
137 ioprio_get = 31,
138 flock = 32,
139 mknodat = 33,
140 mkdirat = 34,
141 unlinkat = 35,
142 symlinkat = 36,
143 linkat = 37,
144 umount2 = 39,
145 mount = 40,
146 pivot_root = 41,
147 nfsservctl = 42,
148 statfs = 43,
149 fstatfs = 44,
150 truncate = 45,
151 ftruncate = 46,
152 fallocate = 47,
153 faccessat = 48,
154 chdir = 49,
155 fchdir = 50,
156 chroot = 51,
157 fchmod = 52,
158 fchmodat = 53,
159 fchownat = 54,
160 fchown = 55,
161 openat = 56,
162 close = 57,
163 vhangup = 58,
164 pipe2 = 59,
165 quotactl = 60,
166 getdents64 = 61,
167 lseek = 62,
168 read = 63,
169 write = 64,
170 readv = 65,
171 writev = 66,
172 pread64 = 67,
173 pwrite64 = 68,
174 preadv = 69,
175 pwritev = 70,
176 sendfile = 71,
177 pselect6 = 72,
178 ppoll = 73,
179 signalfd4 = 74,
180 vmsplice = 75,
181 splice = 76,
182 tee = 77,
183 readlinkat = 78,
184 fstatat = 79,
185 fstat = 80,
186 sync = 81,
187 fsync = 82,
188 fdatasync = 83,
189 sync_file_range = 84,
190 timerfd_create = 85,
191 timerfd_settime = 86,
192 timerfd_gettime = 87,
193 utimensat = 88,
194 acct = 89,
195 capget = 90,
196 capset = 91,
197 personality = 92,
198 exit = 93,
199 exit_group = 94,
200 waitid = 95,
201 set_tid_address = 96,
202 unshare = 97,
203 futex = 98,
204 set_robust_list = 99,
205 get_robust_list = 100,
206 nanosleep = 101,
207 getitimer = 102,
208 setitimer = 103,
209 kexec_load = 104,
210 init_module = 105,
211 delete_module = 106,
212 timer_create = 107,
213 timer_gettime = 108,
214 timer_getoverrun = 109,
215 timer_settime = 110,
216 timer_delete = 111,
217 clock_settime = 112,
218 clock_gettime = 113,
219 clock_getres = 114,
220 clock_nanosleep = 115,
221 syslog = 116,
222 ptrace = 117,
223 sched_setparam = 118,
224 sched_setscheduler = 119,
225 sched_getscheduler = 120,
226 sched_getparam = 121,
227 sched_setaffinity = 122,
228 sched_getaffinity = 123,
229 sched_yield = 124,
230 sched_get_priority_max = 125,
231 sched_get_priority_min = 126,
232 sched_rr_get_interval = 127,
233 restart_syscall = 128,
234 kill = 129,
235 tkill = 130,
236 tgkill = 131,
237 sigaltstack = 132,
238 rt_sigsuspend = 133,
239 rt_sigaction = 134,
240 rt_sigprocmask = 135,
241 rt_sigpending = 136,
242 rt_sigtimedwait = 137,
243 rt_sigqueueinfo = 138,
244 rt_sigreturn = 139,
245 setpriority = 140,
246 getpriority = 141,
247 reboot = 142,
248 setregid = 143,
249 setgid = 144,
250 setreuid = 145,
251 setuid = 146,
252 setresuid = 147,
253 getresuid = 148,
254 setresgid = 149,
255 getresgid = 150,
256 setfsuid = 151,
257 setfsgid = 152,
258 times = 153,
259 setpgid = 154,
260 getpgid = 155,
261 getsid = 156,
262 setsid = 157,
263 getgroups = 158,
264 setgroups = 159,
265 uname = 160,
266 sethostname = 161,
267 setdomainname = 162,
268 getrlimit = 163,
269 setrlimit = 164,
270 getrusage = 165,
271 umask = 166,
272 prctl = 167,
273 getcpu = 168,
274 gettimeofday = 169,
275 settimeofday = 170,
276 adjtimex = 171,
277 getpid = 172,
278 getppid = 173,
279 getuid = 174,
280 geteuid = 175,
281 getgid = 176,
282 getegid = 177,
283 gettid = 178,
284 sysinfo = 179,
285 mq_open = 180,
286 mq_unlink = 181,
287 mq_timedsend = 182,
288 mq_timedreceive = 183,
289 mq_notify = 184,
290 mq_getsetattr = 185,
291 msgget = 186,
292 msgctl = 187,
293 msgrcv = 188,
294 msgsnd = 189,
295 semget = 190,
296 semctl = 191,
297 semtimedop = 192,
298 semop = 193,
299 shmget = 194,
300 shmctl = 195,
301 shmat = 196,
302 shmdt = 197,
303 socket = 198,
304 socketpair = 199,
305 bind = 200,
306 listen = 201,
307 accept = 202,
308 connect = 203,
309 getsockname = 204,
310 getpeername = 205,
311 sendto = 206,
312 recvfrom = 207,
313 setsockopt = 208,
314 getsockopt = 209,
315 shutdown = 210,
316 sendmsg = 211,
317 recvmsg = 212,
318 readahead = 213,
319 brk = 214,
320 munmap = 215,
321 mremap = 216,
322 add_key = 217,
323 request_key = 218,
324 keyctl = 219,
325 clone = 220,
326 execve = 221,
327 mmap = 222,
328 fadvise64 = 223,
329 swapon = 224,
330 swapoff = 225,
331 mprotect = 226,
332 msync = 227,
333 mlock = 228,
334 munlock = 229,
335 mlockall = 230,
336 munlockall = 231,
337 mincore = 232,
338 madvise = 233,
339 remap_file_pages = 234,
340 mbind = 235,
341 get_mempolicy = 236,
342 set_mempolicy = 237,
343 migrate_pages = 238,
344 move_pages = 239,
345 rt_tgsigqueueinfo = 240,
346 perf_event_open = 241,
347 accept4 = 242,
348 recvmmsg = 243,
349
350 riscv_flush_icache = arch_specific_syscall + 15,
351
352 wait4 = 260,
353 prlimit64 = 261,
354 fanotify_init = 262,
355 fanotify_mark = 263,
356 name_to_handle_at = 264,
357 open_by_handle_at = 265,
358 clock_adjtime = 266,
359 syncfs = 267,
360 setns = 268,
361 sendmmsg = 269,
362 process_vm_readv = 270,
363 process_vm_writev = 271,
364 kcmp = 272,
365 finit_module = 273,
366 sched_setattr = 274,
367 sched_getattr = 275,
368 renameat2 = 276,
369 seccomp = 277,
370 getrandom = 278,
371 memfd_create = 279,
372 bpf = 280,
373 execveat = 281,
374 userfaultfd = 282,
375 membarrier = 283,
376 mlock2 = 284,
377 copy_file_range = 285,
378 preadv2 = 286,
379 pwritev2 = 287,
380 pkey_mprotect = 288,
381 pkey_alloc = 289,
382 pkey_free = 290,
383 statx = 291,
384 io_pgetevents = 292,
385 rseq = 293,
386 kexec_file_load = 294,
387 pidfd_send_signal = 424,
388 io_uring_setup = 425,
389 io_uring_enter = 426,
390 io_uring_register = 427,
391 open_tree = 428,
392 move_mount = 429,
393 fsopen = 430,
394 fsconfig = 431,
395 fsmount = 432,
396 fspick = 433,
397 pidfd_open = 434,
398 clone3 = 435,
399 close_range = 436,
400 openat2 = 437,
401 pidfd_getfd = 438,
402 faccessat2 = 439,
403 process_madvise = 440,
404 epoll_pwait2 = 441,
405
406 _,
407};
408
409pub const O_CREAT = 0o100;
410pub const O_EXCL = 0o200;
411pub const O_NOCTTY = 0o400;
412pub const O_TRUNC = 0o1000;
413pub const O_APPEND = 0o2000;
414pub const O_NONBLOCK = 0o4000;
415pub const O_DSYNC = 0o10000;
416pub const O_SYNC = 0o4010000;
417pub const O_RSYNC = 0o4010000;
418pub const O_DIRECTORY = 0o200000;
419pub const O_NOFOLLOW = 0o400000;
420pub const O_CLOEXEC = 0o2000000;
421
422pub const O_ASYNC = 0o20000;
423pub const O_DIRECT = 0o40000;
424pub const O_LARGEFILE = 0o100000;
425pub const O_NOATIME = 0o1000000;
426pub const O_PATH = 0o10000000;
427pub const O_TMPFILE = 0o20200000;
428pub const O_NDELAY = O_NONBLOCK;
429
430pub const F_DUPFD = 0;
431pub const F_GETFD = 1;
432pub const F_SETFD = 2;
433pub const F_GETFL = 3;
434pub const F_SETFL = 4;
435pub const F_GETLK = 5;
436pub const F_SETLK = 6;
437pub const F_SETLKW = 7;
438pub const F_SETOWN = 8;
439pub const F_GETOWN = 9;
440pub const F_SETSIG = 10;
441pub const F_GETSIG = 11;
442
443pub const F_RDLCK = 0;
444pub const F_WRLCK = 1;
445pub const F_UNLCK = 2;
446
447pub const LOCK_SH = 1;
448pub const LOCK_EX = 2;
449pub const LOCK_UN = 8;
450pub const LOCK_NB = 4;
451
452pub const F_SETOWN_EX = 15;
453pub const F_GETOWN_EX = 16;
454
455pub const F_GETOWNER_UIDS = 17;
456
457pub const blksize_t = i32;
458pub const nlink_t = u32;
459pub const time_t = isize;
460pub const mode_t = u32;
461pub const off_t = isize;
462pub const ino_t = usize;
463pub const dev_t = usize;
464pub const blkcnt_t = isize;
465pub const timespec = extern struct {
466 tv_sec: time_t,
467 tv_nsec: isize,
468};
469
470pub const timeval = extern struct {
471 tv_sec: time_t,
472 tv_usec: i64,
473};
474
475pub const Flock = extern struct {
476 l_type: i16,
477 l_whence: i16,
478 l_start: off_t,
479 l_len: off_t,
480 l_pid: pid_t,
481 __unused: [4]u8,
482};
483
484// The `stat` definition used by the Linux kernel.
485pub const Stat = extern struct {
486 dev: dev_t,
487 ino: ino_t,
488 mode: mode_t,
489 nlink: nlink_t,
490 uid: uid_t,
491 gid: gid_t,
492 rdev: dev_t,
493 __pad: usize,
494 size: off_t,
495 blksize: blksize_t,
496 __pad2: i32,
497 blocks: blkcnt_t,
498 atim: timespec,
499 mtim: timespec,
500 ctim: timespec,
501 __unused: [2]u32,
502
503 pub fn atime(self: @This()) timespec {
504 return self.atim;
505 }
506
507 pub fn mtime(self: @This()) timespec {
508 return self.mtim;
509 }
510
511 pub fn ctime(self: @This()) timespec {
512 return self.ctim;
513 }
514};
515
516pub const Elf_Symndx = u32;
lib/std/os/linux/sparc64.zig+641
......@@ -1,3 +1,16 @@
1const std = @import("../../std.zig");
2const pid_t = linux.pid_t;
3const uid_t = linux.uid_t;
4const clock_t = linux.clock_t;
5const stack_t = linux.stack_t;
6const sigset_t = linux.sigset_t;
7
8const linux = std.os.linux;
9const sockaddr = linux.sockaddr;
10const socklen_t = linux.socklen_t;
11const iovec = linux.iovec;
12const iovec_const = linux.iovec_const;
13
114pub fn syscall_pipe(fd: *[2]i32) usize {
215 return asm volatile (
316 \\ mov %[arg], %%g3
......@@ -176,3 +189,631 @@ pub fn restore_rt() callconv(.C) void {
176189 : "memory", "xcc", "o0", "o1", "o2", "o3", "o4", "o5", "o7"
177190 );
178191}
192
193pub const SYS = enum(usize) {
194 restart_syscall = 0,
195 exit = 1,
196 fork = 2,
197 read = 3,
198 write = 4,
199 open = 5,
200 close = 6,
201 wait4 = 7,
202 creat = 8,
203 link = 9,
204 unlink = 10,
205 execv = 11,
206 chdir = 12,
207 chown = 13,
208 mknod = 14,
209 chmod = 15,
210 lchown = 16,
211 brk = 17,
212 perfctr = 18,
213 lseek = 19,
214 getpid = 20,
215 capget = 21,
216 capset = 22,
217 setuid = 23,
218 getuid = 24,
219 vmsplice = 25,
220 ptrace = 26,
221 alarm = 27,
222 sigaltstack = 28,
223 pause = 29,
224 utime = 30,
225 access = 33,
226 nice = 34,
227 sync = 36,
228 kill = 37,
229 stat = 38,
230 sendfile = 39,
231 lstat = 40,
232 dup = 41,
233 pipe = 42,
234 times = 43,
235 umount2 = 45,
236 setgid = 46,
237 getgid = 47,
238 signal = 48,
239 geteuid = 49,
240 getegid = 50,
241 acct = 51,
242 memory_ordering = 52,
243 ioctl = 54,
244 reboot = 55,
245 symlink = 57,
246 readlink = 58,
247 execve = 59,
248 umask = 60,
249 chroot = 61,
250 fstat = 62,
251 fstat64 = 63,
252 getpagesize = 64,
253 msync = 65,
254 vfork = 66,
255 pread64 = 67,
256 pwrite64 = 68,
257 mmap = 71,
258 munmap = 73,
259 mprotect = 74,
260 madvise = 75,
261 vhangup = 76,
262 mincore = 78,
263 getgroups = 79,
264 setgroups = 80,
265 getpgrp = 81,
266 setitimer = 83,
267 swapon = 85,
268 getitimer = 86,
269 sethostname = 88,
270 dup2 = 90,
271 fcntl = 92,
272 select = 93,
273 fsync = 95,
274 setpriority = 96,
275 socket = 97,
276 connect = 98,
277 accept = 99,
278 getpriority = 100,
279 rt_sigreturn = 101,
280 rt_sigaction = 102,
281 rt_sigprocmask = 103,
282 rt_sigpending = 104,
283 rt_sigtimedwait = 105,
284 rt_sigqueueinfo = 106,
285 rt_sigsuspend = 107,
286 setresuid = 108,
287 getresuid = 109,
288 setresgid = 110,
289 getresgid = 111,
290 recvmsg = 113,
291 sendmsg = 114,
292 gettimeofday = 116,
293 getrusage = 117,
294 getsockopt = 118,
295 getcwd = 119,
296 readv = 120,
297 writev = 121,
298 settimeofday = 122,
299 fchown = 123,
300 fchmod = 124,
301 recvfrom = 125,
302 setreuid = 126,
303 setregid = 127,
304 rename = 128,
305 truncate = 129,
306 ftruncate = 130,
307 flock = 131,
308 lstat64 = 132,
309 sendto = 133,
310 shutdown = 134,
311 socketpair = 135,
312 mkdir = 136,
313 rmdir = 137,
314 utimes = 138,
315 stat64 = 139,
316 sendfile64 = 140,
317 getpeername = 141,
318 futex = 142,
319 gettid = 143,
320 getrlimit = 144,
321 setrlimit = 145,
322 pivot_root = 146,
323 prctl = 147,
324 pciconfig_read = 148,
325 pciconfig_write = 149,
326 getsockname = 150,
327 inotify_init = 151,
328 inotify_add_watch = 152,
329 poll = 153,
330 getdents64 = 154,
331 inotify_rm_watch = 156,
332 statfs = 157,
333 fstatfs = 158,
334 umount = 159,
335 sched_set_affinity = 160,
336 sched_get_affinity = 161,
337 getdomainname = 162,
338 setdomainname = 163,
339 utrap_install = 164,
340 quotactl = 165,
341 set_tid_address = 166,
342 mount = 167,
343 ustat = 168,
344 setxattr = 169,
345 lsetxattr = 170,
346 fsetxattr = 171,
347 getxattr = 172,
348 lgetxattr = 173,
349 getdents = 174,
350 setsid = 175,
351 fchdir = 176,
352 fgetxattr = 177,
353 listxattr = 178,
354 llistxattr = 179,
355 flistxattr = 180,
356 removexattr = 181,
357 lremovexattr = 182,
358 sigpending = 183,
359 query_module = 184,
360 setpgid = 185,
361 fremovexattr = 186,
362 tkill = 187,
363 exit_group = 188,
364 uname = 189,
365 init_module = 190,
366 personality = 191,
367 remap_file_pages = 192,
368 epoll_create = 193,
369 epoll_ctl = 194,
370 epoll_wait = 195,
371 ioprio_set = 196,
372 getppid = 197,
373 sigaction = 198,
374 sgetmask = 199,
375 ssetmask = 200,
376 sigsuspend = 201,
377 oldlstat = 202,
378 uselib = 203,
379 readdir = 204,
380 readahead = 205,
381 socketcall = 206,
382 syslog = 207,
383 lookup_dcookie = 208,
384 fadvise64 = 209,
385 fadvise64_64 = 210,
386 tgkill = 211,
387 waitpid = 212,
388 swapoff = 213,
389 sysinfo = 214,
390 ipc = 215,
391 sigreturn = 216,
392 clone = 217,
393 ioprio_get = 218,
394 adjtimex = 219,
395 sigprocmask = 220,
396 create_module = 221,
397 delete_module = 222,
398 get_kernel_syms = 223,
399 getpgid = 224,
400 bdflush = 225,
401 sysfs = 226,
402 afs_syscall = 227,
403 setfsuid = 228,
404 setfsgid = 229,
405 _newselect = 230,
406 splice = 232,
407 stime = 233,
408 statfs64 = 234,
409 fstatfs64 = 235,
410 _llseek = 236,
411 mlock = 237,
412 munlock = 238,
413 mlockall = 239,
414 munlockall = 240,
415 sched_setparam = 241,
416 sched_getparam = 242,
417 sched_setscheduler = 243,
418 sched_getscheduler = 244,
419 sched_yield = 245,
420 sched_get_priority_max = 246,
421 sched_get_priority_min = 247,
422 sched_rr_get_interval = 248,
423 nanosleep = 249,
424 mremap = 250,
425 _sysctl = 251,
426 getsid = 252,
427 fdatasync = 253,
428 nfsservctl = 254,
429 sync_file_range = 255,
430 clock_settime = 256,
431 clock_gettime = 257,
432 clock_getres = 258,
433 clock_nanosleep = 259,
434 sched_getaffinity = 260,
435 sched_setaffinity = 261,
436 timer_settime = 262,
437 timer_gettime = 263,
438 timer_getoverrun = 264,
439 timer_delete = 265,
440 timer_create = 266,
441 vserver = 267,
442 io_setup = 268,
443 io_destroy = 269,
444 io_submit = 270,
445 io_cancel = 271,
446 io_getevents = 272,
447 mq_open = 273,
448 mq_unlink = 274,
449 mq_timedsend = 275,
450 mq_timedreceive = 276,
451 mq_notify = 277,
452 mq_getsetattr = 278,
453 waitid = 279,
454 tee = 280,
455 add_key = 281,
456 request_key = 282,
457 keyctl = 283,
458 openat = 284,
459 mkdirat = 285,
460 mknodat = 286,
461 fchownat = 287,
462 futimesat = 288,
463 fstatat64 = 289,
464 unlinkat = 290,
465 renameat = 291,
466 linkat = 292,
467 symlinkat = 293,
468 readlinkat = 294,
469 fchmodat = 295,
470 faccessat = 296,
471 pselect6 = 297,
472 ppoll = 298,
473 unshare = 299,
474 set_robust_list = 300,
475 get_robust_list = 301,
476 migrate_pages = 302,
477 mbind = 303,
478 get_mempolicy = 304,
479 set_mempolicy = 305,
480 kexec_load = 306,
481 move_pages = 307,
482 getcpu = 308,
483 epoll_pwait = 309,
484 utimensat = 310,
485 signalfd = 311,
486 timerfd_create = 312,
487 eventfd = 313,
488 fallocate = 314,
489 timerfd_settime = 315,
490 timerfd_gettime = 316,
491 signalfd4 = 317,
492 eventfd2 = 318,
493 epoll_create1 = 319,
494 dup3 = 320,
495 pipe2 = 321,
496 inotify_init1 = 322,
497 accept4 = 323,
498 preadv = 324,
499 pwritev = 325,
500 rt_tgsigqueueinfo = 326,
501 perf_event_open = 327,
502 recvmmsg = 328,
503 fanotify_init = 329,
504 fanotify_mark = 330,
505 prlimit64 = 331,
506 name_to_handle_at = 332,
507 open_by_handle_at = 333,
508 clock_adjtime = 334,
509 syncfs = 335,
510 sendmmsg = 336,
511 setns = 337,
512 process_vm_readv = 338,
513 process_vm_writev = 339,
514 kern_features = 340,
515 kcmp = 341,
516 finit_module = 342,
517 sched_setattr = 343,
518 sched_getattr = 344,
519 renameat2 = 345,
520 seccomp = 346,
521 getrandom = 347,
522 memfd_create = 348,
523 bpf = 349,
524 execveat = 350,
525 membarrier = 351,
526 userfaultfd = 352,
527 bind = 353,
528 listen = 354,
529 setsockopt = 355,
530 mlock2 = 356,
531 copy_file_range = 357,
532 preadv2 = 358,
533 pwritev2 = 359,
534 statx = 360,
535 io_pgetevents = 361,
536 pkey_mprotect = 362,
537 pkey_alloc = 363,
538 pkey_free = 364,
539 rseq = 365,
540 semtimedop = 392,
541 semget = 393,
542 semctl = 394,
543 shmget = 395,
544 shmctl = 396,
545 shmat = 397,
546 shmdt = 398,
547 msgget = 399,
548 msgsnd = 400,
549 msgrcv = 401,
550 msgctl = 402,
551 pidfd_send_signal = 424,
552 io_uring_setup = 425,
553 io_uring_enter = 426,
554 io_uring_register = 427,
555 open_tree = 428,
556 move_mount = 429,
557 fsopen = 430,
558 fsconfig = 431,
559 fsmount = 432,
560 fspick = 433,
561 pidfd_open = 434,
562 clone3 = 435,
563 close_range = 436,
564 openat2 = 437,
565 pidfd_getfd = 438,
566 faccessat2 = 439,
567 process_madvise = 440,
568 epoll_pwait2 = 441,
569
570 _,
571};
572
573pub const O_CREAT = 0x200;
574pub const O_EXCL = 0x800;
575pub const O_NOCTTY = 0x8000;
576pub const O_TRUNC = 0x400;
577pub const O_APPEND = 0x8;
578pub const O_NONBLOCK = 0x4000;
579pub const O_SYNC = 0x802000;
580pub const O_DSYNC = 0x2000;
581pub const O_RSYNC = O_SYNC;
582pub const O_DIRECTORY = 0x10000;
583pub const O_NOFOLLOW = 0x20000;
584pub const O_CLOEXEC = 0x400000;
585
586pub const O_ASYNC = 0x40;
587pub const O_DIRECT = 0x100000;
588pub const O_LARGEFILE = 0;
589pub const O_NOATIME = 0x200000;
590pub const O_PATH = 0x1000000;
591pub const O_TMPFILE = 0x2010000;
592pub const O_NDELAY = O_NONBLOCK | 0x4;
593
594pub const F_DUPFD = 0;
595pub const F_GETFD = 1;
596pub const F_SETFD = 2;
597pub const F_GETFL = 3;
598pub const F_SETFL = 4;
599
600pub const F_SETOWN = 5;
601pub const F_GETOWN = 6;
602pub const F_GETLK = 7;
603pub const F_SETLK = 8;
604pub const F_SETLKW = 9;
605
606pub const F_RDLCK = 1;
607pub const F_WRLCK = 2;
608pub const F_UNLCK = 3;
609
610pub const F_SETOWN_EX = 15;
611pub const F_GETOWN_EX = 16;
612
613pub const F_GETOWNER_UIDS = 17;
614
615pub const LOCK_SH = 1;
616pub const LOCK_EX = 2;
617pub const LOCK_NB = 4;
618pub const LOCK_UN = 8;
619
620/// stack-like segment
621pub const MAP_GROWSDOWN = 0x0200;
622
623/// ETXTBSY
624pub const MAP_DENYWRITE = 0x0800;
625
626/// mark it as an executable
627pub const MAP_EXECUTABLE = 0x1000;
628
629/// pages are locked
630pub const MAP_LOCKED = 0x0100;
631
632/// don't check for reservations
633pub const MAP_NORESERVE = 0x0040;
634
635pub const VDSO_CGT_SYM = "__vdso_clock_gettime";
636pub const VDSO_CGT_VER = "LINUX_2.6";
637
638pub const Flock = extern struct {
639 l_type: i16,
640 l_whence: i16,
641 l_start: off_t,
642 l_len: off_t,
643 l_pid: pid_t,
644};
645
646pub const msghdr = extern struct {
647 msg_name: ?*sockaddr,
648 msg_namelen: socklen_t,
649 msg_iov: [*]iovec,
650 msg_iovlen: u64,
651 msg_control: ?*c_void,
652 msg_controllen: u64,
653 msg_flags: i32,
654};
655
656pub const msghdr_const = extern struct {
657 msg_name: ?*const sockaddr,
658 msg_namelen: socklen_t,
659 msg_iov: [*]iovec_const,
660 msg_iovlen: u64,
661 msg_control: ?*c_void,
662 msg_controllen: u64,
663 msg_flags: i32,
664};
665
666pub const off_t = i64;
667pub const ino_t = u64;
668pub const mode_t = u32;
669
670// The `stat64` definition used by the kernel.
671pub const Stat = extern struct {
672 dev: u64,
673 ino: u64,
674 nlink: u64,
675
676 mode: u32,
677 uid: u32,
678 gid: u32,
679 __pad0: u32,
680
681 rdev: u64,
682 size: i64,
683 blksize: i64,
684 blocks: i64,
685
686 atim: timespec,
687 mtim: timespec,
688 ctim: timespec,
689 __unused: [3]u64,
690
691 pub fn atime(self: @This()) timespec {
692 return self.atim;
693 }
694
695 pub fn mtime(self: @This()) timespec {
696 return self.mtim;
697 }
698
699 pub fn ctime(self: @This()) timespec {
700 return self.ctim;
701 }
702};
703
704pub const timespec = extern struct {
705 tv_sec: isize,
706 tv_nsec: isize,
707};
708
709pub const timeval = extern struct {
710 tv_sec: isize,
711 tv_usec: isize,
712};
713
714pub const timezone = extern struct {
715 tz_minuteswest: i32,
716 tz_dsttime: i32,
717};
718
719// TODO I'm not sure if the code below is correct, need someone with more
720// knowledge about sparc64 linux internals to look into.
721
722pub const Elf_Symndx = u32;
723
724pub const fpstate = extern struct {
725 regs: [32]u64,
726 fsr: u64,
727 gsr: u64,
728 fprs: u64,
729};
730
731pub const __fpq = extern struct {
732 fpq_addr: *u32,
733 fpq_instr: u32,
734};
735
736pub const __fq = extern struct {
737 FQu: extern union {
738 whole: f64,
739 fpq: __fpq,
740 },
741};
742
743pub const fpregset_t = extern struct {
744 fpu_fr: extern union {
745 fpu_regs: [32]u32,
746 fpu_dregs: [32]f64,
747 fpu_qregs: [16]c_longdouble,
748 },
749 fpu_q: *__fq,
750 fpu_fsr: u64,
751 fpu_qcnt: u8,
752 fpu_q_entrysize: u8,
753 fpu_en: u8,
754};
755
756pub const siginfo_fpu_t = extern struct {
757 float_regs: [64]u32,
758 fsr: u64,
759 gsr: u64,
760 fprs: u64,
761};
762
763pub const sigcontext = extern struct {
764 info: [128]i8,
765 regs: extern struct {
766 u_regs: [16]u64,
767 tstate: u64,
768 tpc: u64,
769 tnpc: u64,
770 y: u64,
771 fprs: u64,
772 },
773 fpu_save: *siginfo_fpu_t,
774 stack: extern struct {
775 sp: usize,
776 flags: i32,
777 size: u64,
778 },
779 mask: u64,
780};
781
782pub const greg_t = u64;
783pub const gregset_t = [19]greg_t;
784
785pub const fq = extern struct {
786 addr: *u64,
787 insn: u32,
788};
789
790pub const fpu_t = extern struct {
791 fregs: extern union {
792 sregs: [32]u32,
793 dregs: [32]u64,
794 qregs: [16]c_longdouble,
795 },
796 fsr: u64,
797 fprs: u64,
798 gsr: u64,
799 fq: *fq,
800 qcnt: u8,
801 qentsz: u8,
802 enab: u8,
803};
804
805pub const mcontext_t = extern struct {
806 gregs: gregset_t,
807 fp: greg_t,
808 @"i7": greg_t,
809 fpregs: fpu_t,
810};
811
812pub const ucontext_t = extern struct {
813 link: *ucontext_t,
814 flags: u64,
815 sigmask: u64,
816 mcontext: mcontext_t,
817 stack: stack_t,
818 sigmask: sigset_t,
819};
lib/std/os/linux/thumb.zig+5-10
......@@ -1,10 +1,8 @@
1usingnamespace @import("../bits/linux.zig");
2
3// The syscall interface is identical to the ARM one but we're facing an extra
4// challenge: r7, the register where the syscall number is stored, may be
5// reserved for the frame pointer.
6// Save and restore r7 around the syscall without touching the stack pointer not
7// to break the frame chain.
1//! The syscall interface is identical to the ARM one but we're facing an extra
2//! challenge: r7, the register where the syscall number is stored, may be
3//! reserved for the frame pointer.
4//! Save and restore r7 around the syscall without touching the stack pointer not
5//! to break the frame chain.
86
97pub fn syscall0(number: SYS) usize {
108 @setRuntimeSafety(false);
......@@ -140,9 +138,6 @@ pub fn syscall6(
140138 );
141139}
142140
143/// This matches the libc clone function.
144pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
145
146141pub fn restore() callconv(.Naked) void {
147142 return asm volatile (
148143 \\ mov r7, %[number]
lib/std/os/linux/x86_64.zig+2-2
......@@ -1,5 +1,7 @@
11const std = @import("../../std.zig");
22const linux = std.os.linux;
3const iovec = std.os.iovec;
4const iovec_const = std.os.iovec_const;
35
46const pid_t = linux.pid_t;
57const uid_t = linux.uid_t;
......@@ -9,8 +11,6 @@ const stack_t = linux.stack_t;
911const sigset_t = linux.sigset_t;
1012const sockaddr = linux.sockaddr;
1113const socklen_t = linux.socklen_t;
12const iovec = linux.iovec;
13const iovec_const = linux.iovec_const;
1414
1515pub fn syscall0(number: SYS) usize {
1616 return asm volatile ("syscall"