diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-09-15 14:46:31 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-09-15 14:51:08 -0700 |
| commit | f3ebfcae3882c03da84821abed40167ea07a8c78 (patch) | |
| tree | f1b759c94cba5b020a9ffb141fc62cb686fc5f04 /lib/std/os/bits/linux | |
| parent | 111a2dcf3ad53c0c8ad2c9e7c9bd042b81e90c82 (diff) | |
| parent | 0395b35cee8d4082cc40b0dcd0298f797f42309d (diff) | |
| download | zig-f3ebfcae3882c03da84821abed40167ea07a8c78.tar.gz zig-f3ebfcae3882c03da84821abed40167ea07a8c78.zip | |
Merge remote-tracking branch 'origin/master' into llvm13
Conflicts:
* cmake/Findclang.cmake
* cmake/Findlld.cmake
* cmake/Findllvm.cmake
In master branch, more search paths were added to these files with "12"
in the path. In this commit I updated them to "13".
* src/stage1/codegen.cpp
* src/zig_llvm.cpp
* src/zig_llvm.h
In master branch, ZigLLVMBuildCmpXchg is improved to add
`is_single_threaded`. However, the LLVM 13 C API has this already, and
in the llvm13 branch, ZigLLVMBuildCmpXchg is deleted in favor of the C
API. In this commit I updated stage2 to use the LLVM 13 C API rather
than depending on an improved ZigLLVMBuildCmpXchg.
Additionally, src/target.zig largestAtomicBits needed to be updated to
include the new m68k ISA.
Diffstat (limited to 'lib/std/os/bits/linux')
| -rw-r--r-- | lib/std/os/bits/linux/arm-eabi.zig | 636 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/arm64.zig | 495 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/errno/generic.zig | 460 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/errno/mips.zig | 141 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/errno/sparc.zig | 144 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/i386.zig | 670 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/mips.zig | 622 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/netlink.zig | 498 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/powerpc.zig | 621 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/powerpc64.zig | 604 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/prctl.zig | 234 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/riscv64.zig | 423 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/securebits.zig | 35 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/sparc64.zig | 675 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/x86_64.zig | 638 | ||||
| -rw-r--r-- | lib/std/os/bits/linux/xdp.zig | 77 |
16 files changed, 0 insertions, 6973 deletions
diff --git a/lib/std/os/bits/linux/arm-eabi.zig b/lib/std/os/bits/linux/arm-eabi.zig deleted file mode 100644 index 91ca2b32d2..0000000000 --- a/lib/std/os/bits/linux/arm-eabi.zig +++ /dev/null @@ -1,636 +0,0 @@ -// arm-eabi-specific declarations that are intended to be imported into the POSIX namespace. -const std = @import("../../../std.zig"); -const linux = std.os.linux; -const socklen_t = linux.socklen_t; -const iovec = linux.iovec; -const iovec_const = linux.iovec_const; -const stack_t = linux.stack_t; -const sigset_t = linux.sigset_t; -const uid_t = linux.uid_t; -const gid_t = linux.gid_t; -const pid_t = linux.pid_t; - -pub const SYS = enum(usize) { - restart_syscall = 0, - exit = 1, - fork = 2, - read = 3, - write = 4, - open = 5, - close = 6, - creat = 8, - link = 9, - unlink = 10, - execve = 11, - chdir = 12, - mknod = 14, - chmod = 15, - lchown = 16, - lseek = 19, - getpid = 20, - mount = 21, - setuid = 23, - getuid = 24, - ptrace = 26, - pause = 29, - access = 33, - nice = 34, - sync = 36, - kill = 37, - rename = 38, - mkdir = 39, - rmdir = 40, - dup = 41, - pipe = 42, - times = 43, - brk = 45, - setgid = 46, - getgid = 47, - geteuid = 49, - getegid = 50, - acct = 51, - umount2 = 52, - ioctl = 54, - fcntl = 55, - setpgid = 57, - umask = 60, - chroot = 61, - ustat = 62, - dup2 = 63, - getppid = 64, - getpgrp = 65, - setsid = 66, - sigaction = 67, - setreuid = 70, - setregid = 71, - sigsuspend = 72, - sigpending = 73, - sethostname = 74, - setrlimit = 75, - getrusage = 77, - gettimeofday = 78, - settimeofday = 79, - getgroups = 80, - setgroups = 81, - symlink = 83, - readlink = 85, - uselib = 86, - swapon = 87, - reboot = 88, - munmap = 91, - truncate = 92, - ftruncate = 93, - fchmod = 94, - fchown = 95, - getpriority = 96, - setpriority = 97, - statfs = 99, - fstatfs = 100, - syslog = 103, - setitimer = 104, - getitimer = 105, - stat = 106, - lstat = 107, - fstat = 108, - vhangup = 111, - wait4 = 114, - swapoff = 115, - sysinfo = 116, - fsync = 118, - sigreturn = 119, - clone = 120, - setdomainname = 121, - uname = 122, - adjtimex = 124, - mprotect = 125, - sigprocmask = 126, - init_module = 128, - delete_module = 129, - quotactl = 131, - getpgid = 132, - fchdir = 133, - bdflush = 134, - sysfs = 135, - personality = 136, - setfsuid = 138, - setfsgid = 139, - _llseek = 140, - getdents = 141, - _newselect = 142, - flock = 143, - msync = 144, - readv = 145, - writev = 146, - getsid = 147, - fdatasync = 148, - _sysctl = 149, - mlock = 150, - munlock = 151, - mlockall = 152, - munlockall = 153, - sched_setparam = 154, - sched_getparam = 155, - sched_setscheduler = 156, - sched_getscheduler = 157, - sched_yield = 158, - sched_get_priority_max = 159, - sched_get_priority_min = 160, - sched_rr_get_interval = 161, - nanosleep = 162, - mremap = 163, - setresuid = 164, - getresuid = 165, - poll = 168, - nfsservctl = 169, - setresgid = 170, - getresgid = 171, - prctl = 172, - rt_sigreturn = 173, - rt_sigaction = 174, - rt_sigprocmask = 175, - rt_sigpending = 176, - rt_sigtimedwait = 177, - rt_sigqueueinfo = 178, - rt_sigsuspend = 179, - pread64 = 180, - pwrite64 = 181, - chown = 182, - getcwd = 183, - capget = 184, - capset = 185, - sigaltstack = 186, - sendfile = 187, - vfork = 190, - ugetrlimit = 191, - mmap2 = 192, - truncate64 = 193, - ftruncate64 = 194, - stat64 = 195, - lstat64 = 196, - fstat64 = 197, - lchown32 = 198, - getuid32 = 199, - getgid32 = 200, - geteuid32 = 201, - getegid32 = 202, - setreuid32 = 203, - setregid32 = 204, - getgroups32 = 205, - setgroups32 = 206, - fchown32 = 207, - setresuid32 = 208, - getresuid32 = 209, - setresgid32 = 210, - getresgid32 = 211, - chown32 = 212, - setuid32 = 213, - setgid32 = 214, - setfsuid32 = 215, - setfsgid32 = 216, - getdents64 = 217, - pivot_root = 218, - mincore = 219, - madvise = 220, - fcntl64 = 221, - gettid = 224, - readahead = 225, - setxattr = 226, - lsetxattr = 227, - fsetxattr = 228, - getxattr = 229, - lgetxattr = 230, - fgetxattr = 231, - listxattr = 232, - llistxattr = 233, - flistxattr = 234, - removexattr = 235, - lremovexattr = 236, - fremovexattr = 237, - tkill = 238, - sendfile64 = 239, - futex = 240, - sched_setaffinity = 241, - sched_getaffinity = 242, - io_setup = 243, - io_destroy = 244, - io_getevents = 245, - io_submit = 246, - io_cancel = 247, - exit_group = 248, - lookup_dcookie = 249, - epoll_create = 250, - epoll_ctl = 251, - epoll_wait = 252, - remap_file_pages = 253, - set_tid_address = 256, - timer_create = 257, - timer_settime = 258, - timer_gettime = 259, - timer_getoverrun = 260, - timer_delete = 261, - clock_settime = 262, - clock_gettime = 263, - clock_getres = 264, - clock_nanosleep = 265, - statfs64 = 266, - fstatfs64 = 267, - tgkill = 268, - utimes = 269, - fadvise64_64 = 270, - pciconfig_iobase = 271, - pciconfig_read = 272, - pciconfig_write = 273, - mq_open = 274, - mq_unlink = 275, - mq_timedsend = 276, - mq_timedreceive = 277, - mq_notify = 278, - mq_getsetattr = 279, - waitid = 280, - socket = 281, - bind = 282, - connect = 283, - listen = 284, - accept = 285, - getsockname = 286, - getpeername = 287, - socketpair = 288, - send = 289, - sendto = 290, - recv = 291, - recvfrom = 292, - shutdown = 293, - setsockopt = 294, - getsockopt = 295, - sendmsg = 296, - recvmsg = 297, - semop = 298, - semget = 299, - semctl = 300, - msgsnd = 301, - msgrcv = 302, - msgget = 303, - msgctl = 304, - shmat = 305, - shmdt = 306, - shmget = 307, - shmctl = 308, - add_key = 309, - request_key = 310, - keyctl = 311, - semtimedop = 312, - vserver = 313, - ioprio_set = 314, - ioprio_get = 315, - inotify_init = 316, - inotify_add_watch = 317, - inotify_rm_watch = 318, - mbind = 319, - get_mempolicy = 320, - set_mempolicy = 321, - openat = 322, - mkdirat = 323, - mknodat = 324, - fchownat = 325, - futimesat = 326, - fstatat64 = 327, - unlinkat = 328, - renameat = 329, - linkat = 330, - symlinkat = 331, - readlinkat = 332, - fchmodat = 333, - faccessat = 334, - pselect6 = 335, - ppoll = 336, - unshare = 337, - set_robust_list = 338, - get_robust_list = 339, - splice = 340, - sync_file_range = 341, - tee = 342, - vmsplice = 343, - move_pages = 344, - getcpu = 345, - epoll_pwait = 346, - kexec_load = 347, - utimensat = 348, - signalfd = 349, - timerfd_create = 350, - eventfd = 351, - fallocate = 352, - timerfd_settime = 353, - timerfd_gettime = 354, - signalfd4 = 355, - eventfd2 = 356, - epoll_create1 = 357, - dup3 = 358, - pipe2 = 359, - inotify_init1 = 360, - preadv = 361, - pwritev = 362, - rt_tgsigqueueinfo = 363, - perf_event_open = 364, - recvmmsg = 365, - accept4 = 366, - fanotify_init = 367, - fanotify_mark = 368, - prlimit64 = 369, - name_to_handle_at = 370, - open_by_handle_at = 371, - clock_adjtime = 372, - syncfs = 373, - sendmmsg = 374, - setns = 375, - process_vm_readv = 376, - process_vm_writev = 377, - kcmp = 378, - finit_module = 379, - sched_setattr = 380, - sched_getattr = 381, - renameat2 = 382, - seccomp = 383, - getrandom = 384, - memfd_create = 385, - bpf = 386, - execveat = 387, - userfaultfd = 388, - membarrier = 389, - mlock2 = 390, - copy_file_range = 391, - preadv2 = 392, - pwritev2 = 393, - pkey_mprotect = 394, - pkey_alloc = 395, - pkey_free = 396, - statx = 397, - rseq = 398, - io_pgetevents = 399, - migrate_pages = 400, - kexec_file_load = 401, - clock_gettime64 = 403, - clock_settime64 = 404, - clock_adjtime64 = 405, - clock_getres_time64 = 406, - clock_nanosleep_time64 = 407, - timer_gettime64 = 408, - timer_settime64 = 409, - timerfd_gettime64 = 410, - timerfd_settime64 = 411, - utimensat_time64 = 412, - pselect6_time64 = 413, - ppoll_time64 = 414, - io_pgetevents_time64 = 416, - recvmmsg_time64 = 417, - mq_timedsend_time64 = 418, - mq_timedreceive_time64 = 419, - semtimedop_time64 = 420, - rt_sigtimedwait_time64 = 421, - futex_time64 = 422, - sched_rr_get_interval_time64 = 423, - pidfd_send_signal = 424, - io_uring_setup = 425, - io_uring_enter = 426, - io_uring_register = 427, - open_tree = 428, - move_mount = 429, - fsopen = 430, - fsconfig = 431, - fsmount = 432, - fspick = 433, - pidfd_open = 434, - clone3 = 435, - close_range = 436, - openat2 = 437, - pidfd_getfd = 438, - faccessat2 = 439, - process_madvise = 440, - epoll_pwait2 = 441, - - breakpoint = 0x0f0001, - cacheflush = 0x0f0002, - usr26 = 0x0f0003, - usr32 = 0x0f0004, - set_tls = 0x0f0005, - get_tls = 0x0f0006, - - _, -}; - -pub const MMAP2_UNIT = 4096; - -pub const O_CREAT = 0o100; -pub const O_EXCL = 0o200; -pub const O_NOCTTY = 0o400; -pub const O_TRUNC = 0o1000; -pub const O_APPEND = 0o2000; -pub const O_NONBLOCK = 0o4000; -pub const O_DSYNC = 0o10000; -pub const O_SYNC = 0o4010000; -pub const O_RSYNC = 0o4010000; -pub const O_DIRECTORY = 0o40000; -pub const O_NOFOLLOW = 0o100000; -pub const O_CLOEXEC = 0o2000000; - -pub const O_ASYNC = 0o20000; -pub const O_DIRECT = 0o200000; -pub const O_LARGEFILE = 0o400000; -pub const O_NOATIME = 0o1000000; -pub const O_PATH = 0o10000000; -pub const O_TMPFILE = 0o20040000; -pub const O_NDELAY = O_NONBLOCK; - -pub const F_DUPFD = 0; -pub const F_GETFD = 1; -pub const F_SETFD = 2; -pub const F_GETFL = 3; -pub const F_SETFL = 4; - -pub const F_SETOWN = 8; -pub const F_GETOWN = 9; -pub const F_SETSIG = 10; -pub const F_GETSIG = 11; - -pub const F_GETLK = 12; -pub const F_SETLK = 13; -pub const F_SETLKW = 14; - -pub const F_RDLCK = 0; -pub const F_WRLCK = 1; -pub const F_UNLCK = 2; - -pub const F_SETOWN_EX = 15; -pub const F_GETOWN_EX = 16; - -pub const F_GETOWNER_UIDS = 17; - -pub const LOCK_SH = 1; -pub const LOCK_EX = 2; -pub const LOCK_UN = 8; -pub const LOCK_NB = 4; - -/// stack-like segment -pub const MAP_GROWSDOWN = 0x0100; - -/// ETXTBSY -pub const MAP_DENYWRITE = 0x0800; - -/// mark it as an executable -pub const MAP_EXECUTABLE = 0x1000; - -/// pages are locked -pub const MAP_LOCKED = 0x2000; - -/// don't check for reservations -pub const MAP_NORESERVE = 0x4000; - -pub const VDSO_CGT_SYM = "__vdso_clock_gettime"; -pub const VDSO_CGT_VER = "LINUX_2.6"; - -pub const HWCAP_SWP = 1 << 0; -pub const HWCAP_HALF = 1 << 1; -pub const HWCAP_THUMB = 1 << 2; -pub const HWCAP_26BIT = 1 << 3; -pub const HWCAP_FAST_MULT = 1 << 4; -pub const HWCAP_FPA = 1 << 5; -pub const HWCAP_VFP = 1 << 6; -pub const HWCAP_EDSP = 1 << 7; -pub const HWCAP_JAVA = 1 << 8; -pub const HWCAP_IWMMXT = 1 << 9; -pub const HWCAP_CRUNCH = 1 << 10; -pub const HWCAP_THUMBEE = 1 << 11; -pub const HWCAP_NEON = 1 << 12; -pub const HWCAP_VFPv3 = 1 << 13; -pub const HWCAP_VFPv3D16 = 1 << 14; -pub const HWCAP_TLS = 1 << 15; -pub const HWCAP_VFPv4 = 1 << 16; -pub const HWCAP_IDIVA = 1 << 17; -pub const HWCAP_IDIVT = 1 << 18; -pub const HWCAP_VFPD32 = 1 << 19; -pub const HWCAP_IDIV = HWCAP_IDIVA | HWCAP_IDIVT; -pub const HWCAP_LPAE = 1 << 20; -pub const HWCAP_EVTSTRM = 1 << 21; - -pub const Flock = extern struct { - l_type: i16, - l_whence: i16, - __pad0: [4]u8, - l_start: off_t, - l_len: off_t, - l_pid: pid_t, - __unused: [4]u8, -}; - -pub const msghdr = extern struct { - msg_name: ?*sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec, - msg_iovlen: i32, - msg_control: ?*c_void, - msg_controllen: socklen_t, - msg_flags: i32, -}; - -pub const msghdr_const = extern struct { - msg_name: ?*const sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec_const, - msg_iovlen: i32, - msg_control: ?*c_void, - msg_controllen: socklen_t, - msg_flags: i32, -}; - -pub const blksize_t = i32; -pub const nlink_t = u32; -pub const time_t = isize; -pub const mode_t = u32; -pub const off_t = i64; -pub const ino_t = u64; -pub const dev_t = u64; -pub const blkcnt_t = i64; - -// The `stat` definition used by the Linux kernel. -pub const kernel_stat = extern struct { - dev: dev_t, - __dev_padding: u32, - __ino_truncated: u32, - mode: mode_t, - nlink: nlink_t, - uid: uid_t, - gid: gid_t, - rdev: dev_t, - __rdev_padding: u32, - size: off_t, - blksize: blksize_t, - blocks: blkcnt_t, - atim: timespec, - mtim: timespec, - ctim: timespec, - ino: ino_t, - - pub fn atime(self: @This()) timespec { - return self.atim; - } - - pub fn mtime(self: @This()) timespec { - return self.mtim; - } - - pub fn ctime(self: @This()) timespec { - return self.ctim; - } -}; - -// The `stat64` definition used by the libc. -pub const libc_stat = kernel_stat; - -pub const timespec = extern struct { - tv_sec: i32, - tv_nsec: i32, -}; - -pub const timeval = extern struct { - tv_sec: i32, - tv_usec: i32, -}; - -pub const timezone = extern struct { - tz_minuteswest: i32, - tz_dsttime: i32, -}; - -pub const mcontext_t = extern struct { - trap_no: usize, - error_code: usize, - oldmask: usize, - arm_r0: usize, - arm_r1: usize, - arm_r2: usize, - arm_r3: usize, - arm_r4: usize, - arm_r5: usize, - arm_r6: usize, - arm_r7: usize, - arm_r8: usize, - arm_r9: usize, - arm_r10: usize, - arm_fp: usize, - arm_ip: usize, - arm_sp: usize, - arm_lr: usize, - arm_pc: usize, - arm_cpsr: usize, - fault_address: usize, -}; - -pub const ucontext_t = extern struct { - flags: usize, - link: *ucontext_t, - stack: stack_t, - mcontext: mcontext_t, - sigmask: sigset_t, - regspace: [64]u64, -}; - -pub const Elf_Symndx = u32; diff --git a/lib/std/os/bits/linux/arm64.zig b/lib/std/os/bits/linux/arm64.zig deleted file mode 100644 index 67c77ce186..0000000000 --- a/lib/std/os/bits/linux/arm64.zig +++ /dev/null @@ -1,495 +0,0 @@ -// arm64-specific declarations that are intended to be imported into the POSIX namespace. -// This does include Linux-only APIs. - -const std = @import("../../../std.zig"); -const linux = std.os.linux; -const socklen_t = linux.socklen_t; -const sockaddr = linux.sockaddr; -const iovec = linux.iovec; -const iovec_const = linux.iovec_const; -const uid_t = linux.uid_t; -const gid_t = linux.gid_t; -const pid_t = linux.pid_t; -const stack_t = linux.stack_t; -const sigset_t = linux.sigset_t; -pub const SYS = enum(usize) { - io_setup = 0, - io_destroy = 1, - io_submit = 2, - io_cancel = 3, - io_getevents = 4, - setxattr = 5, - lsetxattr = 6, - fsetxattr = 7, - getxattr = 8, - lgetxattr = 9, - fgetxattr = 10, - listxattr = 11, - llistxattr = 12, - flistxattr = 13, - removexattr = 14, - lremovexattr = 15, - fremovexattr = 16, - getcwd = 17, - lookup_dcookie = 18, - eventfd2 = 19, - epoll_create1 = 20, - epoll_ctl = 21, - epoll_pwait = 22, - dup = 23, - dup3 = 24, - fcntl = 25, - inotify_init1 = 26, - inotify_add_watch = 27, - inotify_rm_watch = 28, - ioctl = 29, - ioprio_set = 30, - ioprio_get = 31, - flock = 32, - mknodat = 33, - mkdirat = 34, - unlinkat = 35, - symlinkat = 36, - linkat = 37, - renameat = 38, - umount2 = 39, - mount = 40, - pivot_root = 41, - nfsservctl = 42, - statfs = 43, - fstatfs = 44, - truncate = 45, - ftruncate = 46, - fallocate = 47, - faccessat = 48, - chdir = 49, - fchdir = 50, - chroot = 51, - fchmod = 52, - fchmodat = 53, - fchownat = 54, - fchown = 55, - openat = 56, - close = 57, - vhangup = 58, - pipe2 = 59, - quotactl = 60, - getdents64 = 61, - lseek = 62, - read = 63, - write = 64, - readv = 65, - writev = 66, - pread64 = 67, - pwrite64 = 68, - preadv = 69, - pwritev = 70, - sendfile = 71, - pselect6 = 72, - ppoll = 73, - signalfd4 = 74, - vmsplice = 75, - splice = 76, - tee = 77, - readlinkat = 78, - fstatat = 79, - fstat = 80, - sync = 81, - fsync = 82, - fdatasync = 83, - sync_file_range = 84, - timerfd_create = 85, - timerfd_settime = 86, - timerfd_gettime = 87, - utimensat = 88, - acct = 89, - capget = 90, - capset = 91, - personality = 92, - exit = 93, - exit_group = 94, - waitid = 95, - set_tid_address = 96, - unshare = 97, - futex = 98, - set_robust_list = 99, - get_robust_list = 100, - nanosleep = 101, - getitimer = 102, - setitimer = 103, - kexec_load = 104, - init_module = 105, - delete_module = 106, - timer_create = 107, - timer_gettime = 108, - timer_getoverrun = 109, - timer_settime = 110, - timer_delete = 111, - clock_settime = 112, - clock_gettime = 113, - clock_getres = 114, - clock_nanosleep = 115, - syslog = 116, - ptrace = 117, - sched_setparam = 118, - sched_setscheduler = 119, - sched_getscheduler = 120, - sched_getparam = 121, - sched_setaffinity = 122, - sched_getaffinity = 123, - sched_yield = 124, - sched_get_priority_max = 125, - sched_get_priority_min = 126, - sched_rr_get_interval = 127, - restart_syscall = 128, - kill = 129, - tkill = 130, - tgkill = 131, - sigaltstack = 132, - rt_sigsuspend = 133, - rt_sigaction = 134, - rt_sigprocmask = 135, - rt_sigpending = 136, - rt_sigtimedwait = 137, - rt_sigqueueinfo = 138, - rt_sigreturn = 139, - setpriority = 140, - getpriority = 141, - reboot = 142, - setregid = 143, - setgid = 144, - setreuid = 145, - setuid = 146, - setresuid = 147, - getresuid = 148, - setresgid = 149, - getresgid = 150, - setfsuid = 151, - setfsgid = 152, - times = 153, - setpgid = 154, - getpgid = 155, - getsid = 156, - setsid = 157, - getgroups = 158, - setgroups = 159, - uname = 160, - sethostname = 161, - setdomainname = 162, - getrlimit = 163, - setrlimit = 164, - getrusage = 165, - umask = 166, - prctl = 167, - getcpu = 168, - gettimeofday = 169, - settimeofday = 170, - adjtimex = 171, - getpid = 172, - getppid = 173, - getuid = 174, - geteuid = 175, - getgid = 176, - getegid = 177, - gettid = 178, - sysinfo = 179, - mq_open = 180, - mq_unlink = 181, - mq_timedsend = 182, - mq_timedreceive = 183, - mq_notify = 184, - mq_getsetattr = 185, - msgget = 186, - msgctl = 187, - msgrcv = 188, - msgsnd = 189, - semget = 190, - semctl = 191, - semtimedop = 192, - semop = 193, - shmget = 194, - shmctl = 195, - shmat = 196, - shmdt = 197, - socket = 198, - socketpair = 199, - bind = 200, - listen = 201, - accept = 202, - connect = 203, - getsockname = 204, - getpeername = 205, - sendto = 206, - recvfrom = 207, - setsockopt = 208, - getsockopt = 209, - shutdown = 210, - sendmsg = 211, - recvmsg = 212, - readahead = 213, - brk = 214, - munmap = 215, - mremap = 216, - add_key = 217, - request_key = 218, - keyctl = 219, - clone = 220, - execve = 221, - mmap = 222, - fadvise64 = 223, - swapon = 224, - swapoff = 225, - mprotect = 226, - msync = 227, - mlock = 228, - munlock = 229, - mlockall = 230, - munlockall = 231, - mincore = 232, - madvise = 233, - remap_file_pages = 234, - mbind = 235, - get_mempolicy = 236, - set_mempolicy = 237, - migrate_pages = 238, - move_pages = 239, - rt_tgsigqueueinfo = 240, - perf_event_open = 241, - accept4 = 242, - recvmmsg = 243, - arch_specific_syscall = 244, - wait4 = 260, - prlimit64 = 261, - fanotify_init = 262, - fanotify_mark = 263, - clock_adjtime = 266, - syncfs = 267, - setns = 268, - sendmmsg = 269, - process_vm_readv = 270, - process_vm_writev = 271, - kcmp = 272, - finit_module = 273, - sched_setattr = 274, - sched_getattr = 275, - renameat2 = 276, - seccomp = 277, - getrandom = 278, - memfd_create = 279, - bpf = 280, - execveat = 281, - userfaultfd = 282, - membarrier = 283, - mlock2 = 284, - copy_file_range = 285, - preadv2 = 286, - pwritev2 = 287, - pkey_mprotect = 288, - pkey_alloc = 289, - pkey_free = 290, - statx = 291, - io_pgetevents = 292, - rseq = 293, - kexec_file_load = 294, - pidfd_send_signal = 424, - io_uring_setup = 425, - io_uring_enter = 426, - io_uring_register = 427, - open_tree = 428, - move_mount = 429, - fsopen = 430, - fsconfig = 431, - fsmount = 432, - fspick = 433, - pidfd_open = 434, - clone3 = 435, - close_range = 436, - openat2 = 437, - pidfd_getfd = 438, - faccessat2 = 439, - process_madvise = 440, - epoll_pwait2 = 441, - - _, -}; - -pub const O_CREAT = 0o100; -pub const O_EXCL = 0o200; -pub const O_NOCTTY = 0o400; -pub const O_TRUNC = 0o1000; -pub const O_APPEND = 0o2000; -pub const O_NONBLOCK = 0o4000; -pub const O_DSYNC = 0o10000; -pub const O_SYNC = 0o4010000; -pub const O_RSYNC = 0o4010000; -pub const O_DIRECTORY = 0o40000; -pub const O_NOFOLLOW = 0o100000; -pub const O_CLOEXEC = 0o2000000; - -pub const O_ASYNC = 0o20000; -pub const O_DIRECT = 0o200000; -pub const O_LARGEFILE = 0o400000; -pub const O_NOATIME = 0o1000000; -pub const O_PATH = 0o10000000; -pub const O_TMPFILE = 0o20040000; -pub const O_NDELAY = O_NONBLOCK; - -pub const F_DUPFD = 0; -pub const F_GETFD = 1; -pub const F_SETFD = 2; -pub const F_GETFL = 3; -pub const F_SETFL = 4; - -pub const F_SETOWN = 8; -pub const F_GETOWN = 9; -pub const F_SETSIG = 10; -pub const F_GETSIG = 11; - -pub const F_GETLK = 5; -pub const F_SETLK = 6; -pub const F_SETLKW = 7; - -pub const F_RDLCK = 0; -pub const F_WRLCK = 1; -pub const F_UNLCK = 2; - -pub const LOCK_SH = 1; -pub const LOCK_EX = 2; -pub const LOCK_UN = 8; -pub const LOCK_NB = 4; - -pub const F_SETOWN_EX = 15; -pub const F_GETOWN_EX = 16; - -pub const F_GETOWNER_UIDS = 17; - -/// stack-like segment -pub const MAP_GROWSDOWN = 0x0100; - -/// ETXTBSY -pub const MAP_DENYWRITE = 0x0800; - -/// mark it as an executable -pub const MAP_EXECUTABLE = 0x1000; - -/// pages are locked -pub const MAP_LOCKED = 0x2000; - -/// don't check for reservations -pub const MAP_NORESERVE = 0x4000; - -pub const VDSO_CGT_SYM = "__kernel_clock_gettime"; -pub const VDSO_CGT_VER = "LINUX_2.6.39"; - -pub const Flock = extern struct { - l_type: i16, - l_whence: i16, - l_start: off_t, - l_len: off_t, - l_pid: pid_t, - __unused: [4]u8, -}; - -pub const msghdr = extern struct { - msg_name: ?*sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec, - msg_iovlen: i32, - __pad1: i32 = 0, - msg_control: ?*c_void, - msg_controllen: socklen_t, - __pad2: socklen_t = 0, - msg_flags: i32, -}; - -pub const msghdr_const = extern struct { - msg_name: ?*const sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec_const, - msg_iovlen: i32, - __pad1: i32 = 0, - msg_control: ?*c_void, - msg_controllen: socklen_t, - __pad2: socklen_t = 0, - msg_flags: i32, -}; - -pub const blksize_t = i32; -pub const nlink_t = u32; -pub const time_t = isize; -pub const mode_t = u32; -pub const off_t = isize; -pub const ino_t = usize; -pub const dev_t = usize; -pub const blkcnt_t = isize; - -// The `stat` definition used by the Linux kernel. -pub const kernel_stat = extern struct { - dev: dev_t, - ino: ino_t, - mode: mode_t, - nlink: nlink_t, - uid: uid_t, - gid: gid_t, - rdev: dev_t, - __pad: usize, - size: off_t, - blksize: blksize_t, - __pad2: i32, - blocks: blkcnt_t, - atim: timespec, - mtim: timespec, - ctim: timespec, - __unused: [2]u32, - - pub fn atime(self: @This()) timespec { - return self.atim; - } - - pub fn mtime(self: @This()) timespec { - return self.mtim; - } - - pub fn ctime(self: @This()) timespec { - return self.ctim; - } -}; - -// The `stat64` definition used by the libc. -pub const libc_stat = kernel_stat; - -pub const timespec = extern struct { - tv_sec: time_t, - tv_nsec: isize, -}; - -pub const timeval = extern struct { - tv_sec: isize, - tv_usec: isize, -}; - -pub const timezone = extern struct { - tz_minuteswest: i32, - tz_dsttime: i32, -}; - -pub const mcontext_t = extern struct { - fault_address: usize, - regs: [31]usize, - sp: usize, - pc: usize, - pstate: usize, - // Make sure the field is correctly aligned since this area - // holds various FP/vector registers - reserved1: [256 * 16]u8 align(16), -}; - -pub const ucontext_t = extern struct { - flags: usize, - link: *ucontext_t, - stack: stack_t, - sigmask: sigset_t, - mcontext: mcontext_t, -}; - -pub const Elf_Symndx = u32; diff --git a/lib/std/os/bits/linux/errno/generic.zig b/lib/std/os/bits/linux/errno/generic.zig deleted file mode 100644 index 730c71a5a2..0000000000 --- a/lib/std/os/bits/linux/errno/generic.zig +++ /dev/null @@ -1,460 +0,0 @@ -pub const E = enum(u16) { - /// No error occurred. - /// Same code used for `NSROK`. - SUCCESS = 0, - - /// Operation not permitted - PERM = 1, - - /// No such file or directory - NOENT = 2, - - /// No such process - SRCH = 3, - - /// Interrupted system call - INTR = 4, - - /// I/O error - IO = 5, - - /// No such device or address - NXIO = 6, - - /// Arg list too long - @"2BIG" = 7, - - /// Exec format error - NOEXEC = 8, - - /// Bad file number - BADF = 9, - - /// No child processes - CHILD = 10, - - /// Try again - /// Also means: WOULDBLOCK: operation would block - AGAIN = 11, - - /// Out of memory - NOMEM = 12, - - /// Permission denied - ACCES = 13, - - /// Bad address - FAULT = 14, - - /// Block device required - NOTBLK = 15, - - /// Device or resource busy - BUSY = 16, - - /// File exists - EXIST = 17, - - /// Cross-device link - XDEV = 18, - - /// No such device - NODEV = 19, - - /// Not a directory - NOTDIR = 20, - - /// Is a directory - ISDIR = 21, - - /// Invalid argument - INVAL = 22, - - /// File table overflow - NFILE = 23, - - /// Too many open files - MFILE = 24, - - /// Not a typewriter - NOTTY = 25, - - /// Text file busy - TXTBSY = 26, - - /// File too large - FBIG = 27, - - /// No space left on device - NOSPC = 28, - - /// Illegal seek - SPIPE = 29, - - /// Read-only file system - ROFS = 30, - - /// Too many links - MLINK = 31, - - /// Broken pipe - PIPE = 32, - - /// Math argument out of domain of func - DOM = 33, - - /// Math result not representable - RANGE = 34, - - /// Resource deadlock would occur - DEADLK = 35, - - /// File name too long - NAMETOOLONG = 36, - - /// No record locks available - NOLCK = 37, - - /// Function not implemented - NOSYS = 38, - - /// Directory not empty - NOTEMPTY = 39, - - /// Too many symbolic links encountered - LOOP = 40, - - /// No message of desired type - NOMSG = 42, - - /// Identifier removed - IDRM = 43, - - /// Channel number out of range - CHRNG = 44, - - /// Level 2 not synchronized - L2NSYNC = 45, - - /// Level 3 halted - L3HLT = 46, - - /// Level 3 reset - L3RST = 47, - - /// Link number out of range - LNRNG = 48, - - /// Protocol driver not attached - UNATCH = 49, - - /// No CSI structure available - NOCSI = 50, - - /// Level 2 halted - L2HLT = 51, - - /// Invalid exchange - BADE = 52, - - /// Invalid request descriptor - BADR = 53, - - /// Exchange full - XFULL = 54, - - /// No anode - NOANO = 55, - - /// Invalid request code - BADRQC = 56, - - /// Invalid slot - BADSLT = 57, - - /// Bad font file format - BFONT = 59, - - /// Device not a stream - NOSTR = 60, - - /// No data available - NODATA = 61, - - /// Timer expired - TIME = 62, - - /// Out of streams resources - NOSR = 63, - - /// Machine is not on the network - NONET = 64, - - /// Package not installed - NOPKG = 65, - - /// Object is remote - REMOTE = 66, - - /// Link has been severed - NOLINK = 67, - - /// Advertise error - ADV = 68, - - /// Srmount error - SRMNT = 69, - - /// Communication error on send - COMM = 70, - - /// Protocol error - PROTO = 71, - - /// Multihop attempted - MULTIHOP = 72, - - /// RFS specific error - DOTDOT = 73, - - /// Not a data message - BADMSG = 74, - - /// Value too large for defined data type - OVERFLOW = 75, - - /// Name not unique on network - NOTUNIQ = 76, - - /// File descriptor in bad state - BADFD = 77, - - /// Remote address changed - REMCHG = 78, - - /// Can not access a needed shared library - LIBACC = 79, - - /// Accessing a corrupted shared library - LIBBAD = 80, - - /// .lib section in a.out corrupted - LIBSCN = 81, - - /// Attempting to link in too many shared libraries - LIBMAX = 82, - - /// Cannot exec a shared library directly - LIBEXEC = 83, - - /// Illegal byte sequence - ILSEQ = 84, - - /// Interrupted system call should be restarted - RESTART = 85, - - /// Streams pipe error - STRPIPE = 86, - - /// Too many users - USERS = 87, - - /// Socket operation on non-socket - NOTSOCK = 88, - - /// Destination address required - DESTADDRREQ = 89, - - /// Message too long - MSGSIZE = 90, - - /// Protocol wrong type for socket - PROTOTYPE = 91, - - /// Protocol not available - NOPROTOOPT = 92, - - /// Protocol not supported - PROTONOSUPPORT = 93, - - /// Socket type not supported - SOCKTNOSUPPORT = 94, - - /// Operation not supported on transport endpoint - /// This code also means `NOTSUP`. - OPNOTSUPP = 95, - - /// Protocol family not supported - PFNOSUPPORT = 96, - - /// Address family not supported by protocol - AFNOSUPPORT = 97, - - /// Address already in use - ADDRINUSE = 98, - - /// Cannot assign requested address - ADDRNOTAVAIL = 99, - - /// Network is down - NETDOWN = 100, - - /// Network is unreachable - NETUNREACH = 101, - - /// Network dropped connection because of reset - NETRESET = 102, - - /// Software caused connection abort - CONNABORTED = 103, - - /// Connection reset by peer - CONNRESET = 104, - - /// No buffer space available - NOBUFS = 105, - - /// Transport endpoint is already connected - ISCONN = 106, - - /// Transport endpoint is not connected - NOTCONN = 107, - - /// Cannot send after transport endpoint shutdown - SHUTDOWN = 108, - - /// Too many references: cannot splice - TOOMANYREFS = 109, - - /// Connection timed out - TIMEDOUT = 110, - - /// Connection refused - CONNREFUSED = 111, - - /// Host is down - HOSTDOWN = 112, - - /// No route to host - HOSTUNREACH = 113, - - /// Operation already in progress - ALREADY = 114, - - /// Operation now in progress - INPROGRESS = 115, - - /// Stale NFS file handle - STALE = 116, - - /// Structure needs cleaning - UCLEAN = 117, - - /// Not a XENIX named type file - NOTNAM = 118, - - /// No XENIX semaphores available - NAVAIL = 119, - - /// Is a named type file - ISNAM = 120, - - /// Remote I/O error - REMOTEIO = 121, - - /// Quota exceeded - DQUOT = 122, - - /// No medium found - NOMEDIUM = 123, - - /// Wrong medium type - MEDIUMTYPE = 124, - - /// Operation canceled - CANCELED = 125, - - /// Required key not available - NOKEY = 126, - - /// Key has expired - KEYEXPIRED = 127, - - /// Key has been revoked - KEYREVOKED = 128, - - /// Key was rejected by service - KEYREJECTED = 129, - - // for robust mutexes - - /// Owner died - OWNERDEAD = 130, - - /// State not recoverable - NOTRECOVERABLE = 131, - - /// Operation not possible due to RF-kill - RFKILL = 132, - - /// Memory page has hardware error - HWPOISON = 133, - - // nameserver query return codes - - /// DNS server returned answer with no data - NSRNODATA = 160, - - /// DNS server claims query was misformatted - NSRFORMERR = 161, - - /// DNS server returned general failure - NSRSERVFAIL = 162, - - /// Domain name not found - NSRNOTFOUND = 163, - - /// DNS server does not implement requested operation - NSRNOTIMP = 164, - - /// DNS server refused query - NSRREFUSED = 165, - - /// Misformatted DNS query - NSRBADQUERY = 166, - - /// Misformatted domain name - NSRBADNAME = 167, - - /// Unsupported address family - NSRBADFAMILY = 168, - - /// Misformatted DNS reply - NSRBADRESP = 169, - - /// Could not contact DNS servers - NSRCONNREFUSED = 170, - - /// Timeout while contacting DNS servers - NSRTIMEOUT = 171, - - /// End of file - NSROF = 172, - - /// Error reading file - NSRFILE = 173, - - /// Out of memory - NSRNOMEM = 174, - - /// Application terminated lookup - NSRDESTRUCTION = 175, - - /// Domain name is too long - NSRQUERYDOMAINTOOLONG = 176, - - /// Domain name is too long - NSRCNAMELOOP = 177, - - _, -}; diff --git a/lib/std/os/bits/linux/errno/mips.zig b/lib/std/os/bits/linux/errno/mips.zig deleted file mode 100644 index 39fb9f71ea..0000000000 --- a/lib/std/os/bits/linux/errno/mips.zig +++ /dev/null @@ -1,141 +0,0 @@ -//! These are MIPS ABI compatible. -pub const E = enum(i32) { - /// No error occurred. - SUCCESS = 0, - - PERM = 1, - NOENT = 2, - SRCH = 3, - INTR = 4, - IO = 5, - NXIO = 6, - @"2BIG" = 7, - NOEXEC = 8, - BADF = 9, - CHILD = 10, - /// Also used for WOULDBLOCK. - AGAIN = 11, - NOMEM = 12, - ACCES = 13, - FAULT = 14, - NOTBLK = 15, - BUSY = 16, - EXIST = 17, - XDEV = 18, - NODEV = 19, - NOTDIR = 20, - ISDIR = 21, - INVAL = 22, - NFILE = 23, - MFILE = 24, - NOTTY = 25, - TXTBSY = 26, - FBIG = 27, - NOSPC = 28, - SPIPE = 29, - ROFS = 30, - MLINK = 31, - PIPE = 32, - DOM = 33, - RANGE = 34, - - NOMSG = 35, - IDRM = 36, - CHRNG = 37, - L2NSYNC = 38, - L3HLT = 39, - L3RST = 40, - LNRNG = 41, - UNATCH = 42, - NOCSI = 43, - L2HLT = 44, - DEADLK = 45, - NOLCK = 46, - BADE = 50, - BADR = 51, - XFULL = 52, - NOANO = 53, - BADRQC = 54, - BADSLT = 55, - DEADLOCK = 56, - BFONT = 59, - NOSTR = 60, - NODATA = 61, - TIME = 62, - NOSR = 63, - NONET = 64, - NOPKG = 65, - REMOTE = 66, - NOLINK = 67, - ADV = 68, - SRMNT = 69, - COMM = 70, - PROTO = 71, - DOTDOT = 73, - MULTIHOP = 74, - BADMSG = 77, - NAMETOOLONG = 78, - OVERFLOW = 79, - NOTUNIQ = 80, - BADFD = 81, - REMCHG = 82, - LIBACC = 83, - LIBBAD = 84, - LIBSCN = 85, - LIBMAX = 86, - LIBEXEC = 87, - ILSEQ = 88, - NOSYS = 89, - LOOP = 90, - RESTART = 91, - STRPIPE = 92, - NOTEMPTY = 93, - USERS = 94, - NOTSOCK = 95, - DESTADDRREQ = 96, - MSGSIZE = 97, - PROTOTYPE = 98, - NOPROTOOPT = 99, - PROTONOSUPPORT = 120, - SOCKTNOSUPPORT = 121, - OPNOTSUPP = 122, - PFNOSUPPORT = 123, - AFNOSUPPORT = 124, - ADDRINUSE = 125, - ADDRNOTAVAIL = 126, - NETDOWN = 127, - NETUNREACH = 128, - NETRESET = 129, - CONNABORTED = 130, - CONNRESET = 131, - NOBUFS = 132, - ISCONN = 133, - NOTCONN = 134, - UCLEAN = 135, - NOTNAM = 137, - NAVAIL = 138, - ISNAM = 139, - REMOTEIO = 140, - SHUTDOWN = 143, - TOOMANYREFS = 144, - TIMEDOUT = 145, - CONNREFUSED = 146, - HOSTDOWN = 147, - HOSTUNREACH = 148, - ALREADY = 149, - INPROGRESS = 150, - STALE = 151, - CANCELED = 158, - NOMEDIUM = 159, - MEDIUMTYPE = 160, - NOKEY = 161, - KEYEXPIRED = 162, - KEYREVOKED = 163, - KEYREJECTED = 164, - OWNERDEAD = 165, - NOTRECOVERABLE = 166, - RFKILL = 167, - HWPOISON = 168, - DQUOT = 1133, - _, -}; diff --git a/lib/std/os/bits/linux/errno/sparc.zig b/lib/std/os/bits/linux/errno/sparc.zig deleted file mode 100644 index c4ab65f34a..0000000000 --- a/lib/std/os/bits/linux/errno/sparc.zig +++ /dev/null @@ -1,144 +0,0 @@ -//! These match the SunOS error numbering scheme. -pub const E = enum(i32) { - /// No error occurred. - SUCCESS = 0, - - PERM = 1, - NOENT = 2, - SRCH = 3, - INTR = 4, - IO = 5, - NXIO = 6, - @"2BIG" = 7, - NOEXEC = 8, - BADF = 9, - CHILD = 10, - /// Also used for WOULDBLOCK - AGAIN = 11, - NOMEM = 12, - ACCES = 13, - FAULT = 14, - NOTBLK = 15, - BUSY = 16, - EXIST = 17, - XDEV = 18, - NODEV = 19, - NOTDIR = 20, - ISDIR = 21, - INVAL = 22, - NFILE = 23, - MFILE = 24, - NOTTY = 25, - TXTBSY = 26, - FBIG = 27, - NOSPC = 28, - SPIPE = 29, - ROFS = 30, - MLINK = 31, - PIPE = 32, - DOM = 33, - RANGE = 34, - - INPROGRESS = 36, - ALREADY = 37, - NOTSOCK = 38, - DESTADDRREQ = 39, - MSGSIZE = 40, - PROTOTYPE = 41, - NOPROTOOPT = 42, - PROTONOSUPPORT = 43, - SOCKTNOSUPPORT = 44, - /// Also used for NOTSUP - OPNOTSUPP = 45, - PFNOSUPPORT = 46, - AFNOSUPPORT = 47, - ADDRINUSE = 48, - ADDRNOTAVAIL = 49, - NETDOWN = 50, - NETUNREACH = 51, - NETRESET = 52, - CONNABORTED = 53, - CONNRESET = 54, - NOBUFS = 55, - ISCONN = 56, - NOTCONN = 57, - SHUTDOWN = 58, - TOOMANYREFS = 59, - TIMEDOUT = 60, - CONNREFUSED = 61, - LOOP = 62, - NAMETOOLONG = 63, - HOSTDOWN = 64, - HOSTUNREACH = 65, - NOTEMPTY = 66, - PROCLIM = 67, - USERS = 68, - DQUOT = 69, - STALE = 70, - REMOTE = 71, - NOSTR = 72, - TIME = 73, - NOSR = 74, - NOMSG = 75, - BADMSG = 76, - IDRM = 77, - DEADLK = 78, - NOLCK = 79, - NONET = 80, - RREMOTE = 81, - NOLINK = 82, - ADV = 83, - SRMNT = 84, - COMM = 85, - PROTO = 86, - MULTIHOP = 87, - DOTDOT = 88, - REMCHG = 89, - NOSYS = 90, - STRPIPE = 91, - OVERFLOW = 92, - BADFD = 93, - CHRNG = 94, - L2NSYNC = 95, - L3HLT = 96, - L3RST = 97, - LNRNG = 98, - UNATCH = 99, - NOCSI = 100, - L2HLT = 101, - BADE = 102, - BADR = 103, - XFULL = 104, - NOANO = 105, - BADRQC = 106, - BADSLT = 107, - DEADLOCK = 108, - BFONT = 109, - LIBEXEC = 110, - NODATA = 111, - LIBBAD = 112, - NOPKG = 113, - LIBACC = 114, - NOTUNIQ = 115, - RESTART = 116, - UCLEAN = 117, - NOTNAM = 118, - NAVAIL = 119, - ISNAM = 120, - REMOTEIO = 121, - ILSEQ = 122, - LIBMAX = 123, - LIBSCN = 124, - NOMEDIUM = 125, - MEDIUMTYPE = 126, - CANCELED = 127, - NOKEY = 128, - KEYEXPIRED = 129, - KEYREVOKED = 130, - KEYREJECTED = 131, - OWNERDEAD = 132, - NOTRECOVERABLE = 133, - RFKILL = 134, - HWPOISON = 135, - _, -}; diff --git a/lib/std/os/bits/linux/i386.zig b/lib/std/os/bits/linux/i386.zig deleted file mode 100644 index 12c8fa4713..0000000000 --- a/lib/std/os/bits/linux/i386.zig +++ /dev/null @@ -1,670 +0,0 @@ -// i386-specific declarations that are intended to be imported into the POSIX namespace. -// This does include Linux-only APIs. - -const std = @import("../../../std.zig"); -const linux = std.os.linux; -const socklen_t = linux.socklen_t; -const iovec = linux.iovec; -const iovec_const = linux.iovec_const; -const uid_t = linux.uid_t; -const gid_t = linux.gid_t; -const pid_t = linux.pid_t; -const stack_t = linux.stack_t; -const sigset_t = linux.sigset_t; - -pub const SYS = enum(usize) { - restart_syscall = 0, - exit = 1, - fork = 2, - read = 3, - write = 4, - open = 5, - close = 6, - waitpid = 7, - creat = 8, - link = 9, - unlink = 10, - execve = 11, - chdir = 12, - time = 13, - mknod = 14, - chmod = 15, - lchown = 16, - @"break" = 17, - oldstat = 18, - lseek = 19, - getpid = 20, - mount = 21, - umount = 22, - setuid = 23, - getuid = 24, - stime = 25, - ptrace = 26, - alarm = 27, - oldfstat = 28, - pause = 29, - utime = 30, - stty = 31, - gtty = 32, - access = 33, - nice = 34, - ftime = 35, - sync = 36, - kill = 37, - rename = 38, - mkdir = 39, - rmdir = 40, - dup = 41, - pipe = 42, - times = 43, - prof = 44, - brk = 45, - setgid = 46, - getgid = 47, - signal = 48, - geteuid = 49, - getegid = 50, - acct = 51, - umount2 = 52, - lock = 53, - ioctl = 54, - fcntl = 55, - mpx = 56, - setpgid = 57, - ulimit = 58, - oldolduname = 59, - umask = 60, - chroot = 61, - ustat = 62, - dup2 = 63, - getppid = 64, - getpgrp = 65, - setsid = 66, - sigaction = 67, - sgetmask = 68, - ssetmask = 69, - setreuid = 70, - setregid = 71, - sigsuspend = 72, - sigpending = 73, - sethostname = 74, - setrlimit = 75, - getrlimit = 76, - getrusage = 77, - gettimeofday = 78, - settimeofday = 79, - getgroups = 80, - setgroups = 81, - select = 82, - symlink = 83, - oldlstat = 84, - readlink = 85, - uselib = 86, - swapon = 87, - reboot = 88, - readdir = 89, - mmap = 90, - munmap = 91, - truncate = 92, - ftruncate = 93, - fchmod = 94, - fchown = 95, - getpriority = 96, - setpriority = 97, - profil = 98, - statfs = 99, - fstatfs = 100, - ioperm = 101, - socketcall = 102, - syslog = 103, - setitimer = 104, - getitimer = 105, - stat = 106, - lstat = 107, - fstat = 108, - olduname = 109, - iopl = 110, - vhangup = 111, - idle = 112, - vm86old = 113, - wait4 = 114, - swapoff = 115, - sysinfo = 116, - ipc = 117, - fsync = 118, - sigreturn = 119, - clone = 120, - setdomainname = 121, - uname = 122, - modify_ldt = 123, - adjtimex = 124, - mprotect = 125, - sigprocmask = 126, - create_module = 127, - init_module = 128, - delete_module = 129, - get_kernel_syms = 130, - quotactl = 131, - getpgid = 132, - fchdir = 133, - bdflush = 134, - sysfs = 135, - personality = 136, - afs_syscall = 137, - setfsuid = 138, - setfsgid = 139, - _llseek = 140, - getdents = 141, - _newselect = 142, - flock = 143, - msync = 144, - readv = 145, - writev = 146, - getsid = 147, - fdatasync = 148, - _sysctl = 149, - mlock = 150, - munlock = 151, - mlockall = 152, - munlockall = 153, - sched_setparam = 154, - sched_getparam = 155, - sched_setscheduler = 156, - sched_getscheduler = 157, - sched_yield = 158, - sched_get_priority_max = 159, - sched_get_priority_min = 160, - sched_rr_get_interval = 161, - nanosleep = 162, - mremap = 163, - setresuid = 164, - getresuid = 165, - vm86 = 166, - query_module = 167, - poll = 168, - nfsservctl = 169, - setresgid = 170, - getresgid = 171, - prctl = 172, - rt_sigreturn = 173, - rt_sigaction = 174, - rt_sigprocmask = 175, - rt_sigpending = 176, - rt_sigtimedwait = 177, - rt_sigqueueinfo = 178, - rt_sigsuspend = 179, - pread64 = 180, - pwrite64 = 181, - chown = 182, - getcwd = 183, - capget = 184, - capset = 185, - sigaltstack = 186, - sendfile = 187, - getpmsg = 188, - putpmsg = 189, - vfork = 190, - ugetrlimit = 191, - mmap2 = 192, - truncate64 = 193, - ftruncate64 = 194, - stat64 = 195, - lstat64 = 196, - fstat64 = 197, - lchown32 = 198, - getuid32 = 199, - getgid32 = 200, - geteuid32 = 201, - getegid32 = 202, - setreuid32 = 203, - setregid32 = 204, - getgroups32 = 205, - setgroups32 = 206, - fchown32 = 207, - setresuid32 = 208, - getresuid32 = 209, - setresgid32 = 210, - getresgid32 = 211, - chown32 = 212, - setuid32 = 213, - setgid32 = 214, - setfsuid32 = 215, - setfsgid32 = 216, - pivot_root = 217, - mincore = 218, - madvise = 219, - getdents64 = 220, - fcntl64 = 221, - gettid = 224, - readahead = 225, - setxattr = 226, - lsetxattr = 227, - fsetxattr = 228, - getxattr = 229, - lgetxattr = 230, - fgetxattr = 231, - listxattr = 232, - llistxattr = 233, - flistxattr = 234, - removexattr = 235, - lremovexattr = 236, - fremovexattr = 237, - tkill = 238, - sendfile64 = 239, - futex = 240, - sched_setaffinity = 241, - sched_getaffinity = 242, - set_thread_area = 243, - get_thread_area = 244, - io_setup = 245, - io_destroy = 246, - io_getevents = 247, - io_submit = 248, - io_cancel = 249, - fadvise64 = 250, - exit_group = 252, - lookup_dcookie = 253, - epoll_create = 254, - epoll_ctl = 255, - epoll_wait = 256, - remap_file_pages = 257, - set_tid_address = 258, - timer_create = 259, - timer_settime, // SYS_timer_create + 1 - timer_gettime, // SYS_timer_create + 2 - timer_getoverrun, // SYS_timer_create + 3 - timer_delete, // SYS_timer_create + 4 - clock_settime, // SYS_timer_create + 5 - clock_gettime, // SYS_timer_create + 6 - clock_getres, // SYS_timer_create + 7 - clock_nanosleep, // SYS_timer_create + 8 - statfs64 = 268, - fstatfs64 = 269, - tgkill = 270, - utimes = 271, - fadvise64_64 = 272, - vserver = 273, - mbind = 274, - get_mempolicy = 275, - set_mempolicy = 276, - mq_open = 277, - mq_unlink, // SYS_mq_open + 1 - mq_timedsend, // SYS_mq_open + 2 - mq_timedreceive, // SYS_mq_open + 3 - mq_notify, // SYS_mq_open + 4 - mq_getsetattr, // SYS_mq_open + 5 - kexec_load = 283, - waitid = 284, - add_key = 286, - request_key = 287, - keyctl = 288, - ioprio_set = 289, - ioprio_get = 290, - inotify_init = 291, - inotify_add_watch = 292, - inotify_rm_watch = 293, - migrate_pages = 294, - openat = 295, - mkdirat = 296, - mknodat = 297, - fchownat = 298, - futimesat = 299, - fstatat64 = 300, - unlinkat = 301, - renameat = 302, - linkat = 303, - symlinkat = 304, - readlinkat = 305, - fchmodat = 306, - faccessat = 307, - pselect6 = 308, - ppoll = 309, - unshare = 310, - set_robust_list = 311, - get_robust_list = 312, - splice = 313, - sync_file_range = 314, - tee = 315, - vmsplice = 316, - move_pages = 317, - getcpu = 318, - epoll_pwait = 319, - utimensat = 320, - signalfd = 321, - timerfd_create = 322, - eventfd = 323, - fallocate = 324, - timerfd_settime = 325, - timerfd_gettime = 326, - signalfd4 = 327, - eventfd2 = 328, - epoll_create1 = 329, - dup3 = 330, - pipe2 = 331, - inotify_init1 = 332, - preadv = 333, - pwritev = 334, - rt_tgsigqueueinfo = 335, - perf_event_open = 336, - recvmmsg = 337, - fanotify_init = 338, - fanotify_mark = 339, - prlimit64 = 340, - name_to_handle_at = 341, - open_by_handle_at = 342, - clock_adjtime = 343, - syncfs = 344, - sendmmsg = 345, - setns = 346, - process_vm_readv = 347, - process_vm_writev = 348, - kcmp = 349, - finit_module = 350, - sched_setattr = 351, - sched_getattr = 352, - renameat2 = 353, - seccomp = 354, - getrandom = 355, - memfd_create = 356, - bpf = 357, - execveat = 358, - socket = 359, - socketpair = 360, - bind = 361, - connect = 362, - listen = 363, - accept4 = 364, - getsockopt = 365, - setsockopt = 366, - getsockname = 367, - getpeername = 368, - sendto = 369, - sendmsg = 370, - recvfrom = 371, - recvmsg = 372, - shutdown = 373, - userfaultfd = 374, - membarrier = 375, - mlock2 = 376, - copy_file_range = 377, - preadv2 = 378, - pwritev2 = 379, - pkey_mprotect = 380, - pkey_alloc = 381, - pkey_free = 382, - statx = 383, - arch_prctl = 384, - io_pgetevents = 385, - rseq = 386, - semget = 393, - semctl = 394, - shmget = 395, - shmctl = 396, - shmat = 397, - shmdt = 398, - msgget = 399, - msgsnd = 400, - msgrcv = 401, - msgctl = 402, - clock_gettime64 = 403, - clock_settime64 = 404, - clock_adjtime64 = 405, - clock_getres_time64 = 406, - clock_nanosleep_time64 = 407, - timer_gettime64 = 408, - timer_settime64 = 409, - timerfd_gettime64 = 410, - timerfd_settime64 = 411, - utimensat_time64 = 412, - pselect6_time64 = 413, - ppoll_time64 = 414, - io_pgetevents_time64 = 416, - recvmmsg_time64 = 417, - mq_timedsend_time64 = 418, - mq_timedreceive_time64 = 419, - semtimedop_time64 = 420, - rt_sigtimedwait_time64 = 421, - futex_time64 = 422, - sched_rr_get_interval_time64 = 423, - pidfd_send_signal = 424, - io_uring_setup = 425, - io_uring_enter = 426, - io_uring_register = 427, - open_tree = 428, - move_mount = 429, - fsopen = 430, - fsconfig = 431, - fsmount = 432, - fspick = 433, - pidfd_open = 434, - clone3 = 435, - close_range = 436, - openat2 = 437, - pidfd_getfd = 438, - faccessat2 = 439, - process_madvise = 440, - epoll_pwait2 = 441, - - _, -}; - -pub const O_CREAT = 0o100; -pub const O_EXCL = 0o200; -pub const O_NOCTTY = 0o400; -pub const O_TRUNC = 0o1000; -pub const O_APPEND = 0o2000; -pub const O_NONBLOCK = 0o4000; -pub const O_DSYNC = 0o10000; -pub const O_SYNC = 0o4010000; -pub const O_RSYNC = 0o4010000; -pub const O_DIRECTORY = 0o200000; -pub const O_NOFOLLOW = 0o400000; -pub const O_CLOEXEC = 0o2000000; - -pub const O_ASYNC = 0o20000; -pub const O_DIRECT = 0o40000; -pub const O_LARGEFILE = 0o100000; -pub const O_NOATIME = 0o1000000; -pub const O_PATH = 0o10000000; -pub const O_TMPFILE = 0o20200000; -pub const O_NDELAY = O_NONBLOCK; - -pub const F_DUPFD = 0; -pub const F_GETFD = 1; -pub const F_SETFD = 2; -pub const F_GETFL = 3; -pub const F_SETFL = 4; - -pub const F_SETOWN = 8; -pub const F_GETOWN = 9; -pub const F_SETSIG = 10; -pub const F_GETSIG = 11; - -pub const F_GETLK = 12; -pub const F_SETLK = 13; -pub const F_SETLKW = 14; - -pub const F_RDLCK = 0; -pub const F_WRLCK = 1; -pub const F_UNLCK = 2; - -pub const LOCK_SH = 1; -pub const LOCK_EX = 2; -pub const LOCK_UN = 8; -pub const LOCK_NB = 4; - -pub const F_SETOWN_EX = 15; -pub const F_GETOWN_EX = 16; - -pub const F_GETOWNER_UIDS = 17; - -pub const MAP_NORESERVE = 0x4000; -pub const MAP_GROWSDOWN = 0x0100; -pub const MAP_DENYWRITE = 0x0800; -pub const MAP_EXECUTABLE = 0x1000; -pub const MAP_LOCKED = 0x2000; -pub const MAP_32BIT = 0x40; - -pub const MMAP2_UNIT = 4096; - -pub const VDSO_CGT_SYM = "__vdso_clock_gettime"; -pub const VDSO_CGT_VER = "LINUX_2.6"; - -pub const Flock = extern struct { - l_type: i16, - l_whence: i16, - l_start: off_t, - l_len: off_t, - l_pid: pid_t, -}; - -pub const msghdr = extern struct { - msg_name: ?*sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec, - msg_iovlen: i32, - msg_control: ?*c_void, - msg_controllen: socklen_t, - msg_flags: i32, -}; - -pub const msghdr_const = extern struct { - msg_name: ?*const sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec_const, - msg_iovlen: i32, - msg_control: ?*c_void, - msg_controllen: socklen_t, - msg_flags: i32, -}; - -pub const blksize_t = i32; -pub const nlink_t = u32; -pub const time_t = isize; -pub const mode_t = u32; -pub const off_t = i64; -pub const ino_t = u64; -pub const dev_t = u64; -pub const blkcnt_t = i64; - -// The `stat` definition used by the Linux kernel. -pub const kernel_stat = extern struct { - dev: dev_t, - __dev_padding: u32, - __ino_truncated: u32, - mode: mode_t, - nlink: nlink_t, - uid: uid_t, - gid: gid_t, - rdev: dev_t, - __rdev_padding: u32, - size: off_t, - blksize: blksize_t, - blocks: blkcnt_t, - atim: timespec, - mtim: timespec, - ctim: timespec, - ino: ino_t, - - pub fn atime(self: @This()) timespec { - return self.atim; - } - - pub fn mtime(self: @This()) timespec { - return self.mtim; - } - - pub fn ctime(self: @This()) timespec { - return self.ctim; - } -}; - -// The `stat64` definition used by the libc. -pub const libc_stat = kernel_stat; - -pub const timespec = extern struct { - tv_sec: i32, - tv_nsec: i32, -}; - -pub const timeval = extern struct { - tv_sec: i32, - tv_usec: i32, -}; - -pub const timezone = extern struct { - tz_minuteswest: i32, - tz_dsttime: i32, -}; - -pub const mcontext_t = extern struct { - gregs: [19]usize, - fpregs: [*]u8, - oldmask: usize, - cr2: usize, -}; - -pub const REG_GS = 0; -pub const REG_FS = 1; -pub const REG_ES = 2; -pub const REG_DS = 3; -pub const REG_EDI = 4; -pub const REG_ESI = 5; -pub const REG_EBP = 6; -pub const REG_ESP = 7; -pub const REG_EBX = 8; -pub const REG_EDX = 9; -pub const REG_ECX = 10; -pub const REG_EAX = 11; -pub const REG_TRAPNO = 12; -pub const REG_ERR = 13; -pub const REG_EIP = 14; -pub const REG_CS = 15; -pub const REG_EFL = 16; -pub const REG_UESP = 17; -pub const REG_SS = 18; - -pub const ucontext_t = extern struct { - flags: usize, - link: *ucontext_t, - stack: stack_t, - mcontext: mcontext_t, - sigmask: sigset_t, - regspace: [64]u64, -}; - -pub const Elf_Symndx = u32; - -pub const user_desc = packed struct { - entry_number: u32, - base_addr: u32, - limit: u32, - seg_32bit: u1, - contents: u2, - read_exec_only: u1, - limit_in_pages: u1, - seg_not_present: u1, - useable: u1, -}; - -// socketcall() call numbers -pub const SC_socket = 1; -pub const SC_bind = 2; -pub const SC_connect = 3; -pub const SC_listen = 4; -pub const SC_accept = 5; -pub const SC_getsockname = 6; -pub const SC_getpeername = 7; -pub const SC_socketpair = 8; -pub const SC_send = 9; -pub const SC_recv = 10; -pub const SC_sendto = 11; -pub const SC_recvfrom = 12; -pub const SC_shutdown = 13; -pub const SC_setsockopt = 14; -pub const SC_getsockopt = 15; -pub const SC_sendmsg = 16; -pub const SC_recvmsg = 17; -pub const SC_accept4 = 18; -pub const SC_recvmmsg = 19; -pub const SC_sendmmsg = 20; diff --git a/lib/std/os/bits/linux/mips.zig b/lib/std/os/bits/linux/mips.zig deleted file mode 100644 index ddf241fb4d..0000000000 --- a/lib/std/os/bits/linux/mips.zig +++ /dev/null @@ -1,622 +0,0 @@ -const std = @import("../../../std.zig"); -const linux = std.os.linux; -const socklen_t = linux.socklen_t; -const iovec = linux.iovec; -const iovec_const = linux.iovec_const; -const uid_t = linux.uid_t; -const gid_t = linux.gid_t; -const pid_t = linux.pid_t; - -pub const SYS = enum(usize) { - pub const Linux = 4000; - - syscall = Linux + 0, - exit = Linux + 1, - fork = Linux + 2, - read = Linux + 3, - write = Linux + 4, - open = Linux + 5, - close = Linux + 6, - waitpid = Linux + 7, - creat = Linux + 8, - link = Linux + 9, - unlink = Linux + 10, - execve = Linux + 11, - chdir = Linux + 12, - time = Linux + 13, - mknod = Linux + 14, - chmod = Linux + 15, - lchown = Linux + 16, - @"break" = Linux + 17, - unused18 = Linux + 18, - lseek = Linux + 19, - getpid = Linux + 20, - mount = Linux + 21, - umount = Linux + 22, - setuid = Linux + 23, - getuid = Linux + 24, - stime = Linux + 25, - ptrace = Linux + 26, - alarm = Linux + 27, - unused28 = Linux + 28, - pause = Linux + 29, - utime = Linux + 30, - stty = Linux + 31, - gtty = Linux + 32, - access = Linux + 33, - nice = Linux + 34, - ftime = Linux + 35, - sync = Linux + 36, - kill = Linux + 37, - rename = Linux + 38, - mkdir = Linux + 39, - rmdir = Linux + 40, - dup = Linux + 41, - pipe = Linux + 42, - times = Linux + 43, - prof = Linux + 44, - brk = Linux + 45, - setgid = Linux + 46, - getgid = Linux + 47, - signal = Linux + 48, - geteuid = Linux + 49, - getegid = Linux + 50, - acct = Linux + 51, - umount2 = Linux + 52, - lock = Linux + 53, - ioctl = Linux + 54, - fcntl = Linux + 55, - mpx = Linux + 56, - setpgid = Linux + 57, - ulimit = Linux + 58, - unused59 = Linux + 59, - umask = Linux + 60, - chroot = Linux + 61, - ustat = Linux + 62, - dup2 = Linux + 63, - getppid = Linux + 64, - getpgrp = Linux + 65, - setsid = Linux + 66, - sigaction = Linux + 67, - sgetmask = Linux + 68, - ssetmask = Linux + 69, - setreuid = Linux + 70, - setregid = Linux + 71, - sigsuspend = Linux + 72, - sigpending = Linux + 73, - sethostname = Linux + 74, - setrlimit = Linux + 75, - getrlimit = Linux + 76, - getrusage = Linux + 77, - gettimeofday = Linux + 78, - settimeofday = Linux + 79, - getgroups = Linux + 80, - setgroups = Linux + 81, - reserved82 = Linux + 82, - symlink = Linux + 83, - unused84 = Linux + 84, - readlink = Linux + 85, - uselib = Linux + 86, - swapon = Linux + 87, - reboot = Linux + 88, - readdir = Linux + 89, - mmap = Linux + 90, - munmap = Linux + 91, - truncate = Linux + 92, - ftruncate = Linux + 93, - fchmod = Linux + 94, - fchown = Linux + 95, - getpriority = Linux + 96, - setpriority = Linux + 97, - profil = Linux + 98, - statfs = Linux + 99, - fstatfs = Linux + 100, - ioperm = Linux + 101, - socketcall = Linux + 102, - syslog = Linux + 103, - setitimer = Linux + 104, - getitimer = Linux + 105, - stat = Linux + 106, - lstat = Linux + 107, - fstat = Linux + 108, - unused109 = Linux + 109, - iopl = Linux + 110, - vhangup = Linux + 111, - idle = Linux + 112, - vm86 = Linux + 113, - wait4 = Linux + 114, - swapoff = Linux + 115, - sysinfo = Linux + 116, - ipc = Linux + 117, - fsync = Linux + 118, - sigreturn = Linux + 119, - clone = Linux + 120, - setdomainname = Linux + 121, - uname = Linux + 122, - modify_ldt = Linux + 123, - adjtimex = Linux + 124, - mprotect = Linux + 125, - sigprocmask = Linux + 126, - create_module = Linux + 127, - init_module = Linux + 128, - delete_module = Linux + 129, - get_kernel_syms = Linux + 130, - quotactl = Linux + 131, - getpgid = Linux + 132, - fchdir = Linux + 133, - bdflush = Linux + 134, - sysfs = Linux + 135, - personality = Linux + 136, - afs_syscall = Linux + 137, - setfsuid = Linux + 138, - setfsgid = Linux + 139, - _llseek = Linux + 140, - getdents = Linux + 141, - _newselect = Linux + 142, - flock = Linux + 143, - msync = Linux + 144, - readv = Linux + 145, - writev = Linux + 146, - cacheflush = Linux + 147, - cachectl = Linux + 148, - sysmips = Linux + 149, - unused150 = Linux + 150, - getsid = Linux + 151, - fdatasync = Linux + 152, - _sysctl = Linux + 153, - mlock = Linux + 154, - munlock = Linux + 155, - mlockall = Linux + 156, - munlockall = Linux + 157, - sched_setparam = Linux + 158, - sched_getparam = Linux + 159, - sched_setscheduler = Linux + 160, - sched_getscheduler = Linux + 161, - sched_yield = Linux + 162, - sched_get_priority_max = Linux + 163, - sched_get_priority_min = Linux + 164, - sched_rr_get_interval = Linux + 165, - nanosleep = Linux + 166, - mremap = Linux + 167, - accept = Linux + 168, - bind = Linux + 169, - connect = Linux + 170, - getpeername = Linux + 171, - getsockname = Linux + 172, - getsockopt = Linux + 173, - listen = Linux + 174, - recv = Linux + 175, - recvfrom = Linux + 176, - recvmsg = Linux + 177, - send = Linux + 178, - sendmsg = Linux + 179, - sendto = Linux + 180, - setsockopt = Linux + 181, - shutdown = Linux + 182, - socket = Linux + 183, - socketpair = Linux + 184, - setresuid = Linux + 185, - getresuid = Linux + 186, - query_module = Linux + 187, - poll = Linux + 188, - nfsservctl = Linux + 189, - setresgid = Linux + 190, - getresgid = Linux + 191, - prctl = Linux + 192, - rt_sigreturn = Linux + 193, - rt_sigaction = Linux + 194, - rt_sigprocmask = Linux + 195, - rt_sigpending = Linux + 196, - rt_sigtimedwait = Linux + 197, - rt_sigqueueinfo = Linux + 198, - rt_sigsuspend = Linux + 199, - pread64 = Linux + 200, - pwrite64 = Linux + 201, - chown = Linux + 202, - getcwd = Linux + 203, - capget = Linux + 204, - capset = Linux + 205, - sigaltstack = Linux + 206, - sendfile = Linux + 207, - getpmsg = Linux + 208, - putpmsg = Linux + 209, - mmap2 = Linux + 210, - truncate64 = Linux + 211, - ftruncate64 = Linux + 212, - stat64 = Linux + 213, - lstat64 = Linux + 214, - fstat64 = Linux + 215, - pivot_root = Linux + 216, - mincore = Linux + 217, - madvise = Linux + 218, - getdents64 = Linux + 219, - fcntl64 = Linux + 220, - reserved221 = Linux + 221, - gettid = Linux + 222, - readahead = Linux + 223, - setxattr = Linux + 224, - lsetxattr = Linux + 225, - fsetxattr = Linux + 226, - getxattr = Linux + 227, - lgetxattr = Linux + 228, - fgetxattr = Linux + 229, - listxattr = Linux + 230, - llistxattr = Linux + 231, - flistxattr = Linux + 232, - removexattr = Linux + 233, - lremovexattr = Linux + 234, - fremovexattr = Linux + 235, - tkill = Linux + 236, - sendfile64 = Linux + 237, - futex = Linux + 238, - sched_setaffinity = Linux + 239, - sched_getaffinity = Linux + 240, - io_setup = Linux + 241, - io_destroy = Linux + 242, - io_getevents = Linux + 243, - io_submit = Linux + 244, - io_cancel = Linux + 245, - exit_group = Linux + 246, - lookup_dcookie = Linux + 247, - epoll_create = Linux + 248, - epoll_ctl = Linux + 249, - epoll_wait = Linux + 250, - remap_file_pages = Linux + 251, - set_tid_address = Linux + 252, - restart_syscall = Linux + 253, - fadvise64 = Linux + 254, - statfs64 = Linux + 255, - fstatfs64 = Linux + 256, - timer_create = Linux + 257, - timer_settime = Linux + 258, - timer_gettime = Linux + 259, - timer_getoverrun = Linux + 260, - timer_delete = Linux + 261, - clock_settime = Linux + 262, - clock_gettime = Linux + 263, - clock_getres = Linux + 264, - clock_nanosleep = Linux + 265, - tgkill = Linux + 266, - utimes = Linux + 267, - mbind = Linux + 268, - get_mempolicy = Linux + 269, - set_mempolicy = Linux + 270, - mq_open = Linux + 271, - mq_unlink = Linux + 272, - mq_timedsend = Linux + 273, - mq_timedreceive = Linux + 274, - mq_notify = Linux + 275, - mq_getsetattr = Linux + 276, - vserver = Linux + 277, - waitid = Linux + 278, - add_key = Linux + 280, - request_key = Linux + 281, - keyctl = Linux + 282, - set_thread_area = Linux + 283, - inotify_init = Linux + 284, - inotify_add_watch = Linux + 285, - inotify_rm_watch = Linux + 286, - migrate_pages = Linux + 287, - openat = Linux + 288, - mkdirat = Linux + 289, - mknodat = Linux + 290, - fchownat = Linux + 291, - futimesat = Linux + 292, - fstatat64 = Linux + 293, - unlinkat = Linux + 294, - renameat = Linux + 295, - linkat = Linux + 296, - symlinkat = Linux + 297, - readlinkat = Linux + 298, - fchmodat = Linux + 299, - faccessat = Linux + 300, - pselect6 = Linux + 301, - ppoll = Linux + 302, - unshare = Linux + 303, - splice = Linux + 304, - sync_file_range = Linux + 305, - tee = Linux + 306, - vmsplice = Linux + 307, - move_pages = Linux + 308, - set_robust_list = Linux + 309, - get_robust_list = Linux + 310, - kexec_load = Linux + 311, - getcpu = Linux + 312, - epoll_pwait = Linux + 313, - ioprio_set = Linux + 314, - ioprio_get = Linux + 315, - utimensat = Linux + 316, - signalfd = Linux + 317, - timerfd = Linux + 318, - eventfd = Linux + 319, - fallocate = Linux + 320, - timerfd_create = Linux + 321, - timerfd_gettime = Linux + 322, - timerfd_settime = Linux + 323, - signalfd4 = Linux + 324, - eventfd2 = Linux + 325, - epoll_create1 = Linux + 326, - dup3 = Linux + 327, - pipe2 = Linux + 328, - inotify_init1 = Linux + 329, - preadv = Linux + 330, - pwritev = Linux + 331, - rt_tgsigqueueinfo = Linux + 332, - perf_event_open = Linux + 333, - accept4 = Linux + 334, - recvmmsg = Linux + 335, - fanotify_init = Linux + 336, - fanotify_mark = Linux + 337, - prlimit64 = Linux + 338, - name_to_handle_at = Linux + 339, - open_by_handle_at = Linux + 340, - clock_adjtime = Linux + 341, - syncfs = Linux + 342, - sendmmsg = Linux + 343, - setns = Linux + 344, - process_vm_readv = Linux + 345, - process_vm_writev = Linux + 346, - kcmp = Linux + 347, - finit_module = Linux + 348, - sched_setattr = Linux + 349, - sched_getattr = Linux + 350, - renameat2 = Linux + 351, - seccomp = Linux + 352, - getrandom = Linux + 353, - memfd_create = Linux + 354, - bpf = Linux + 355, - execveat = Linux + 356, - userfaultfd = Linux + 357, - membarrier = Linux + 358, - mlock2 = Linux + 359, - copy_file_range = Linux + 360, - preadv2 = Linux + 361, - pwritev2 = Linux + 362, - pkey_mprotect = Linux + 363, - pkey_alloc = Linux + 364, - pkey_free = Linux + 365, - statx = Linux + 366, - rseq = Linux + 367, - io_pgetevents = Linux + 368, - semget = Linux + 393, - semctl = Linux + 394, - shmget = Linux + 395, - shmctl = Linux + 396, - shmat = Linux + 397, - shmdt = Linux + 398, - msgget = Linux + 399, - msgsnd = Linux + 400, - msgrcv = Linux + 401, - msgctl = Linux + 402, - clock_gettime64 = Linux + 403, - clock_settime64 = Linux + 404, - clock_adjtime64 = Linux + 405, - clock_getres_time64 = Linux + 406, - clock_nanosleep_time64 = Linux + 407, - timer_gettime64 = Linux + 408, - timer_settime64 = Linux + 409, - timerfd_gettime64 = Linux + 410, - timerfd_settime64 = Linux + 411, - utimensat_time64 = Linux + 412, - pselect6_time64 = Linux + 413, - ppoll_time64 = Linux + 414, - io_pgetevents_time64 = Linux + 416, - recvmmsg_time64 = Linux + 417, - mq_timedsend_time64 = Linux + 418, - mq_timedreceive_time64 = Linux + 419, - semtimedop_time64 = Linux + 420, - rt_sigtimedwait_time64 = Linux + 421, - futex_time64 = Linux + 422, - sched_rr_get_interval_time64 = Linux + 423, - pidfd_send_signal = Linux + 424, - io_uring_setup = Linux + 425, - io_uring_enter = Linux + 426, - io_uring_register = Linux + 427, - open_tree = Linux + 428, - move_mount = Linux + 429, - fsopen = Linux + 430, - fsconfig = Linux + 431, - fsmount = Linux + 432, - fspick = Linux + 433, - pidfd_open = Linux + 434, - clone3 = Linux + 435, - close_range = Linux + 436, - openat2 = Linux + 437, - pidfd_getfd = Linux + 438, - faccessat2 = Linux + 439, - process_madvise = Linux + 440, - epoll_pwait2 = Linux + 441, - - _, -}; - -pub const O_CREAT = 0o0400; -pub const O_EXCL = 0o02000; -pub const O_NOCTTY = 0o04000; -pub const O_TRUNC = 0o01000; -pub const O_APPEND = 0o0010; -pub const O_NONBLOCK = 0o0200; -pub const O_DSYNC = 0o0020; -pub const O_SYNC = 0o040020; -pub const O_RSYNC = 0o040020; -pub const O_DIRECTORY = 0o0200000; -pub const O_NOFOLLOW = 0o0400000; -pub const O_CLOEXEC = 0o02000000; - -pub const O_ASYNC = 0o010000; -pub const O_DIRECT = 0o0100000; -pub const O_LARGEFILE = 0o020000; -pub const O_NOATIME = 0o01000000; -pub const O_PATH = 0o010000000; -pub const O_TMPFILE = 0o020200000; -pub const O_NDELAY = O_NONBLOCK; - -pub const F_DUPFD = 0; -pub const F_GETFD = 1; -pub const F_SETFD = 2; -pub const F_GETFL = 3; -pub const F_SETFL = 4; - -pub const F_SETOWN = 24; -pub const F_GETOWN = 23; -pub const F_SETSIG = 10; -pub const F_GETSIG = 11; - -pub const F_GETLK = 33; -pub const F_SETLK = 34; -pub const F_SETLKW = 35; - -pub const F_RDLCK = 0; -pub const F_WRLCK = 1; -pub const F_UNLCK = 2; - -pub const LOCK_SH = 1; -pub const LOCK_EX = 2; -pub const LOCK_UN = 8; -pub const LOCK_NB = 4; - -pub const F_SETOWN_EX = 15; -pub const F_GETOWN_EX = 16; - -pub const F_GETOWNER_UIDS = 17; - -pub const MMAP2_UNIT = 4096; - -pub const MAP_NORESERVE = 0x0400; -pub const MAP_GROWSDOWN = 0x1000; -pub const MAP_DENYWRITE = 0x2000; -pub const MAP_EXECUTABLE = 0x4000; -pub const MAP_LOCKED = 0x8000; -pub const MAP_32BIT = 0x40; - -pub const SO_DEBUG = 1; -pub const SO_REUSEADDR = 0x0004; -pub const SO_KEEPALIVE = 0x0008; -pub const SO_DONTROUTE = 0x0010; -pub const SO_BROADCAST = 0x0020; -pub const SO_LINGER = 0x0080; -pub const SO_OOBINLINE = 0x0100; -pub const SO_REUSEPORT = 0x0200; -pub const SO_SNDBUF = 0x1001; -pub const SO_RCVBUF = 0x1002; -pub const SO_SNDLOWAT = 0x1003; -pub const SO_RCVLOWAT = 0x1004; -pub const SO_RCVTIMEO = 0x1006; -pub const SO_SNDTIMEO = 0x1005; -pub const SO_ERROR = 0x1007; -pub const SO_TYPE = 0x1008; -pub const SO_ACCEPTCONN = 0x1009; -pub const SO_PROTOCOL = 0x1028; -pub const SO_DOMAIN = 0x1029; -pub const SO_NO_CHECK = 11; -pub const SO_PRIORITY = 12; -pub const SO_BSDCOMPAT = 14; -pub const SO_PASSCRED = 17; -pub const SO_PEERCRED = 18; -pub const SO_PEERSEC = 30; -pub const SO_SNDBUFFORCE = 31; -pub const SO_RCVBUFFORCE = 33; - -pub const VDSO_CGT_SYM = "__kernel_clock_gettime"; -pub const VDSO_CGT_VER = "LINUX_2.6.39"; - -pub const Flock = extern struct { - l_type: i16, - l_whence: i16, - __pad0: [4]u8, - l_start: off_t, - l_len: off_t, - l_pid: pid_t, - __unused: [4]u8, -}; - -pub const blksize_t = i32; -pub const nlink_t = u32; -pub const time_t = i32; -pub const mode_t = u32; -pub const off_t = i64; -pub const ino_t = u64; -pub const dev_t = u64; -pub const blkcnt_t = i64; - -// The `stat` definition used by the Linux kernel. -pub const kernel_stat = extern struct { - dev: u32, - __pad0: [3]u32, // Reserved for st_dev expansion - ino: ino_t, - mode: mode_t, - nlink: nlink_t, - uid: uid_t, - gid: gid_t, - rdev: u32, - __pad1: [3]u32, - size: off_t, - atim: timespec, - mtim: timespec, - ctim: timespec, - blksize: blksize_t, - __pad3: u32, - blocks: blkcnt_t, - __pad4: [14]usize, - - pub fn atime(self: @This()) timespec { - return self.atim; - } - - pub fn mtime(self: @This()) timespec { - return self.mtim; - } - - pub fn ctime(self: @This()) timespec { - return self.ctim; - } -}; - -pub const libc_stat = extern struct { - dev: dev_t, - __pad0: [2]u32, - ino: ino_t, - mode: mode_t, - nlink: nlink_t, - uid: uid_t, - gid: gid_t, - rdev: dev_t, - __pad1: [2]u32, - size: off_t, - atim: timespec, - mtim: timespec, - ctim: timespec, - blksize: blksize_t, - __pad3: u32, - blocks: blkcnt_t, - __pad4: [14]u32, - - pub fn atime(self: @This()) timespec { - return self.atim; - } - - pub fn mtime(self: @This()) timespec { - return self.mtim; - } - - pub fn ctime(self: @This()) timespec { - return self.ctim; - } -}; - -pub const timespec = extern struct { - tv_sec: isize, - tv_nsec: isize, -}; - -pub const timeval = extern struct { - tv_sec: isize, - tv_usec: isize, -}; - -pub const timezone = extern struct { - tz_minuteswest: i32, - tz_dsttime: i32, -}; - -pub const Elf_Symndx = u32; diff --git a/lib/std/os/bits/linux/netlink.zig b/lib/std/os/bits/linux/netlink.zig deleted file mode 100644 index 9de546fb20..0000000000 --- a/lib/std/os/bits/linux/netlink.zig +++ /dev/null @@ -1,498 +0,0 @@ -usingnamespace @import("../linux.zig"); - -/// Routing/device hook -pub const NETLINK_ROUTE = 0; - -/// Unused number -pub const NETLINK_UNUSED = 1; - -/// Reserved for user mode socket protocols -pub const NETLINK_USERSOCK = 2; - -/// Unused number, formerly ip_queue -pub const NETLINK_FIREWALL = 3; - -/// socket monitoring -pub const NETLINK_SOCK_DIAG = 4; - -/// netfilter/iptables ULOG -pub const NETLINK_NFLOG = 5; - -/// ipsec -pub const NETLINK_XFRM = 6; - -/// SELinux event notifications -pub const NETLINK_SELINUX = 7; - -/// Open-iSCSI -pub const NETLINK_ISCSI = 8; - -/// auditing -pub const NETLINK_AUDIT = 9; - -pub const NETLINK_FIB_LOOKUP = 10; - -pub const NETLINK_CONNECTOR = 11; - -/// netfilter subsystem -pub const NETLINK_NETFILTER = 12; - -pub const NETLINK_IP6_FW = 13; - -/// DECnet routing messages -pub const NETLINK_DNRTMSG = 14; - -/// Kernel messages to userspace -pub const NETLINK_KOBJECT_UEVENT = 15; - -pub const NETLINK_GENERIC = 16; - -// leave room for NETLINK_DM (DM Events) - -/// SCSI Transports -pub const NETLINK_SCSITRANSPORT = 18; - -pub const NETLINK_ECRYPTFS = 19; - -pub const NETLINK_RDMA = 20; - -/// Crypto layer -pub const NETLINK_CRYPTO = 21; - -/// SMC monitoring -pub const NETLINK_SMC = 22; - -// Flags values - -/// It is request message. -pub const NLM_F_REQUEST = 0x01; - -/// Multipart message, terminated by NLMSG_DONE -pub const NLM_F_MULTI = 0x02; - -/// Reply with ack, with zero or error code -pub const NLM_F_ACK = 0x04; - -/// Echo this request -pub const NLM_F_ECHO = 0x08; - -/// Dump was inconsistent due to sequence change -pub const NLM_F_DUMP_INTR = 0x10; - -/// Dump was filtered as requested -pub const NLM_F_DUMP_FILTERED = 0x20; - -// Modifiers to GET request - -/// specify tree root -pub const NLM_F_ROOT = 0x100; - -/// return all matching -pub const NLM_F_MATCH = 0x200; - -/// atomic GET -pub const NLM_F_ATOMIC = 0x400; -pub const NLM_F_DUMP = NLM_F_ROOT | NLM_F_MATCH; - -// Modifiers to NEW request - -/// Override existing -pub const NLM_F_REPLACE = 0x100; - -/// Do not touch, if it exists -pub const NLM_F_EXCL = 0x200; - -/// Create, if it does not exist -pub const NLM_F_CREATE = 0x400; - -/// Add to end of list -pub const NLM_F_APPEND = 0x800; - -// Modifiers to DELETE request - -/// Do not delete recursively -pub const NLM_F_NONREC = 0x100; - -// Flags for ACK message - -/// request was capped -pub const NLM_F_CAPPED = 0x100; - -/// extended ACK TVLs were included -pub const NLM_F_ACK_TLVS = 0x200; - -pub const NetlinkMessageType = enum(u16) { - /// < 0x10: reserved control messages - pub const MIN_TYPE = 0x10; - - /// Nothing. - NOOP = 0x1, - - /// Error - ERROR = 0x2, - - /// End of a dump - DONE = 0x3, - - /// Data lost - OVERRUN = 0x4, - - // rtlink types - - RTM_NEWLINK = 16, - RTM_DELLINK, - RTM_GETLINK, - RTM_SETLINK, - - RTM_NEWADDR = 20, - RTM_DELADDR, - RTM_GETADDR, - - RTM_NEWROUTE = 24, - RTM_DELROUTE, - RTM_GETROUTE, - - RTM_NEWNEIGH = 28, - RTM_DELNEIGH, - RTM_GETNEIGH, - - RTM_NEWRULE = 32, - RTM_DELRULE, - RTM_GETRULE, - - RTM_NEWQDISC = 36, - RTM_DELQDISC, - RTM_GETQDISC, - - RTM_NEWTCLASS = 40, - RTM_DELTCLASS, - RTM_GETTCLASS, - - RTM_NEWTFILTER = 44, - RTM_DELTFILTER, - RTM_GETTFILTER, - - RTM_NEWACTION = 48, - RTM_DELACTION, - RTM_GETACTION, - - RTM_NEWPREFIX = 52, - - RTM_GETMULTICAST = 58, - - RTM_GETANYCAST = 62, - - RTM_NEWNEIGHTBL = 64, - RTM_GETNEIGHTBL = 66, - RTM_SETNEIGHTBL, - - RTM_NEWNDUSEROPT = 68, - - RTM_NEWADDRLABEL = 72, - RTM_DELADDRLABEL, - RTM_GETADDRLABEL, - - RTM_GETDCB = 78, - RTM_SETDCB, - - RTM_NEWNETCONF = 80, - RTM_DELNETCONF, - RTM_GETNETCONF = 82, - - RTM_NEWMDB = 84, - RTM_DELMDB = 85, - RTM_GETMDB = 86, - - RTM_NEWNSID = 88, - RTM_DELNSID = 89, - RTM_GETNSID = 90, - - RTM_NEWSTATS = 92, - RTM_GETSTATS = 94, - - RTM_NEWCACHEREPORT = 96, - - RTM_NEWCHAIN = 100, - RTM_DELCHAIN, - RTM_GETCHAIN, - - RTM_NEWNEXTHOP = 104, - RTM_DELNEXTHOP, - RTM_GETNEXTHOP, - - _, -}; - -/// Netlink socket address -pub const sockaddr_nl = extern struct { - family: sa_family_t = AF_NETLINK, - __pad1: c_ushort = 0, - - /// port ID - pid: u32, - - /// multicast groups mask - groups: u32, -}; - -/// Netlink message header -/// Specified in RFC 3549 Section 2.3.2 -pub const nlmsghdr = extern struct { - /// Length of message including header - len: u32, - - /// Message content - @"type": NetlinkMessageType, - - /// Additional flags - flags: u16, - - /// Sequence number - seq: u32, - - /// Sending process port ID - pid: u32, -}; - -pub const ifinfomsg = extern struct { - family: u8, - __pad1: u8 = 0, - - /// ARPHRD_* - @"type": c_ushort, - - /// Link index - index: c_int, - - /// IFF_* flags - flags: c_uint, - - /// IFF_* change mask - change: c_uint, -}; - -pub const rtattr = extern struct { - /// Length of option - len: c_ushort, - - /// Type of option - @"type": IFLA, - - pub const ALIGNTO = 4; -}; - -pub const IFLA = enum(c_ushort) { - UNSPEC, - ADDRESS, - BROADCAST, - IFNAME, - MTU, - LINK, - QDISC, - STATS, - COST, - PRIORITY, - MASTER, - - /// Wireless Extension event - WIRELESS, - - /// Protocol specific information for a link - PROTINFO, - - TXQLEN, - MAP, - WEIGHT, - OPERSTATE, - LINKMODE, - LINKINFO, - NET_NS_PID, - IFALIAS, - - /// Number of VFs if device is SR-IOV PF - NUM_VF, - - VFINFO_LIST, - STATS64, - VF_PORTS, - PORT_SELF, - AF_SPEC, - - /// Group the device belongs to - GROUP, - - NET_NS_FD, - - /// Extended info mask, VFs, etc - EXT_MASK, - - /// Promiscuity count: > 0 means acts PROMISC - PROMISCUITY, - - NUM_TX_QUEUES, - NUM_RX_QUEUES, - CARRIER, - PHYS_PORT_ID, - CARRIER_CHANGES, - PHYS_SWITCH_ID, - LINK_NETNSID, - PHYS_PORT_NAME, - PROTO_DOWN, - GSO_MAX_SEGS, - GSO_MAX_SIZE, - PAD, - XDP, - EVENT, - - NEW_NETNSID, - IF_NETNSID, - - CARRIER_UP_COUNT, - CARRIER_DOWN_COUNT, - NEW_IFINDEX, - MIN_MTU, - MAX_MTU, - - _, - - pub const TARGET_NETNSID: IFLA = .IF_NETNSID; -}; - -pub const rtnl_link_ifmap = extern struct { - mem_start: u64, - mem_end: u64, - base_addr: u64, - irq: u16, - dma: u8, - port: u8, -}; - -pub const rtnl_link_stats = extern struct { - /// total packets received - rx_packets: u32, - - /// total packets transmitted - tx_packets: u32, - - /// total bytes received - rx_bytes: u32, - - /// total bytes transmitted - tx_bytes: u32, - - /// bad packets received - rx_errors: u32, - - /// packet transmit problems - tx_errors: u32, - - /// no space in linux buffers - rx_dropped: u32, - - /// no space available in linux - tx_dropped: u32, - - /// multicast packets received - multicast: u32, - - collisions: u32, - - // detailed rx_errors - - rx_length_errors: u32, - - /// receiver ring buff overflow - rx_over_errors: u32, - - /// recved pkt with crc error - rx_crc_errors: u32, - - /// recv'd frame alignment error - rx_frame_errors: u32, - - /// recv'r fifo overrun - rx_fifo_errors: u32, - - /// receiver missed packet - rx_missed_errors: u32, - - // detailed tx_errors - tx_aborted_errors: u32, - tx_carrier_errors: u32, - tx_fifo_errors: u32, - tx_heartbeat_errors: u32, - tx_window_errors: u32, - - // for cslip etc - - rx_compressed: u32, - tx_compressed: u32, - - /// dropped, no handler found - rx_nohandler: u32, -}; - -pub const rtnl_link_stats64 = extern struct { - /// total packets received - rx_packets: u64, - - /// total packets transmitted - tx_packets: u64, - - /// total bytes received - rx_bytes: u64, - - /// total bytes transmitted - tx_bytes: u64, - - /// bad packets received - rx_errors: u64, - - /// packet transmit problems - tx_errors: u64, - - /// no space in linux buffers - rx_dropped: u64, - - /// no space available in linux - tx_dropped: u64, - - /// multicast packets received - multicast: u64, - - collisions: u64, - - // detailed rx_errors - - rx_length_errors: u64, - - /// receiver ring buff overflow - rx_over_errors: u64, - - /// recved pkt with crc error - rx_crc_errors: u64, - - /// recv'd frame alignment error - rx_frame_errors: u64, - - /// recv'r fifo overrun - rx_fifo_errors: u64, - - /// receiver missed packet - rx_missed_errors: u64, - - // detailed tx_errors - tx_aborted_errors: u64, - tx_carrier_errors: u64, - tx_fifo_errors: u64, - tx_heartbeat_errors: u64, - tx_window_errors: u64, - - // for cslip etc - - rx_compressed: u64, - tx_compressed: u64, - - /// dropped, no handler found - rx_nohandler: u64, -}; diff --git a/lib/std/os/bits/linux/powerpc.zig b/lib/std/os/bits/linux/powerpc.zig deleted file mode 100644 index 06f8e326ba..0000000000 --- a/lib/std/os/bits/linux/powerpc.zig +++ /dev/null @@ -1,621 +0,0 @@ -const std = @import("../../../std.zig"); -const linux = std.os.linux; -const socklen_t = linux.socklen_t; -const iovec = linux.iovec; -const iovec_const = linux.iovec_const; -const uid_t = linux.uid_t; -const gid_t = linux.gid_t; -const pid_t = linux.pid_t; -const stack_t = linux.stack_t; -const sigset_t = linux.sigset_t; -pub const SYS = enum(usize) { - restart_syscall = 0, - exit = 1, - fork = 2, - read = 3, - write = 4, - open = 5, - close = 6, - waitpid = 7, - creat = 8, - link = 9, - unlink = 10, - execve = 11, - chdir = 12, - time = 13, - mknod = 14, - chmod = 15, - lchown = 16, - @"break" = 17, - oldstat = 18, - lseek = 19, - getpid = 20, - mount = 21, - umount = 22, - setuid = 23, - getuid = 24, - stime = 25, - ptrace = 26, - alarm = 27, - oldfstat = 28, - pause = 29, - utime = 30, - stty = 31, - gtty = 32, - access = 33, - nice = 34, - ftime = 35, - sync = 36, - kill = 37, - rename = 38, - mkdir = 39, - rmdir = 40, - dup = 41, - pipe = 42, - times = 43, - prof = 44, - brk = 45, - setgid = 46, - getgid = 47, - signal = 48, - geteuid = 49, - getegid = 50, - acct = 51, - umount2 = 52, - lock = 53, - ioctl = 54, - fcntl = 55, - mpx = 56, - setpgid = 57, - ulimit = 58, - oldolduname = 59, - umask = 60, - chroot = 61, - ustat = 62, - dup2 = 63, - getppid = 64, - getpgrp = 65, - setsid = 66, - sigaction = 67, - sgetmask = 68, - ssetmask = 69, - setreuid = 70, - setregid = 71, - sigsuspend = 72, - sigpending = 73, - sethostname = 74, - setrlimit = 75, - getrlimit = 76, - getrusage = 77, - gettimeofday = 78, - settimeofday = 79, - getgroups = 80, - setgroups = 81, - select = 82, - symlink = 83, - oldlstat = 84, - readlink = 85, - uselib = 86, - swapon = 87, - reboot = 88, - readdir = 89, - mmap = 90, - munmap = 91, - truncate = 92, - ftruncate = 93, - fchmod = 94, - fchown = 95, - getpriority = 96, - setpriority = 97, - profil = 98, - statfs = 99, - fstatfs = 100, - ioperm = 101, - socketcall = 102, - syslog = 103, - setitimer = 104, - getitimer = 105, - stat = 106, - lstat = 107, - fstat = 108, - olduname = 109, - iopl = 110, - vhangup = 111, - idle = 112, - vm86 = 113, - wait4 = 114, - swapoff = 115, - sysinfo = 116, - ipc = 117, - fsync = 118, - sigreturn = 119, - clone = 120, - setdomainname = 121, - uname = 122, - modify_ldt = 123, - adjtimex = 124, - mprotect = 125, - sigprocmask = 126, - create_module = 127, - init_module = 128, - delete_module = 129, - get_kernel_syms = 130, - quotactl = 131, - getpgid = 132, - fchdir = 133, - bdflush = 134, - sysfs = 135, - personality = 136, - afs_syscall = 137, - setfsuid = 138, - setfsgid = 139, - _llseek = 140, - getdents = 141, - _newselect = 142, - flock = 143, - msync = 144, - readv = 145, - writev = 146, - getsid = 147, - fdatasync = 148, - _sysctl = 149, - mlock = 150, - munlock = 151, - mlockall = 152, - munlockall = 153, - sched_setparam = 154, - sched_getparam = 155, - sched_setscheduler = 156, - sched_getscheduler = 157, - sched_yield = 158, - sched_get_priority_max = 159, - sched_get_priority_min = 160, - sched_rr_get_interval = 161, - nanosleep = 162, - mremap = 163, - setresuid = 164, - getresuid = 165, - query_module = 166, - poll = 167, - nfsservctl = 168, - setresgid = 169, - getresgid = 170, - prctl = 171, - rt_sigreturn = 172, - rt_sigaction = 173, - rt_sigprocmask = 174, - rt_sigpending = 175, - rt_sigtimedwait = 176, - rt_sigqueueinfo = 177, - rt_sigsuspend = 178, - pread64 = 179, - pwrite64 = 180, - chown = 181, - getcwd = 182, - capget = 183, - capset = 184, - sigaltstack = 185, - sendfile = 186, - getpmsg = 187, - putpmsg = 188, - vfork = 189, - ugetrlimit = 190, - readahead = 191, - mmap2 = 192, - truncate64 = 193, - ftruncate64 = 194, - stat64 = 195, - lstat64 = 196, - fstat64 = 197, - pciconfig_read = 198, - pciconfig_write = 199, - pciconfig_iobase = 200, - multiplexer = 201, - getdents64 = 202, - pivot_root = 203, - fcntl64 = 204, - madvise = 205, - mincore = 206, - gettid = 207, - tkill = 208, - setxattr = 209, - lsetxattr = 210, - fsetxattr = 211, - getxattr = 212, - lgetxattr = 213, - fgetxattr = 214, - listxattr = 215, - llistxattr = 216, - flistxattr = 217, - removexattr = 218, - lremovexattr = 219, - fremovexattr = 220, - futex = 221, - sched_setaffinity = 222, - sched_getaffinity = 223, - tuxcall = 225, - sendfile64 = 226, - io_setup = 227, - io_destroy = 228, - io_getevents = 229, - io_submit = 230, - io_cancel = 231, - set_tid_address = 232, - fadvise64 = 233, - exit_group = 234, - lookup_dcookie = 235, - epoll_create = 236, - epoll_ctl = 237, - epoll_wait = 238, - remap_file_pages = 239, - timer_create = 240, - timer_settime = 241, - timer_gettime = 242, - timer_getoverrun = 243, - timer_delete = 244, - clock_settime = 245, - clock_gettime = 246, - clock_getres = 247, - clock_nanosleep = 248, - swapcontext = 249, - tgkill = 250, - utimes = 251, - statfs64 = 252, - fstatfs64 = 253, - fadvise64_64 = 254, - rtas = 255, - sys_debug_setcontext = 256, - migrate_pages = 258, - mbind = 259, - get_mempolicy = 260, - set_mempolicy = 261, - mq_open = 262, - mq_unlink = 263, - mq_timedsend = 264, - mq_timedreceive = 265, - mq_notify = 266, - mq_getsetattr = 267, - kexec_load = 268, - add_key = 269, - request_key = 270, - keyctl = 271, - waitid = 272, - ioprio_set = 273, - ioprio_get = 274, - inotify_init = 275, - inotify_add_watch = 276, - inotify_rm_watch = 277, - spu_run = 278, - spu_create = 279, - pselect6 = 280, - ppoll = 281, - unshare = 282, - splice = 283, - tee = 284, - vmsplice = 285, - openat = 286, - mkdirat = 287, - mknodat = 288, - fchownat = 289, - futimesat = 290, - fstatat64 = 291, - unlinkat = 292, - renameat = 293, - linkat = 294, - symlinkat = 295, - readlinkat = 296, - fchmodat = 297, - faccessat = 298, - get_robust_list = 299, - set_robust_list = 300, - move_pages = 301, - getcpu = 302, - epoll_pwait = 303, - utimensat = 304, - signalfd = 305, - timerfd_create = 306, - eventfd = 307, - sync_file_range = 308, - fallocate = 309, - subpage_prot = 310, - timerfd_settime = 311, - timerfd_gettime = 312, - signalfd4 = 313, - eventfd2 = 314, - epoll_create1 = 315, - dup3 = 316, - pipe2 = 317, - inotify_init1 = 318, - perf_event_open = 319, - preadv = 320, - pwritev = 321, - rt_tgsigqueueinfo = 322, - fanotify_init = 323, - fanotify_mark = 324, - prlimit64 = 325, - socket = 326, - bind = 327, - connect = 328, - listen = 329, - accept = 330, - getsockname = 331, - getpeername = 332, - socketpair = 333, - send = 334, - sendto = 335, - recv = 336, - recvfrom = 337, - shutdown = 338, - setsockopt = 339, - getsockopt = 340, - sendmsg = 341, - recvmsg = 342, - recvmmsg = 343, - accept4 = 344, - name_to_handle_at = 345, - open_by_handle_at = 346, - clock_adjtime = 347, - syncfs = 348, - sendmmsg = 349, - setns = 350, - process_vm_readv = 351, - process_vm_writev = 352, - finit_module = 353, - kcmp = 354, - sched_setattr = 355, - sched_getattr = 356, - renameat2 = 357, - seccomp = 358, - getrandom = 359, - memfd_create = 360, - bpf = 361, - execveat = 362, - switch_endian = 363, - userfaultfd = 364, - membarrier = 365, - mlock2 = 378, - copy_file_range = 379, - preadv2 = 380, - pwritev2 = 381, - kexec_file_load = 382, - statx = 383, - pkey_alloc = 384, - pkey_free = 385, - pkey_mprotect = 386, - rseq = 387, - io_pgetevents = 388, - semget = 393, - semctl = 394, - shmget = 395, - shmctl = 396, - shmat = 397, - shmdt = 398, - msgget = 399, - msgsnd = 400, - msgrcv = 401, - msgctl = 402, - clock_gettime64 = 403, - clock_settime64 = 404, - clock_adjtime64 = 405, - clock_getres_time64 = 406, - clock_nanosleep_time64 = 407, - timer_gettime64 = 408, - timer_settime64 = 409, - timerfd_gettime64 = 410, - timerfd_settime64 = 411, - utimensat_time64 = 412, - pselect6_time64 = 413, - ppoll_time64 = 414, - io_pgetevents_time64 = 416, - recvmmsg_time64 = 417, - mq_timedsend_time64 = 418, - mq_timedreceive_time64 = 419, - semtimedop_time64 = 420, - rt_sigtimedwait_time64 = 421, - futex_time64 = 422, - sched_rr_get_interval_time64 = 423, - pidfd_send_signal = 424, - io_uring_setup = 425, - io_uring_enter = 426, - io_uring_register = 427, - open_tree = 428, - move_mount = 429, - fsopen = 430, - fsconfig = 431, - fsmount = 432, - fspick = 433, - pidfd_open = 434, - clone3 = 435, - close_range = 436, - openat2 = 437, - pidfd_getfd = 438, - faccessat2 = 439, - process_madvise = 440, -}; - -pub const O_CREAT = 0o100; -pub const O_EXCL = 0o200; -pub const O_NOCTTY = 0o400; -pub const O_TRUNC = 0o1000; -pub const O_APPEND = 0o2000; -pub const O_NONBLOCK = 0o4000; -pub const O_DSYNC = 0o10000; -pub const O_SYNC = 0o4010000; -pub const O_RSYNC = 0o4010000; -pub const O_DIRECTORY = 0o40000; -pub const O_NOFOLLOW = 0o100000; -pub const O_CLOEXEC = 0o2000000; - -pub const O_ASYNC = 0o20000; -pub const O_DIRECT = 0o400000; -pub const O_LARGEFILE = 0o200000; -pub const O_NOATIME = 0o1000000; -pub const O_PATH = 0o10000000; -pub const O_TMPFILE = 0o20040000; -pub const O_NDELAY = O_NONBLOCK; - -pub const F_DUPFD = 0; -pub const F_GETFD = 1; -pub const F_SETFD = 2; -pub const F_GETFL = 3; -pub const F_SETFL = 4; - -pub const F_SETOWN = 8; -pub const F_GETOWN = 9; -pub const F_SETSIG = 10; -pub const F_GETSIG = 11; - -pub const F_GETLK = 12; -pub const F_SETLK = 13; -pub const F_SETLKW = 14; - -pub const F_SETOWN_EX = 15; -pub const F_GETOWN_EX = 16; - -pub const F_GETOWNER_UIDS = 17; - -pub const F_RDLCK = 0; -pub const F_WRLCK = 1; -pub const F_UNLCK = 2; - -pub const LOCK_SH = 1; -pub const LOCK_EX = 2; -pub const LOCK_UN = 8; -pub const LOCK_NB = 4; - -/// stack-like segment -pub const MAP_GROWSDOWN = 0x0100; - -/// ETXTBSY -pub const MAP_DENYWRITE = 0x0800; - -/// mark it as an executable -pub const MAP_EXECUTABLE = 0x1000; - -/// pages are locked -pub const MAP_LOCKED = 0x0080; - -/// don't check for reservations -pub const MAP_NORESERVE = 0x0040; - -pub const VDSO_CGT_SYM = "__kernel_clock_gettime"; -pub const VDSO_CGT_VER = "LINUX_2.6.15"; - -pub const Flock = extern struct { - l_type: i16, - l_whence: i16, - l_start: off_t, - l_len: off_t, - l_pid: pid_t, -}; - -pub const msghdr = extern struct { - msg_name: ?*sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec, - msg_iovlen: usize, - msg_control: ?*c_void, - msg_controllen: socklen_t, - msg_flags: i32, -}; - -pub const msghdr_const = extern struct { - msg_name: ?*const sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec_const, - msg_iovlen: usize, - msg_control: ?*c_void, - msg_controllen: socklen_t, - msg_flags: i32, -}; - -pub const blksize_t = i32; -pub const nlink_t = u32; -pub const time_t = isize; -pub const mode_t = u32; -pub const off_t = i64; -pub const ino_t = u64; -pub const dev_t = u64; -pub const blkcnt_t = i64; - -// The `stat` definition used by the Linux kernel. -pub const kernel_stat = extern struct { - dev: dev_t, - ino: ino_t, - mode: mode_t, - nlink: nlink_t, - uid: uid_t, - gid: gid_t, - rdev: dev_t, - __rdev_padding: i16, - size: off_t, - blksize: blksize_t, - blocks: blkcnt_t, - atim: timespec, - mtim: timespec, - ctim: timespec, - __unused: [2]u32, - - pub fn atime(self: @This()) timespec { - return self.atim; - } - - pub fn mtime(self: @This()) timespec { - return self.mtim; - } - - pub fn ctime(self: @This()) timespec { - return self.ctim; - } -}; - -// The `stat64` definition used by the libc. -pub const libc_stat = kernel_stat; - -pub const timespec = extern struct { - tv_sec: time_t, - tv_nsec: isize, -}; - -pub const timeval = extern struct { - tv_sec: time_t, - tv_usec: isize, -}; - -pub const timezone = extern struct { - tz_minuteswest: i32, - tz_dsttime: i32, -}; - -pub const greg_t = u32; -pub const gregset_t = [48]greg_t; -pub const fpregset_t = [33]f64; - -pub const vrregset = extern struct { - vrregs: [32][4]u32, - vrsave: u32, - _pad: [2]u32, - vscr: u32, -}; -pub const vrregset_t = vrregset; - -pub const mcontext_t = extern struct { - gp_regs: gregset_t, - fp_regs: fpregset_t, - v_regs: vrregset_t align(16), -}; - -pub const ucontext_t = extern struct { - flags: u32, - link: *ucontext_t, - stack: stack_t, - pad: [7]i32, - regs: *mcontext_t, - sigmask: sigset_t, - pad2: [3]i32, - mcontext: mcontext_t, -}; - -pub const Elf_Symndx = u32; - -pub const MMAP2_UNIT = 4096; diff --git a/lib/std/os/bits/linux/powerpc64.zig b/lib/std/os/bits/linux/powerpc64.zig deleted file mode 100644 index 74c6ad11fc..0000000000 --- a/lib/std/os/bits/linux/powerpc64.zig +++ /dev/null @@ -1,604 +0,0 @@ -const std = @import("../../../std.zig"); -const linux = std.os.linux; -const socklen_t = linux.socklen_t; -const iovec = linux.iovec; -const iovec_const = linux.iovec_const; -const uid_t = linux.uid_t; -const gid_t = linux.gid_t; -const pid_t = linux.pid_t; -const stack_t = linux.stack_t; -const sigset_t = linux.sigset_t; -pub const SYS = enum(usize) { - restart_syscall = 0, - exit = 1, - fork = 2, - read = 3, - write = 4, - open = 5, - close = 6, - waitpid = 7, - creat = 8, - link = 9, - unlink = 10, - execve = 11, - chdir = 12, - time = 13, - mknod = 14, - chmod = 15, - lchown = 16, - @"break" = 17, - oldstat = 18, - lseek = 19, - getpid = 20, - mount = 21, - umount = 22, - setuid = 23, - getuid = 24, - stime = 25, - ptrace = 26, - alarm = 27, - oldfstat = 28, - pause = 29, - utime = 30, - stty = 31, - gtty = 32, - access = 33, - nice = 34, - ftime = 35, - sync = 36, - kill = 37, - rename = 38, - mkdir = 39, - rmdir = 40, - dup = 41, - pipe = 42, - times = 43, - prof = 44, - brk = 45, - setgid = 46, - getgid = 47, - signal = 48, - geteuid = 49, - getegid = 50, - acct = 51, - umount2 = 52, - lock = 53, - ioctl = 54, - fcntl = 55, - mpx = 56, - setpgid = 57, - ulimit = 58, - oldolduname = 59, - umask = 60, - chroot = 61, - ustat = 62, - dup2 = 63, - getppid = 64, - getpgrp = 65, - setsid = 66, - sigaction = 67, - sgetmask = 68, - ssetmask = 69, - setreuid = 70, - setregid = 71, - sigsuspend = 72, - sigpending = 73, - sethostname = 74, - setrlimit = 75, - getrlimit = 76, - getrusage = 77, - gettimeofday = 78, - settimeofday = 79, - getgroups = 80, - setgroups = 81, - select = 82, - symlink = 83, - oldlstat = 84, - readlink = 85, - uselib = 86, - swapon = 87, - reboot = 88, - readdir = 89, - mmap = 90, - munmap = 91, - truncate = 92, - ftruncate = 93, - fchmod = 94, - fchown = 95, - getpriority = 96, - setpriority = 97, - profil = 98, - statfs = 99, - fstatfs = 100, - ioperm = 101, - socketcall = 102, - syslog = 103, - setitimer = 104, - getitimer = 105, - stat = 106, - lstat = 107, - fstat = 108, - olduname = 109, - iopl = 110, - vhangup = 111, - idle = 112, - vm86 = 113, - wait4 = 114, - swapoff = 115, - sysinfo = 116, - ipc = 117, - fsync = 118, - sigreturn = 119, - clone = 120, - setdomainname = 121, - uname = 122, - modify_ldt = 123, - adjtimex = 124, - mprotect = 125, - sigprocmask = 126, - create_module = 127, - init_module = 128, - delete_module = 129, - get_kernel_syms = 130, - quotactl = 131, - getpgid = 132, - fchdir = 133, - bdflush = 134, - sysfs = 135, - personality = 136, - afs_syscall = 137, - setfsuid = 138, - setfsgid = 139, - _llseek = 140, - getdents = 141, - _newselect = 142, - flock = 143, - msync = 144, - readv = 145, - writev = 146, - getsid = 147, - fdatasync = 148, - _sysctl = 149, - mlock = 150, - munlock = 151, - mlockall = 152, - munlockall = 153, - sched_setparam = 154, - sched_getparam = 155, - sched_setscheduler = 156, - sched_getscheduler = 157, - sched_yield = 158, - sched_get_priority_max = 159, - sched_get_priority_min = 160, - sched_rr_get_interval = 161, - nanosleep = 162, - mremap = 163, - setresuid = 164, - getresuid = 165, - query_module = 166, - poll = 167, - nfsservctl = 168, - setresgid = 169, - getresgid = 170, - prctl = 171, - rt_sigreturn = 172, - rt_sigaction = 173, - rt_sigprocmask = 174, - rt_sigpending = 175, - rt_sigtimedwait = 176, - rt_sigqueueinfo = 177, - rt_sigsuspend = 178, - pread64 = 179, - pwrite64 = 180, - chown = 181, - getcwd = 182, - capget = 183, - capset = 184, - sigaltstack = 185, - sendfile = 186, - getpmsg = 187, - putpmsg = 188, - vfork = 189, - ugetrlimit = 190, - readahead = 191, - pciconfig_read = 198, - pciconfig_write = 199, - pciconfig_iobase = 200, - multiplexer = 201, - getdents64 = 202, - pivot_root = 203, - madvise = 205, - mincore = 206, - gettid = 207, - tkill = 208, - setxattr = 209, - lsetxattr = 210, - fsetxattr = 211, - getxattr = 212, - lgetxattr = 213, - fgetxattr = 214, - listxattr = 215, - llistxattr = 216, - flistxattr = 217, - removexattr = 218, - lremovexattr = 219, - fremovexattr = 220, - futex = 221, - sched_setaffinity = 222, - sched_getaffinity = 223, - tuxcall = 225, - io_setup = 227, - io_destroy = 228, - io_getevents = 229, - io_submit = 230, - io_cancel = 231, - set_tid_address = 232, - fadvise64 = 233, - exit_group = 234, - lookup_dcookie = 235, - epoll_create = 236, - epoll_ctl = 237, - epoll_wait = 238, - remap_file_pages = 239, - timer_create = 240, - timer_settime = 241, - timer_gettime = 242, - timer_getoverrun = 243, - timer_delete = 244, - clock_settime = 245, - clock_gettime = 246, - clock_getres = 247, - clock_nanosleep = 248, - swapcontext = 249, - tgkill = 250, - utimes = 251, - statfs64 = 252, - fstatfs64 = 253, - rtas = 255, - sys_debug_setcontext = 256, - migrate_pages = 258, - mbind = 259, - get_mempolicy = 260, - set_mempolicy = 261, - mq_open = 262, - mq_unlink = 263, - mq_timedsend = 264, - mq_timedreceive = 265, - mq_notify = 266, - mq_getsetattr = 267, - kexec_load = 268, - add_key = 269, - request_key = 270, - keyctl = 271, - waitid = 272, - ioprio_set = 273, - ioprio_get = 274, - inotify_init = 275, - inotify_add_watch = 276, - inotify_rm_watch = 277, - spu_run = 278, - spu_create = 279, - pselect6 = 280, - ppoll = 281, - unshare = 282, - splice = 283, - tee = 284, - vmsplice = 285, - openat = 286, - mkdirat = 287, - mknodat = 288, - fchownat = 289, - futimesat = 290, - fstatat = 291, - unlinkat = 292, - renameat = 293, - linkat = 294, - symlinkat = 295, - readlinkat = 296, - fchmodat = 297, - faccessat = 298, - get_robust_list = 299, - set_robust_list = 300, - move_pages = 301, - getcpu = 302, - epoll_pwait = 303, - utimensat = 304, - signalfd = 305, - timerfd_create = 306, - eventfd = 307, - sync_file_range = 308, - fallocate = 309, - subpage_prot = 310, - timerfd_settime = 311, - timerfd_gettime = 312, - signalfd4 = 313, - eventfd2 = 314, - epoll_create1 = 315, - dup3 = 316, - pipe2 = 317, - inotify_init1 = 318, - perf_event_open = 319, - preadv = 320, - pwritev = 321, - rt_tgsigqueueinfo = 322, - fanotify_init = 323, - fanotify_mark = 324, - prlimit64 = 325, - socket = 326, - bind = 327, - connect = 328, - listen = 329, - accept = 330, - getsockname = 331, - getpeername = 332, - socketpair = 333, - send = 334, - sendto = 335, - recv = 336, - recvfrom = 337, - shutdown = 338, - setsockopt = 339, - getsockopt = 340, - sendmsg = 341, - recvmsg = 342, - recvmmsg = 343, - accept4 = 344, - name_to_handle_at = 345, - open_by_handle_at = 346, - clock_adjtime = 347, - syncfs = 348, - sendmmsg = 349, - setns = 350, - process_vm_readv = 351, - process_vm_writev = 352, - finit_module = 353, - kcmp = 354, - sched_setattr = 355, - sched_getattr = 356, - renameat2 = 357, - seccomp = 358, - getrandom = 359, - memfd_create = 360, - bpf = 361, - execveat = 362, - switch_endian = 363, - userfaultfd = 364, - membarrier = 365, - mlock2 = 378, - copy_file_range = 379, - preadv2 = 380, - pwritev2 = 381, - kexec_file_load = 382, - statx = 383, - pkey_alloc = 384, - pkey_free = 385, - pkey_mprotect = 386, - rseq = 387, - io_pgetevents = 388, - semtimedop = 392, - semget = 393, - semctl = 394, - shmget = 395, - shmctl = 396, - shmat = 397, - shmdt = 398, - msgget = 399, - msgsnd = 400, - msgrcv = 401, - msgctl = 402, - pidfd_send_signal = 424, - io_uring_setup = 425, - io_uring_enter = 426, - io_uring_register = 427, - open_tree = 428, - move_mount = 429, - fsopen = 430, - fsconfig = 431, - fsmount = 432, - fspick = 433, - pidfd_open = 434, - clone3 = 435, - close_range = 436, - openat2 = 437, - pidfd_getfd = 438, - faccessat2 = 439, - process_madvise = 440, - epoll_pwait2 = 441, - - _, -}; - -pub const O_CREAT = 0o100; -pub const O_EXCL = 0o200; -pub const O_NOCTTY = 0o400; -pub const O_TRUNC = 0o1000; -pub const O_APPEND = 0o2000; -pub const O_NONBLOCK = 0o4000; -pub const O_DSYNC = 0o10000; -pub const O_SYNC = 0o4010000; -pub const O_RSYNC = 0o4010000; -pub const O_DIRECTORY = 0o40000; -pub const O_NOFOLLOW = 0o100000; -pub const O_CLOEXEC = 0o2000000; - -pub const O_ASYNC = 0o20000; -pub const O_DIRECT = 0o400000; -pub const O_LARGEFILE = 0o200000; -pub const O_NOATIME = 0o1000000; -pub const O_PATH = 0o10000000; -pub const O_TMPFILE = 0o20200000; -pub const O_NDELAY = O_NONBLOCK; - -pub const F_DUPFD = 0; -pub const F_GETFD = 1; -pub const F_SETFD = 2; -pub const F_GETFL = 3; -pub const F_SETFL = 4; - -pub const F_SETOWN = 8; -pub const F_GETOWN = 9; -pub const F_SETSIG = 10; -pub const F_GETSIG = 11; - -pub const F_GETLK = 5; -pub const F_SETLK = 6; -pub const F_SETLKW = 7; - -pub const F_RDLCK = 0; -pub const F_WRLCK = 1; -pub const F_UNLCK = 2; - -pub const LOCK_SH = 1; -pub const LOCK_EX = 2; -pub const LOCK_UN = 8; -pub const LOCK_NB = 4; - -pub const F_SETOWN_EX = 15; -pub const F_GETOWN_EX = 16; - -pub const F_GETOWNER_UIDS = 17; - -/// stack-like segment -pub const MAP_GROWSDOWN = 0x0100; - -/// ETXTBSY -pub const MAP_DENYWRITE = 0x0800; - -/// mark it as an executable -pub const MAP_EXECUTABLE = 0x1000; - -/// pages are locked -pub const MAP_LOCKED = 0x0080; - -/// don't check for reservations -pub const MAP_NORESERVE = 0x0040; - -pub const VDSO_CGT_SYM = "__kernel_clock_gettime"; -pub const VDSO_CGT_VER = "LINUX_2.6.15"; - -pub const Flock = extern struct { - l_type: i16, - l_whence: i16, - l_start: off_t, - l_len: off_t, - l_pid: pid_t, - __unused: [4]u8, -}; - -pub const msghdr = extern struct { - msg_name: ?*sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec, - msg_iovlen: usize, - msg_control: ?*c_void, - msg_controllen: usize, - msg_flags: i32, -}; - -pub const msghdr_const = extern struct { - msg_name: ?*const sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec_const, - msg_iovlen: usize, - msg_control: ?*c_void, - msg_controllen: usize, - msg_flags: i32, -}; - -pub const blksize_t = i64; -pub const nlink_t = u64; -pub const time_t = i64; -pub const mode_t = u32; -pub const off_t = i64; -pub const ino_t = u64; -pub const dev_t = u64; -pub const blkcnt_t = i64; - -// The `stat` definition used by the Linux kernel. -pub const kernel_stat = extern struct { - dev: dev_t, - ino: ino_t, - nlink: nlink_t, - mode: mode_t, - uid: uid_t, - gid: gid_t, - rdev: dev_t, - size: off_t, - blksize: blksize_t, - blocks: blkcnt_t, - atim: timespec, - mtim: timespec, - ctim: timespec, - __unused: [3]u64, - - pub fn atime(self: @This()) timespec { - return self.atim; - } - - pub fn mtime(self: @This()) timespec { - return self.mtim; - } - - pub fn ctime(self: @This()) timespec { - return self.ctim; - } -}; - -// The `stat64` definition used by the libc. -pub const libc_stat = kernel_stat; - -pub const timespec = extern struct { - tv_sec: time_t, - tv_nsec: isize, -}; - -pub const timeval = extern struct { - tv_sec: isize, - tv_usec: isize, -}; - -pub const timezone = extern struct { - tz_minuteswest: i32, - tz_dsttime: i32, -}; - -pub const greg_t = u64; -pub const gregset_t = [48]greg_t; -pub const fpregset_t = [33]f64; - -/// The position of the vscr register depends on endianness. -/// On C, macros are used to change vscr_word's offset to -/// account for this. Here we'll just define vscr_word_le -/// and vscr_word_be. Code must take care to use the correct one. -pub const vrregset = extern struct { - vrregs: [32][4]u32 align(16), - vscr_word_le: u32, - _pad1: [2]u32, - vscr_word_be: u32, - vrsave: u32, - _pad2: [3]u32, -}; -pub const vrregset_t = vrregset; - -pub const mcontext_t = extern struct { - __unused: [4]u64, - signal: i32, - _pad0: i32, - handler: u64, - oldmask: u64, - regs: ?*c_void, - gp_regs: gregset_t, - fp_regs: fpregset_t, - v_regs: *vrregset_t, - vmx_reserve: [34 + 34 + 32 + 1]i64, -}; - -pub const ucontext_t = extern struct { - flags: u32, - link: *ucontext_t, - stack: stack_t, - sigmask: sigset_t, - mcontext: mcontext_t, -}; - -pub const Elf_Symndx = u32; diff --git a/lib/std/os/bits/linux/prctl.zig b/lib/std/os/bits/linux/prctl.zig deleted file mode 100644 index d29b6021b6..0000000000 --- a/lib/std/os/bits/linux/prctl.zig +++ /dev/null @@ -1,234 +0,0 @@ -pub const PR = enum(i32) { - SET_PDEATHSIG = 1, - GET_PDEATHSIG = 2, - - GET_DUMPABLE = 3, - SET_DUMPABLE = 4, - - GET_UNALIGN = 5, - SET_UNALIGN = 6, - - GET_KEEPCAPS = 7, - SET_KEEPCAPS = 8, - - GET_FPEMU = 9, - SET_FPEMU = 10, - - GET_FPEXC = 11, - SET_FPEXC = 12, - - GET_TIMING = 13, - SET_TIMING = 14, - - SET_NAME = 15, - GET_NAME = 16, - - GET_ENDIAN = 19, - SET_ENDIAN = 20, - - GET_SECCOMP = 21, - SET_SECCOMP = 22, - - CAPBSET_READ = 23, - CAPBSET_DROP = 24, - - GET_TSC = 25, - SET_TSC = 26, - - GET_SECUREBITS = 27, - SET_SECUREBITS = 28, - - SET_TIMERSLACK = 29, - GET_TIMERSLACK = 30, - - TASK_PERF_EVENTS_DISABLE = 31, - TASK_PERF_EVENTS_ENABLE = 32, - - MCE_KILL = 33, - - MCE_KILL_GET = 34, - - SET_MM = 35, - - SET_PTRACER = 0x59616d61, - - SET_CHILD_SUBREAPER = 36, - GET_CHILD_SUBREAPER = 37, - - SET_NO_NEW_PRIVS = 38, - GET_NO_NEW_PRIVS = 39, - - GET_TID_ADDRESS = 40, - - SET_THP_DISABLE = 41, - GET_THP_DISABLE = 42, - - MPX_ENABLE_MANAGEMENT = 43, - MPX_DISABLE_MANAGEMENT = 44, - - SET_FP_MODE = 45, - GET_FP_MODE = 46, - - CAP_AMBIENT = 47, - - SVE_SET_VL = 50, - SVE_GET_VL = 51, - - GET_SPECULATION_CTRL = 52, - SET_SPECULATION_CTRL = 53, - - _, -}; - -pub const PR_SET_PDEATHSIG = @enumToInt(PR.SET_PDEATHSIG); -pub const PR_GET_PDEATHSIG = @enumToInt(PR.GET_PDEATHSIG); - -pub const PR_GET_DUMPABLE = @enumToInt(PR.GET_DUMPABLE); -pub const PR_SET_DUMPABLE = @enumToInt(PR.SET_DUMPABLE); - -pub const PR_GET_UNALIGN = @enumToInt(PR.GET_UNALIGN); -pub const PR_SET_UNALIGN = @enumToInt(PR.SET_UNALIGN); -pub const PR_UNALIGN_NOPRINT = 1; -pub const PR_UNALIGN_SIGBUS = 2; - -pub const PR_GET_KEEPCAPS = @enumToInt(PR.GET_KEEPCAPS); -pub const PR_SET_KEEPCAPS = @enumToInt(PR.SET_KEEPCAPS); - -pub const PR_GET_FPEMU = @enumToInt(PR.GET_FPEMU); -pub const PR_SET_FPEMU = @enumToInt(PR.SET_FPEMU); -pub const PR_FPEMU_NOPRINT = 1; -pub const PR_FPEMU_SIGFPE = 2; - -pub const PR_GET_FPEXC = @enumToInt(PR.GET_FPEXC); -pub const PR_SET_FPEXC = @enumToInt(PR.SET_FPEXC); -pub const PR_FP_EXC_SW_ENABLE = 0x80; -pub const PR_FP_EXC_DIV = 0x010000; -pub const PR_FP_EXC_OVF = 0x020000; -pub const PR_FP_EXC_UND = 0x040000; -pub const PR_FP_EXC_RES = 0x080000; -pub const PR_FP_EXC_INV = 0x100000; -pub const PR_FP_EXC_DISABLED = 0; -pub const PR_FP_EXC_NONRECOV = 1; -pub const PR_FP_EXC_ASYNC = 2; -pub const PR_FP_EXC_PRECISE = 3; - -pub const PR_GET_TIMING = @enumToInt(PR.GET_TIMING); -pub const PR_SET_TIMING = @enumToInt(PR.SET_TIMING); -pub const PR_TIMING_STATISTICAL = 0; -pub const PR_TIMING_TIMESTAMP = 1; - -pub const PR_SET_NAME = @enumToInt(PR.SET_NAME); -pub const PR_GET_NAME = @enumToInt(PR.GET_NAME); - -pub const PR_GET_ENDIAN = @enumToInt(PR.GET_ENDIAN); -pub const PR_SET_ENDIAN = @enumToInt(PR.SET_ENDIAN); -pub const PR_ENDIAN_BIG = 0; -pub const PR_ENDIAN_LITTLE = 1; -pub const PR_ENDIAN_PPC_LITTLE = 2; - -pub const PR_GET_SECCOMP = @enumToInt(PR.GET_SECCOMP); -pub const PR_SET_SECCOMP = @enumToInt(PR.SET_SECCOMP); - -pub const PR_CAPBSET_READ = @enumToInt(PR.CAPBSET_READ); -pub const PR_CAPBSET_DROP = @enumToInt(PR.CAPBSET_DROP); - -pub const PR_GET_TSC = @enumToInt(PR.GET_TSC); -pub const PR_SET_TSC = @enumToInt(PR.SET_TSC); -pub const PR_TSC_ENABLE = 1; -pub const PR_TSC_SIGSEGV = 2; - -pub const PR_GET_SECUREBITS = @enumToInt(PR.GET_SECUREBITS); -pub const PR_SET_SECUREBITS = @enumToInt(PR.SET_SECUREBITS); - -pub const PR_SET_TIMERSLACK = @enumToInt(PR.SET_TIMERSLACK); -pub const PR_GET_TIMERSLACK = @enumToInt(PR.GET_TIMERSLACK); - -pub const PR_TASK_PERF_EVENTS_DISABLE = @enumToInt(PR.TASK_PERF_EVENTS_DISABLE); -pub const PR_TASK_PERF_EVENTS_ENABLE = @enumToInt(PR.TASK_PERF_EVENTS_ENABLE); - -pub const PR_MCE_KILL = @enumToInt(PR.MCE_KILL); -pub const PR_MCE_KILL_CLEAR = 0; -pub const PR_MCE_KILL_SET = 1; - -pub const PR_MCE_KILL_LATE = 0; -pub const PR_MCE_KILL_EARLY = 1; -pub const PR_MCE_KILL_DEFAULT = 2; - -pub const PR_MCE_KILL_GET = @enumToInt(PR.MCE_KILL_GET); - -pub const PR_SET_MM = @enumToInt(PR.SET_MM); -pub const PR_SET_MM_START_CODE = 1; -pub const PR_SET_MM_END_CODE = 2; -pub const PR_SET_MM_START_DATA = 3; -pub const PR_SET_MM_END_DATA = 4; -pub const PR_SET_MM_START_STACK = 5; -pub const PR_SET_MM_START_BRK = 6; -pub const PR_SET_MM_BRK = 7; -pub const PR_SET_MM_ARG_START = 8; -pub const PR_SET_MM_ARG_END = 9; -pub const PR_SET_MM_ENV_START = 10; -pub const PR_SET_MM_ENV_END = 11; -pub const PR_SET_MM_AUXV = 12; -pub const PR_SET_MM_EXE_FILE = 13; -pub const PR_SET_MM_MAP = 14; -pub const PR_SET_MM_MAP_SIZE = 15; - -pub const prctl_mm_map = extern struct { - start_code: u64, - end_code: u64, - start_data: u64, - end_data: u64, - start_brk: u64, - brk: u64, - start_stack: u64, - arg_start: u64, - arg_end: u64, - env_start: u64, - env_end: u64, - auxv: *u64, - auxv_size: u32, - exe_fd: u32, -}; - -pub const PR_SET_PTRACER = @enumToInt(PR.SET_PTRACER); -pub const PR_SET_PTRACER_ANY = std.math.maxInt(c_ulong); - -pub const PR_SET_CHILD_SUBREAPER = @enumToInt(PR.SET_CHILD_SUBREAPER); -pub const PR_GET_CHILD_SUBREAPER = @enumToInt(PR.GET_CHILD_SUBREAPER); - -pub const PR_SET_NO_NEW_PRIVS = @enumToInt(PR.SET_NO_NEW_PRIVS); -pub const PR_GET_NO_NEW_PRIVS = @enumToInt(PR.GET_NO_NEW_PRIVS); - -pub const PR_GET_TID_ADDRESS = @enumToInt(PR.GET_TID_ADDRESS); - -pub const PR_SET_THP_DISABLE = @enumToInt(PR.SET_THP_DISABLE); -pub const PR_GET_THP_DISABLE = @enumToInt(PR.GET_THP_DISABLE); - -pub const PR_MPX_ENABLE_MANAGEMENT = @enumToInt(PR.MPX_ENABLE_MANAGEMENT); -pub const PR_MPX_DISABLE_MANAGEMENT = @enumToInt(PR.MPX_DISABLE_MANAGEMENT); - -pub const PR_SET_FP_MODE = @enumToInt(PR.SET_FP_MODE); -pub const PR_GET_FP_MODE = @enumToInt(PR.GET_FP_MODE); -pub const PR_FP_MODE_FR = 1 << 0; -pub const PR_FP_MODE_FRE = 1 << 1; - -pub const PR_CAP_AMBIENT = @enumToInt(PR.CAP_AMBIENT); -pub const PR_CAP_AMBIENT_IS_SET = 1; -pub const PR_CAP_AMBIENT_RAISE = 2; -pub const PR_CAP_AMBIENT_LOWER = 3; -pub const PR_CAP_AMBIENT_CLEAR_ALL = 4; - -pub const PR_SVE_SET_VL = @enumToInt(PR.SVE_SET_VL); -pub const PR_SVE_SET_VL_ONEXEC = 1 << 18; -pub const PR_SVE_GET_VL = @enumToInt(PR.SVE_GET_VL); -pub const PR_SVE_VL_LEN_MASK = 0xffff; -pub const PR_SVE_VL_INHERIT = 1 << 17; - -pub const PR_GET_SPECULATION_CTRL = @enumToInt(PR.GET_SPECULATION_CTRL); -pub const PR_SET_SPECULATION_CTRL = @enumToInt(PR.SET_SPECULATION_CTRL); -pub const PR_SPEC_STORE_BYPASS = 0; -pub const PR_SPEC_NOT_AFFECTED = 0; -pub const PR_SPEC_PRCTL = 1 << 0; -pub const PR_SPEC_ENABLE = 1 << 1; -pub const PR_SPEC_DISABLE = 1 << 2; -pub const PR_SPEC_FORCE_DISABLE = 1 << 3; diff --git a/lib/std/os/bits/linux/riscv64.zig b/lib/std/os/bits/linux/riscv64.zig deleted file mode 100644 index 7a0811cc1a..0000000000 --- a/lib/std/os/bits/linux/riscv64.zig +++ /dev/null @@ -1,423 +0,0 @@ -// riscv64-specific declarations that are intended to be imported into the POSIX namespace. -const std = @import("../../../std.zig"); -const uid_t = std.os.linux.uid_t; -const gid_t = std.os.linux.gid_t; -const pid_t = std.os.linux.pid_t; - -pub const SYS = enum(usize) { - pub const arch_specific_syscall = 244; - - io_setup = 0, - io_destroy = 1, - io_submit = 2, - io_cancel = 3, - io_getevents = 4, - setxattr = 5, - lsetxattr = 6, - fsetxattr = 7, - getxattr = 8, - lgetxattr = 9, - fgetxattr = 10, - listxattr = 11, - llistxattr = 12, - flistxattr = 13, - removexattr = 14, - lremovexattr = 15, - fremovexattr = 16, - getcwd = 17, - lookup_dcookie = 18, - eventfd2 = 19, - epoll_create1 = 20, - epoll_ctl = 21, - epoll_pwait = 22, - dup = 23, - dup3 = 24, - fcntl = 25, - inotify_init1 = 26, - inotify_add_watch = 27, - inotify_rm_watch = 28, - ioctl = 29, - ioprio_set = 30, - ioprio_get = 31, - flock = 32, - mknodat = 33, - mkdirat = 34, - unlinkat = 35, - symlinkat = 36, - linkat = 37, - umount2 = 39, - mount = 40, - pivot_root = 41, - nfsservctl = 42, - statfs = 43, - fstatfs = 44, - truncate = 45, - ftruncate = 46, - fallocate = 47, - faccessat = 48, - chdir = 49, - fchdir = 50, - chroot = 51, - fchmod = 52, - fchmodat = 53, - fchownat = 54, - fchown = 55, - openat = 56, - close = 57, - vhangup = 58, - pipe2 = 59, - quotactl = 60, - getdents64 = 61, - lseek = 62, - read = 63, - write = 64, - readv = 65, - writev = 66, - pread64 = 67, - pwrite64 = 68, - preadv = 69, - pwritev = 70, - sendfile = 71, - pselect6 = 72, - ppoll = 73, - signalfd4 = 74, - vmsplice = 75, - splice = 76, - tee = 77, - readlinkat = 78, - fstatat = 79, - fstat = 80, - sync = 81, - fsync = 82, - fdatasync = 83, - sync_file_range = 84, - timerfd_create = 85, - timerfd_settime = 86, - timerfd_gettime = 87, - utimensat = 88, - acct = 89, - capget = 90, - capset = 91, - personality = 92, - exit = 93, - exit_group = 94, - waitid = 95, - set_tid_address = 96, - unshare = 97, - futex = 98, - set_robust_list = 99, - get_robust_list = 100, - nanosleep = 101, - getitimer = 102, - setitimer = 103, - kexec_load = 104, - init_module = 105, - delete_module = 106, - timer_create = 107, - timer_gettime = 108, - timer_getoverrun = 109, - timer_settime = 110, - timer_delete = 111, - clock_settime = 112, - clock_gettime = 113, - clock_getres = 114, - clock_nanosleep = 115, - syslog = 116, - ptrace = 117, - sched_setparam = 118, - sched_setscheduler = 119, - sched_getscheduler = 120, - sched_getparam = 121, - sched_setaffinity = 122, - sched_getaffinity = 123, - sched_yield = 124, - sched_get_priority_max = 125, - sched_get_priority_min = 126, - sched_rr_get_interval = 127, - restart_syscall = 128, - kill = 129, - tkill = 130, - tgkill = 131, - sigaltstack = 132, - rt_sigsuspend = 133, - rt_sigaction = 134, - rt_sigprocmask = 135, - rt_sigpending = 136, - rt_sigtimedwait = 137, - rt_sigqueueinfo = 138, - rt_sigreturn = 139, - setpriority = 140, - getpriority = 141, - reboot = 142, - setregid = 143, - setgid = 144, - setreuid = 145, - setuid = 146, - setresuid = 147, - getresuid = 148, - setresgid = 149, - getresgid = 150, - setfsuid = 151, - setfsgid = 152, - times = 153, - setpgid = 154, - getpgid = 155, - getsid = 156, - setsid = 157, - getgroups = 158, - setgroups = 159, - uname = 160, - sethostname = 161, - setdomainname = 162, - getrlimit = 163, - setrlimit = 164, - getrusage = 165, - umask = 166, - prctl = 167, - getcpu = 168, - gettimeofday = 169, - settimeofday = 170, - adjtimex = 171, - getpid = 172, - getppid = 173, - getuid = 174, - geteuid = 175, - getgid = 176, - getegid = 177, - gettid = 178, - sysinfo = 179, - mq_open = 180, - mq_unlink = 181, - mq_timedsend = 182, - mq_timedreceive = 183, - mq_notify = 184, - mq_getsetattr = 185, - msgget = 186, - msgctl = 187, - msgrcv = 188, - msgsnd = 189, - semget = 190, - semctl = 191, - semtimedop = 192, - semop = 193, - shmget = 194, - shmctl = 195, - shmat = 196, - shmdt = 197, - socket = 198, - socketpair = 199, - bind = 200, - listen = 201, - accept = 202, - connect = 203, - getsockname = 204, - getpeername = 205, - sendto = 206, - recvfrom = 207, - setsockopt = 208, - getsockopt = 209, - shutdown = 210, - sendmsg = 211, - recvmsg = 212, - readahead = 213, - brk = 214, - munmap = 215, - mremap = 216, - add_key = 217, - request_key = 218, - keyctl = 219, - clone = 220, - execve = 221, - mmap = 222, - fadvise64 = 223, - swapon = 224, - swapoff = 225, - mprotect = 226, - msync = 227, - mlock = 228, - munlock = 229, - mlockall = 230, - munlockall = 231, - mincore = 232, - madvise = 233, - remap_file_pages = 234, - mbind = 235, - get_mempolicy = 236, - set_mempolicy = 237, - migrate_pages = 238, - move_pages = 239, - rt_tgsigqueueinfo = 240, - perf_event_open = 241, - accept4 = 242, - recvmmsg = 243, - - riscv_flush_icache = arch_specific_syscall + 15, - - wait4 = 260, - prlimit64 = 261, - fanotify_init = 262, - fanotify_mark = 263, - name_to_handle_at = 264, - open_by_handle_at = 265, - clock_adjtime = 266, - syncfs = 267, - setns = 268, - sendmmsg = 269, - process_vm_readv = 270, - process_vm_writev = 271, - kcmp = 272, - finit_module = 273, - sched_setattr = 274, - sched_getattr = 275, - renameat2 = 276, - seccomp = 277, - getrandom = 278, - memfd_create = 279, - bpf = 280, - execveat = 281, - userfaultfd = 282, - membarrier = 283, - mlock2 = 284, - copy_file_range = 285, - preadv2 = 286, - pwritev2 = 287, - pkey_mprotect = 288, - pkey_alloc = 289, - pkey_free = 290, - statx = 291, - io_pgetevents = 292, - rseq = 293, - kexec_file_load = 294, - pidfd_send_signal = 424, - io_uring_setup = 425, - io_uring_enter = 426, - io_uring_register = 427, - open_tree = 428, - move_mount = 429, - fsopen = 430, - fsconfig = 431, - fsmount = 432, - fspick = 433, - pidfd_open = 434, - clone3 = 435, - close_range = 436, - openat2 = 437, - pidfd_getfd = 438, - faccessat2 = 439, - process_madvise = 440, - epoll_pwait2 = 441, - - _, -}; - -pub const O_CREAT = 0o100; -pub const O_EXCL = 0o200; -pub const O_NOCTTY = 0o400; -pub const O_TRUNC = 0o1000; -pub const O_APPEND = 0o2000; -pub const O_NONBLOCK = 0o4000; -pub const O_DSYNC = 0o10000; -pub const O_SYNC = 0o4010000; -pub const O_RSYNC = 0o4010000; -pub const O_DIRECTORY = 0o200000; -pub const O_NOFOLLOW = 0o400000; -pub const O_CLOEXEC = 0o2000000; - -pub const O_ASYNC = 0o20000; -pub const O_DIRECT = 0o40000; -pub const O_LARGEFILE = 0o100000; -pub const O_NOATIME = 0o1000000; -pub const O_PATH = 0o10000000; -pub const O_TMPFILE = 0o20200000; -pub const O_NDELAY = O_NONBLOCK; - -pub const F_DUPFD = 0; -pub const F_GETFD = 1; -pub const F_SETFD = 2; -pub const F_GETFL = 3; -pub const F_SETFL = 4; -pub const F_GETLK = 5; -pub const F_SETLK = 6; -pub const F_SETLKW = 7; -pub const F_SETOWN = 8; -pub const F_GETOWN = 9; -pub const F_SETSIG = 10; -pub const F_GETSIG = 11; - -pub const F_RDLCK = 0; -pub const F_WRLCK = 1; -pub const F_UNLCK = 2; - -pub const LOCK_SH = 1; -pub const LOCK_EX = 2; -pub const LOCK_UN = 8; -pub const LOCK_NB = 4; - -pub const F_SETOWN_EX = 15; -pub const F_GETOWN_EX = 16; - -pub const F_GETOWNER_UIDS = 17; - -pub const blksize_t = i32; -pub const nlink_t = u32; -pub const time_t = isize; -pub const mode_t = u32; -pub const off_t = isize; -pub const ino_t = usize; -pub const dev_t = usize; -pub const blkcnt_t = isize; -pub const timespec = extern struct { - tv_sec: time_t, - tv_nsec: isize, -}; - -pub const timeval = extern struct { - tv_sec: time_t, - tv_usec: i64, -}; - -pub const Flock = extern struct { - l_type: i16, - l_whence: i16, - l_start: off_t, - l_len: off_t, - l_pid: pid_t, - __unused: [4]u8, -}; - -// The `stat` definition used by the Linux kernel. -pub const kernel_stat = extern struct { - dev: dev_t, - ino: ino_t, - mode: mode_t, - nlink: nlink_t, - uid: uid_t, - gid: gid_t, - rdev: dev_t, - __pad: usize, - size: off_t, - blksize: blksize_t, - __pad2: i32, - blocks: blkcnt_t, - atim: timespec, - mtim: timespec, - ctim: timespec, - __unused: [2]u32, - - pub fn atime(self: @This()) timespec { - return self.atim; - } - - pub fn mtime(self: @This()) timespec { - return self.mtim; - } - - pub fn ctime(self: @This()) timespec { - return self.ctim; - } -}; - -// The `stat64` definition used by the libc. -pub const libc_stat = kernel_stat; - -pub const Elf_Symndx = u32; diff --git a/lib/std/os/bits/linux/securebits.zig b/lib/std/os/bits/linux/securebits.zig deleted file mode 100644 index a23ced3cf2..0000000000 --- a/lib/std/os/bits/linux/securebits.zig +++ /dev/null @@ -1,35 +0,0 @@ -fn issecure_mask(comptime x: comptime_int) comptime_int { - return 1 << x; -} - -pub const SECUREBITS_DEFAULT = 0x00000000; - -pub const SECURE_NOROOT = 0; -pub const SECURE_NOROOT_LOCKED = 1; - -pub const SECBIT_NOROOT = issecure_mask(SECURE_NOROOT); -pub const SECBIT_NOROOT_LOCKED = issecure_mask(SECURE_NOROOT_LOCKED); - -pub const SECURE_NO_SETUID_FIXUP = 2; -pub const SECURE_NO_SETUID_FIXUP_LOCKED = 3; - -pub const SECBIT_NO_SETUID_FIXUP = issecure_mask(SECURE_NO_SETUID_FIXUP); -pub const SECBIT_NO_SETUID_FIXUP_LOCKED = issecure_mask(SECURE_NO_SETUID_FIXUP_LOCKED); - -pub const SECURE_KEEP_CAPS = 4; -pub const SECURE_KEEP_CAPS_LOCKED = 5; - -pub const SECBIT_KEEP_CAPS = issecure_mask(SECURE_KEEP_CAPS); -pub const SECBIT_KEEP_CAPS_LOCKED = issecure_mask(SECURE_KEEP_CAPS_LOCKED); - -pub const SECURE_NO_CAP_AMBIENT_RAISE = 6; -pub const SECURE_NO_CAP_AMBIENT_RAISE_LOCKED = 7; - -pub const SECBIT_NO_CAP_AMBIENT_RAISE = issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE); -pub const SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED = issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE_LOCKED); - -pub const SECURE_ALL_BITS = issecure_mask(SECURE_NOROOT) | - issecure_mask(SECURE_NO_SETUID_FIXUP) | - issecure_mask(SECURE_KEEP_CAPS) | - issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE); -pub const SECURE_ALL_LOCKS = SECURE_ALL_BITS << 1; diff --git a/lib/std/os/bits/linux/sparc64.zig b/lib/std/os/bits/linux/sparc64.zig deleted file mode 100644 index 5c67b745f0..0000000000 --- a/lib/std/os/bits/linux/sparc64.zig +++ /dev/null @@ -1,675 +0,0 @@ -// sparc64-specific declarations that are intended to be imported into the POSIX namespace. -const std = @import("../../../std.zig"); -const pid_t = linux.pid_t; -const uid_t = linux.uid_t; -const clock_t = linux.clock_t; -const stack_t = linux.stack_t; -const sigset_t = linux.sigset_t; - -const linux = std.os.linux; -const sockaddr = linux.sockaddr; -const socklen_t = linux.socklen_t; -const iovec = linux.iovec; -const iovec_const = linux.iovec_const; - -pub const SYS = enum(usize) { - restart_syscall = 0, - exit = 1, - fork = 2, - read = 3, - write = 4, - open = 5, - close = 6, - wait4 = 7, - creat = 8, - link = 9, - unlink = 10, - execv = 11, - chdir = 12, - chown = 13, - mknod = 14, - chmod = 15, - lchown = 16, - brk = 17, - perfctr = 18, - lseek = 19, - getpid = 20, - capget = 21, - capset = 22, - setuid = 23, - getuid = 24, - vmsplice = 25, - ptrace = 26, - alarm = 27, - sigaltstack = 28, - pause = 29, - utime = 30, - access = 33, - nice = 34, - sync = 36, - kill = 37, - stat = 38, - sendfile = 39, - lstat = 40, - dup = 41, - pipe = 42, - times = 43, - umount2 = 45, - setgid = 46, - getgid = 47, - signal = 48, - geteuid = 49, - getegid = 50, - acct = 51, - memory_ordering = 52, - ioctl = 54, - reboot = 55, - symlink = 57, - readlink = 58, - execve = 59, - umask = 60, - chroot = 61, - fstat = 62, - fstat64 = 63, - getpagesize = 64, - msync = 65, - vfork = 66, - pread64 = 67, - pwrite64 = 68, - mmap = 71, - munmap = 73, - mprotect = 74, - madvise = 75, - vhangup = 76, - mincore = 78, - getgroups = 79, - setgroups = 80, - getpgrp = 81, - setitimer = 83, - swapon = 85, - getitimer = 86, - sethostname = 88, - dup2 = 90, - fcntl = 92, - select = 93, - fsync = 95, - setpriority = 96, - socket = 97, - connect = 98, - accept = 99, - getpriority = 100, - rt_sigreturn = 101, - rt_sigaction = 102, - rt_sigprocmask = 103, - rt_sigpending = 104, - rt_sigtimedwait = 105, - rt_sigqueueinfo = 106, - rt_sigsuspend = 107, - setresuid = 108, - getresuid = 109, - setresgid = 110, - getresgid = 111, - recvmsg = 113, - sendmsg = 114, - gettimeofday = 116, - getrusage = 117, - getsockopt = 118, - getcwd = 119, - readv = 120, - writev = 121, - settimeofday = 122, - fchown = 123, - fchmod = 124, - recvfrom = 125, - setreuid = 126, - setregid = 127, - rename = 128, - truncate = 129, - ftruncate = 130, - flock = 131, - lstat64 = 132, - sendto = 133, - shutdown = 134, - socketpair = 135, - mkdir = 136, - rmdir = 137, - utimes = 138, - stat64 = 139, - sendfile64 = 140, - getpeername = 141, - futex = 142, - gettid = 143, - getrlimit = 144, - setrlimit = 145, - pivot_root = 146, - prctl = 147, - pciconfig_read = 148, - pciconfig_write = 149, - getsockname = 150, - inotify_init = 151, - inotify_add_watch = 152, - poll = 153, - getdents64 = 154, - inotify_rm_watch = 156, - statfs = 157, - fstatfs = 158, - umount = 159, - sched_set_affinity = 160, - sched_get_affinity = 161, - getdomainname = 162, - setdomainname = 163, - utrap_install = 164, - quotactl = 165, - set_tid_address = 166, - mount = 167, - ustat = 168, - setxattr = 169, - lsetxattr = 170, - fsetxattr = 171, - getxattr = 172, - lgetxattr = 173, - getdents = 174, - setsid = 175, - fchdir = 176, - fgetxattr = 177, - listxattr = 178, - llistxattr = 179, - flistxattr = 180, - removexattr = 181, - lremovexattr = 182, - sigpending = 183, - query_module = 184, - setpgid = 185, - fremovexattr = 186, - tkill = 187, - exit_group = 188, - uname = 189, - init_module = 190, - personality = 191, - remap_file_pages = 192, - epoll_create = 193, - epoll_ctl = 194, - epoll_wait = 195, - ioprio_set = 196, - getppid = 197, - sigaction = 198, - sgetmask = 199, - ssetmask = 200, - sigsuspend = 201, - oldlstat = 202, - uselib = 203, - readdir = 204, - readahead = 205, - socketcall = 206, - syslog = 207, - lookup_dcookie = 208, - fadvise64 = 209, - fadvise64_64 = 210, - tgkill = 211, - waitpid = 212, - swapoff = 213, - sysinfo = 214, - ipc = 215, - sigreturn = 216, - clone = 217, - ioprio_get = 218, - adjtimex = 219, - sigprocmask = 220, - create_module = 221, - delete_module = 222, - get_kernel_syms = 223, - getpgid = 224, - bdflush = 225, - sysfs = 226, - afs_syscall = 227, - setfsuid = 228, - setfsgid = 229, - _newselect = 230, - splice = 232, - stime = 233, - statfs64 = 234, - fstatfs64 = 235, - _llseek = 236, - mlock = 237, - munlock = 238, - mlockall = 239, - munlockall = 240, - sched_setparam = 241, - sched_getparam = 242, - sched_setscheduler = 243, - sched_getscheduler = 244, - sched_yield = 245, - sched_get_priority_max = 246, - sched_get_priority_min = 247, - sched_rr_get_interval = 248, - nanosleep = 249, - mremap = 250, - _sysctl = 251, - getsid = 252, - fdatasync = 253, - nfsservctl = 254, - sync_file_range = 255, - clock_settime = 256, - clock_gettime = 257, - clock_getres = 258, - clock_nanosleep = 259, - sched_getaffinity = 260, - sched_setaffinity = 261, - timer_settime = 262, - timer_gettime = 263, - timer_getoverrun = 264, - timer_delete = 265, - timer_create = 266, - vserver = 267, - io_setup = 268, - io_destroy = 269, - io_submit = 270, - io_cancel = 271, - io_getevents = 272, - mq_open = 273, - mq_unlink = 274, - mq_timedsend = 275, - mq_timedreceive = 276, - mq_notify = 277, - mq_getsetattr = 278, - waitid = 279, - tee = 280, - add_key = 281, - request_key = 282, - keyctl = 283, - openat = 284, - mkdirat = 285, - mknodat = 286, - fchownat = 287, - futimesat = 288, - fstatat64 = 289, - unlinkat = 290, - renameat = 291, - linkat = 292, - symlinkat = 293, - readlinkat = 294, - fchmodat = 295, - faccessat = 296, - pselect6 = 297, - ppoll = 298, - unshare = 299, - set_robust_list = 300, - get_robust_list = 301, - migrate_pages = 302, - mbind = 303, - get_mempolicy = 304, - set_mempolicy = 305, - kexec_load = 306, - move_pages = 307, - getcpu = 308, - epoll_pwait = 309, - utimensat = 310, - signalfd = 311, - timerfd_create = 312, - eventfd = 313, - fallocate = 314, - timerfd_settime = 315, - timerfd_gettime = 316, - signalfd4 = 317, - eventfd2 = 318, - epoll_create1 = 319, - dup3 = 320, - pipe2 = 321, - inotify_init1 = 322, - accept4 = 323, - preadv = 324, - pwritev = 325, - rt_tgsigqueueinfo = 326, - perf_event_open = 327, - recvmmsg = 328, - fanotify_init = 329, - fanotify_mark = 330, - prlimit64 = 331, - name_to_handle_at = 332, - open_by_handle_at = 333, - clock_adjtime = 334, - syncfs = 335, - sendmmsg = 336, - setns = 337, - process_vm_readv = 338, - process_vm_writev = 339, - kern_features = 340, - kcmp = 341, - finit_module = 342, - sched_setattr = 343, - sched_getattr = 344, - renameat2 = 345, - seccomp = 346, - getrandom = 347, - memfd_create = 348, - bpf = 349, - execveat = 350, - membarrier = 351, - userfaultfd = 352, - bind = 353, - listen = 354, - setsockopt = 355, - mlock2 = 356, - copy_file_range = 357, - preadv2 = 358, - pwritev2 = 359, - statx = 360, - io_pgetevents = 361, - pkey_mprotect = 362, - pkey_alloc = 363, - pkey_free = 364, - rseq = 365, - semtimedop = 392, - semget = 393, - semctl = 394, - shmget = 395, - shmctl = 396, - shmat = 397, - shmdt = 398, - msgget = 399, - msgsnd = 400, - msgrcv = 401, - msgctl = 402, - pidfd_send_signal = 424, - io_uring_setup = 425, - io_uring_enter = 426, - io_uring_register = 427, - open_tree = 428, - move_mount = 429, - fsopen = 430, - fsconfig = 431, - fsmount = 432, - fspick = 433, - pidfd_open = 434, - clone3 = 435, - close_range = 436, - openat2 = 437, - pidfd_getfd = 438, - faccessat2 = 439, - process_madvise = 440, - epoll_pwait2 = 441, - - _, -}; - -pub const O_CREAT = 0x200; -pub const O_EXCL = 0x800; -pub const O_NOCTTY = 0x8000; -pub const O_TRUNC = 0x400; -pub const O_APPEND = 0x8; -pub const O_NONBLOCK = 0x4000; -pub const O_SYNC = 0x802000; -pub const O_DSYNC = 0x2000; -pub const O_RSYNC = O_SYNC; -pub const O_DIRECTORY = 0x10000; -pub const O_NOFOLLOW = 0x20000; -pub const O_CLOEXEC = 0x400000; - -pub const O_ASYNC = 0x40; -pub const O_DIRECT = 0x100000; -pub const O_LARGEFILE = 0; -pub const O_NOATIME = 0x200000; -pub const O_PATH = 0x1000000; -pub const O_TMPFILE = 0x2010000; -pub const O_NDELAY = O_NONBLOCK | 0x4; - -pub const F_DUPFD = 0; -pub const F_GETFD = 1; -pub const F_SETFD = 2; -pub const F_GETFL = 3; -pub const F_SETFL = 4; - -pub const F_SETOWN = 5; -pub const F_GETOWN = 6; -pub const F_GETLK = 7; -pub const F_SETLK = 8; -pub const F_SETLKW = 9; - -pub const F_RDLCK = 1; -pub const F_WRLCK = 2; -pub const F_UNLCK = 3; - -pub const F_SETOWN_EX = 15; -pub const F_GETOWN_EX = 16; - -pub const F_GETOWNER_UIDS = 17; - -pub const LOCK_SH = 1; -pub const LOCK_EX = 2; -pub const LOCK_NB = 4; -pub const LOCK_UN = 8; - -/// stack-like segment -pub const MAP_GROWSDOWN = 0x0200; - -/// ETXTBSY -pub const MAP_DENYWRITE = 0x0800; - -/// mark it as an executable -pub const MAP_EXECUTABLE = 0x1000; - -/// pages are locked -pub const MAP_LOCKED = 0x0100; - -/// don't check for reservations -pub const MAP_NORESERVE = 0x0040; - -pub const VDSO_CGT_SYM = "__vdso_clock_gettime"; -pub const VDSO_CGT_VER = "LINUX_2.6"; - -pub const Flock = extern struct { - l_type: i16, - l_whence: i16, - l_start: off_t, - l_len: off_t, - l_pid: pid_t, -}; - -pub const msghdr = extern struct { - msg_name: ?*sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec, - msg_iovlen: u64, - msg_control: ?*c_void, - msg_controllen: u64, - msg_flags: i32, -}; - -pub const msghdr_const = extern struct { - msg_name: ?*const sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec_const, - msg_iovlen: u64, - msg_control: ?*c_void, - msg_controllen: u64, - msg_flags: i32, -}; - -pub const off_t = i64; -pub const ino_t = u64; -pub const mode_t = u32; - -// The `stat64` definition used by the libc. -pub const libc_stat = extern struct { - dev: u64, - ino: ino_t, - mode: u32, - nlink: usize, - - uid: u32, - gid: u32, - rdev: u64, - __pad0: u32, - - size: off_t, - blksize: isize, - blocks: i64, - - atim: timespec, - mtim: timespec, - ctim: timespec, - __unused: [2]isize, - - pub fn atime(self: libc_stat) timespec { - return self.atim; - } - - pub fn mtime(self: libc_stat) timespec { - return self.mtim; - } - - pub fn ctime(self: libc_stat) timespec { - return self.ctim; - } -}; - -// The `stat64` definition used by the kernel. -pub const kernel_stat = extern struct { - dev: u64, - ino: u64, - nlink: u64, - - mode: u32, - uid: u32, - gid: u32, - __pad0: u32, - - rdev: u64, - size: i64, - blksize: i64, - blocks: i64, - - atim: timespec, - mtim: timespec, - ctim: timespec, - __unused: [3]u64, - - pub fn atime(self: @This()) timespec { - return self.atim; - } - - pub fn mtime(self: @This()) timespec { - return self.mtim; - } - - pub fn ctime(self: @This()) timespec { - return self.ctim; - } -}; - -pub const timespec = extern struct { - tv_sec: isize, - tv_nsec: isize, -}; - -pub const timeval = extern struct { - tv_sec: isize, - tv_usec: isize, -}; - -pub const timezone = extern struct { - tz_minuteswest: i32, - tz_dsttime: i32, -}; - -// TODO I'm not sure if the code below is correct, need someone with more -// knowledge about sparc64 linux internals to look into. - -pub const Elf_Symndx = u32; - -pub const fpstate = extern struct { - regs: [32]u64, - fsr: u64, - gsr: u64, - fprs: u64, -}; - -pub const __fpq = extern struct { - fpq_addr: *u32, - fpq_instr: u32, -}; - -pub const __fq = extern struct { - FQu: extern union { - whole: f64, - fpq: __fpq, - }, -}; - -pub const fpregset_t = extern struct { - fpu_fr: extern union { - fpu_regs: [32]u32, - fpu_dregs: [32]f64, - fpu_qregs: [16]c_longdouble, - }, - fpu_q: *__fq, - fpu_fsr: u64, - fpu_qcnt: u8, - fpu_q_entrysize: u8, - fpu_en: u8, -}; - -pub const siginfo_fpu_t = extern struct { - float_regs: [64]u32, - fsr: u64, - gsr: u64, - fprs: u64, -}; - -pub const sigcontext = extern struct { - info: [128]i8, - regs: extern struct { - u_regs: [16]u64, - tstate: u64, - tpc: u64, - tnpc: u64, - y: u64, - fprs: u64, - }, - fpu_save: *siginfo_fpu_t, - stack: extern struct { - sp: usize, - flags: i32, - size: u64, - }, - mask: u64, -}; - -pub const greg_t = u64; -pub const gregset_t = [19]greg_t; - -pub const fq = extern struct { - addr: *u64, - insn: u32, -}; - -pub const fpu_t = extern struct { - fregs: extern union { - sregs: [32]u32, - dregs: [32]u64, - qregs: [16]c_longdouble, - }, - fsr: u64, - fprs: u64, - gsr: u64, - fq: *fq, - qcnt: u8, - qentsz: u8, - enab: u8, -}; - -pub const mcontext_t = extern struct { - gregs: gregset_t, - fp: greg_t, - @"i7": greg_t, - fpregs: fpu_t, -}; - -pub const ucontext_t = extern struct { - link: *ucontext_t, - flags: u64, - sigmask: u64, - mcontext: mcontext_t, - stack: stack_t, - sigmask: sigset_t, -}; diff --git a/lib/std/os/bits/linux/x86_64.zig b/lib/std/os/bits/linux/x86_64.zig deleted file mode 100644 index 69beac9d87..0000000000 --- a/lib/std/os/bits/linux/x86_64.zig +++ /dev/null @@ -1,638 +0,0 @@ -// x86-64-specific declarations that are intended to be imported into the POSIX namespace. -const std = @import("../../../std.zig"); -const pid_t = linux.pid_t; -const uid_t = linux.uid_t; -const gid_t = linux.gid_t; -const clock_t = linux.clock_t; -const stack_t = linux.stack_t; -const sigset_t = linux.sigset_t; - -const linux = std.os.linux; -const sockaddr = linux.sockaddr; -const socklen_t = linux.socklen_t; -const iovec = linux.iovec; -const iovec_const = linux.iovec_const; - -pub const mode_t = usize; -pub const time_t = isize; - -pub const SYS = enum(usize) { - read = 0, - write = 1, - open = 2, - close = 3, - stat = 4, - fstat = 5, - lstat = 6, - poll = 7, - lseek = 8, - mmap = 9, - mprotect = 10, - munmap = 11, - brk = 12, - rt_sigaction = 13, - rt_sigprocmask = 14, - rt_sigreturn = 15, - ioctl = 16, - pread = 17, - pwrite = 18, - readv = 19, - writev = 20, - access = 21, - pipe = 22, - select = 23, - sched_yield = 24, - mremap = 25, - msync = 26, - mincore = 27, - madvise = 28, - shmget = 29, - shmat = 30, - shmctl = 31, - dup = 32, - dup2 = 33, - pause = 34, - nanosleep = 35, - getitimer = 36, - alarm = 37, - setitimer = 38, - getpid = 39, - sendfile = 40, - socket = 41, - connect = 42, - accept = 43, - sendto = 44, - recvfrom = 45, - sendmsg = 46, - recvmsg = 47, - shutdown = 48, - bind = 49, - listen = 50, - getsockname = 51, - getpeername = 52, - socketpair = 53, - setsockopt = 54, - getsockopt = 55, - clone = 56, - fork = 57, - vfork = 58, - execve = 59, - exit = 60, - wait4 = 61, - kill = 62, - uname = 63, - semget = 64, - semop = 65, - semctl = 66, - shmdt = 67, - msgget = 68, - msgsnd = 69, - msgrcv = 70, - msgctl = 71, - fcntl = 72, - flock = 73, - fsync = 74, - fdatasync = 75, - truncate = 76, - ftruncate = 77, - getdents = 78, - getcwd = 79, - chdir = 80, - fchdir = 81, - rename = 82, - mkdir = 83, - rmdir = 84, - creat = 85, - link = 86, - unlink = 87, - symlink = 88, - readlink = 89, - chmod = 90, - fchmod = 91, - chown = 92, - fchown = 93, - lchown = 94, - umask = 95, - gettimeofday = 96, - getrlimit = 97, - getrusage = 98, - sysinfo = 99, - times = 100, - ptrace = 101, - getuid = 102, - syslog = 103, - getgid = 104, - setuid = 105, - setgid = 106, - geteuid = 107, - getegid = 108, - setpgid = 109, - getppid = 110, - getpgrp = 111, - setsid = 112, - setreuid = 113, - setregid = 114, - getgroups = 115, - setgroups = 116, - setresuid = 117, - getresuid = 118, - setresgid = 119, - getresgid = 120, - getpgid = 121, - setfsuid = 122, - setfsgid = 123, - getsid = 124, - capget = 125, - capset = 126, - rt_sigpending = 127, - rt_sigtimedwait = 128, - rt_sigqueueinfo = 129, - rt_sigsuspend = 130, - sigaltstack = 131, - utime = 132, - mknod = 133, - uselib = 134, - personality = 135, - ustat = 136, - statfs = 137, - fstatfs = 138, - sysfs = 139, - getpriority = 140, - setpriority = 141, - sched_setparam = 142, - sched_getparam = 143, - sched_setscheduler = 144, - sched_getscheduler = 145, - sched_get_priority_max = 146, - sched_get_priority_min = 147, - sched_rr_get_interval = 148, - mlock = 149, - munlock = 150, - mlockall = 151, - munlockall = 152, - vhangup = 153, - modify_ldt = 154, - pivot_root = 155, - _sysctl = 156, - prctl = 157, - arch_prctl = 158, - adjtimex = 159, - setrlimit = 160, - chroot = 161, - sync = 162, - acct = 163, - settimeofday = 164, - mount = 165, - umount2 = 166, - swapon = 167, - swapoff = 168, - reboot = 169, - sethostname = 170, - setdomainname = 171, - iopl = 172, - ioperm = 173, - create_module = 174, - init_module = 175, - delete_module = 176, - get_kernel_syms = 177, - query_module = 178, - quotactl = 179, - nfsservctl = 180, - getpmsg = 181, - putpmsg = 182, - afs_syscall = 183, - tuxcall = 184, - security = 185, - gettid = 186, - readahead = 187, - setxattr = 188, - lsetxattr = 189, - fsetxattr = 190, - getxattr = 191, - lgetxattr = 192, - fgetxattr = 193, - listxattr = 194, - llistxattr = 195, - flistxattr = 196, - removexattr = 197, - lremovexattr = 198, - fremovexattr = 199, - tkill = 200, - time = 201, - futex = 202, - sched_setaffinity = 203, - sched_getaffinity = 204, - set_thread_area = 205, - io_setup = 206, - io_destroy = 207, - io_getevents = 208, - io_submit = 209, - io_cancel = 210, - get_thread_area = 211, - lookup_dcookie = 212, - epoll_create = 213, - epoll_ctl_old = 214, - epoll_wait_old = 215, - remap_file_pages = 216, - getdents64 = 217, - set_tid_address = 218, - restart_syscall = 219, - semtimedop = 220, - fadvise64 = 221, - timer_create = 222, - timer_settime = 223, - timer_gettime = 224, - timer_getoverrun = 225, - timer_delete = 226, - clock_settime = 227, - clock_gettime = 228, - clock_getres = 229, - clock_nanosleep = 230, - exit_group = 231, - epoll_wait = 232, - epoll_ctl = 233, - tgkill = 234, - utimes = 235, - vserver = 236, - mbind = 237, - set_mempolicy = 238, - get_mempolicy = 239, - mq_open = 240, - mq_unlink = 241, - mq_timedsend = 242, - mq_timedreceive = 243, - mq_notify = 244, - mq_getsetattr = 245, - kexec_load = 246, - waitid = 247, - add_key = 248, - request_key = 249, - keyctl = 250, - ioprio_set = 251, - ioprio_get = 252, - inotify_init = 253, - inotify_add_watch = 254, - inotify_rm_watch = 255, - migrate_pages = 256, - openat = 257, - mkdirat = 258, - mknodat = 259, - fchownat = 260, - futimesat = 261, - fstatat = 262, - unlinkat = 263, - renameat = 264, - linkat = 265, - symlinkat = 266, - readlinkat = 267, - fchmodat = 268, - faccessat = 269, - pselect6 = 270, - ppoll = 271, - unshare = 272, - set_robust_list = 273, - get_robust_list = 274, - splice = 275, - tee = 276, - sync_file_range = 277, - vmsplice = 278, - move_pages = 279, - utimensat = 280, - epoll_pwait = 281, - signalfd = 282, - timerfd_create = 283, - eventfd = 284, - fallocate = 285, - timerfd_settime = 286, - timerfd_gettime = 287, - accept4 = 288, - signalfd4 = 289, - eventfd2 = 290, - epoll_create1 = 291, - dup3 = 292, - pipe2 = 293, - inotify_init1 = 294, - preadv = 295, - pwritev = 296, - rt_tgsigqueueinfo = 297, - perf_event_open = 298, - recvmmsg = 299, - fanotify_init = 300, - fanotify_mark = 301, - prlimit64 = 302, - name_to_handle_at = 303, - open_by_handle_at = 304, - clock_adjtime = 305, - syncfs = 306, - sendmmsg = 307, - setns = 308, - getcpu = 309, - process_vm_readv = 310, - process_vm_writev = 311, - kcmp = 312, - finit_module = 313, - sched_setattr = 314, - sched_getattr = 315, - renameat2 = 316, - seccomp = 317, - getrandom = 318, - memfd_create = 319, - kexec_file_load = 320, - bpf = 321, - execveat = 322, - userfaultfd = 323, - membarrier = 324, - mlock2 = 325, - copy_file_range = 326, - preadv2 = 327, - pwritev2 = 328, - pkey_mprotect = 329, - pkey_alloc = 330, - pkey_free = 331, - statx = 332, - io_pgetevents = 333, - rseq = 334, - pidfd_send_signal = 424, - io_uring_setup = 425, - io_uring_enter = 426, - io_uring_register = 427, - open_tree = 428, - move_mount = 429, - fsopen = 430, - fsconfig = 431, - fsmount = 432, - fspick = 433, - pidfd_open = 434, - clone3 = 435, - close_range = 436, - openat2 = 437, - pidfd_getfd = 438, - faccessat2 = 439, - process_madvise = 440, - epoll_pwait2 = 441, - - _, -}; - -pub const O_CREAT = 0o100; -pub const O_EXCL = 0o200; -pub const O_NOCTTY = 0o400; -pub const O_TRUNC = 0o1000; -pub const O_APPEND = 0o2000; -pub const O_NONBLOCK = 0o4000; -pub const O_DSYNC = 0o10000; -pub const O_SYNC = 0o4010000; -pub const O_RSYNC = 0o4010000; -pub const O_DIRECTORY = 0o200000; -pub const O_NOFOLLOW = 0o400000; -pub const O_CLOEXEC = 0o2000000; - -pub const O_ASYNC = 0o20000; -pub const O_DIRECT = 0o40000; -pub const O_LARGEFILE = 0; -pub const O_NOATIME = 0o1000000; -pub const O_PATH = 0o10000000; -pub const O_TMPFILE = 0o20200000; -pub const O_NDELAY = O_NONBLOCK; - -pub const F_DUPFD = 0; -pub const F_GETFD = 1; -pub const F_SETFD = 2; -pub const F_GETFL = 3; -pub const F_SETFL = 4; - -pub const F_SETOWN = 8; -pub const F_GETOWN = 9; -pub const F_SETSIG = 10; -pub const F_GETSIG = 11; - -pub const F_GETLK = 5; -pub const F_SETLK = 6; -pub const F_SETLKW = 7; - -pub const F_SETOWN_EX = 15; -pub const F_GETOWN_EX = 16; - -pub const F_GETOWNER_UIDS = 17; - -/// only give out 32bit addresses -pub const MAP_32BIT = 0x40; - -/// stack-like segment -pub const MAP_GROWSDOWN = 0x0100; - -/// ETXTBSY -pub const MAP_DENYWRITE = 0x0800; - -/// mark it as an executable -pub const MAP_EXECUTABLE = 0x1000; - -/// pages are locked -pub const MAP_LOCKED = 0x2000; - -/// don't check for reservations -pub const MAP_NORESERVE = 0x4000; - -pub const VDSO_CGT_SYM = "__vdso_clock_gettime"; -pub const VDSO_CGT_VER = "LINUX_2.6"; -pub const VDSO_GETCPU_SYM = "__vdso_getcpu"; -pub const VDSO_GETCPU_VER = "LINUX_2.6"; - -pub const ARCH_SET_GS = 0x1001; -pub const ARCH_SET_FS = 0x1002; -pub const ARCH_GET_FS = 0x1003; -pub const ARCH_GET_GS = 0x1004; - -pub const REG_R8 = 0; -pub const REG_R9 = 1; -pub const REG_R10 = 2; -pub const REG_R11 = 3; -pub const REG_R12 = 4; -pub const REG_R13 = 5; -pub const REG_R14 = 6; -pub const REG_R15 = 7; -pub const REG_RDI = 8; -pub const REG_RSI = 9; -pub const REG_RBP = 10; -pub const REG_RBX = 11; -pub const REG_RDX = 12; -pub const REG_RAX = 13; -pub const REG_RCX = 14; -pub const REG_RSP = 15; -pub const REG_RIP = 16; -pub const REG_EFL = 17; -pub const REG_CSGSFS = 18; -pub const REG_ERR = 19; -pub const REG_TRAPNO = 20; -pub const REG_OLDMASK = 21; -pub const REG_CR2 = 22; - -pub const LOCK_SH = 1; -pub const LOCK_EX = 2; -pub const LOCK_UN = 8; -pub const LOCK_NB = 4; - -pub const F_RDLCK = 0; -pub const F_WRLCK = 1; -pub const F_UNLCK = 2; - -pub const Flock = extern struct { - l_type: i16, - l_whence: i16, - l_start: off_t, - l_len: off_t, - l_pid: pid_t, -}; - -pub const msghdr = extern struct { - msg_name: ?*sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec, - msg_iovlen: i32, - __pad1: i32 = 0, - msg_control: ?*c_void, - msg_controllen: socklen_t, - __pad2: socklen_t = 0, - msg_flags: i32, -}; - -pub const msghdr_const = extern struct { - msg_name: ?*const sockaddr, - msg_namelen: socklen_t, - msg_iov: [*]iovec_const, - msg_iovlen: i32, - __pad1: i32 = 0, - msg_control: ?*c_void, - msg_controllen: socklen_t, - __pad2: socklen_t = 0, - msg_flags: i32, -}; - -pub const off_t = i64; -pub const ino_t = u64; -pub const dev_t = u64; - -// The `stat` definition used by the Linux kernel. -pub const kernel_stat = extern struct { - dev: dev_t, - ino: ino_t, - nlink: usize, - - mode: u32, - uid: uid_t, - gid: gid_t, - __pad0: u32, - rdev: dev_t, - size: off_t, - blksize: isize, - blocks: i64, - - atim: timespec, - mtim: timespec, - ctim: timespec, - __unused: [3]isize, - - pub fn atime(self: @This()) timespec { - return self.atim; - } - - pub fn mtime(self: @This()) timespec { - return self.mtim; - } - - pub fn ctime(self: @This()) timespec { - return self.ctim; - } -}; - -// The `stat64` definition used by the libc. -pub const libc_stat = kernel_stat; - -pub const timespec = extern struct { - tv_sec: isize, - tv_nsec: isize, -}; - -pub const timeval = extern struct { - tv_sec: isize, - tv_usec: isize, -}; - -pub const timezone = extern struct { - tz_minuteswest: i32, - tz_dsttime: i32, -}; - -pub const Elf_Symndx = u32; - -pub const greg_t = usize; -pub const gregset_t = [23]greg_t; -pub const fpstate = extern struct { - cwd: u16, - swd: u16, - ftw: u16, - fop: u16, - rip: usize, - rdp: usize, - mxcsr: u32, - mxcr_mask: u32, - st: [8]extern struct { - significand: [4]u16, - exponent: u16, - padding: [3]u16 = undefined, - }, - xmm: [16]extern struct { - element: [4]u32, - }, - padding: [24]u32 = undefined, -}; -pub const fpregset_t = *fpstate; -pub const sigcontext = extern struct { - r8: usize, - r9: usize, - r10: usize, - r11: usize, - r12: usize, - r13: usize, - r14: usize, - r15: usize, - - rdi: usize, - rsi: usize, - rbp: usize, - rbx: usize, - rdx: usize, - rax: usize, - rcx: usize, - rsp: usize, - rip: usize, - eflags: usize, - - cs: u16, - gs: u16, - fs: u16, - pad0: u16 = undefined, - - err: usize, - trapno: usize, - oldmask: usize, - cr2: usize, - - fpstate: *fpstate, - reserved1: [8]usize = undefined, -}; - -pub const mcontext_t = extern struct { - gregs: gregset_t, - fpregs: fpregset_t, - reserved1: [8]usize = undefined, -}; - -pub const ucontext_t = extern struct { - flags: usize, - link: *ucontext_t, - stack: stack_t, - mcontext: mcontext_t, - sigmask: sigset_t, - fpregs_mem: [64]usize, -}; diff --git a/lib/std/os/bits/linux/xdp.zig b/lib/std/os/bits/linux/xdp.zig deleted file mode 100644 index 88fa9918a3..0000000000 --- a/lib/std/os/bits/linux/xdp.zig +++ /dev/null @@ -1,77 +0,0 @@ -usingnamespace @import("../linux.zig"); - -pub const XDP_SHARED_UMEM = (1 << 0); -pub const XDP_COPY = (1 << 1); -pub const XDP_ZEROCOPY = (1 << 2); - -pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG = (1 << 0); - -pub const sockaddr_xdp = extern struct { - family: u16 = AF_XDP, - flags: u16, - ifindex: u32, - queue_id: u32, - shared_umem_fd: u32, -}; - -pub const XDP_USE_NEED_WAKEUP = (1 << 3); - -pub const xdp_ring_offset = extern struct { - producer: u64, - consumer: u64, - desc: u64, - flags: u64, -}; - -pub const xdp_mmap_offsets = extern struct { - rx: xdp_ring_offset, - tx: xdp_ring_offset, - fr: xdp_ring_offset, - cr: xdp_ring_offset, -}; - -pub const XDP_MMAP_OFFSETS = 1; -pub const XDP_RX_RING = 2; -pub const XDP_TX_RING = 3; -pub const XDP_UMEM_REG = 4; -pub const XDP_UMEM_FILL_RING = 5; -pub const XDP_UMEM_COMPLETION_RING = 6; -pub const XDP_STATISTICS = 7; -pub const XDP_OPTIONS = 8; - -pub const xdp_umem_reg = extern struct { - addr: u64, - len: u64, - chunk_size: u32, - headroom: u32, - flags: u32, -}; - -pub const xdp_statistics = extern struct { - rx_dropped: u64, - rx_invalid_descs: u64, - tx_invalid_descs: u64, - rx_ring_full: u64, - rx_fill_ring_empty_descs: u64, - tx_ring_empty_descs: u64, -}; - -pub const xdp_options = extern struct { - flags: u32, -}; - -pub const XDP_OPTIONS_ZEROCOPY = (1 << 0); - -pub const XDP_PGOFF_RX_RING = 0; -pub const XDP_PGOFF_TX_RING = 0x80000000; -pub const XDP_UMEM_PGOFF_FILL_RING = 0x100000000; -pub const XDP_UMEM_PGOFF_COMPLETION_RING = 0x180000000; - -pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT = 48; -pub const XSK_UNALIGNED_BUF_ADDR_MASK = (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1; - -pub const xdp_desc = extern struct { - addr: u64, - len: u32, - options: u32, -}; |
