authorgravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2019-08-28 16:35:23+02:00
committergravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2019-08-28 16:35:23+02:00
log32f4606cece09b6bcf4f553c06c3aaab34f784c6
tree4d945a5d2bf5f4381ce5087f939c4cbabc00c075
parentac477f3c9a94b6d32a56d89a01ae24c68143ee5d

add arm32 linux bits definitions


2 files changed, 511 insertions(+), 0 deletions(-)

std/os/bits/linux.zig+1
......@@ -7,6 +7,7 @@ pub usingnamespace @import("linux/errno.zig");
77pub usingnamespace switch (builtin.arch) {
88 .x86_64 => @import("linux/x86_64.zig"),
99 .aarch64 => @import("linux/arm64.zig"),
10 .arm => @import("linux/arm-eabi.zig"),
1011 else => struct {},
1112};
1213
std/os/bits/linux/arm-eabi.zig created+510
......@@ -0,0 +1,510 @@
1// arm-eabi-specific declarations that are intended to be imported into the POSIX namespace.
2
3const std = @import("../../std.zig");
4const linux = std.os.linux;
5const socklen_t = linux.socklen_t;
6const iovec = linux.iovec;
7const iovec_const = linux.iovec_const;
8
9pub const SYS_restart_syscall = 0;
10pub const SYS_exit = 1;
11pub const SYS_fork = 2;
12pub const SYS_read = 3;
13pub const SYS_write = 4;
14pub const SYS_open = 5;
15pub const SYS_close = 6;
16pub const SYS_creat = 8;
17pub const SYS_link = 9;
18pub const SYS_unlink = 10;
19pub const SYS_execve = 11;
20pub const SYS_chdir = 12;
21pub const SYS_mknod = 14;
22pub const SYS_chmod = 15;
23pub const SYS_lchown = 16;
24pub const SYS_lseek = 19;
25pub const SYS_getpid = 20;
26pub const SYS_mount = 21;
27pub const SYS_setuid = 23;
28pub const SYS_getuid = 24;
29pub const SYS_ptrace = 26;
30pub const SYS_pause = 29;
31pub const SYS_access = 33;
32pub const SYS_nice = 34;
33pub const SYS_sync = 36;
34pub const SYS_kill = 37;
35pub const SYS_rename = 38;
36pub const SYS_mkdir = 39;
37pub const SYS_rmdir = 40;
38pub const SYS_dup = 41;
39pub const SYS_pipe = 42;
40pub const SYS_times = 43;
41pub const SYS_brk = 45;
42pub const SYS_setgid = 46;
43pub const SYS_getgid = 47;
44pub const SYS_geteuid = 49;
45pub const SYS_getegid = 50;
46pub const SYS_acct = 51;
47pub const SYS_umount2 = 52;
48pub const SYS_ioctl = 54;
49pub const SYS_fcntl = 55;
50pub const SYS_setpgid = 57;
51pub const SYS_umask = 60;
52pub const SYS_chroot = 61;
53pub const SYS_ustat = 62;
54pub const SYS_dup2 = 63;
55pub const SYS_getppid = 64;
56pub const SYS_getpgrp = 65;
57pub const SYS_setsid = 66;
58pub const SYS_sigaction = 67;
59pub const SYS_setreuid = 70;
60pub const SYS_setregid = 71;
61pub const SYS_sigsuspend = 72;
62pub const SYS_sigpending = 73;
63pub const SYS_sethostname = 74;
64pub const SYS_setrlimit = 75;
65pub const SYS_getrusage = 77;
66pub const SYS_gettimeofday = 78;
67pub const SYS_settimeofday = 79;
68pub const SYS_getgroups = 80;
69pub const SYS_setgroups = 81;
70pub const SYS_symlink = 83;
71pub const SYS_readlink = 85;
72pub const SYS_uselib = 86;
73pub const SYS_swapon = 87;
74pub const SYS_reboot = 88;
75pub const SYS_munmap = 91;
76pub const SYS_truncate = 92;
77pub const SYS_ftruncate = 93;
78pub const SYS_fchmod = 94;
79pub const SYS_fchown = 95;
80pub const SYS_getpriority = 96;
81pub const SYS_setpriority = 97;
82pub const SYS_statfs = 99;
83pub const SYS_fstatfs = 100;
84pub const SYS_syslog = 103;
85pub const SYS_setitimer = 104;
86pub const SYS_getitimer = 105;
87pub const SYS_stat = 106;
88pub const SYS_lstat = 107;
89pub const SYS_fstat = 108;
90pub const SYS_vhangup = 111;
91pub const SYS_wait4 = 114;
92pub const SYS_swapoff = 115;
93pub const SYS_sysinfo = 116;
94pub const SYS_fsync = 118;
95pub const SYS_sigreturn = 119;
96pub const SYS_clone = 120;
97pub const SYS_setdomainname = 121;
98pub const SYS_uname = 122;
99pub const SYS_adjtimex = 124;
100pub const SYS_mprotect = 125;
101pub const SYS_sigprocmask = 126;
102pub const SYS_init_module = 128;
103pub const SYS_delete_module = 129;
104pub const SYS_quotactl = 131;
105pub const SYS_getpgid = 132;
106pub const SYS_fchdir = 133;
107pub const SYS_bdflush = 134;
108pub const SYS_sysfs = 135;
109pub const SYS_personality = 136;
110pub const SYS_setfsuid = 138;
111pub const SYS_setfsgid = 139;
112pub const SYS__llseek = 140;
113pub const SYS_getdents = 141;
114pub const SYS__newselect = 142;
115pub const SYS_flock = 143;
116pub const SYS_msync = 144;
117pub const SYS_readv = 145;
118pub const SYS_writev = 146;
119pub const SYS_getsid = 147;
120pub const SYS_fdatasync = 148;
121pub const SYS__sysctl = 149;
122pub const SYS_mlock = 150;
123pub const SYS_munlock = 151;
124pub const SYS_mlockall = 152;
125pub const SYS_munlockall = 153;
126pub const SYS_sched_setparam = 154;
127pub const SYS_sched_getparam = 155;
128pub const SYS_sched_setscheduler = 156;
129pub const SYS_sched_getscheduler = 157;
130pub const SYS_sched_yield = 158;
131pub const SYS_sched_get_priority_max = 159;
132pub const SYS_sched_get_priority_min = 160;
133pub const SYS_sched_rr_get_interval = 161;
134pub const SYS_nanosleep = 162;
135pub const SYS_mremap = 163;
136pub const SYS_setresuid = 164;
137pub const SYS_getresuid = 165;
138pub const SYS_poll = 168;
139pub const SYS_nfsservctl = 169;
140pub const SYS_setresgid = 170;
141pub const SYS_getresgid = 171;
142pub const SYS_prctl = 172;
143pub const SYS_rt_sigreturn = 173;
144pub const SYS_rt_sigaction = 174;
145pub const SYS_rt_sigprocmask = 175;
146pub const SYS_rt_sigpending = 176;
147pub const SYS_rt_sigtimedwait = 177;
148pub const SYS_rt_sigqueueinfo = 178;
149pub const SYS_rt_sigsuspend = 179;
150pub const SYS_pread64 = 180;
151pub const SYS_pwrite64 = 181;
152pub const SYS_chown = 182;
153pub const SYS_getcwd = 183;
154pub const SYS_capget = 184;
155pub const SYS_capset = 185;
156pub const SYS_sigaltstack = 186;
157pub const SYS_sendfile = 187;
158pub const SYS_vfork = 190;
159pub const SYS_ugetrlimit = 191;
160pub const SYS_mmap2 = 192;
161pub const SYS_truncate64 = 193;
162pub const SYS_ftruncate64 = 194;
163pub const SYS_stat64 = 195;
164pub const SYS_lstat64 = 196;
165pub const SYS_fstat64 = 197;
166pub const SYS_lchown32 = 198;
167pub const SYS_getuid32 = 199;
168pub const SYS_getgid32 = 200;
169pub const SYS_geteuid32 = 201;
170pub const SYS_getegid32 = 202;
171pub const SYS_setreuid32 = 203;
172pub const SYS_setregid32 = 204;
173pub const SYS_getgroups32 = 205;
174pub const SYS_setgroups32 = 206;
175pub const SYS_fchown32 = 207;
176pub const SYS_setresuid32 = 208;
177pub const SYS_getresuid32 = 209;
178pub const SYS_setresgid32 = 210;
179pub const SYS_getresgid32 = 211;
180pub const SYS_chown32 = 212;
181pub const SYS_setuid32 = 213;
182pub const SYS_setgid32 = 214;
183pub const SYS_setfsuid32 = 215;
184pub const SYS_setfsgid32 = 216;
185pub const SYS_getdents64 = 217;
186pub const SYS_pivot_root = 218;
187pub const SYS_mincore = 219;
188pub const SYS_madvise = 220;
189pub const SYS_fcntl64 = 221;
190pub const SYS_gettid = 224;
191pub const SYS_readahead = 225;
192pub const SYS_setxattr = 226;
193pub const SYS_lsetxattr = 227;
194pub const SYS_fsetxattr = 228;
195pub const SYS_getxattr = 229;
196pub const SYS_lgetxattr = 230;
197pub const SYS_fgetxattr = 231;
198pub const SYS_listxattr = 232;
199pub const SYS_llistxattr = 233;
200pub const SYS_flistxattr = 234;
201pub const SYS_removexattr = 235;
202pub const SYS_lremovexattr = 236;
203pub const SYS_fremovexattr = 237;
204pub const SYS_tkill = 238;
205pub const SYS_sendfile64 = 239;
206pub const SYS_futex = 240;
207pub const SYS_sched_setaffinity = 241;
208pub const SYS_sched_getaffinity = 242;
209pub const SYS_io_setup = 243;
210pub const SYS_io_destroy = 244;
211pub const SYS_io_getevents = 245;
212pub const SYS_io_submit = 246;
213pub const SYS_io_cancel = 247;
214pub const SYS_exit_group = 248;
215pub const SYS_lookup_dcookie = 249;
216pub const SYS_epoll_create = 250;
217pub const SYS_epoll_ctl = 251;
218pub const SYS_epoll_wait = 252;
219pub const SYS_remap_file_pages = 253;
220pub const SYS_set_tid_address = 256;
221pub const SYS_timer_create = 257;
222pub const SYS_timer_settime = 258;
223pub const SYS_timer_gettime = 259;
224pub const SYS_timer_getoverrun = 260;
225pub const SYS_timer_delete = 261;
226pub const SYS_clock_settime = 262;
227pub const SYS_clock_gettime = 263;
228pub const SYS_clock_getres = 264;
229pub const SYS_clock_nanosleep = 265;
230pub const SYS_statfs64 = 266;
231pub const SYS_fstatfs64 = 267;
232pub const SYS_tgkill = 268;
233pub const SYS_utimes = 269;
234pub const SYS_arm_fadvise64_64 = 270;
235pub const SYS_pciconfig_iobase = 271;
236pub const SYS_pciconfig_read = 272;
237pub const SYS_pciconfig_write = 273;
238pub const SYS_mq_open = 274;
239pub const SYS_mq_unlink = 275;
240pub const SYS_mq_timedsend = 276;
241pub const SYS_mq_timedreceive = 277;
242pub const SYS_mq_notify = 278;
243pub const SYS_mq_getsetattr = 279;
244pub const SYS_waitid = 280;
245pub const SYS_socket = 281;
246pub const SYS_bind = 282;
247pub const SYS_connect = 283;
248pub const SYS_listen = 284;
249pub const SYS_accept = 285;
250pub const SYS_getsockname = 286;
251pub const SYS_getpeername = 287;
252pub const SYS_socketpair = 288;
253pub const SYS_send = 289;
254pub const SYS_sendto = 290;
255pub const SYS_recv = 291;
256pub const SYS_recvfrom = 292;
257pub const SYS_shutdown = 293;
258pub const SYS_setsockopt = 294;
259pub const SYS_getsockopt = 295;
260pub const SYS_sendmsg = 296;
261pub const SYS_recvmsg = 297;
262pub const SYS_semop = 298;
263pub const SYS_semget = 299;
264pub const SYS_semctl = 300;
265pub const SYS_msgsnd = 301;
266pub const SYS_msgrcv = 302;
267pub const SYS_msgget = 303;
268pub const SYS_msgctl = 304;
269pub const SYS_shmat = 305;
270pub const SYS_shmdt = 306;
271pub const SYS_shmget = 307;
272pub const SYS_shmctl = 308;
273pub const SYS_add_key = 309;
274pub const SYS_request_key = 310;
275pub const SYS_keyctl = 311;
276pub const SYS_semtimedop = 312;
277pub const SYS_vserver = 313;
278pub const SYS_ioprio_set = 314;
279pub const SYS_ioprio_get = 315;
280pub const SYS_inotify_init = 316;
281pub const SYS_inotify_add_watch = 317;
282pub const SYS_inotify_rm_watch = 318;
283pub const SYS_mbind = 319;
284pub const SYS_get_mempolicy = 320;
285pub const SYS_set_mempolicy = 321;
286pub const SYS_openat = 322;
287pub const SYS_mkdirat = 323;
288pub const SYS_mknodat = 324;
289pub const SYS_fchownat = 325;
290pub const SYS_futimesat = 326;
291pub const SYS_fstatat64 = 327;
292pub const SYS_unlinkat = 328;
293pub const SYS_renameat = 329;
294pub const SYS_linkat = 330;
295pub const SYS_symlinkat = 331;
296pub const SYS_readlinkat = 332;
297pub const SYS_fchmodat = 333;
298pub const SYS_faccessat = 334;
299pub const SYS_pselect6 = 335;
300pub const SYS_ppoll = 336;
301pub const SYS_unshare = 337;
302pub const SYS_set_robust_list = 338;
303pub const SYS_get_robust_list = 339;
304pub const SYS_splice = 340;
305pub const SYS_arm_sync_file_range = 341;
306pub const SYS_tee = 342;
307pub const SYS_vmsplice = 343;
308pub const SYS_move_pages = 344;
309pub const SYS_getcpu = 345;
310pub const SYS_epoll_pwait = 346;
311pub const SYS_kexec_load = 347;
312pub const SYS_utimensat = 348;
313pub const SYS_signalfd = 349;
314pub const SYS_timerfd_create = 350;
315pub const SYS_eventfd = 351;
316pub const SYS_fallocate = 352;
317pub const SYS_timerfd_settime = 353;
318pub const SYS_timerfd_gettime = 354;
319pub const SYS_signalfd4 = 355;
320pub const SYS_eventfd2 = 356;
321pub const SYS_epoll_create1 = 357;
322pub const SYS_dup3 = 358;
323pub const SYS_pipe2 = 359;
324pub const SYS_inotify_init1 = 360;
325pub const SYS_preadv = 361;
326pub const SYS_pwritev = 362;
327pub const SYS_rt_tgsigqueueinfo = 363;
328pub const SYS_perf_event_open = 364;
329pub const SYS_recvmmsg = 365;
330pub const SYS_accept4 = 366;
331pub const SYS_fanotify_init = 367;
332pub const SYS_fanotify_mark = 368;
333pub const SYS_prlimit64 = 369;
334pub const SYS_name_to_handle_at = 370;
335pub const SYS_open_by_handle_at = 371;
336pub const SYS_clock_adjtime = 372;
337pub const SYS_syncfs = 373;
338pub const SYS_sendmmsg = 374;
339pub const SYS_setns = 375;
340pub const SYS_process_vm_readv = 376;
341pub const SYS_process_vm_writev = 377;
342pub const SYS_kcmp = 378;
343pub const SYS_finit_module = 379;
344pub const SYS_sched_setattr = 380;
345pub const SYS_sched_getattr = 381;
346pub const SYS_renameat2 = 382;
347pub const SYS_seccomp = 383;
348pub const SYS_getrandom = 384;
349pub const SYS_memfd_create = 385;
350pub const SYS_bpf = 386;
351pub const SYS_execveat = 387;
352pub const SYS_userfaultfd = 388;
353pub const SYS_membarrier = 389;
354pub const SYS_mlock2 = 390;
355pub const SYS_copy_file_range = 391;
356pub const SYS_preadv2 = 392;
357pub const SYS_pwritev2 = 393;
358pub const SYS_pkey_mprotect = 394;
359pub const SYS_pkey_alloc = 395;
360pub const SYS_pkey_free = 396;
361pub const SYS_statx = 397;
362pub const SYS_rseq = 398;
363pub const SYS_io_pgetevents = 399;
364
365pub const O_CREAT = 0o100;
366pub const O_EXCL = 0o200;
367pub const O_NOCTTY = 0o400;
368pub const O_TRUNC = 0o1000;
369pub const O_APPEND = 0o2000;
370pub const O_NONBLOCK = 0o4000;
371pub const O_DSYNC = 0o10000;
372pub const O_SYNC = 0o4010000;
373pub const O_RSYNC = 0o4010000;
374pub const O_DIRECTORY = 0o40000;
375pub const O_NOFOLLOW = 0o100000;
376pub const O_CLOEXEC = 0o2000000;
377
378pub const O_ASYNC = 0o20000;
379pub const O_DIRECT = 0o200000;
380pub const O_LARGEFILE = 0o400000;
381pub const O_NOATIME = 0o1000000;
382pub const O_PATH = 0o10000000;
383pub const O_TMPFILE = 0o20040000;
384pub const O_NDELAY = O_NONBLOCK;
385
386pub const F_DUPFD = 0;
387pub const F_GETFD = 1;
388pub const F_SETFD = 2;
389pub const F_GETFL = 3;
390pub const F_SETFL = 4;
391
392pub const F_SETOWN = 8;
393pub const F_GETOWN = 9;
394pub const F_SETSIG = 10;
395pub const F_GETSIG = 11;
396
397pub const F_GETLK = 12;
398pub const F_SETLK = 13;
399pub const F_SETLKW = 14;
400
401pub const F_SETOWN_EX = 15;
402pub const F_GETOWN_EX = 16;
403
404pub const F_GETOWNER_UIDS = 17;
405
406/// stack-like segment
407pub const MAP_GROWSDOWN = 0x0100;
408
409/// ETXTBSY
410pub const MAP_DENYWRITE = 0x0800;
411
412/// mark it as an executable
413pub const MAP_EXECUTABLE = 0x1000;
414
415/// pages are locked
416pub const MAP_LOCKED = 0x2000;
417
418/// don't check for reservations
419pub const MAP_NORESERVE = 0x4000;
420
421/// populate (prefault) pagetables
422pub const MAP_POPULATE = 0x8000;
423
424/// do not block on IO
425pub const MAP_NONBLOCK = 0x10000;
426
427/// give out an address that is best suited for process/thread stacks
428pub const MAP_STACK = 0x20000;
429
430/// create a huge page mapping
431pub const MAP_HUGETLB = 0x40000;
432
433/// perform synchronous page faults for the mapping
434pub const MAP_SYNC = 0x80000;
435
436pub const VDSO_USEFUL = true;
437pub const VDSO_CGT_SYM = "__vdso_clock_gettime";
438pub const VDSO_CGT_VER = "LINUX_2.6";
439
440pub const msghdr = extern struct {
441 msg_name: ?*sockaddr,
442 msg_namelen: socklen_t,
443 msg_iov: [*]iovec,
444 msg_iovlen: i32,
445 msg_control: ?*c_void,
446 msg_controllen: socklen_t,
447 msg_flags: i32,
448};
449
450pub const msghdr_const = extern struct {
451 msg_name: ?*const sockaddr,
452 msg_namelen: socklen_t,
453 msg_iov: [*]iovec_const,
454 msg_iovlen: i32,
455 msg_control: ?*c_void,
456 msg_controllen: socklen_t,
457 msg_flags: i32,
458};
459
460/// Renamed to Stat to not conflict with the stat function.
461/// atime, mtime, and ctime have functions to return `timespec`,
462/// because although this is a POSIX API, the layout and names of
463/// the structs are inconsistent across operating systems, and
464/// in C, macros are used to hide the differences. Here we use
465/// methods to accomplish this.
466pub const Stat = extern struct {
467 dev: u64,
468 __dev_patting: u32,
469 __ino_truncated: u32,
470 mode: u32,
471 nlink: u32,
472 uid: u32,
473 gid: u32,
474 rdev: u64,
475 __rdev_padding: u32,
476 size: i64,
477 blksize: i32,
478 blocks: i64,
479 atim: timespec,
480 mtim: timespec,
481 ctim: timespec,
482 ino: u64,
483
484 pub fn atime(self: Stat) timespec {
485 return self.atim;
486 }
487
488 pub fn mtime(self: Stat) timespec {
489 return self.mtim;
490 }
491
492 pub fn ctime(self: Stat) timespec {
493 return self.ctim;
494 }
495};
496
497pub const timespec = extern struct {
498 tv_sec: i32,
499 tv_nsec: i32,
500};
501
502pub const timeval = extern struct {
503 tv_sec: i32,
504 tv_usec: i32,
505};
506
507pub const timezone = extern struct {
508 tz_minuteswest: i32,
509 tz_dsttime: i32,
510};