| author | |
| committer | |
| log | 3d61e4228298dcb973c13d8d6eba0bff36acf1ca |
| tree | d20ca827bdbcfef862a3048df288e65c3971aab5 |
| parent | 17b0166e004e81d9c433576f4c642e743fc527b7 |
| signature | Commit is signed but in an unrecognized format. |
30 files changed, 5384 insertions(+), 5381 deletions(-)
CMakeLists.txt+30-33| ... | ... | @@ -474,10 +474,7 @@ set(ZIG_STD_FILES |
| 474 | 474 | "c/linux.zig" |
| 475 | 475 | "c/netbsd.zig" |
| 476 | 476 | "c/windows.zig" |
| 477 | "c/posix.zig" | |
| 478 | "c/posix/darwin.zig" | |
| 479 | "c/posix/freebsd.zig" | |
| 480 | "c/posix/windows.zig" | |
| 477 | "child_process.zig" | |
| 481 | 478 | "coff.zig" |
| 482 | 479 | "crypto.zig" |
| 483 | 480 | "crypto/blake2.zig" |
| ... | ... | @@ -491,8 +488,8 @@ set(ZIG_STD_FILES |
| 491 | 488 | "crypto/x25519.zig" |
| 492 | 489 | "cstr.zig" |
| 493 | 490 | "debug.zig" |
| 494 | "debug/leb128.zig" | |
| 495 | 491 | "debug/failing_allocator.zig" |
| 492 | "debug/leb128.zig" | |
| 496 | 493 | "dwarf.zig" |
| 497 | 494 | "dynamic_library.zig" |
| 498 | 495 | "elf.zig" |
| ... | ... | @@ -513,6 +510,10 @@ set(ZIG_STD_FILES |
| 513 | 510 | "fmt/errol/enum3.zig" |
| 514 | 511 | "fmt/errol/lookup.zig" |
| 515 | 512 | "fmt/parse_float.zig" |
| 513 | "fs.zig" | |
| 514 | "fs/file.zig" | |
| 515 | "fs/get_app_data_dir.zig" | |
| 516 | "fs/path.zig" | |
| 516 | 517 | "hash.zig" |
| 517 | 518 | "hash/adler.zig" |
| 518 | 519 | "hash/crc.zig" |
| ... | ... | @@ -521,8 +522,8 @@ set(ZIG_STD_FILES |
| 521 | 522 | "hash_map.zig" |
| 522 | 523 | "heap.zig" |
| 523 | 524 | "io.zig" |
| 524 | "io/seekable_stream.zig" | |
| 525 | 525 | "io/c_out_stream.zig" |
| 526 | "io/seekable_stream.zig" | |
| 526 | 527 | "json.zig" |
| 527 | 528 | "lazy_init.zig" |
| 528 | 529 | "linked_list.zig" |
| ... | ... | @@ -604,46 +605,40 @@ set(ZIG_STD_FILES |
| 604 | 605 | "mutex.zig" |
| 605 | 606 | "net.zig" |
| 606 | 607 | "os.zig" |
| 607 | "os/child_process.zig" | |
| 608 | "os/bits.zig" | |
| 609 | "os/bits/darwin.zig" | |
| 610 | "os/bits/freebsd.zig" | |
| 611 | "os/bits/linux.zig" | |
| 612 | "os/bits/linux/arm64.zig" | |
| 613 | "os/bits/linux/errno.zig" | |
| 614 | "os/bits/linux/x86_64.zig" | |
| 615 | "os/bits/netbsd.zig" | |
| 616 | "os/bits/wasi.zig" | |
| 617 | "os/bits/windows.zig" | |
| 608 | 618 | "os/darwin.zig" |
| 609 | "os/darwin/errno.zig" | |
| 610 | 619 | "os/epoch.zig" |
| 611 | "os/file.zig" | |
| 612 | 620 | "os/freebsd.zig" |
| 613 | "os/freebsd/errno.zig" | |
| 614 | "os/get_app_data_dir.zig" | |
| 615 | "os/get_user_id.zig" | |
| 616 | 621 | "os/linux.zig" |
| 617 | 622 | "os/linux/arm64.zig" |
| 618 | "os/linux/errno.zig" | |
| 619 | "os/linux/posix.zig" | |
| 620 | "os/linux/posix/arm64.zig" | |
| 621 | "os/linux/posix/x86_64.zig" | |
| 622 | 623 | "os/linux/sys.zig" |
| 623 | 624 | "os/linux/tls.zig" |
| 624 | 625 | "os/linux/vdso.zig" |
| 625 | 626 | "os/linux/x86_64.zig" |
| 626 | 627 | "os/netbsd.zig" |
| 627 | "os/netbsd/errno.zig" | |
| 628 | "os/path.zig" | |
| 629 | "os/posix.zig" | |
| 630 | "os/time.zig" | |
| 631 | 628 | "os/uefi.zig" |
| 632 | 629 | "os/wasi.zig" |
| 633 | "os/wasi/posix.zig" | |
| 634 | 630 | "os/windows.zig" |
| 635 | 631 | "os/windows/advapi32.zig" |
| 636 | "os/windows/errno.zig" | |
| 637 | 632 | "os/windows/error.zig" |
| 638 | 633 | "os/windows/kernel32.zig" |
| 639 | 634 | "os/windows/ntdll.zig" |
| 640 | 635 | "os/windows/ole32.zig" |
| 641 | 636 | "os/windows/shell32.zig" |
| 642 | "os/windows/util.zig" | |
| 643 | 637 | "os/zen.zig" |
| 644 | 638 | "packed_int_array.zig" |
| 645 | 639 | "pdb.zig" |
| 646 | 640 | "priority_queue.zig" |
| 641 | "process.zig" | |
| 647 | 642 | "rand.zig" |
| 648 | 643 | "rand/ziggurat.zig" |
| 649 | 644 | "rb.zig" |
| ... | ... | @@ -655,17 +650,18 @@ set(ZIG_STD_FILES |
| 655 | 650 | "special/build_runner.zig" |
| 656 | 651 | "special/c.zig" |
| 657 | 652 | "special/compiler_rt.zig" |
| 658 | "special/compiler_rt/stack_probe.zig" | |
| 659 | "special/compiler_rt/arm/aeabi_fcmp.zig" | |
| 660 | "special/compiler_rt/arm/aeabi_dcmp.zig" | |
| 661 | 653 | "special/compiler_rt/addXf3.zig" |
| 654 | "special/compiler_rt/arm/aeabi_dcmp.zig" | |
| 655 | "special/compiler_rt/arm/aeabi_fcmp.zig" | |
| 656 | "special/compiler_rt/ashlti3.zig" | |
| 657 | "special/compiler_rt/ashrti3.zig" | |
| 662 | 658 | "special/compiler_rt/aulldiv.zig" |
| 663 | 659 | "special/compiler_rt/aullrem.zig" |
| 664 | "special/compiler_rt/comparetf2.zig" | |
| 665 | 660 | "special/compiler_rt/comparedf2.zig" |
| 666 | 661 | "special/compiler_rt/comparesf2.zig" |
| 667 | "special/compiler_rt/divsf3.zig" | |
| 662 | "special/compiler_rt/comparetf2.zig" | |
| 668 | 663 | "special/compiler_rt/divdf3.zig" |
| 664 | "special/compiler_rt/divsf3.zig" | |
| 669 | 665 | "special/compiler_rt/divti3.zig" |
| 670 | 666 | "special/compiler_rt/extendXfYf2.zig" |
| 671 | 667 | "special/compiler_rt/fixdfdi.zig" |
| ... | ... | @@ -690,26 +686,25 @@ set(ZIG_STD_FILES |
| 690 | 686 | "special/compiler_rt/fixunstfti.zig" |
| 691 | 687 | "special/compiler_rt/floatdidf.zig" |
| 692 | 688 | "special/compiler_rt/floatsiXf.zig" |
| 693 | "special/compiler_rt/floatunsidf.zig" | |
| 694 | 689 | "special/compiler_rt/floattidf.zig" |
| 695 | 690 | "special/compiler_rt/floattisf.zig" |
| 696 | 691 | "special/compiler_rt/floattitf.zig" |
| 697 | 692 | "special/compiler_rt/floatundidf.zig" |
| 698 | 693 | "special/compiler_rt/floatunditf.zig" |
| 694 | "special/compiler_rt/floatunsidf.zig" | |
| 699 | 695 | "special/compiler_rt/floatunsitf.zig" |
| 700 | 696 | "special/compiler_rt/floatuntidf.zig" |
| 701 | 697 | "special/compiler_rt/floatuntisf.zig" |
| 702 | 698 | "special/compiler_rt/floatuntitf.zig" |
| 699 | "special/compiler_rt/lshrti3.zig" | |
| 703 | 700 | "special/compiler_rt/modti3.zig" |
| 704 | 701 | "special/compiler_rt/mulXf3.zig" |
| 705 | "special/compiler_rt/muloti4.zig" | |
| 706 | 702 | "special/compiler_rt/mulodi4.zig" |
| 703 | "special/compiler_rt/muloti4.zig" | |
| 707 | 704 | "special/compiler_rt/multi3.zig" |
| 708 | "special/compiler_rt/ashlti3.zig" | |
| 709 | "special/compiler_rt/ashrti3.zig" | |
| 710 | "special/compiler_rt/lshrti3.zig" | |
| 711 | 705 | "special/compiler_rt/negXf2.zig" |
| 712 | 706 | "special/compiler_rt/popcountdi2.zig" |
| 707 | "special/compiler_rt/stack_probe.zig" | |
| 713 | 708 | "special/compiler_rt/truncXfYf2.zig" |
| 714 | 709 | "special/compiler_rt/udivmod.zig" |
| 715 | 710 | "special/compiler_rt/udivmoddi4.zig" |
| ... | ... | @@ -726,6 +721,8 @@ set(ZIG_STD_FILES |
| 726 | 721 | "statically_initialized_mutex.zig" |
| 727 | 722 | "std.zig" |
| 728 | 723 | "testing.zig" |
| 724 | "thread.zig" | |
| 725 | "time.zig" | |
| 729 | 726 | "unicode.zig" |
| 730 | 727 | "valgrind.zig" |
| 731 | 728 | "valgrind/callgrind.zig" |
std/c.zig+2-3| ... | ... | @@ -1,10 +1,9 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | 2 | |
| 3 | pub const posix = @import("c/posix.zig"); | |
| 4 | pub use posix; | |
| 3 | pub use @import("os/bits.zig"); | |
| 5 | 4 | |
| 6 | 5 | pub use switch (builtin.os) { |
| 7 | .linux => @import("os/linux/posix.zig"), | |
| 6 | .linux => @import("c/linux.zig"), | |
| 8 | 7 | .windows => @import("c/windows.zig"), |
| 9 | 8 | .macosx, .ios, .tvos, .watchos => @import("c/darwin.zig"), |
| 10 | 9 | .freebsd => @import("c/freebsd.zig"), |
std/c/linux.zig+3-8| ... | ... | @@ -1,17 +1,12 @@ |
| 1 | const linux = @import("../os/linux.zig"); | |
| 2 | pub use @import("../os/linux/errno.zig"); | |
| 1 | const std = @import("../std.zig"); | |
| 2 | use std.c; | |
| 3 | 3 | |
| 4 | 4 | pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) c_int; |
| 5 | 5 | extern "c" fn __errno_location() *c_int; |
| 6 | 6 | pub const _errno = __errno_location; |
| 7 | 7 | |
| 8 | pub const pthread_attr_t = extern struct { | |
| 9 | __size: [56]u8, | |
| 10 | __align: c_long, | |
| 11 | }; | |
| 12 | ||
| 13 | 8 | /// See std.elf for constants for this |
| 14 | 9 | pub extern fn getauxval(__type: c_ulong) c_ulong; |
| 15 | 10 | |
| 16 | pub const dl_iterate_phdr_callback = extern fn (info: *linux.dl_phdr_info, size: usize, data: ?*c_void) c_int; | |
| 11 | pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int; | |
| 17 | 12 | pub extern fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; |
std/c/posix.zig deleted-26| ... | ... | @@ -1,26 +0,0 @@ |
| 1 | // Declarations that are intended to be imported into the POSIX namespace. | |
| 2 | ||
| 3 | const builtin = @import("builtin"); | |
| 4 | ||
| 5 | pub use switch (builtin.os) { | |
| 6 | .windows => @import("posix/windows.zig"), | |
| 7 | .macosx, .ios, .tvos, .watchos => @import("posix/darwin.zig"), | |
| 8 | .freebsd => @import("posix/freebsd.zig"), | |
| 9 | .netbsd => @import("posix/netbsd.zig"), | |
| 10 | else => struct {}, | |
| 11 | }; | |
| 12 | ||
| 13 | pub const fd_t = c_int; | |
| 14 | pub const pid_t = c_int; | |
| 15 | pub const pthread_t = *@OpaqueType(); | |
| 16 | pub const FILE = @OpaqueType(); | |
| 17 | ||
| 18 | pub const iovec = extern struct { | |
| 19 | iov_base: [*]u8, | |
| 20 | iov_len: usize, | |
| 21 | }; | |
| 22 | ||
| 23 | pub const iovec_const = extern struct { | |
| 24 | iov_base: [*]const u8, | |
| 25 | iov_len: usize, | |
| 26 | }; |
std/c/posix/darwin.zig deleted-1099| ... | ... | @@ -1,1099 +0,0 @@ |
| 1 | const std = @import("../std.zig"); | |
| 2 | const assert = std.debug.assert; | |
| 3 | ||
| 4 | pub fn sigaction(sig: u5, noalias act: *const Sigaction, noalias oact: ?*Sigaction) usize { | |
| 5 | assert(sig != SIGKILL); | |
| 6 | assert(sig != SIGSTOP); | |
| 7 | var cact = c.Sigaction{ | |
| 8 | .handler = @ptrCast(extern fn (c_int) void, act.handler), | |
| 9 | .sa_flags = @bitCast(c_int, act.flags), | |
| 10 | .sa_mask = act.mask, | |
| 11 | }; | |
| 12 | var coact: c.Sigaction = undefined; | |
| 13 | const result = errnoWrap(c.sigaction(sig, &cact, &coact)); | |
| 14 | if (result != 0) { | |
| 15 | return result; | |
| 16 | } | |
| 17 | if (oact) |old| { | |
| 18 | old.* = Sigaction{ | |
| 19 | .handler = @ptrCast(extern fn (i32) void, coact.handler), | |
| 20 | .flags = @bitCast(u32, coact.sa_flags), | |
| 21 | .mask = coact.sa_mask, | |
| 22 | }; | |
| 23 | } | |
| 24 | return result; | |
| 25 | } | |
| 26 | ||
| 27 | pub const in_port_t = u16; | |
| 28 | pub const sa_family_t = u8; | |
| 29 | pub const socklen_t = u32; | |
| 30 | pub const sockaddr = extern union { | |
| 31 | in: sockaddr_in, | |
| 32 | in6: sockaddr_in6, | |
| 33 | }; | |
| 34 | pub const sockaddr_in = extern struct { | |
| 35 | len: u8, | |
| 36 | family: sa_family_t, | |
| 37 | port: in_port_t, | |
| 38 | addr: u32, | |
| 39 | zero: [8]u8, | |
| 40 | }; | |
| 41 | pub const sockaddr_in6 = extern struct { | |
| 42 | len: u8, | |
| 43 | family: sa_family_t, | |
| 44 | port: in_port_t, | |
| 45 | flowinfo: u32, | |
| 46 | addr: [16]u8, | |
| 47 | scope_id: u32, | |
| 48 | }; | |
| 49 | ||
| 50 | pub const timeval = extern struct { | |
| 51 | tv_sec: c_long, | |
| 52 | tv_usec: i32, | |
| 53 | }; | |
| 54 | ||
| 55 | pub const timezone = extern struct { | |
| 56 | tz_minuteswest: i32, | |
| 57 | tz_dsttime: i32, | |
| 58 | }; | |
| 59 | ||
| 60 | pub const mach_timebase_info_data = extern struct { | |
| 61 | numer: u32, | |
| 62 | denom: u32, | |
| 63 | }; | |
| 64 | ||
| 65 | /// Renamed to Stat to not conflict with the stat function. | |
| 66 | pub const Stat = extern struct { | |
| 67 | dev: i32, | |
| 68 | mode: u16, | |
| 69 | nlink: u16, | |
| 70 | ino: u64, | |
| 71 | uid: u32, | |
| 72 | gid: u32, | |
| 73 | rdev: i32, | |
| 74 | atime: usize, | |
| 75 | atimensec: usize, | |
| 76 | mtime: usize, | |
| 77 | mtimensec: usize, | |
| 78 | ctime: usize, | |
| 79 | ctimensec: usize, | |
| 80 | birthtime: usize, | |
| 81 | birthtimensec: usize, | |
| 82 | size: i64, | |
| 83 | blocks: i64, | |
| 84 | blksize: i32, | |
| 85 | flags: u32, | |
| 86 | gen: u32, | |
| 87 | lspare: i32, | |
| 88 | qspare: [2]i64, | |
| 89 | }; | |
| 90 | ||
| 91 | pub const timespec = extern struct { | |
| 92 | tv_sec: isize, | |
| 93 | tv_nsec: isize, | |
| 94 | }; | |
| 95 | ||
| 96 | pub const sigset_t = u32; | |
| 97 | pub const empty_sigset = sigset_t(0); | |
| 98 | ||
| 99 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name. | |
| 100 | pub const Sigaction = extern struct { | |
| 101 | handler: extern fn (c_int) void, | |
| 102 | sa_mask: sigset_t, | |
| 103 | sa_flags: c_int, | |
| 104 | }; | |
| 105 | ||
| 106 | pub const dirent = extern struct { | |
| 107 | d_ino: usize, | |
| 108 | d_seekoff: usize, | |
| 109 | d_reclen: u16, | |
| 110 | d_namlen: u16, | |
| 111 | d_type: u8, | |
| 112 | d_name: u8, // field address is address of first byte of name | |
| 113 | }; | |
| 114 | ||
| 115 | pub const pthread_attr_t = extern struct { | |
| 116 | __sig: c_long, | |
| 117 | __opaque: [56]u8, | |
| 118 | }; | |
| 119 | ||
| 120 | /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. | |
| 121 | pub const Kevent = extern struct { | |
| 122 | ident: usize, | |
| 123 | filter: i16, | |
| 124 | flags: u16, | |
| 125 | fflags: u32, | |
| 126 | data: isize, | |
| 127 | udata: usize, | |
| 128 | }; | |
| 129 | ||
| 130 | // sys/types.h on macos uses #pragma pack(4) so these checks are | |
| 131 | // to make sure the struct is laid out the same. These values were | |
| 132 | // produced from C code using the offsetof macro. | |
| 133 | comptime { | |
| 134 | assert(@byteOffsetOf(Kevent, "ident") == 0); | |
| 135 | assert(@byteOffsetOf(Kevent, "filter") == 8); | |
| 136 | assert(@byteOffsetOf(Kevent, "flags") == 10); | |
| 137 | assert(@byteOffsetOf(Kevent, "fflags") == 12); | |
| 138 | assert(@byteOffsetOf(Kevent, "data") == 16); | |
| 139 | assert(@byteOffsetOf(Kevent, "udata") == 24); | |
| 140 | } | |
| 141 | ||
| 142 | pub const kevent64_s = extern struct { | |
| 143 | ident: u64, | |
| 144 | filter: i16, | |
| 145 | flags: u16, | |
| 146 | fflags: u32, | |
| 147 | data: i64, | |
| 148 | udata: u64, | |
| 149 | ext: [2]u64, | |
| 150 | }; | |
| 151 | ||
| 152 | // sys/types.h on macos uses #pragma pack() so these checks are | |
| 153 | // to make sure the struct is laid out the same. These values were | |
| 154 | // produced from C code using the offsetof macro. | |
| 155 | comptime { | |
| 156 | assert(@byteOffsetOf(kevent64_s, "ident") == 0); | |
| 157 | assert(@byteOffsetOf(kevent64_s, "filter") == 8); | |
| 158 | assert(@byteOffsetOf(kevent64_s, "flags") == 10); | |
| 159 | assert(@byteOffsetOf(kevent64_s, "fflags") == 12); | |
| 160 | assert(@byteOffsetOf(kevent64_s, "data") == 16); | |
| 161 | assert(@byteOffsetOf(kevent64_s, "udata") == 24); | |
| 162 | assert(@byteOffsetOf(kevent64_s, "ext") == 32); | |
| 163 | } | |
| 164 | ||
| 165 | pub const mach_port_t = c_uint; | |
| 166 | pub const clock_serv_t = mach_port_t; | |
| 167 | pub const clock_res_t = c_int; | |
| 168 | pub const mach_port_name_t = natural_t; | |
| 169 | pub const natural_t = c_uint; | |
| 170 | pub const mach_timespec_t = extern struct { | |
| 171 | tv_sec: c_uint, | |
| 172 | tv_nsec: clock_res_t, | |
| 173 | }; | |
| 174 | pub const kern_return_t = c_int; | |
| 175 | pub const host_t = mach_port_t; | |
| 176 | pub const CALENDAR_CLOCK = 1; | |
| 177 | ||
| 178 | pub const PATH_MAX = 1024; | |
| 179 | ||
| 180 | pub const STDIN_FILENO = 0; | |
| 181 | pub const STDOUT_FILENO = 1; | |
| 182 | pub const STDERR_FILENO = 2; | |
| 183 | ||
| 184 | /// [MC2] no permissions | |
| 185 | pub const PROT_NONE = 0x00; | |
| 186 | ||
| 187 | /// [MC2] pages can be read | |
| 188 | pub const PROT_READ = 0x01; | |
| 189 | ||
| 190 | /// [MC2] pages can be written | |
| 191 | pub const PROT_WRITE = 0x02; | |
| 192 | ||
| 193 | /// [MC2] pages can be executed | |
| 194 | pub const PROT_EXEC = 0x04; | |
| 195 | ||
| 196 | /// allocated from memory, swap space | |
| 197 | pub const MAP_ANONYMOUS = 0x1000; | |
| 198 | ||
| 199 | /// map from file (default) | |
| 200 | pub const MAP_FILE = 0x0000; | |
| 201 | ||
| 202 | /// interpret addr exactly | |
| 203 | pub const MAP_FIXED = 0x0010; | |
| 204 | ||
| 205 | /// region may contain semaphores | |
| 206 | pub const MAP_HASSEMAPHORE = 0x0200; | |
| 207 | ||
| 208 | /// changes are private | |
| 209 | pub const MAP_PRIVATE = 0x0002; | |
| 210 | ||
| 211 | /// share changes | |
| 212 | pub const MAP_SHARED = 0x0001; | |
| 213 | ||
| 214 | /// don't cache pages for this mapping | |
| 215 | pub const MAP_NOCACHE = 0x0400; | |
| 216 | ||
| 217 | /// don't reserve needed swap area | |
| 218 | pub const MAP_NORESERVE = 0x0040; | |
| 219 | pub const MAP_FAILED = maxInt(usize); | |
| 220 | ||
| 221 | /// [XSI] no hang in wait/no child to reap | |
| 222 | pub const WNOHANG = 0x00000001; | |
| 223 | ||
| 224 | /// [XSI] notify on stop, untraced child | |
| 225 | pub const WUNTRACED = 0x00000002; | |
| 226 | ||
| 227 | /// take signal on signal stack | |
| 228 | pub const SA_ONSTACK = 0x0001; | |
| 229 | ||
| 230 | /// restart system on signal return | |
| 231 | pub const SA_RESTART = 0x0002; | |
| 232 | ||
| 233 | /// reset to SIG_DFL when taking signal | |
| 234 | pub const SA_RESETHAND = 0x0004; | |
| 235 | ||
| 236 | /// do not generate SIGCHLD on child stop | |
| 237 | pub const SA_NOCLDSTOP = 0x0008; | |
| 238 | ||
| 239 | /// don't mask the signal we're delivering | |
| 240 | pub const SA_NODEFER = 0x0010; | |
| 241 | ||
| 242 | /// don't keep zombies around | |
| 243 | pub const SA_NOCLDWAIT = 0x0020; | |
| 244 | ||
| 245 | /// signal handler with SA_SIGINFO args | |
| 246 | pub const SA_SIGINFO = 0x0040; | |
| 247 | ||
| 248 | /// do not bounce off kernel's sigtramp | |
| 249 | pub const SA_USERTRAMP = 0x0100; | |
| 250 | ||
| 251 | /// signal handler with SA_SIGINFO args with 64bit regs information | |
| 252 | pub const SA_64REGSET = 0x0200; | |
| 253 | ||
| 254 | pub const O_LARGEFILE = 0x0000; | |
| 255 | pub const O_PATH = 0x0000; | |
| 256 | ||
| 257 | pub const F_OK = 0; | |
| 258 | pub const X_OK = 1; | |
| 259 | pub const W_OK = 2; | |
| 260 | pub const R_OK = 4; | |
| 261 | ||
| 262 | /// open for reading only | |
| 263 | pub const O_RDONLY = 0x0000; | |
| 264 | ||
| 265 | /// open for writing only | |
| 266 | pub const O_WRONLY = 0x0001; | |
| 267 | ||
| 268 | /// open for reading and writing | |
| 269 | pub const O_RDWR = 0x0002; | |
| 270 | ||
| 271 | /// do not block on open or for data to become available | |
| 272 | pub const O_NONBLOCK = 0x0004; | |
| 273 | ||
| 274 | /// append on each write | |
| 275 | pub const O_APPEND = 0x0008; | |
| 276 | ||
| 277 | /// create file if it does not exist | |
| 278 | pub const O_CREAT = 0x0200; | |
| 279 | ||
| 280 | /// truncate size to 0 | |
| 281 | pub const O_TRUNC = 0x0400; | |
| 282 | ||
| 283 | /// error if O_CREAT and the file exists | |
| 284 | pub const O_EXCL = 0x0800; | |
| 285 | ||
| 286 | /// atomically obtain a shared lock | |
| 287 | pub const O_SHLOCK = 0x0010; | |
| 288 | ||
| 289 | /// atomically obtain an exclusive lock | |
| 290 | pub const O_EXLOCK = 0x0020; | |
| 291 | ||
| 292 | /// do not follow symlinks | |
| 293 | pub const O_NOFOLLOW = 0x0100; | |
| 294 | ||
| 295 | /// allow open of symlinks | |
| 296 | pub const O_SYMLINK = 0x200000; | |
| 297 | ||
| 298 | /// descriptor requested for event notifications only | |
| 299 | pub const O_EVTONLY = 0x8000; | |
| 300 | ||
| 301 | /// mark as close-on-exec | |
| 302 | pub const O_CLOEXEC = 0x1000000; | |
| 303 | ||
| 304 | pub const O_ACCMODE = 3; | |
| 305 | pub const O_ALERT = 536870912; | |
| 306 | pub const O_ASYNC = 64; | |
| 307 | pub const O_DIRECTORY = 1048576; | |
| 308 | pub const O_DP_GETRAWENCRYPTED = 1; | |
| 309 | pub const O_DP_GETRAWUNENCRYPTED = 2; | |
| 310 | pub const O_DSYNC = 4194304; | |
| 311 | pub const O_FSYNC = O_SYNC; | |
| 312 | pub const O_NOCTTY = 131072; | |
| 313 | pub const O_POPUP = 2147483648; | |
| 314 | pub const O_SYNC = 128; | |
| 315 | ||
| 316 | pub const SEEK_SET = 0x0; | |
| 317 | pub const SEEK_CUR = 0x1; | |
| 318 | pub const SEEK_END = 0x2; | |
| 319 | ||
| 320 | pub const DT_UNKNOWN = 0; | |
| 321 | pub const DT_FIFO = 1; | |
| 322 | pub const DT_CHR = 2; | |
| 323 | pub const DT_DIR = 4; | |
| 324 | pub const DT_BLK = 6; | |
| 325 | pub const DT_REG = 8; | |
| 326 | pub const DT_LNK = 10; | |
| 327 | pub const DT_SOCK = 12; | |
| 328 | pub const DT_WHT = 14; | |
| 329 | ||
| 330 | /// block specified signal set | |
| 331 | pub const SIG_BLOCK = 1; | |
| 332 | ||
| 333 | /// unblock specified signal set | |
| 334 | pub const SIG_UNBLOCK = 2; | |
| 335 | ||
| 336 | /// set specified signal set | |
| 337 | pub const SIG_SETMASK = 3; | |
| 338 | ||
| 339 | /// hangup | |
| 340 | pub const SIGHUP = 1; | |
| 341 | ||
| 342 | /// interrupt | |
| 343 | pub const SIGINT = 2; | |
| 344 | ||
| 345 | /// quit | |
| 346 | pub const SIGQUIT = 3; | |
| 347 | ||
| 348 | /// illegal instruction (not reset when caught) | |
| 349 | pub const SIGILL = 4; | |
| 350 | ||
| 351 | /// trace trap (not reset when caught) | |
| 352 | pub const SIGTRAP = 5; | |
| 353 | ||
| 354 | /// abort() | |
| 355 | pub const SIGABRT = 6; | |
| 356 | ||
| 357 | /// pollable event ([XSR] generated, not supported) | |
| 358 | pub const SIGPOLL = 7; | |
| 359 | ||
| 360 | /// compatibility | |
| 361 | pub const SIGIOT = SIGABRT; | |
| 362 | ||
| 363 | /// EMT instruction | |
| 364 | pub const SIGEMT = 7; | |
| 365 | ||
| 366 | /// floating point exception | |
| 367 | pub const SIGFPE = 8; | |
| 368 | ||
| 369 | /// kill (cannot be caught or ignored) | |
| 370 | pub const SIGKILL = 9; | |
| 371 | ||
| 372 | /// bus error | |
| 373 | pub const SIGBUS = 10; | |
| 374 | ||
| 375 | /// segmentation violation | |
| 376 | pub const SIGSEGV = 11; | |
| 377 | ||
| 378 | /// bad argument to system call | |
| 379 | pub const SIGSYS = 12; | |
| 380 | ||
| 381 | /// write on a pipe with no one to read it | |
| 382 | pub const SIGPIPE = 13; | |
| 383 | ||
| 384 | /// alarm clock | |
| 385 | pub const SIGALRM = 14; | |
| 386 | ||
| 387 | /// software termination signal from kill | |
| 388 | pub const SIGTERM = 15; | |
| 389 | ||
| 390 | /// urgent condition on IO channel | |
| 391 | pub const SIGURG = 16; | |
| 392 | ||
| 393 | /// sendable stop signal not from tty | |
| 394 | pub const SIGSTOP = 17; | |
| 395 | ||
| 396 | /// stop signal from tty | |
| 397 | pub const SIGTSTP = 18; | |
| 398 | ||
| 399 | /// continue a stopped process | |
| 400 | pub const SIGCONT = 19; | |
| 401 | ||
| 402 | /// to parent on child stop or exit | |
| 403 | pub const SIGCHLD = 20; | |
| 404 | ||
| 405 | /// to readers pgrp upon background tty read | |
| 406 | pub const SIGTTIN = 21; | |
| 407 | ||
| 408 | /// like TTIN for output if (tp->t_local&LTOSTOP) | |
| 409 | pub const SIGTTOU = 22; | |
| 410 | ||
| 411 | /// input/output possible signal | |
| 412 | pub const SIGIO = 23; | |
| 413 | ||
| 414 | /// exceeded CPU time limit | |
| 415 | pub const SIGXCPU = 24; | |
| 416 | ||
| 417 | /// exceeded file size limit | |
| 418 | pub const SIGXFSZ = 25; | |
| 419 | ||
| 420 | /// virtual time alarm | |
| 421 | pub const SIGVTALRM = 26; | |
| 422 | ||
| 423 | /// profiling time alarm | |
| 424 | pub const SIGPROF = 27; | |
| 425 | ||
| 426 | /// window size changes | |
| 427 | pub const SIGWINCH = 28; | |
| 428 | ||
| 429 | /// information request | |
| 430 | pub const SIGINFO = 29; | |
| 431 | ||
| 432 | /// user defined signal 1 | |
| 433 | pub const SIGUSR1 = 30; | |
| 434 | ||
| 435 | /// user defined signal 2 | |
| 436 | pub const SIGUSR2 = 31; | |
| 437 | ||
| 438 | /// no flag value | |
| 439 | pub const KEVENT_FLAG_NONE = 0x000; | |
| 440 | ||
| 441 | /// immediate timeout | |
| 442 | pub const KEVENT_FLAG_IMMEDIATE = 0x001; | |
| 443 | ||
| 444 | /// output events only include change | |
| 445 | pub const KEVENT_FLAG_ERROR_EVENTS = 0x002; | |
| 446 | ||
| 447 | /// add event to kq (implies enable) | |
| 448 | pub const EV_ADD = 0x0001; | |
| 449 | ||
| 450 | /// delete event from kq | |
| 451 | pub const EV_DELETE = 0x0002; | |
| 452 | ||
| 453 | /// enable event | |
| 454 | pub const EV_ENABLE = 0x0004; | |
| 455 | ||
| 456 | /// disable event (not reported) | |
| 457 | pub const EV_DISABLE = 0x0008; | |
| 458 | ||
| 459 | /// only report one occurrence | |
| 460 | pub const EV_ONESHOT = 0x0010; | |
| 461 | ||
| 462 | /// clear event state after reporting | |
| 463 | pub const EV_CLEAR = 0x0020; | |
| 464 | ||
| 465 | /// force immediate event output | |
| 466 | /// ... with or without EV_ERROR | |
| 467 | /// ... use KEVENT_FLAG_ERROR_EVENTS | |
| 468 | /// on syscalls supporting flags | |
| 469 | pub const EV_RECEIPT = 0x0040; | |
| 470 | ||
| 471 | /// disable event after reporting | |
| 472 | pub const EV_DISPATCH = 0x0080; | |
| 473 | ||
| 474 | /// unique kevent per udata value | |
| 475 | pub const EV_UDATA_SPECIFIC = 0x0100; | |
| 476 | ||
| 477 | /// ... in combination with EV_DELETE | |
| 478 | /// will defer delete until udata-specific | |
| 479 | /// event enabled. EINPROGRESS will be | |
| 480 | /// returned to indicate the deferral | |
| 481 | pub const EV_DISPATCH2 = EV_DISPATCH | EV_UDATA_SPECIFIC; | |
| 482 | ||
| 483 | /// report that source has vanished | |
| 484 | /// ... only valid with EV_DISPATCH2 | |
| 485 | pub const EV_VANISHED = 0x0200; | |
| 486 | ||
| 487 | /// reserved by system | |
| 488 | pub const EV_SYSFLAGS = 0xF000; | |
| 489 | ||
| 490 | /// filter-specific flag | |
| 491 | pub const EV_FLAG0 = 0x1000; | |
| 492 | ||
| 493 | /// filter-specific flag | |
| 494 | pub const EV_FLAG1 = 0x2000; | |
| 495 | ||
| 496 | /// EOF detected | |
| 497 | pub const EV_EOF = 0x8000; | |
| 498 | ||
| 499 | /// error, data contains errno | |
| 500 | pub const EV_ERROR = 0x4000; | |
| 501 | ||
| 502 | pub const EV_POLL = EV_FLAG0; | |
| 503 | pub const EV_OOBAND = EV_FLAG1; | |
| 504 | ||
| 505 | pub const EVFILT_READ = -1; | |
| 506 | pub const EVFILT_WRITE = -2; | |
| 507 | ||
| 508 | /// attached to aio requests | |
| 509 | pub const EVFILT_AIO = -3; | |
| 510 | ||
| 511 | /// attached to vnodes | |
| 512 | pub const EVFILT_VNODE = -4; | |
| 513 | ||
| 514 | /// attached to struct proc | |
| 515 | pub const EVFILT_PROC = -5; | |
| 516 | ||
| 517 | /// attached to struct proc | |
| 518 | pub const EVFILT_SIGNAL = -6; | |
| 519 | ||
| 520 | /// timers | |
| 521 | pub const EVFILT_TIMER = -7; | |
| 522 | ||
| 523 | /// Mach portsets | |
| 524 | pub const EVFILT_MACHPORT = -8; | |
| 525 | ||
| 526 | /// Filesystem events | |
| 527 | pub const EVFILT_FS = -9; | |
| 528 | ||
| 529 | /// User events | |
| 530 | pub const EVFILT_USER = -10; | |
| 531 | ||
| 532 | /// Virtual memory events | |
| 533 | pub const EVFILT_VM = -12; | |
| 534 | ||
| 535 | /// Exception events | |
| 536 | pub const EVFILT_EXCEPT = -15; | |
| 537 | ||
| 538 | pub const EVFILT_SYSCOUNT = 17; | |
| 539 | ||
| 540 | /// On input, NOTE_TRIGGER causes the event to be triggered for output. | |
| 541 | pub const NOTE_TRIGGER = 0x01000000; | |
| 542 | ||
| 543 | /// ignore input fflags | |
| 544 | pub const NOTE_FFNOP = 0x00000000; | |
| 545 | ||
| 546 | /// and fflags | |
| 547 | pub const NOTE_FFAND = 0x40000000; | |
| 548 | ||
| 549 | /// or fflags | |
| 550 | pub const NOTE_FFOR = 0x80000000; | |
| 551 | ||
| 552 | /// copy fflags | |
| 553 | pub const NOTE_FFCOPY = 0xc0000000; | |
| 554 | ||
| 555 | /// mask for operations | |
| 556 | pub const NOTE_FFCTRLMASK = 0xc0000000; | |
| 557 | pub const NOTE_FFLAGSMASK = 0x00ffffff; | |
| 558 | ||
| 559 | /// low water mark | |
| 560 | pub const NOTE_LOWAT = 0x00000001; | |
| 561 | ||
| 562 | /// OOB data | |
| 563 | pub const NOTE_OOB = 0x00000002; | |
| 564 | ||
| 565 | /// vnode was removed | |
| 566 | pub const NOTE_DELETE = 0x00000001; | |
| 567 | ||
| 568 | /// data contents changed | |
| 569 | pub const NOTE_WRITE = 0x00000002; | |
| 570 | ||
| 571 | /// size increased | |
| 572 | pub const NOTE_EXTEND = 0x00000004; | |
| 573 | ||
| 574 | /// attributes changed | |
| 575 | pub const NOTE_ATTRIB = 0x00000008; | |
| 576 | ||
| 577 | /// link count changed | |
| 578 | pub const NOTE_LINK = 0x00000010; | |
| 579 | ||
| 580 | /// vnode was renamed | |
| 581 | pub const NOTE_RENAME = 0x00000020; | |
| 582 | ||
| 583 | /// vnode access was revoked | |
| 584 | pub const NOTE_REVOKE = 0x00000040; | |
| 585 | ||
| 586 | /// No specific vnode event: to test for EVFILT_READ activation | |
| 587 | pub const NOTE_NONE = 0x00000080; | |
| 588 | ||
| 589 | /// vnode was unlocked by flock(2) | |
| 590 | pub const NOTE_FUNLOCK = 0x00000100; | |
| 591 | ||
| 592 | /// process exited | |
| 593 | pub const NOTE_EXIT = 0x80000000; | |
| 594 | ||
| 595 | /// process forked | |
| 596 | pub const NOTE_FORK = 0x40000000; | |
| 597 | ||
| 598 | /// process exec'd | |
| 599 | pub const NOTE_EXEC = 0x20000000; | |
| 600 | ||
| 601 | /// shared with EVFILT_SIGNAL | |
| 602 | pub const NOTE_SIGNAL = 0x08000000; | |
| 603 | ||
| 604 | /// exit status to be returned, valid for child process only | |
| 605 | pub const NOTE_EXITSTATUS = 0x04000000; | |
| 606 | ||
| 607 | /// provide details on reasons for exit | |
| 608 | pub const NOTE_EXIT_DETAIL = 0x02000000; | |
| 609 | ||
| 610 | /// mask for signal & exit status | |
| 611 | pub const NOTE_PDATAMASK = 0x000fffff; | |
| 612 | pub const NOTE_PCTRLMASK = (~NOTE_PDATAMASK); | |
| 613 | ||
| 614 | pub const NOTE_EXIT_DETAIL_MASK = 0x00070000; | |
| 615 | pub const NOTE_EXIT_DECRYPTFAIL = 0x00010000; | |
| 616 | pub const NOTE_EXIT_MEMORY = 0x00020000; | |
| 617 | pub const NOTE_EXIT_CSERROR = 0x00040000; | |
| 618 | ||
| 619 | /// will react on memory pressure | |
| 620 | pub const NOTE_VM_PRESSURE = 0x80000000; | |
| 621 | ||
| 622 | /// will quit on memory pressure, possibly after cleaning up dirty state | |
| 623 | pub const NOTE_VM_PRESSURE_TERMINATE = 0x40000000; | |
| 624 | ||
| 625 | /// will quit immediately on memory pressure | |
| 626 | pub const NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000; | |
| 627 | ||
| 628 | /// there was an error | |
| 629 | pub const NOTE_VM_ERROR = 0x10000000; | |
| 630 | ||
| 631 | /// data is seconds | |
| 632 | pub const NOTE_SECONDS = 0x00000001; | |
| 633 | ||
| 634 | /// data is microseconds | |
| 635 | pub const NOTE_USECONDS = 0x00000002; | |
| 636 | ||
| 637 | /// data is nanoseconds | |
| 638 | pub const NOTE_NSECONDS = 0x00000004; | |
| 639 | ||
| 640 | /// absolute timeout | |
| 641 | pub const NOTE_ABSOLUTE = 0x00000008; | |
| 642 | ||
| 643 | /// ext[1] holds leeway for power aware timers | |
| 644 | pub const NOTE_LEEWAY = 0x00000010; | |
| 645 | ||
| 646 | /// system does minimal timer coalescing | |
| 647 | pub const NOTE_CRITICAL = 0x00000020; | |
| 648 | ||
| 649 | /// system does maximum timer coalescing | |
| 650 | pub const NOTE_BACKGROUND = 0x00000040; | |
| 651 | pub const NOTE_MACH_CONTINUOUS_TIME = 0x00000080; | |
| 652 | ||
| 653 | /// data is mach absolute time units | |
| 654 | pub const NOTE_MACHTIME = 0x00000100; | |
| 655 | ||
| 656 | pub const AF_UNSPEC = 0; | |
| 657 | pub const AF_LOCAL = 1; | |
| 658 | pub const AF_UNIX = AF_LOCAL; | |
| 659 | pub const AF_INET = 2; | |
| 660 | pub const AF_SYS_CONTROL = 2; | |
| 661 | pub const AF_IMPLINK = 3; | |
| 662 | pub const AF_PUP = 4; | |
| 663 | pub const AF_CHAOS = 5; | |
| 664 | pub const AF_NS = 6; | |
| 665 | pub const AF_ISO = 7; | |
| 666 | pub const AF_OSI = AF_ISO; | |
| 667 | pub const AF_ECMA = 8; | |
| 668 | pub const AF_DATAKIT = 9; | |
| 669 | pub const AF_CCITT = 10; | |
| 670 | pub const AF_SNA = 11; | |
| 671 | pub const AF_DECnet = 12; | |
| 672 | pub const AF_DLI = 13; | |
| 673 | pub const AF_LAT = 14; | |
| 674 | pub const AF_HYLINK = 15; | |
| 675 | pub const AF_APPLETALK = 16; | |
| 676 | pub const AF_ROUTE = 17; | |
| 677 | pub const AF_LINK = 18; | |
| 678 | pub const AF_XTP = 19; | |
| 679 | pub const AF_COIP = 20; | |
| 680 | pub const AF_CNT = 21; | |
| 681 | pub const AF_RTIP = 22; | |
| 682 | pub const AF_IPX = 23; | |
| 683 | pub const AF_SIP = 24; | |
| 684 | pub const AF_PIP = 25; | |
| 685 | pub const AF_ISDN = 28; | |
| 686 | pub const AF_E164 = AF_ISDN; | |
| 687 | pub const AF_KEY = 29; | |
| 688 | pub const AF_INET6 = 30; | |
| 689 | pub const AF_NATM = 31; | |
| 690 | pub const AF_SYSTEM = 32; | |
| 691 | pub const AF_NETBIOS = 33; | |
| 692 | pub const AF_PPP = 34; | |
| 693 | pub const AF_MAX = 40; | |
| 694 | ||
| 695 | pub const PF_UNSPEC = AF_UNSPEC; | |
| 696 | pub const PF_LOCAL = AF_LOCAL; | |
| 697 | pub const PF_UNIX = PF_LOCAL; | |
| 698 | pub const PF_INET = AF_INET; | |
| 699 | pub const PF_IMPLINK = AF_IMPLINK; | |
| 700 | pub const PF_PUP = AF_PUP; | |
| 701 | pub const PF_CHAOS = AF_CHAOS; | |
| 702 | pub const PF_NS = AF_NS; | |
| 703 | pub const PF_ISO = AF_ISO; | |
| 704 | pub const PF_OSI = AF_ISO; | |
| 705 | pub const PF_ECMA = AF_ECMA; | |
| 706 | pub const PF_DATAKIT = AF_DATAKIT; | |
| 707 | pub const PF_CCITT = AF_CCITT; | |
| 708 | pub const PF_SNA = AF_SNA; | |
| 709 | pub const PF_DECnet = AF_DECnet; | |
| 710 | pub const PF_DLI = AF_DLI; | |
| 711 | pub const PF_LAT = AF_LAT; | |
| 712 | pub const PF_HYLINK = AF_HYLINK; | |
| 713 | pub const PF_APPLETALK = AF_APPLETALK; | |
| 714 | pub const PF_ROUTE = AF_ROUTE; | |
| 715 | pub const PF_LINK = AF_LINK; | |
| 716 | pub const PF_XTP = AF_XTP; | |
| 717 | pub const PF_COIP = AF_COIP; | |
| 718 | pub const PF_CNT = AF_CNT; | |
| 719 | pub const PF_SIP = AF_SIP; | |
| 720 | pub const PF_IPX = AF_IPX; | |
| 721 | pub const PF_RTIP = AF_RTIP; | |
| 722 | pub const PF_PIP = AF_PIP; | |
| 723 | pub const PF_ISDN = AF_ISDN; | |
| 724 | pub const PF_KEY = AF_KEY; | |
| 725 | pub const PF_INET6 = AF_INET6; | |
| 726 | pub const PF_NATM = AF_NATM; | |
| 727 | pub const PF_SYSTEM = AF_SYSTEM; | |
| 728 | pub const PF_NETBIOS = AF_NETBIOS; | |
| 729 | pub const PF_PPP = AF_PPP; | |
| 730 | pub const PF_MAX = AF_MAX; | |
| 731 | ||
| 732 | pub const SYSPROTO_EVENT = 1; | |
| 733 | pub const SYSPROTO_CONTROL = 2; | |
| 734 | ||
| 735 | pub const SOCK_STREAM = 1; | |
| 736 | pub const SOCK_DGRAM = 2; | |
| 737 | pub const SOCK_RAW = 3; | |
| 738 | pub const SOCK_RDM = 4; | |
| 739 | pub const SOCK_SEQPACKET = 5; | |
| 740 | pub const SOCK_MAXADDRLEN = 255; | |
| 741 | ||
| 742 | pub const IPPROTO_ICMP = 1; | |
| 743 | pub const IPPROTO_ICMPV6 = 58; | |
| 744 | pub const IPPROTO_TCP = 6; | |
| 745 | pub const IPPROTO_UDP = 17; | |
| 746 | pub const IPPROTO_IP = 0; | |
| 747 | pub const IPPROTO_IPV6 = 41; | |
| 748 | ||
| 749 | fn wstatus(x: i32) i32 { | |
| 750 | return x & 0o177; | |
| 751 | } | |
| 752 | const wstopped = 0o177; | |
| 753 | pub fn WEXITSTATUS(x: i32) i32 { | |
| 754 | return x >> 8; | |
| 755 | } | |
| 756 | pub fn WTERMSIG(x: i32) i32 { | |
| 757 | return wstatus(x); | |
| 758 | } | |
| 759 | pub fn WSTOPSIG(x: i32) i32 { | |
| 760 | return x >> 8; | |
| 761 | } | |
| 762 | pub fn WIFEXITED(x: i32) bool { | |
| 763 | return wstatus(x) == 0; | |
| 764 | } | |
| 765 | pub fn WIFSTOPPED(x: i32) bool { | |
| 766 | return wstatus(x) == wstopped and WSTOPSIG(x) != 0x13; | |
| 767 | } | |
| 768 | pub fn WIFSIGNALED(x: i32) bool { | |
| 769 | return wstatus(x) != wstopped and wstatus(x) != 0; | |
| 770 | } | |
| 771 | ||
| 772 | /// Operation not permitted | |
| 773 | pub const EPERM = 1; | |
| 774 | ||
| 775 | /// No such file or directory | |
| 776 | pub const ENOENT = 2; | |
| 777 | ||
| 778 | /// No such process | |
| 779 | pub const ESRCH = 3; | |
| 780 | ||
| 781 | /// Interrupted system call | |
| 782 | pub const EINTR = 4; | |
| 783 | ||
| 784 | /// Input/output error | |
| 785 | pub const EIO = 5; | |
| 786 | ||
| 787 | /// Device not configured | |
| 788 | pub const ENXIO = 6; | |
| 789 | ||
| 790 | /// Argument list too long | |
| 791 | pub const E2BIG = 7; | |
| 792 | ||
| 793 | /// Exec format error | |
| 794 | pub const ENOEXEC = 8; | |
| 795 | ||
| 796 | /// Bad file descriptor | |
| 797 | pub const EBADF = 9; | |
| 798 | ||
| 799 | /// No child processes | |
| 800 | pub const ECHILD = 10; | |
| 801 | ||
| 802 | /// Resource deadlock avoided | |
| 803 | pub const EDEADLK = 11; | |
| 804 | ||
| 805 | /// Cannot allocate memory | |
| 806 | pub const ENOMEM = 12; | |
| 807 | ||
| 808 | /// Permission denied | |
| 809 | pub const EACCES = 13; | |
| 810 | ||
| 811 | /// Bad address | |
| 812 | pub const EFAULT = 14; | |
| 813 | ||
| 814 | /// Block device required | |
| 815 | pub const ENOTBLK = 15; | |
| 816 | ||
| 817 | /// Device / Resource busy | |
| 818 | pub const EBUSY = 16; | |
| 819 | ||
| 820 | /// File exists | |
| 821 | pub const EEXIST = 17; | |
| 822 | ||
| 823 | /// Cross-device link | |
| 824 | pub const EXDEV = 18; | |
| 825 | ||
| 826 | /// Operation not supported by device | |
| 827 | pub const ENODEV = 19; | |
| 828 | ||
| 829 | /// Not a directory | |
| 830 | pub const ENOTDIR = 20; | |
| 831 | ||
| 832 | /// Is a directory | |
| 833 | pub const EISDIR = 21; | |
| 834 | ||
| 835 | /// Invalid argument | |
| 836 | pub const EINVAL = 22; | |
| 837 | ||
| 838 | /// Too many open files in system | |
| 839 | pub const ENFILE = 23; | |
| 840 | ||
| 841 | /// Too many open files | |
| 842 | pub const EMFILE = 24; | |
| 843 | ||
| 844 | /// Inappropriate ioctl for device | |
| 845 | pub const ENOTTY = 25; | |
| 846 | ||
| 847 | /// Text file busy | |
| 848 | pub const ETXTBSY = 26; | |
| 849 | ||
| 850 | /// File too large | |
| 851 | pub const EFBIG = 27; | |
| 852 | ||
| 853 | /// No space left on device | |
| 854 | pub const ENOSPC = 28; | |
| 855 | ||
| 856 | /// Illegal seek | |
| 857 | pub const ESPIPE = 29; | |
| 858 | ||
| 859 | /// Read-only file system | |
| 860 | pub const EROFS = 30; | |
| 861 | ||
| 862 | /// Too many links | |
| 863 | pub const EMLINK = 31; | |
| 864 | /// Broken pipe | |
| 865 | ||
| 866 | // math software | |
| 867 | pub const EPIPE = 32; | |
| 868 | ||
| 869 | /// Numerical argument out of domain | |
| 870 | pub const EDOM = 33; | |
| 871 | /// Result too large | |
| 872 | ||
| 873 | // non-blocking and interrupt i/o | |
| 874 | pub const ERANGE = 34; | |
| 875 | ||
| 876 | /// Resource temporarily unavailable | |
| 877 | pub const EAGAIN = 35; | |
| 878 | ||
| 879 | /// Operation would block | |
| 880 | pub const EWOULDBLOCK = EAGAIN; | |
| 881 | ||
| 882 | /// Operation now in progress | |
| 883 | pub const EINPROGRESS = 36; | |
| 884 | /// Operation already in progress | |
| 885 | ||
| 886 | // ipc/network software -- argument errors | |
| 887 | pub const EALREADY = 37; | |
| 888 | ||
| 889 | /// Socket operation on non-socket | |
| 890 | pub const ENOTSOCK = 38; | |
| 891 | ||
| 892 | /// Destination address required | |
| 893 | pub const EDESTADDRREQ = 39; | |
| 894 | ||
| 895 | /// Message too long | |
| 896 | pub const EMSGSIZE = 40; | |
| 897 | ||
| 898 | /// Protocol wrong type for socket | |
| 899 | pub const EPROTOTYPE = 41; | |
| 900 | ||
| 901 | /// Protocol not available | |
| 902 | pub const ENOPROTOOPT = 42; | |
| 903 | ||
| 904 | /// Protocol not supported | |
| 905 | pub const EPROTONOSUPPORT = 43; | |
| 906 | ||
| 907 | /// Socket type not supported | |
| 908 | pub const ESOCKTNOSUPPORT = 44; | |
| 909 | ||
| 910 | /// Operation not supported | |
| 911 | pub const ENOTSUP = 45; | |
| 912 | ||
| 913 | /// Protocol family not supported | |
| 914 | pub const EPFNOSUPPORT = 46; | |
| 915 | ||
| 916 | /// Address family not supported by protocol family | |
| 917 | pub const EAFNOSUPPORT = 47; | |
| 918 | ||
| 919 | /// Address already in use | |
| 920 | pub const EADDRINUSE = 48; | |
| 921 | /// Can't assign requested address | |
| 922 | ||
| 923 | // ipc/network software -- operational errors | |
| 924 | pub const EADDRNOTAVAIL = 49; | |
| 925 | ||
| 926 | /// Network is down | |
| 927 | pub const ENETDOWN = 50; | |
| 928 | ||
| 929 | /// Network is unreachable | |
| 930 | pub const ENETUNREACH = 51; | |
| 931 | ||
| 932 | /// Network dropped connection on reset | |
| 933 | pub const ENETRESET = 52; | |
| 934 | ||
| 935 | /// Software caused connection abort | |
| 936 | pub const ECONNABORTED = 53; | |
| 937 | ||
| 938 | /// Connection reset by peer | |
| 939 | pub const ECONNRESET = 54; | |
| 940 | ||
| 941 | /// No buffer space available | |
| 942 | pub const ENOBUFS = 55; | |
| 943 | ||
| 944 | /// Socket is already connected | |
| 945 | pub const EISCONN = 56; | |
| 946 | ||
| 947 | /// Socket is not connected | |
| 948 | pub const ENOTCONN = 57; | |
| 949 | ||
| 950 | /// Can't send after socket shutdown | |
| 951 | pub const ESHUTDOWN = 58; | |
| 952 | ||
| 953 | /// Too many references: can't splice | |
| 954 | pub const ETOOMANYREFS = 59; | |
| 955 | ||
| 956 | /// Operation timed out | |
| 957 | pub const ETIMEDOUT = 60; | |
| 958 | ||
| 959 | /// Connection refused | |
| 960 | pub const ECONNREFUSED = 61; | |
| 961 | ||
| 962 | /// Too many levels of symbolic links | |
| 963 | pub const ELOOP = 62; | |
| 964 | ||
| 965 | /// File name too long | |
| 966 | pub const ENAMETOOLONG = 63; | |
| 967 | ||
| 968 | /// Host is down | |
| 969 | pub const EHOSTDOWN = 64; | |
| 970 | ||
| 971 | /// No route to host | |
| 972 | pub const EHOSTUNREACH = 65; | |
| 973 | /// Directory not empty | |
| 974 | ||
| 975 | // quotas & mush | |
| 976 | pub const ENOTEMPTY = 66; | |
| 977 | ||
| 978 | /// Too many processes | |
| 979 | pub const EPROCLIM = 67; | |
| 980 | ||
| 981 | /// Too many users | |
| 982 | pub const EUSERS = 68; | |
| 983 | /// Disc quota exceeded | |
| 984 | ||
| 985 | // Network File System | |
| 986 | pub const EDQUOT = 69; | |
| 987 | ||
| 988 | /// Stale NFS file handle | |
| 989 | pub const ESTALE = 70; | |
| 990 | ||
| 991 | /// Too many levels of remote in path | |
| 992 | pub const EREMOTE = 71; | |
| 993 | ||
| 994 | /// RPC struct is bad | |
| 995 | pub const EBADRPC = 72; | |
| 996 | ||
| 997 | /// RPC version wrong | |
| 998 | pub const ERPCMISMATCH = 73; | |
| 999 | ||
| 1000 | /// RPC prog. not avail | |
| 1001 | pub const EPROGUNAVAIL = 74; | |
| 1002 | ||
| 1003 | /// Program version wrong | |
| 1004 | pub const EPROGMISMATCH = 75; | |
| 1005 | ||
| 1006 | /// Bad procedure for program | |
| 1007 | pub const EPROCUNAVAIL = 76; | |
| 1008 | ||
| 1009 | /// No locks available | |
| 1010 | pub const ENOLCK = 77; | |
| 1011 | ||
| 1012 | /// Function not implemented | |
| 1013 | pub const ENOSYS = 78; | |
| 1014 | ||
| 1015 | /// Inappropriate file type or format | |
| 1016 | pub const EFTYPE = 79; | |
| 1017 | ||
| 1018 | /// Authentication error | |
| 1019 | pub const EAUTH = 80; | |
| 1020 | /// Need authenticator | |
| 1021 | ||
| 1022 | // Intelligent device errors | |
| 1023 | pub const ENEEDAUTH = 81; | |
| 1024 | ||
| 1025 | /// Device power is off | |
| 1026 | pub const EPWROFF = 82; | |
| 1027 | ||
| 1028 | /// Device error, e.g. paper out | |
| 1029 | pub const EDEVERR = 83; | |
| 1030 | /// Value too large to be stored in data type | |
| 1031 | ||
| 1032 | // Program loading errors | |
| 1033 | pub const EOVERFLOW = 84; | |
| 1034 | ||
| 1035 | /// Bad executable | |
| 1036 | pub const EBADEXEC = 85; | |
| 1037 | ||
| 1038 | /// Bad CPU type in executable | |
| 1039 | pub const EBADARCH = 86; | |
| 1040 | ||
| 1041 | /// Shared library version mismatch | |
| 1042 | pub const ESHLIBVERS = 87; | |
| 1043 | ||
| 1044 | /// Malformed Macho file | |
| 1045 | pub const EBADMACHO = 88; | |
| 1046 | ||
| 1047 | /// Operation canceled | |
| 1048 | pub const ECANCELED = 89; | |
| 1049 | ||
| 1050 | /// Identifier removed | |
| 1051 | pub const EIDRM = 90; | |
| 1052 | ||
| 1053 | /// No message of desired type | |
| 1054 | pub const ENOMSG = 91; | |
| 1055 | ||
| 1056 | /// Illegal byte sequence | |
| 1057 | pub const EILSEQ = 92; | |
| 1058 | ||
| 1059 | /// Attribute not found | |
| 1060 | pub const ENOATTR = 93; | |
| 1061 | ||
| 1062 | /// Bad message | |
| 1063 | pub const EBADMSG = 94; | |
| 1064 | ||
| 1065 | /// Reserved | |
| 1066 | pub const EMULTIHOP = 95; | |
| 1067 | ||
| 1068 | /// No message available on STREAM | |
| 1069 | pub const ENODATA = 96; | |
| 1070 | ||
| 1071 | /// Reserved | |
| 1072 | pub const ENOLINK = 97; | |
| 1073 | ||
| 1074 | /// No STREAM resources | |
| 1075 | pub const ENOSR = 98; | |
| 1076 | ||
| 1077 | /// Not a STREAM | |
| 1078 | pub const ENOSTR = 99; | |
| 1079 | ||
| 1080 | /// Protocol error | |
| 1081 | pub const EPROTO = 100; | |
| 1082 | ||
| 1083 | /// STREAM ioctl timeout | |
| 1084 | pub const ETIME = 101; | |
| 1085 | ||
| 1086 | /// No such policy registered | |
| 1087 | pub const ENOPOLICY = 103; | |
| 1088 | ||
| 1089 | /// State not recoverable | |
| 1090 | pub const ENOTRECOVERABLE = 104; | |
| 1091 | ||
| 1092 | /// Previous owner died | |
| 1093 | pub const EOWNERDEAD = 105; | |
| 1094 | ||
| 1095 | /// Interface output queue is full | |
| 1096 | pub const EQFULL = 106; | |
| 1097 | ||
| 1098 | /// Must be equal largest errno | |
| 1099 | pub const ELAST = 106; |
std/c/posix/freebsd.zig deleted-839| ... | ... | @@ -1,839 +0,0 @@ |
| 1 | const std = @import("../std.zig"); | |
| 2 | ||
| 3 | /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. | |
| 4 | pub const Kevent = extern struct { | |
| 5 | ident: usize, | |
| 6 | filter: i16, | |
| 7 | flags: u16, | |
| 8 | fflags: u32, | |
| 9 | data: i64, | |
| 10 | udata: usize, | |
| 11 | // TODO ext | |
| 12 | }; | |
| 13 | ||
| 14 | pub const pthread_attr_t = extern struct { | |
| 15 | __size: [56]u8, | |
| 16 | __align: c_long, | |
| 17 | }; | |
| 18 | ||
| 19 | pub const msghdr = extern struct { | |
| 20 | /// optional address | |
| 21 | msg_name: ?*sockaddr, | |
| 22 | ||
| 23 | /// size of address | |
| 24 | msg_namelen: socklen_t, | |
| 25 | ||
| 26 | /// scatter/gather array | |
| 27 | msg_iov: [*]iovec, | |
| 28 | ||
| 29 | /// # elements in msg_iov | |
| 30 | msg_iovlen: i32, | |
| 31 | ||
| 32 | /// ancillary data | |
| 33 | msg_control: ?*c_void, | |
| 34 | ||
| 35 | /// ancillary data buffer len | |
| 36 | msg_controllen: socklen_t, | |
| 37 | ||
| 38 | /// flags on received message | |
| 39 | msg_flags: i32, | |
| 40 | }; | |
| 41 | ||
| 42 | pub const msghdr_const = extern struct { | |
| 43 | /// optional address | |
| 44 | msg_name: ?*const sockaddr, | |
| 45 | ||
| 46 | /// size of address | |
| 47 | msg_namelen: socklen_t, | |
| 48 | ||
| 49 | /// scatter/gather array | |
| 50 | msg_iov: [*]iovec_const, | |
| 51 | ||
| 52 | /// # elements in msg_iov | |
| 53 | msg_iovlen: i32, | |
| 54 | ||
| 55 | /// ancillary data | |
| 56 | msg_control: ?*c_void, | |
| 57 | ||
| 58 | /// ancillary data buffer len | |
| 59 | msg_controllen: socklen_t, | |
| 60 | ||
| 61 | /// flags on received message | |
| 62 | msg_flags: i32, | |
| 63 | }; | |
| 64 | ||
| 65 | pub const Stat = extern struct { | |
| 66 | dev: u64, | |
| 67 | ino: u64, | |
| 68 | nlink: usize, | |
| 69 | ||
| 70 | mode: u16, | |
| 71 | __pad0: u16, | |
| 72 | uid: u32, | |
| 73 | gid: u32, | |
| 74 | __pad1: u32, | |
| 75 | rdev: u64, | |
| 76 | ||
| 77 | atim: timespec, | |
| 78 | mtim: timespec, | |
| 79 | ctim: timespec, | |
| 80 | birthtim: timespec, | |
| 81 | ||
| 82 | size: i64, | |
| 83 | blocks: i64, | |
| 84 | blksize: isize, | |
| 85 | flags: u32, | |
| 86 | gen: u64, | |
| 87 | __spare: [10]u64, | |
| 88 | }; | |
| 89 | ||
| 90 | pub const timespec = extern struct { | |
| 91 | tv_sec: isize, | |
| 92 | tv_nsec: isize, | |
| 93 | }; | |
| 94 | ||
| 95 | pub const dirent = extern struct { | |
| 96 | d_fileno: usize, | |
| 97 | d_off: i64, | |
| 98 | d_reclen: u16, | |
| 99 | d_type: u8, | |
| 100 | d_pad0: u8, | |
| 101 | d_namlen: u16, | |
| 102 | d_pad1: u16, | |
| 103 | d_name: [256]u8, | |
| 104 | }; | |
| 105 | ||
| 106 | pub const in_port_t = u16; | |
| 107 | pub const sa_family_t = u16; | |
| 108 | ||
| 109 | pub const sockaddr = extern union { | |
| 110 | in: sockaddr_in, | |
| 111 | in6: sockaddr_in6, | |
| 112 | }; | |
| 113 | ||
| 114 | pub const sockaddr_in = extern struct { | |
| 115 | len: u8, | |
| 116 | family: sa_family_t, | |
| 117 | port: in_port_t, | |
| 118 | addr: [16]u8, | |
| 119 | zero: [8]u8, | |
| 120 | }; | |
| 121 | ||
| 122 | pub const sockaddr_in6 = extern struct { | |
| 123 | len: u8, | |
| 124 | family: sa_family_t, | |
| 125 | port: in_port_t, | |
| 126 | flowinfo: u32, | |
| 127 | addr: [16]u8, | |
| 128 | scope_id: u32, | |
| 129 | }; | |
| 130 | ||
| 131 | pub const CTL_KERN = 1; | |
| 132 | pub const CTL_DEBUG = 5; | |
| 133 | ||
| 134 | pub const KERN_PROC = 14; // struct: process entries | |
| 135 | pub const KERN_PROC_PATHNAME = 12; // path to executable | |
| 136 | ||
| 137 | pub const PATH_MAX = 1024; | |
| 138 | ||
| 139 | pub const STDIN_FILENO = 0; | |
| 140 | pub const STDOUT_FILENO = 1; | |
| 141 | pub const STDERR_FILENO = 2; | |
| 142 | ||
| 143 | pub const PROT_NONE = 0; | |
| 144 | pub const PROT_READ = 1; | |
| 145 | pub const PROT_WRITE = 2; | |
| 146 | pub const PROT_EXEC = 4; | |
| 147 | ||
| 148 | pub const CLOCK_REALTIME = 0; | |
| 149 | pub const CLOCK_VIRTUAL = 1; | |
| 150 | pub const CLOCK_PROF = 2; | |
| 151 | pub const CLOCK_MONOTONIC = 4; | |
| 152 | pub const CLOCK_UPTIME = 5; | |
| 153 | pub const CLOCK_UPTIME_PRECISE = 7; | |
| 154 | pub const CLOCK_UPTIME_FAST = 8; | |
| 155 | pub const CLOCK_REALTIME_PRECISE = 9; | |
| 156 | pub const CLOCK_REALTIME_FAST = 10; | |
| 157 | pub const CLOCK_MONOTONIC_PRECISE = 11; | |
| 158 | pub const CLOCK_MONOTONIC_FAST = 12; | |
| 159 | pub const CLOCK_SECOND = 13; | |
| 160 | pub const CLOCK_THREAD_CPUTIME_ID = 14; | |
| 161 | pub const CLOCK_PROCESS_CPUTIME_ID = 15; | |
| 162 | ||
| 163 | pub const MAP_FAILED = maxInt(usize); | |
| 164 | pub const MAP_SHARED = 0x0001; | |
| 165 | pub const MAP_PRIVATE = 0x0002; | |
| 166 | pub const MAP_FIXED = 0x0010; | |
| 167 | pub const MAP_STACK = 0x0400; | |
| 168 | pub const MAP_NOSYNC = 0x0800; | |
| 169 | pub const MAP_ANON = 0x1000; | |
| 170 | pub const MAP_ANONYMOUS = MAP_ANON; | |
| 171 | pub const MAP_FILE = 0; | |
| 172 | pub const MAP_NORESERVE = 0; | |
| 173 | ||
| 174 | pub const MAP_GUARD = 0x00002000; | |
| 175 | pub const MAP_EXCL = 0x00004000; | |
| 176 | pub const MAP_NOCORE = 0x00020000; | |
| 177 | pub const MAP_PREFAULT_READ = 0x00040000; | |
| 178 | pub const MAP_32BIT = 0x00080000; | |
| 179 | ||
| 180 | pub const WNOHANG = 1; | |
| 181 | pub const WUNTRACED = 2; | |
| 182 | pub const WSTOPPED = WUNTRACED; | |
| 183 | pub const WCONTINUED = 4; | |
| 184 | pub const WNOWAIT = 8; | |
| 185 | pub const WEXITED = 16; | |
| 186 | pub const WTRAPPED = 32; | |
| 187 | ||
| 188 | pub const SA_ONSTACK = 0x0001; | |
| 189 | pub const SA_RESTART = 0x0002; | |
| 190 | pub const SA_RESETHAND = 0x0004; | |
| 191 | pub const SA_NOCLDSTOP = 0x0008; | |
| 192 | pub const SA_NODEFER = 0x0010; | |
| 193 | pub const SA_NOCLDWAIT = 0x0020; | |
| 194 | pub const SA_SIGINFO = 0x0040; | |
| 195 | ||
| 196 | pub const SIGHUP = 1; | |
| 197 | pub const SIGINT = 2; | |
| 198 | pub const SIGQUIT = 3; | |
| 199 | pub const SIGILL = 4; | |
| 200 | pub const SIGTRAP = 5; | |
| 201 | pub const SIGABRT = 6; | |
| 202 | pub const SIGIOT = SIGABRT; | |
| 203 | pub const SIGEMT = 7; | |
| 204 | pub const SIGFPE = 8; | |
| 205 | pub const SIGKILL = 9; | |
| 206 | pub const SIGBUS = 10; | |
| 207 | pub const SIGSEGV = 11; | |
| 208 | pub const SIGSYS = 12; | |
| 209 | pub const SIGPIPE = 13; | |
| 210 | pub const SIGALRM = 14; | |
| 211 | pub const SIGTERM = 15; | |
| 212 | pub const SIGURG = 16; | |
| 213 | pub const SIGSTOP = 17; | |
| 214 | pub const SIGTSTP = 18; | |
| 215 | pub const SIGCONT = 19; | |
| 216 | pub const SIGCHLD = 20; | |
| 217 | pub const SIGTTIN = 21; | |
| 218 | pub const SIGTTOU = 22; | |
| 219 | pub const SIGIO = 23; | |
| 220 | pub const SIGXCPU = 24; | |
| 221 | pub const SIGXFSZ = 25; | |
| 222 | pub const SIGVTALRM = 26; | |
| 223 | pub const SIGPROF = 27; | |
| 224 | pub const SIGWINCH = 28; | |
| 225 | pub const SIGINFO = 29; | |
| 226 | pub const SIGUSR1 = 30; | |
| 227 | pub const SIGUSR2 = 31; | |
| 228 | pub const SIGTHR = 32; | |
| 229 | pub const SIGLWP = SIGTHR; | |
| 230 | pub const SIGLIBRT = 33; | |
| 231 | ||
| 232 | pub const SIGRTMIN = 65; | |
| 233 | pub const SIGRTMAX = 126; | |
| 234 | ||
| 235 | // access function | |
| 236 | pub const F_OK = 0; // test for existence of file | |
| 237 | pub const X_OK = 1; // test for execute or search permission | |
| 238 | pub const W_OK = 2; // test for write permission | |
| 239 | pub const R_OK = 4; // test for read permission | |
| 240 | ||
| 241 | pub const O_RDONLY = 0x0000; | |
| 242 | pub const O_WRONLY = 0x0001; | |
| 243 | pub const O_RDWR = 0x0002; | |
| 244 | pub const O_ACCMODE = 0x0003; | |
| 245 | ||
| 246 | pub const O_CREAT = 0x0200; | |
| 247 | pub const O_EXCL = 0x0800; | |
| 248 | pub const O_NOCTTY = 0x8000; | |
| 249 | pub const O_TRUNC = 0x0400; | |
| 250 | pub const O_APPEND = 0x0008; | |
| 251 | pub const O_NONBLOCK = 0x0004; | |
| 252 | pub const O_DSYNC = 0o10000; | |
| 253 | pub const O_SYNC = 0x0080; | |
| 254 | pub const O_RSYNC = 0o4010000; | |
| 255 | pub const O_DIRECTORY = 0o200000; | |
| 256 | pub const O_NOFOLLOW = 0x0100; | |
| 257 | pub const O_CLOEXEC = 0x00100000; | |
| 258 | ||
| 259 | pub const O_ASYNC = 0x0040; | |
| 260 | pub const O_DIRECT = 0x00010000; | |
| 261 | pub const O_LARGEFILE = 0; | |
| 262 | pub const O_NOATIME = 0o1000000; | |
| 263 | pub const O_PATH = 0o10000000; | |
| 264 | pub const O_TMPFILE = 0o20200000; | |
| 265 | pub const O_NDELAY = O_NONBLOCK; | |
| 266 | ||
| 267 | pub const F_DUPFD = 0; | |
| 268 | pub const F_GETFD = 1; | |
| 269 | pub const F_SETFD = 2; | |
| 270 | pub const F_GETFL = 3; | |
| 271 | pub const F_SETFL = 4; | |
| 272 | ||
| 273 | pub const F_SETOWN = 8; | |
| 274 | pub const F_GETOWN = 9; | |
| 275 | pub const F_SETSIG = 10; | |
| 276 | pub const F_GETSIG = 11; | |
| 277 | ||
| 278 | pub const F_GETLK = 5; | |
| 279 | pub const F_SETLK = 6; | |
| 280 | pub const F_SETLKW = 7; | |
| 281 | ||
| 282 | pub const F_SETOWN_EX = 15; | |
| 283 | pub const F_GETOWN_EX = 16; | |
| 284 | ||
| 285 | pub const F_GETOWNER_UIDS = 17; | |
| 286 | ||
| 287 | pub const SEEK_SET = 0; | |
| 288 | pub const SEEK_CUR = 1; | |
| 289 | pub const SEEK_END = 2; | |
| 290 | ||
| 291 | pub const SIG_BLOCK = 1; | |
| 292 | pub const SIG_UNBLOCK = 2; | |
| 293 | pub const SIG_SETMASK = 3; | |
| 294 | ||
| 295 | pub const SOCK_STREAM = 1; | |
| 296 | pub const SOCK_DGRAM = 2; | |
| 297 | pub const SOCK_RAW = 3; | |
| 298 | pub const SOCK_RDM = 4; | |
| 299 | pub const SOCK_SEQPACKET = 5; | |
| 300 | ||
| 301 | pub const SOCK_CLOEXEC = 0x10000000; | |
| 302 | pub const SOCK_NONBLOCK = 0x20000000; | |
| 303 | ||
| 304 | pub const PROTO_ip = 0o000; | |
| 305 | pub const PROTO_icmp = 0o001; | |
| 306 | pub const PROTO_igmp = 0o002; | |
| 307 | pub const PROTO_ggp = 0o003; | |
| 308 | pub const PROTO_ipencap = 0o004; | |
| 309 | pub const PROTO_st = 0o005; | |
| 310 | pub const PROTO_tcp = 0o006; | |
| 311 | pub const PROTO_egp = 0o010; | |
| 312 | pub const PROTO_pup = 0o014; | |
| 313 | pub const PROTO_udp = 0o021; | |
| 314 | pub const PROTO_hmp = 0o024; | |
| 315 | pub const PROTO_xns_idp = 0o026; | |
| 316 | pub const PROTO_rdp = 0o033; | |
| 317 | pub const PROTO_iso_tp4 = 0o035; | |
| 318 | pub const PROTO_xtp = 0o044; | |
| 319 | pub const PROTO_ddp = 0o045; | |
| 320 | pub const PROTO_idpr_cmtp = 0o046; | |
| 321 | pub const PROTO_ipv6 = 0o051; | |
| 322 | pub const PROTO_ipv6_route = 0o053; | |
| 323 | pub const PROTO_ipv6_frag = 0o054; | |
| 324 | pub const PROTO_idrp = 0o055; | |
| 325 | pub const PROTO_rsvp = 0o056; | |
| 326 | pub const PROTO_gre = 0o057; | |
| 327 | pub const PROTO_esp = 0o062; | |
| 328 | pub const PROTO_ah = 0o063; | |
| 329 | pub const PROTO_skip = 0o071; | |
| 330 | pub const PROTO_ipv6_icmp = 0o072; | |
| 331 | pub const PROTO_ipv6_nonxt = 0o073; | |
| 332 | pub const PROTO_ipv6_opts = 0o074; | |
| 333 | pub const PROTO_rspf = 0o111; | |
| 334 | pub const PROTO_vmtp = 0o121; | |
| 335 | pub const PROTO_ospf = 0o131; | |
| 336 | pub const PROTO_ipip = 0o136; | |
| 337 | pub const PROTO_encap = 0o142; | |
| 338 | pub const PROTO_pim = 0o147; | |
| 339 | pub const PROTO_raw = 0o377; | |
| 340 | ||
| 341 | pub const PF_UNSPEC = 0; | |
| 342 | pub const PF_LOCAL = 1; | |
| 343 | pub const PF_UNIX = PF_LOCAL; | |
| 344 | pub const PF_FILE = PF_LOCAL; | |
| 345 | pub const PF_INET = 2; | |
| 346 | pub const PF_AX25 = 3; | |
| 347 | pub const PF_IPX = 4; | |
| 348 | pub const PF_APPLETALK = 5; | |
| 349 | pub const PF_NETROM = 6; | |
| 350 | pub const PF_BRIDGE = 7; | |
| 351 | pub const PF_ATMPVC = 8; | |
| 352 | pub const PF_X25 = 9; | |
| 353 | pub const PF_INET6 = 10; | |
| 354 | pub const PF_ROSE = 11; | |
| 355 | pub const PF_DECnet = 12; | |
| 356 | pub const PF_NETBEUI = 13; | |
| 357 | pub const PF_SECURITY = 14; | |
| 358 | pub const PF_KEY = 15; | |
| 359 | pub const PF_NETLINK = 16; | |
| 360 | pub const PF_ROUTE = PF_NETLINK; | |
| 361 | pub const PF_PACKET = 17; | |
| 362 | pub const PF_ASH = 18; | |
| 363 | pub const PF_ECONET = 19; | |
| 364 | pub const PF_ATMSVC = 20; | |
| 365 | pub const PF_RDS = 21; | |
| 366 | pub const PF_SNA = 22; | |
| 367 | pub const PF_IRDA = 23; | |
| 368 | pub const PF_PPPOX = 24; | |
| 369 | pub const PF_WANPIPE = 25; | |
| 370 | pub const PF_LLC = 26; | |
| 371 | pub const PF_IB = 27; | |
| 372 | pub const PF_MPLS = 28; | |
| 373 | pub const PF_CAN = 29; | |
| 374 | pub const PF_TIPC = 30; | |
| 375 | pub const PF_BLUETOOTH = 31; | |
| 376 | pub const PF_IUCV = 32; | |
| 377 | pub const PF_RXRPC = 33; | |
| 378 | pub const PF_ISDN = 34; | |
| 379 | pub const PF_PHONET = 35; | |
| 380 | pub const PF_IEEE802154 = 36; | |
| 381 | pub const PF_CAIF = 37; | |
| 382 | pub const PF_ALG = 38; | |
| 383 | pub const PF_NFC = 39; | |
| 384 | pub const PF_VSOCK = 40; | |
| 385 | pub const PF_MAX = 41; | |
| 386 | ||
| 387 | pub const AF_UNSPEC = PF_UNSPEC; | |
| 388 | pub const AF_LOCAL = PF_LOCAL; | |
| 389 | pub const AF_UNIX = AF_LOCAL; | |
| 390 | pub const AF_FILE = AF_LOCAL; | |
| 391 | pub const AF_INET = PF_INET; | |
| 392 | pub const AF_AX25 = PF_AX25; | |
| 393 | pub const AF_IPX = PF_IPX; | |
| 394 | pub const AF_APPLETALK = PF_APPLETALK; | |
| 395 | pub const AF_NETROM = PF_NETROM; | |
| 396 | pub const AF_BRIDGE = PF_BRIDGE; | |
| 397 | pub const AF_ATMPVC = PF_ATMPVC; | |
| 398 | pub const AF_X25 = PF_X25; | |
| 399 | pub const AF_INET6 = PF_INET6; | |
| 400 | pub const AF_ROSE = PF_ROSE; | |
| 401 | pub const AF_DECnet = PF_DECnet; | |
| 402 | pub const AF_NETBEUI = PF_NETBEUI; | |
| 403 | pub const AF_SECURITY = PF_SECURITY; | |
| 404 | pub const AF_KEY = PF_KEY; | |
| 405 | pub const AF_NETLINK = PF_NETLINK; | |
| 406 | pub const AF_ROUTE = PF_ROUTE; | |
| 407 | pub const AF_PACKET = PF_PACKET; | |
| 408 | pub const AF_ASH = PF_ASH; | |
| 409 | pub const AF_ECONET = PF_ECONET; | |
| 410 | pub const AF_ATMSVC = PF_ATMSVC; | |
| 411 | pub const AF_RDS = PF_RDS; | |
| 412 | pub const AF_SNA = PF_SNA; | |
| 413 | pub const AF_IRDA = PF_IRDA; | |
| 414 | pub const AF_PPPOX = PF_PPPOX; | |
| 415 | pub const AF_WANPIPE = PF_WANPIPE; | |
| 416 | pub const AF_LLC = PF_LLC; | |
| 417 | pub const AF_IB = PF_IB; | |
| 418 | pub const AF_MPLS = PF_MPLS; | |
| 419 | pub const AF_CAN = PF_CAN; | |
| 420 | pub const AF_TIPC = PF_TIPC; | |
| 421 | pub const AF_BLUETOOTH = PF_BLUETOOTH; | |
| 422 | pub const AF_IUCV = PF_IUCV; | |
| 423 | pub const AF_RXRPC = PF_RXRPC; | |
| 424 | pub const AF_ISDN = PF_ISDN; | |
| 425 | pub const AF_PHONET = PF_PHONET; | |
| 426 | pub const AF_IEEE802154 = PF_IEEE802154; | |
| 427 | pub const AF_CAIF = PF_CAIF; | |
| 428 | pub const AF_ALG = PF_ALG; | |
| 429 | pub const AF_NFC = PF_NFC; | |
| 430 | pub const AF_VSOCK = PF_VSOCK; | |
| 431 | pub const AF_MAX = PF_MAX; | |
| 432 | ||
| 433 | pub const DT_UNKNOWN = 0; | |
| 434 | pub const DT_FIFO = 1; | |
| 435 | pub const DT_CHR = 2; | |
| 436 | pub const DT_DIR = 4; | |
| 437 | pub const DT_BLK = 6; | |
| 438 | pub const DT_REG = 8; | |
| 439 | pub const DT_LNK = 10; | |
| 440 | pub const DT_SOCK = 12; | |
| 441 | pub const DT_WHT = 14; | |
| 442 | ||
| 443 | /// add event to kq (implies enable) | |
| 444 | pub const EV_ADD = 0x0001; | |
| 445 | ||
| 446 | /// delete event from kq | |
| 447 | pub const EV_DELETE = 0x0002; | |
| 448 | ||
| 449 | /// enable event | |
| 450 | pub const EV_ENABLE = 0x0004; | |
| 451 | ||
| 452 | /// disable event (not reported) | |
| 453 | pub const EV_DISABLE = 0x0008; | |
| 454 | ||
| 455 | /// only report one occurrence | |
| 456 | pub const EV_ONESHOT = 0x0010; | |
| 457 | ||
| 458 | /// clear event state after reporting | |
| 459 | pub const EV_CLEAR = 0x0020; | |
| 460 | ||
| 461 | /// force immediate event output | |
| 462 | /// ... with or without EV_ERROR | |
| 463 | /// ... use KEVENT_FLAG_ERROR_EVENTS | |
| 464 | /// on syscalls supporting flags | |
| 465 | pub const EV_RECEIPT = 0x0040; | |
| 466 | ||
| 467 | /// disable event after reporting | |
| 468 | pub const EV_DISPATCH = 0x0080; | |
| 469 | ||
| 470 | pub const EVFILT_READ = -1; | |
| 471 | pub const EVFILT_WRITE = -2; | |
| 472 | ||
| 473 | /// attached to aio requests | |
| 474 | pub const EVFILT_AIO = -3; | |
| 475 | ||
| 476 | /// attached to vnodes | |
| 477 | pub const EVFILT_VNODE = -4; | |
| 478 | ||
| 479 | /// attached to struct proc | |
| 480 | pub const EVFILT_PROC = -5; | |
| 481 | ||
| 482 | /// attached to struct proc | |
| 483 | pub const EVFILT_SIGNAL = -6; | |
| 484 | ||
| 485 | /// timers | |
| 486 | pub const EVFILT_TIMER = -7; | |
| 487 | ||
| 488 | /// Process descriptors | |
| 489 | pub const EVFILT_PROCDESC = -8; | |
| 490 | ||
| 491 | /// Filesystem events | |
| 492 | pub const EVFILT_FS = -9; | |
| 493 | ||
| 494 | pub const EVFILT_LIO = -10; | |
| 495 | ||
| 496 | /// User events | |
| 497 | pub const EVFILT_USER = -11; | |
| 498 | ||
| 499 | /// Sendfile events | |
| 500 | pub const EVFILT_SENDFILE = -12; | |
| 501 | ||
| 502 | pub const EVFILT_EMPTY = -13; | |
| 503 | ||
| 504 | /// On input, NOTE_TRIGGER causes the event to be triggered for output. | |
| 505 | pub const NOTE_TRIGGER = 0x01000000; | |
| 506 | ||
| 507 | /// ignore input fflags | |
| 508 | pub const NOTE_FFNOP = 0x00000000; | |
| 509 | ||
| 510 | /// and fflags | |
| 511 | pub const NOTE_FFAND = 0x40000000; | |
| 512 | ||
| 513 | /// or fflags | |
| 514 | pub const NOTE_FFOR = 0x80000000; | |
| 515 | ||
| 516 | /// copy fflags | |
| 517 | pub const NOTE_FFCOPY = 0xc0000000; | |
| 518 | ||
| 519 | /// mask for operations | |
| 520 | pub const NOTE_FFCTRLMASK = 0xc0000000; | |
| 521 | pub const NOTE_FFLAGSMASK = 0x00ffffff; | |
| 522 | ||
| 523 | /// low water mark | |
| 524 | pub const NOTE_LOWAT = 0x00000001; | |
| 525 | ||
| 526 | /// behave like poll() | |
| 527 | pub const NOTE_FILE_POLL = 0x00000002; | |
| 528 | ||
| 529 | /// vnode was removed | |
| 530 | pub const NOTE_DELETE = 0x00000001; | |
| 531 | ||
| 532 | /// data contents changed | |
| 533 | pub const NOTE_WRITE = 0x00000002; | |
| 534 | ||
| 535 | /// size increased | |
| 536 | pub const NOTE_EXTEND = 0x00000004; | |
| 537 | ||
| 538 | /// attributes changed | |
| 539 | pub const NOTE_ATTRIB = 0x00000008; | |
| 540 | ||
| 541 | /// link count changed | |
| 542 | pub const NOTE_LINK = 0x00000010; | |
| 543 | ||
| 544 | /// vnode was renamed | |
| 545 | pub const NOTE_RENAME = 0x00000020; | |
| 546 | ||
| 547 | /// vnode access was revoked | |
| 548 | pub const NOTE_REVOKE = 0x00000040; | |
| 549 | ||
| 550 | /// vnode was opened | |
| 551 | pub const NOTE_OPEN = 0x00000080; | |
| 552 | ||
| 553 | /// file closed, fd did not allow write | |
| 554 | pub const NOTE_CLOSE = 0x00000100; | |
| 555 | ||
| 556 | /// file closed, fd did allow write | |
| 557 | pub const NOTE_CLOSE_WRITE = 0x00000200; | |
| 558 | ||
| 559 | /// file was read | |
| 560 | pub const NOTE_READ = 0x00000400; | |
| 561 | ||
| 562 | /// process exited | |
| 563 | pub const NOTE_EXIT = 0x80000000; | |
| 564 | ||
| 565 | /// process forked | |
| 566 | pub const NOTE_FORK = 0x40000000; | |
| 567 | ||
| 568 | /// process exec'd | |
| 569 | pub const NOTE_EXEC = 0x20000000; | |
| 570 | ||
| 571 | /// mask for signal & exit status | |
| 572 | pub const NOTE_PDATAMASK = 0x000fffff; | |
| 573 | pub const NOTE_PCTRLMASK = (~NOTE_PDATAMASK); | |
| 574 | ||
| 575 | /// data is seconds | |
| 576 | pub const NOTE_SECONDS = 0x00000001; | |
| 577 | ||
| 578 | /// data is milliseconds | |
| 579 | pub const NOTE_MSECONDS = 0x00000002; | |
| 580 | ||
| 581 | /// data is microseconds | |
| 582 | pub const NOTE_USECONDS = 0x00000004; | |
| 583 | ||
| 584 | /// data is nanoseconds | |
| 585 | pub const NOTE_NSECONDS = 0x00000008; | |
| 586 | ||
| 587 | /// timeout is absolute | |
| 588 | pub const NOTE_ABSTIME = 0x00000010; | |
| 589 | ||
| 590 | pub const TCGETS = 0x5401; | |
| 591 | pub const TCSETS = 0x5402; | |
| 592 | pub const TCSETSW = 0x5403; | |
| 593 | pub const TCSETSF = 0x5404; | |
| 594 | pub const TCGETA = 0x5405; | |
| 595 | pub const TCSETA = 0x5406; | |
| 596 | pub const TCSETAW = 0x5407; | |
| 597 | pub const TCSETAF = 0x5408; | |
| 598 | pub const TCSBRK = 0x5409; | |
| 599 | pub const TCXONC = 0x540A; | |
| 600 | pub const TCFLSH = 0x540B; | |
| 601 | pub const TIOCEXCL = 0x540C; | |
| 602 | pub const TIOCNXCL = 0x540D; | |
| 603 | pub const TIOCSCTTY = 0x540E; | |
| 604 | pub const TIOCGPGRP = 0x540F; | |
| 605 | pub const TIOCSPGRP = 0x5410; | |
| 606 | pub const TIOCOUTQ = 0x5411; | |
| 607 | pub const TIOCSTI = 0x5412; | |
| 608 | pub const TIOCGWINSZ = 0x5413; | |
| 609 | pub const TIOCSWINSZ = 0x5414; | |
| 610 | pub const TIOCMGET = 0x5415; | |
| 611 | pub const TIOCMBIS = 0x5416; | |
| 612 | pub const TIOCMBIC = 0x5417; | |
| 613 | pub const TIOCMSET = 0x5418; | |
| 614 | pub const TIOCGSOFTCAR = 0x5419; | |
| 615 | pub const TIOCSSOFTCAR = 0x541A; | |
| 616 | pub const FIONREAD = 0x541B; | |
| 617 | pub const TIOCINQ = FIONREAD; | |
| 618 | pub const TIOCLINUX = 0x541C; | |
| 619 | pub const TIOCCONS = 0x541D; | |
| 620 | pub const TIOCGSERIAL = 0x541E; | |
| 621 | pub const TIOCSSERIAL = 0x541F; | |
| 622 | pub const TIOCPKT = 0x5420; | |
| 623 | pub const FIONBIO = 0x5421; | |
| 624 | pub const TIOCNOTTY = 0x5422; | |
| 625 | pub const TIOCSETD = 0x5423; | |
| 626 | pub const TIOCGETD = 0x5424; | |
| 627 | pub const TCSBRKP = 0x5425; | |
| 628 | pub const TIOCSBRK = 0x5427; | |
| 629 | pub const TIOCCBRK = 0x5428; | |
| 630 | pub const TIOCGSID = 0x5429; | |
| 631 | pub const TIOCGRS485 = 0x542E; | |
| 632 | pub const TIOCSRS485 = 0x542F; | |
| 633 | pub const TIOCGPTN = 0x80045430; | |
| 634 | pub const TIOCSPTLCK = 0x40045431; | |
| 635 | pub const TIOCGDEV = 0x80045432; | |
| 636 | pub const TCGETX = 0x5432; | |
| 637 | pub const TCSETX = 0x5433; | |
| 638 | pub const TCSETXF = 0x5434; | |
| 639 | pub const TCSETXW = 0x5435; | |
| 640 | pub const TIOCSIG = 0x40045436; | |
| 641 | pub const TIOCVHANGUP = 0x5437; | |
| 642 | pub const TIOCGPKT = 0x80045438; | |
| 643 | pub const TIOCGPTLCK = 0x80045439; | |
| 644 | pub const TIOCGEXCL = 0x80045440; | |
| 645 | ||
| 646 | fn unsigned(s: i32) u32 { | |
| 647 | return @bitCast(u32, s); | |
| 648 | } | |
| 649 | fn signed(s: u32) i32 { | |
| 650 | return @bitCast(i32, s); | |
| 651 | } | |
| 652 | pub fn WEXITSTATUS(s: i32) i32 { | |
| 653 | return signed((unsigned(s) & 0xff00) >> 8); | |
| 654 | } | |
| 655 | pub fn WTERMSIG(s: i32) i32 { | |
| 656 | return signed(unsigned(s) & 0x7f); | |
| 657 | } | |
| 658 | pub fn WSTOPSIG(s: i32) i32 { | |
| 659 | return WEXITSTATUS(s); | |
| 660 | } | |
| 661 | pub fn WIFEXITED(s: i32) bool { | |
| 662 | return WTERMSIG(s) == 0; | |
| 663 | } | |
| 664 | pub fn WIFSTOPPED(s: i32) bool { | |
| 665 | return @intCast(u16, (((unsigned(s) & 0xffff) *% 0x10001) >> 8)) > 0x7f00; | |
| 666 | } | |
| 667 | pub fn WIFSIGNALED(s: i32) bool { | |
| 668 | return (unsigned(s) & 0xffff) -% 1 < 0xff; | |
| 669 | } | |
| 670 | ||
| 671 | pub const winsize = extern struct { | |
| 672 | ws_row: u16, | |
| 673 | ws_col: u16, | |
| 674 | ws_xpixel: u16, | |
| 675 | ws_ypixel: u16, | |
| 676 | }; | |
| 677 | ||
| 678 | const NSIG = 32; | |
| 679 | ||
| 680 | pub const SIG_ERR = @intToPtr(extern fn (i32) void, maxInt(usize)); | |
| 681 | pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0); | |
| 682 | pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1); | |
| 683 | ||
| 684 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. | |
| 685 | pub const Sigaction = extern struct { | |
| 686 | /// signal handler | |
| 687 | __sigaction_u: extern union { | |
| 688 | __sa_handler: extern fn (i32) void, | |
| 689 | __sa_sigaction: extern fn (i32, *__siginfo, usize) void, | |
| 690 | }, | |
| 691 | ||
| 692 | /// see signal options | |
| 693 | sa_flags: u32, | |
| 694 | ||
| 695 | /// signal mask to apply | |
| 696 | sa_mask: sigset_t, | |
| 697 | }; | |
| 698 | ||
| 699 | pub const _SIG_WORDS = 4; | |
| 700 | pub const _SIG_MAXSIG = 128; | |
| 701 | ||
| 702 | pub inline fn _SIG_IDX(sig: usize) usize { | |
| 703 | return sig - 1; | |
| 704 | } | |
| 705 | pub inline fn _SIG_WORD(sig: usize) usize { | |
| 706 | return_SIG_IDX(sig) >> 5; | |
| 707 | } | |
| 708 | pub inline fn _SIG_BIT(sig: usize) usize { | |
| 709 | return 1 << (_SIG_IDX(sig) & 31); | |
| 710 | } | |
| 711 | pub inline fn _SIG_VALID(sig: usize) usize { | |
| 712 | return sig <= _SIG_MAXSIG and sig > 0; | |
| 713 | } | |
| 714 | ||
| 715 | pub const sigset_t = extern struct { | |
| 716 | __bits: [_SIG_WORDS]u32, | |
| 717 | }; | |
| 718 | ||
| 719 | pub const EPERM = 1; // Operation not permitted | |
| 720 | pub const ENOENT = 2; // No such file or directory | |
| 721 | pub const ESRCH = 3; // No such process | |
| 722 | pub const EINTR = 4; // Interrupted system call | |
| 723 | pub const EIO = 5; // Input/output error | |
| 724 | pub const ENXIO = 6; // Device not configured | |
| 725 | pub const E2BIG = 7; // Argument list too long | |
| 726 | pub const ENOEXEC = 8; // Exec format error | |
| 727 | pub const EBADF = 9; // Bad file descriptor | |
| 728 | pub const ECHILD = 10; // No child processes | |
| 729 | pub const EDEADLK = 11; // Resource deadlock avoided | |
| 730 | // 11 was EAGAIN | |
| 731 | pub const ENOMEM = 12; // Cannot allocate memory | |
| 732 | pub const EACCES = 13; // Permission denied | |
| 733 | pub const EFAULT = 14; // Bad address | |
| 734 | pub const ENOTBLK = 15; // Block device required | |
| 735 | pub const EBUSY = 16; // Device busy | |
| 736 | pub const EEXIST = 17; // File exists | |
| 737 | pub const EXDEV = 18; // Cross-device link | |
| 738 | pub const ENODEV = 19; // Operation not supported by device | |
| 739 | pub const ENOTDIR = 20; // Not a directory | |
| 740 | pub const EISDIR = 21; // Is a directory | |
| 741 | pub const EINVAL = 22; // Invalid argument | |
| 742 | pub const ENFILE = 23; // Too many open files in system | |
| 743 | pub const EMFILE = 24; // Too many open files | |
| 744 | pub const ENOTTY = 25; // Inappropriate ioctl for device | |
| 745 | pub const ETXTBSY = 26; // Text file busy | |
| 746 | pub const EFBIG = 27; // File too large | |
| 747 | pub const ENOSPC = 28; // No space left on device | |
| 748 | pub const ESPIPE = 29; // Illegal seek | |
| 749 | pub const EROFS = 30; // Read-only filesystem | |
| 750 | pub const EMLINK = 31; // Too many links | |
| 751 | pub const EPIPE = 32; // Broken pipe | |
| 752 | ||
| 753 | // math software | |
| 754 | pub const EDOM = 33; // Numerical argument out of domain | |
| 755 | pub const ERANGE = 34; // Result too large | |
| 756 | ||
| 757 | // non-blocking and interrupt i/o | |
| 758 | pub const EAGAIN = 35; // Resource temporarily unavailable | |
| 759 | pub const EWOULDBLOCK = EAGAIN; // Operation would block | |
| 760 | pub const EINPROGRESS = 36; // Operation now in progress | |
| 761 | pub const EALREADY = 37; // Operation already in progress | |
| 762 | ||
| 763 | // ipc/network software -- argument errors | |
| 764 | pub const ENOTSOCK = 38; // Socket operation on non-socket | |
| 765 | pub const EDESTADDRREQ = 39; // Destination address required | |
| 766 | pub const EMSGSIZE = 40; // Message too long | |
| 767 | pub const EPROTOTYPE = 41; // Protocol wrong type for socket | |
| 768 | pub const ENOPROTOOPT = 42; // Protocol not available | |
| 769 | pub const EPROTONOSUPPORT = 43; // Protocol not supported | |
| 770 | pub const ESOCKTNOSUPPORT = 44; // Socket type not supported | |
| 771 | pub const EOPNOTSUPP = 45; // Operation not supported | |
| 772 | pub const ENOTSUP = EOPNOTSUPP; // Operation not supported | |
| 773 | pub const EPFNOSUPPORT = 46; // Protocol family not supported | |
| 774 | pub const EAFNOSUPPORT = 47; // Address family not supported by protocol family | |
| 775 | pub const EADDRINUSE = 48; // Address already in use | |
| 776 | pub const EADDRNOTAVAIL = 49; // Can't assign requested address | |
| 777 | ||
| 778 | // ipc/network software -- operational errors | |
| 779 | pub const ENETDOWN = 50; // Network is down | |
| 780 | pub const ENETUNREACH = 51; // Network is unreachable | |
| 781 | pub const ENETRESET = 52; // Network dropped connection on reset | |
| 782 | pub const ECONNABORTED = 53; // Software caused connection abort | |
| 783 | pub const ECONNRESET = 54; // Connection reset by peer | |
| 784 | pub const ENOBUFS = 55; // No buffer space available | |
| 785 | pub const EISCONN = 56; // Socket is already connected | |
| 786 | pub const ENOTCONN = 57; // Socket is not connected | |
| 787 | pub const ESHUTDOWN = 58; // Can't send after socket shutdown | |
| 788 | pub const ETOOMANYREFS = 59; // Too many references: can't splice | |
| 789 | pub const ETIMEDOUT = 60; // Operation timed out | |
| 790 | pub const ECONNREFUSED = 61; // Connection refused | |
| 791 | ||
| 792 | pub const ELOOP = 62; // Too many levels of symbolic links | |
| 793 | pub const ENAMETOOLONG = 63; // File name too long | |
| 794 | ||
| 795 | // should be rearranged | |
| 796 | pub const EHOSTDOWN = 64; // Host is down | |
| 797 | pub const EHOSTUNREACH = 65; // No route to host | |
| 798 | pub const ENOTEMPTY = 66; // Directory not empty | |
| 799 | ||
| 800 | // quotas & mush | |
| 801 | pub const EPROCLIM = 67; // Too many processes | |
| 802 | pub const EUSERS = 68; // Too many users | |
| 803 | pub const EDQUOT = 69; // Disc quota exceeded | |
| 804 | ||
| 805 | // Network File System | |
| 806 | pub const ESTALE = 70; // Stale NFS file handle | |
| 807 | pub const EREMOTE = 71; // Too many levels of remote in path | |
| 808 | pub const EBADRPC = 72; // RPC struct is bad | |
| 809 | pub const ERPCMISMATCH = 73; // RPC version wrong | |
| 810 | pub const EPROGUNAVAIL = 74; // RPC prog. not avail | |
| 811 | pub const EPROGMISMATCH = 75; // Program version wrong | |
| 812 | pub const EPROCUNAVAIL = 76; // Bad procedure for program | |
| 813 | ||
| 814 | pub const ENOLCK = 77; // No locks available | |
| 815 | pub const ENOSYS = 78; // Function not implemented | |
| 816 | ||
| 817 | pub const EFTYPE = 79; // Inappropriate file type or format | |
| 818 | pub const EAUTH = 80; // Authentication error | |
| 819 | pub const ENEEDAUTH = 81; // Need authenticator | |
| 820 | pub const EIDRM = 82; // Identifier removed | |
| 821 | pub const ENOMSG = 83; // No message of desired type | |
| 822 | pub const EOVERFLOW = 84; // Value too large to be stored in data type | |
| 823 | pub const ECANCELED = 85; // Operation canceled | |
| 824 | pub const EILSEQ = 86; // Illegal byte sequence | |
| 825 | pub const ENOATTR = 87; // Attribute not found | |
| 826 | ||
| 827 | pub const EDOOFUS = 88; // Programming error | |
| 828 | ||
| 829 | pub const EBADMSG = 89; // Bad message | |
| 830 | pub const EMULTIHOP = 90; // Multihop attempted | |
| 831 | pub const ENOLINK = 91; // Link has been severed | |
| 832 | pub const EPROTO = 92; // Protocol error | |
| 833 | ||
| 834 | pub const ENOTCAPABLE = 93; // Capabilities insufficient | |
| 835 | pub const ECAPMODE = 94; // Not permitted in capability mode | |
| 836 | pub const ENOTRECOVERABLE = 95; // State not recoverable | |
| 837 | pub const EOWNERDEAD = 96; // Previous owner died | |
| 838 | ||
| 839 | pub const ELAST = 96; // Must be equal largest errno |
std/c/posix/netbsd.zig deleted-728| ... | ... | @@ -1,728 +0,0 @@ |
| 1 | const std = @import("../../std.zig"); | |
| 2 | const maxInt = std.math.maxInt; | |
| 3 | ||
| 4 | /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. | |
| 5 | pub const Kevent = extern struct { | |
| 6 | ident: usize, | |
| 7 | filter: i32, | |
| 8 | flags: u32, | |
| 9 | fflags: u32, | |
| 10 | data: i64, | |
| 11 | udata: usize, | |
| 12 | }; | |
| 13 | ||
| 14 | pub const pthread_attr_t = extern struct { | |
| 15 | pta_magic: u32, | |
| 16 | pta_flags: c_int, | |
| 17 | pta_private: *c_void, | |
| 18 | }; | |
| 19 | ||
| 20 | pub const msghdr = extern struct { | |
| 21 | /// optional address | |
| 22 | msg_name: ?*sockaddr, | |
| 23 | ||
| 24 | /// size of address | |
| 25 | msg_namelen: socklen_t, | |
| 26 | ||
| 27 | /// scatter/gather array | |
| 28 | msg_iov: [*]iovec, | |
| 29 | ||
| 30 | /// # elements in msg_iov | |
| 31 | msg_iovlen: i32, | |
| 32 | ||
| 33 | /// ancillary data | |
| 34 | msg_control: ?*c_void, | |
| 35 | ||
| 36 | /// ancillary data buffer len | |
| 37 | msg_controllen: socklen_t, | |
| 38 | ||
| 39 | /// flags on received message | |
| 40 | msg_flags: i32, | |
| 41 | }; | |
| 42 | ||
| 43 | pub const msghdr_const = extern struct { | |
| 44 | /// optional address | |
| 45 | msg_name: ?*const sockaddr, | |
| 46 | ||
| 47 | /// size of address | |
| 48 | msg_namelen: socklen_t, | |
| 49 | ||
| 50 | /// scatter/gather array | |
| 51 | msg_iov: [*]iovec_const, | |
| 52 | ||
| 53 | /// # elements in msg_iov | |
| 54 | msg_iovlen: i32, | |
| 55 | ||
| 56 | /// ancillary data | |
| 57 | msg_control: ?*c_void, | |
| 58 | ||
| 59 | /// ancillary data buffer len | |
| 60 | msg_controllen: socklen_t, | |
| 61 | ||
| 62 | /// flags on received message | |
| 63 | msg_flags: i32, | |
| 64 | }; | |
| 65 | ||
| 66 | pub const Stat = extern struct { | |
| 67 | dev: u64, | |
| 68 | mode: u32, | |
| 69 | ino: u64, | |
| 70 | nlink: usize, | |
| 71 | ||
| 72 | uid: u32, | |
| 73 | gid: u32, | |
| 74 | rdev: u64, | |
| 75 | ||
| 76 | atim: timespec, | |
| 77 | mtim: timespec, | |
| 78 | ctim: timespec, | |
| 79 | birthtim: timespec, | |
| 80 | ||
| 81 | size: i64, | |
| 82 | blocks: i64, | |
| 83 | blksize: isize, | |
| 84 | flags: u32, | |
| 85 | gen: u32, | |
| 86 | __spare: [2]u32, | |
| 87 | }; | |
| 88 | ||
| 89 | pub const timespec = extern struct { | |
| 90 | tv_sec: i64, | |
| 91 | tv_nsec: isize, | |
| 92 | }; | |
| 93 | ||
| 94 | pub const dirent = extern struct { | |
| 95 | d_fileno: u64, | |
| 96 | d_reclen: u16, | |
| 97 | d_namlen: u16, | |
| 98 | d_type: u8, | |
| 99 | d_off: i64, | |
| 100 | d_name: [512]u8, | |
| 101 | }; | |
| 102 | ||
| 103 | pub const in_port_t = u16; | |
| 104 | pub const sa_family_t = u8; | |
| 105 | ||
| 106 | pub const sockaddr = extern union { | |
| 107 | in: sockaddr_in, | |
| 108 | in6: sockaddr_in6, | |
| 109 | }; | |
| 110 | ||
| 111 | pub const sockaddr_in = extern struct { | |
| 112 | len: u8, | |
| 113 | family: sa_family_t, | |
| 114 | port: in_port_t, | |
| 115 | addr: u32, | |
| 116 | zero: [8]u8, | |
| 117 | }; | |
| 118 | ||
| 119 | pub const sockaddr_in6 = extern struct { | |
| 120 | len: u8, | |
| 121 | family: sa_family_t, | |
| 122 | port: in_port_t, | |
| 123 | flowinfo: u32, | |
| 124 | addr: [16]u8, | |
| 125 | scope_id: u32, | |
| 126 | }; | |
| 127 | ||
| 128 | pub const CTL_KERN = 1; | |
| 129 | pub const CTL_DEBUG = 5; | |
| 130 | ||
| 131 | pub const KERN_PROC_ARGS = 48; // struct: process argv/env | |
| 132 | pub const KERN_PROC_PATHNAME = 5; // path to executable | |
| 133 | ||
| 134 | pub const PATH_MAX = 1024; | |
| 135 | ||
| 136 | pub const STDIN_FILENO = 0; | |
| 137 | pub const STDOUT_FILENO = 1; | |
| 138 | pub const STDERR_FILENO = 2; | |
| 139 | ||
| 140 | pub const PROT_NONE = 0; | |
| 141 | pub const PROT_READ = 1; | |
| 142 | pub const PROT_WRITE = 2; | |
| 143 | pub const PROT_EXEC = 4; | |
| 144 | ||
| 145 | pub const CLOCK_REALTIME = 0; | |
| 146 | pub const CLOCK_VIRTUAL = 1; | |
| 147 | pub const CLOCK_PROF = 2; | |
| 148 | pub const CLOCK_MONOTONIC = 3; | |
| 149 | pub const CLOCK_THREAD_CPUTIME_ID = 0x20000000; | |
| 150 | pub const CLOCK_PROCESS_CPUTIME_ID = 0x40000000; | |
| 151 | ||
| 152 | pub const MAP_FAILED = maxInt(usize); | |
| 153 | pub const MAP_SHARED = 0x0001; | |
| 154 | pub const MAP_PRIVATE = 0x0002; | |
| 155 | pub const MAP_REMAPDUP = 0x0004; | |
| 156 | pub const MAP_FIXED = 0x0010; | |
| 157 | pub const MAP_RENAME = 0x0020; | |
| 158 | pub const MAP_NORESERVE = 0x0040; | |
| 159 | pub const MAP_INHERIT = 0x0080; | |
| 160 | pub const MAP_HASSEMAPHORE = 0x0200; | |
| 161 | pub const MAP_TRYFIXED = 0x0400; | |
| 162 | pub const MAP_WIRED = 0x0800; | |
| 163 | ||
| 164 | pub const MAP_FILE = 0x0000; | |
| 165 | pub const MAP_NOSYNC = 0x0800; | |
| 166 | pub const MAP_ANON = 0x1000; | |
| 167 | pub const MAP_ANONYMOUS = MAP_ANON; | |
| 168 | pub const MAP_STACK = 0x2000; | |
| 169 | ||
| 170 | pub const WNOHANG = 0x00000001; | |
| 171 | pub const WUNTRACED = 0x00000002; | |
| 172 | pub const WSTOPPED = WUNTRACED; | |
| 173 | pub const WCONTINUED = 0x00000010; | |
| 174 | pub const WNOWAIT = 0x00010000; | |
| 175 | pub const WEXITED = 0x00000020; | |
| 176 | pub const WTRAPPED = 0x00000040; | |
| 177 | ||
| 178 | pub const SA_ONSTACK = 0x0001; | |
| 179 | pub const SA_RESTART = 0x0002; | |
| 180 | pub const SA_RESETHAND = 0x0004; | |
| 181 | pub const SA_NOCLDSTOP = 0x0008; | |
| 182 | pub const SA_NODEFER = 0x0010; | |
| 183 | pub const SA_NOCLDWAIT = 0x0020; | |
| 184 | pub const SA_SIGINFO = 0x0040; | |
| 185 | ||
| 186 | pub const SIGHUP = 1; | |
| 187 | pub const SIGINT = 2; | |
| 188 | pub const SIGQUIT = 3; | |
| 189 | pub const SIGILL = 4; | |
| 190 | pub const SIGTRAP = 5; | |
| 191 | pub const SIGABRT = 6; | |
| 192 | pub const SIGIOT = SIGABRT; | |
| 193 | pub const SIGEMT = 7; | |
| 194 | pub const SIGFPE = 8; | |
| 195 | pub const SIGKILL = 9; | |
| 196 | pub const SIGBUS = 10; | |
| 197 | pub const SIGSEGV = 11; | |
| 198 | pub const SIGSYS = 12; | |
| 199 | pub const SIGPIPE = 13; | |
| 200 | pub const SIGALRM = 14; | |
| 201 | pub const SIGTERM = 15; | |
| 202 | pub const SIGURG = 16; | |
| 203 | pub const SIGSTOP = 17; | |
| 204 | pub const SIGTSTP = 18; | |
| 205 | pub const SIGCONT = 19; | |
| 206 | pub const SIGCHLD = 20; | |
| 207 | pub const SIGTTIN = 21; | |
| 208 | pub const SIGTTOU = 22; | |
| 209 | pub const SIGIO = 23; | |
| 210 | pub const SIGXCPU = 24; | |
| 211 | pub const SIGXFSZ = 25; | |
| 212 | pub const SIGVTALRM = 26; | |
| 213 | pub const SIGPROF = 27; | |
| 214 | pub const SIGWINCH = 28; | |
| 215 | pub const SIGINFO = 29; | |
| 216 | pub const SIGUSR1 = 30; | |
| 217 | pub const SIGUSR2 = 31; | |
| 218 | pub const SIGPWR = 32; | |
| 219 | ||
| 220 | pub const SIGRTMIN = 33; | |
| 221 | pub const SIGRTMAX = 63; | |
| 222 | ||
| 223 | // access function | |
| 224 | pub const F_OK = 0; // test for existence of file | |
| 225 | pub const X_OK = 1; // test for execute or search permission | |
| 226 | pub const W_OK = 2; // test for write permission | |
| 227 | pub const R_OK = 4; // test for read permission | |
| 228 | ||
| 229 | pub const O_RDONLY = 0x0000; | |
| 230 | pub const O_WRONLY = 0x0001; | |
| 231 | pub const O_RDWR = 0x0002; | |
| 232 | pub const O_ACCMODE = 0x0003; | |
| 233 | ||
| 234 | pub const O_CREAT = 0x0200; | |
| 235 | pub const O_EXCL = 0x0800; | |
| 236 | pub const O_NOCTTY = 0x8000; | |
| 237 | pub const O_TRUNC = 0x0400; | |
| 238 | pub const O_APPEND = 0x0008; | |
| 239 | pub const O_NONBLOCK = 0x0004; | |
| 240 | pub const O_DSYNC = 0x00010000; | |
| 241 | pub const O_SYNC = 0x0080; | |
| 242 | pub const O_RSYNC = 0x00020000; | |
| 243 | pub const O_DIRECTORY = 0x00080000; | |
| 244 | pub const O_NOFOLLOW = 0x00000100; | |
| 245 | pub const O_CLOEXEC = 0x00400000; | |
| 246 | ||
| 247 | pub const O_ASYNC = 0x0040; | |
| 248 | pub const O_DIRECT = 0x00080000; | |
| 249 | pub const O_LARGEFILE = 0; | |
| 250 | pub const O_NOATIME = 0; | |
| 251 | pub const O_PATH = 0; | |
| 252 | pub const O_TMPFILE = 0; | |
| 253 | pub const O_NDELAY = O_NONBLOCK; | |
| 254 | ||
| 255 | pub const F_DUPFD = 0; | |
| 256 | pub const F_GETFD = 1; | |
| 257 | pub const F_SETFD = 2; | |
| 258 | pub const F_GETFL = 3; | |
| 259 | pub const F_SETFL = 4; | |
| 260 | ||
| 261 | pub const F_GETOWN = 5; | |
| 262 | pub const F_SETOWN = 6; | |
| 263 | ||
| 264 | pub const F_GETLK = 7; | |
| 265 | pub const F_SETLK = 8; | |
| 266 | pub const F_SETLKW = 9; | |
| 267 | ||
| 268 | pub const SEEK_SET = 0; | |
| 269 | pub const SEEK_CUR = 1; | |
| 270 | pub const SEEK_END = 2; | |
| 271 | ||
| 272 | pub const SIG_BLOCK = 1; | |
| 273 | pub const SIG_UNBLOCK = 2; | |
| 274 | pub const SIG_SETMASK = 3; | |
| 275 | ||
| 276 | pub const SOCK_STREAM = 1; | |
| 277 | pub const SOCK_DGRAM = 2; | |
| 278 | pub const SOCK_RAW = 3; | |
| 279 | pub const SOCK_RDM = 4; | |
| 280 | pub const SOCK_SEQPACKET = 5; | |
| 281 | ||
| 282 | pub const SOCK_CLOEXEC = 0x10000000; | |
| 283 | pub const SOCK_NONBLOCK = 0x20000000; | |
| 284 | ||
| 285 | pub const PROTO_ip = 0; | |
| 286 | pub const PROTO_icmp = 1; | |
| 287 | pub const PROTO_igmp = 2; | |
| 288 | pub const PROTO_ggp = 3; | |
| 289 | pub const PROTO_ipencap = 4; | |
| 290 | pub const PROTO_tcp = 6; | |
| 291 | pub const PROTO_egp = 8; | |
| 292 | pub const PROTO_pup = 12; | |
| 293 | pub const PROTO_udp = 17; | |
| 294 | pub const PROTO_xns_idp = 22; | |
| 295 | pub const PROTO_iso_tp4 = 29; | |
| 296 | pub const PROTO_ipv6 = 41; | |
| 297 | pub const PROTO_ipv6_route = 43; | |
| 298 | pub const PROTO_ipv6_frag = 44; | |
| 299 | pub const PROTO_rsvp = 46; | |
| 300 | pub const PROTO_gre = 47; | |
| 301 | pub const PROTO_esp = 50; | |
| 302 | pub const PROTO_ah = 51; | |
| 303 | pub const PROTO_ipv6_icmp = 58; | |
| 304 | pub const PROTO_ipv6_nonxt = 59; | |
| 305 | pub const PROTO_ipv6_opts = 60; | |
| 306 | pub const PROTO_encap = 98; | |
| 307 | pub const PROTO_pim = 103; | |
| 308 | pub const PROTO_raw = 255; | |
| 309 | ||
| 310 | pub const PF_UNSPEC = 0; | |
| 311 | pub const PF_LOCAL = 1; | |
| 312 | pub const PF_UNIX = PF_LOCAL; | |
| 313 | pub const PF_FILE = PF_LOCAL; | |
| 314 | pub const PF_INET = 2; | |
| 315 | pub const PF_APPLETALK = 16; | |
| 316 | pub const PF_INET6 = 24; | |
| 317 | pub const PF_DECnet = 12; | |
| 318 | pub const PF_KEY = 29; | |
| 319 | pub const PF_ROUTE = 34; | |
| 320 | pub const PF_SNA = 11; | |
| 321 | pub const PF_MPLS = 33; | |
| 322 | pub const PF_CAN = 35; | |
| 323 | pub const PF_BLUETOOTH = 31; | |
| 324 | pub const PF_ISDN = 26; | |
| 325 | pub const PF_MAX = 37; | |
| 326 | ||
| 327 | pub const AF_UNSPEC = PF_UNSPEC; | |
| 328 | pub const AF_LOCAL = PF_LOCAL; | |
| 329 | pub const AF_UNIX = AF_LOCAL; | |
| 330 | pub const AF_FILE = AF_LOCAL; | |
| 331 | pub const AF_INET = PF_INET; | |
| 332 | pub const AF_APPLETALK = PF_APPLETALK; | |
| 333 | pub const AF_INET6 = PF_INET6; | |
| 334 | pub const AF_KEY = PF_KEY; | |
| 335 | pub const AF_ROUTE = PF_ROUTE; | |
| 336 | pub const AF_SNA = PF_SNA; | |
| 337 | pub const AF_MPLS = PF_MPLS; | |
| 338 | pub const AF_CAN = PF_CAN; | |
| 339 | pub const AF_BLUETOOTH = PF_BLUETOOTH; | |
| 340 | pub const AF_ISDN = PF_ISDN; | |
| 341 | pub const AF_MAX = PF_MAX; | |
| 342 | ||
| 343 | pub const DT_UNKNOWN = 0; | |
| 344 | pub const DT_FIFO = 1; | |
| 345 | pub const DT_CHR = 2; | |
| 346 | pub const DT_DIR = 4; | |
| 347 | pub const DT_BLK = 6; | |
| 348 | pub const DT_REG = 8; | |
| 349 | pub const DT_LNK = 10; | |
| 350 | pub const DT_SOCK = 12; | |
| 351 | pub const DT_WHT = 14; | |
| 352 | ||
| 353 | /// add event to kq (implies enable) | |
| 354 | pub const EV_ADD = 0x0001; | |
| 355 | ||
| 356 | /// delete event from kq | |
| 357 | pub const EV_DELETE = 0x0002; | |
| 358 | ||
| 359 | /// enable event | |
| 360 | pub const EV_ENABLE = 0x0004; | |
| 361 | ||
| 362 | /// disable event (not reported) | |
| 363 | pub const EV_DISABLE = 0x0008; | |
| 364 | ||
| 365 | /// only report one occurrence | |
| 366 | pub const EV_ONESHOT = 0x0010; | |
| 367 | ||
| 368 | /// clear event state after reporting | |
| 369 | pub const EV_CLEAR = 0x0020; | |
| 370 | ||
| 371 | /// force immediate event output | |
| 372 | /// ... with or without EV_ERROR | |
| 373 | /// ... use KEVENT_FLAG_ERROR_EVENTS | |
| 374 | /// on syscalls supporting flags | |
| 375 | pub const EV_RECEIPT = 0x0040; | |
| 376 | ||
| 377 | /// disable event after reporting | |
| 378 | pub const EV_DISPATCH = 0x0080; | |
| 379 | ||
| 380 | pub const EVFILT_READ = 0; | |
| 381 | pub const EVFILT_WRITE = 1; | |
| 382 | ||
| 383 | /// attached to aio requests | |
| 384 | pub const EVFILT_AIO = 2; | |
| 385 | ||
| 386 | /// attached to vnodes | |
| 387 | pub const EVFILT_VNODE = 3; | |
| 388 | ||
| 389 | /// attached to struct proc | |
| 390 | pub const EVFILT_PROC = 4; | |
| 391 | ||
| 392 | /// attached to struct proc | |
| 393 | pub const EVFILT_SIGNAL = 5; | |
| 394 | ||
| 395 | /// timers | |
| 396 | pub const EVFILT_TIMER = 6; | |
| 397 | ||
| 398 | /// Filesystem events | |
| 399 | pub const EVFILT_FS = 7; | |
| 400 | ||
| 401 | /// On input, NOTE_TRIGGER causes the event to be triggered for output. | |
| 402 | pub const NOTE_TRIGGER = 0x08000000; | |
| 403 | ||
| 404 | /// low water mark | |
| 405 | pub const NOTE_LOWAT = 0x00000001; | |
| 406 | ||
| 407 | /// vnode was removed | |
| 408 | pub const NOTE_DELETE = 0x00000001; | |
| 409 | ||
| 410 | /// data contents changed | |
| 411 | pub const NOTE_WRITE = 0x00000002; | |
| 412 | ||
| 413 | /// size increased | |
| 414 | pub const NOTE_EXTEND = 0x00000004; | |
| 415 | ||
| 416 | /// attributes changed | |
| 417 | pub const NOTE_ATTRIB = 0x00000008; | |
| 418 | ||
| 419 | /// link count changed | |
| 420 | pub const NOTE_LINK = 0x00000010; | |
| 421 | ||
| 422 | /// vnode was renamed | |
| 423 | pub const NOTE_RENAME = 0x00000020; | |
| 424 | ||
| 425 | /// vnode access was revoked | |
| 426 | pub const NOTE_REVOKE = 0x00000040; | |
| 427 | ||
| 428 | /// process exited | |
| 429 | pub const NOTE_EXIT = 0x80000000; | |
| 430 | ||
| 431 | /// process forked | |
| 432 | pub const NOTE_FORK = 0x40000000; | |
| 433 | ||
| 434 | /// process exec'd | |
| 435 | pub const NOTE_EXEC = 0x20000000; | |
| 436 | ||
| 437 | /// mask for signal & exit status | |
| 438 | pub const NOTE_PDATAMASK = 0x000fffff; | |
| 439 | pub const NOTE_PCTRLMASK = 0xf0000000; | |
| 440 | ||
| 441 | pub const TIOCCBRK = 0x2000747a; | |
| 442 | pub const TIOCCDTR = 0x20007478; | |
| 443 | pub const TIOCCONS = 0x80047462; | |
| 444 | pub const TIOCDCDTIMESTAMP = 0x40107458; | |
| 445 | pub const TIOCDRAIN = 0x2000745e; | |
| 446 | pub const TIOCEXCL = 0x2000740d; | |
| 447 | pub const TIOCEXT = 0x80047460; | |
| 448 | pub const TIOCFLAG_CDTRCTS = 0x10; | |
| 449 | pub const TIOCFLAG_CLOCAL = 0x2; | |
| 450 | pub const TIOCFLAG_CRTSCTS = 0x4; | |
| 451 | pub const TIOCFLAG_MDMBUF = 0x8; | |
| 452 | pub const TIOCFLAG_SOFTCAR = 0x1; | |
| 453 | pub const TIOCFLUSH = 0x80047410; | |
| 454 | pub const TIOCGETA = 0x402c7413; | |
| 455 | pub const TIOCGETD = 0x4004741a; | |
| 456 | pub const TIOCGFLAGS = 0x4004745d; | |
| 457 | pub const TIOCGLINED = 0x40207442; | |
| 458 | pub const TIOCGPGRP = 0x40047477; | |
| 459 | pub const TIOCGQSIZE = 0x40047481; | |
| 460 | pub const TIOCGRANTPT = 0x20007447; | |
| 461 | pub const TIOCGSID = 0x40047463; | |
| 462 | pub const TIOCGSIZE = 0x40087468; | |
| 463 | pub const TIOCGWINSZ = 0x40087468; | |
| 464 | pub const TIOCMBIC = 0x8004746b; | |
| 465 | pub const TIOCMBIS = 0x8004746c; | |
| 466 | pub const TIOCMGET = 0x4004746a; | |
| 467 | pub const TIOCMSET = 0x8004746d; | |
| 468 | pub const TIOCM_CAR = 0x40; | |
| 469 | pub const TIOCM_CD = 0x40; | |
| 470 | pub const TIOCM_CTS = 0x20; | |
| 471 | pub const TIOCM_DSR = 0x100; | |
| 472 | pub const TIOCM_DTR = 0x2; | |
| 473 | pub const TIOCM_LE = 0x1; | |
| 474 | pub const TIOCM_RI = 0x80; | |
| 475 | pub const TIOCM_RNG = 0x80; | |
| 476 | pub const TIOCM_RTS = 0x4; | |
| 477 | pub const TIOCM_SR = 0x10; | |
| 478 | pub const TIOCM_ST = 0x8; | |
| 479 | pub const TIOCNOTTY = 0x20007471; | |
| 480 | pub const TIOCNXCL = 0x2000740e; | |
| 481 | pub const TIOCOUTQ = 0x40047473; | |
| 482 | pub const TIOCPKT = 0x80047470; | |
| 483 | pub const TIOCPKT_DATA = 0x0; | |
| 484 | pub const TIOCPKT_DOSTOP = 0x20; | |
| 485 | pub const TIOCPKT_FLUSHREAD = 0x1; | |
| 486 | pub const TIOCPKT_FLUSHWRITE = 0x2; | |
| 487 | pub const TIOCPKT_IOCTL = 0x40; | |
| 488 | pub const TIOCPKT_NOSTOP = 0x10; | |
| 489 | pub const TIOCPKT_START = 0x8; | |
| 490 | pub const TIOCPKT_STOP = 0x4; | |
| 491 | pub const TIOCPTMGET = 0x40287446; | |
| 492 | pub const TIOCPTSNAME = 0x40287448; | |
| 493 | pub const TIOCRCVFRAME = 0x80087445; | |
| 494 | pub const TIOCREMOTE = 0x80047469; | |
| 495 | pub const TIOCSBRK = 0x2000747b; | |
| 496 | pub const TIOCSCTTY = 0x20007461; | |
| 497 | pub const TIOCSDTR = 0x20007479; | |
| 498 | pub const TIOCSETA = 0x802c7414; | |
| 499 | pub const TIOCSETAF = 0x802c7416; | |
| 500 | pub const TIOCSETAW = 0x802c7415; | |
| 501 | pub const TIOCSETD = 0x8004741b; | |
| 502 | pub const TIOCSFLAGS = 0x8004745c; | |
| 503 | pub const TIOCSIG = 0x2000745f; | |
| 504 | pub const TIOCSLINED = 0x80207443; | |
| 505 | pub const TIOCSPGRP = 0x80047476; | |
| 506 | pub const TIOCSQSIZE = 0x80047480; | |
| 507 | pub const TIOCSSIZE = 0x80087467; | |
| 508 | pub const TIOCSTART = 0x2000746e; | |
| 509 | pub const TIOCSTAT = 0x80047465; | |
| 510 | pub const TIOCSTI = 0x80017472; | |
| 511 | pub const TIOCSTOP = 0x2000746f; | |
| 512 | pub const TIOCSWINSZ = 0x80087467; | |
| 513 | pub const TIOCUCNTL = 0x80047466; | |
| 514 | pub const TIOCXMTFRAME = 0x80087444; | |
| 515 | ||
| 516 | fn unsigned(s: i32) u32 { | |
| 517 | return @bitCast(u32, s); | |
| 518 | } | |
| 519 | fn signed(s: u32) i32 { | |
| 520 | return @bitCast(i32, s); | |
| 521 | } | |
| 522 | pub fn WEXITSTATUS(s: i32) i32 { | |
| 523 | return signed((unsigned(s) >> 8) & 0xff); | |
| 524 | } | |
| 525 | pub fn WTERMSIG(s: i32) i32 { | |
| 526 | return signed(unsigned(s) & 0x7f); | |
| 527 | } | |
| 528 | pub fn WSTOPSIG(s: i32) i32 { | |
| 529 | return WEXITSTATUS(s); | |
| 530 | } | |
| 531 | pub fn WIFEXITED(s: i32) bool { | |
| 532 | return WTERMSIG(s) == 0; | |
| 533 | } | |
| 534 | ||
| 535 | pub fn WIFCONTINUED(s: i32) bool { | |
| 536 | return ((s & 0x7f) == 0xffff); | |
| 537 | } | |
| 538 | ||
| 539 | pub fn WIFSTOPPED(s: i32) bool { | |
| 540 | return ((s & 0x7f != 0x7f) and !WIFCONTINUED(s)); | |
| 541 | } | |
| 542 | ||
| 543 | pub fn WIFSIGNALED(s: i32) bool { | |
| 544 | return !WIFSTOPPED(s) and !WIFCONTINUED(s) and !WIFEXITED(s); | |
| 545 | } | |
| 546 | ||
| 547 | pub const winsize = extern struct { | |
| 548 | ws_row: u16, | |
| 549 | ws_col: u16, | |
| 550 | ws_xpixel: u16, | |
| 551 | ws_ypixel: u16, | |
| 552 | }; | |
| 553 | ||
| 554 | const NSIG = 32; | |
| 555 | ||
| 556 | pub const SIG_ERR = @intToPtr(extern fn (i32) void, maxInt(usize)); | |
| 557 | pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0); | |
| 558 | pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1); | |
| 559 | ||
| 560 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. | |
| 561 | pub const Sigaction = extern struct { | |
| 562 | /// signal handler | |
| 563 | __sigaction_u: extern union { | |
| 564 | __sa_handler: extern fn (i32) void, | |
| 565 | __sa_sigaction: extern fn (i32, *__siginfo, usize) void, | |
| 566 | }, | |
| 567 | ||
| 568 | /// see signal options | |
| 569 | sa_flags: u32, | |
| 570 | ||
| 571 | /// signal mask to apply | |
| 572 | sa_mask: sigset_t, | |
| 573 | }; | |
| 574 | ||
| 575 | pub const _SIG_WORDS = 4; | |
| 576 | pub const _SIG_MAXSIG = 128; | |
| 577 | ||
| 578 | pub inline fn _SIG_IDX(sig: usize) usize { | |
| 579 | return sig - 1; | |
| 580 | } | |
| 581 | pub inline fn _SIG_WORD(sig: usize) usize { | |
| 582 | return_SIG_IDX(sig) >> 5; | |
| 583 | } | |
| 584 | pub inline fn _SIG_BIT(sig: usize) usize { | |
| 585 | return 1 << (_SIG_IDX(sig) & 31); | |
| 586 | } | |
| 587 | pub inline fn _SIG_VALID(sig: usize) usize { | |
| 588 | return sig <= _SIG_MAXSIG and sig > 0; | |
| 589 | } | |
| 590 | ||
| 591 | pub const sigset_t = extern struct { | |
| 592 | __bits: [_SIG_WORDS]u32, | |
| 593 | }; | |
| 594 | ||
| 595 | pub const EPERM = 1; // Operation not permitted | |
| 596 | pub const ENOENT = 2; // No such file or directory | |
| 597 | pub const ESRCH = 3; // No such process | |
| 598 | pub const EINTR = 4; // Interrupted system call | |
| 599 | pub const EIO = 5; // Input/output error | |
| 600 | pub const ENXIO = 6; // Device not configured | |
| 601 | pub const E2BIG = 7; // Argument list too long | |
| 602 | pub const ENOEXEC = 8; // Exec format error | |
| 603 | pub const EBADF = 9; // Bad file descriptor | |
| 604 | pub const ECHILD = 10; // No child processes | |
| 605 | pub const EDEADLK = 11; // Resource deadlock avoided | |
| 606 | // 11 was EAGAIN | |
| 607 | pub const ENOMEM = 12; // Cannot allocate memory | |
| 608 | pub const EACCES = 13; // Permission denied | |
| 609 | pub const EFAULT = 14; // Bad address | |
| 610 | pub const ENOTBLK = 15; // Block device required | |
| 611 | pub const EBUSY = 16; // Device busy | |
| 612 | pub const EEXIST = 17; // File exists | |
| 613 | pub const EXDEV = 18; // Cross-device link | |
| 614 | pub const ENODEV = 19; // Operation not supported by device | |
| 615 | pub const ENOTDIR = 20; // Not a directory | |
| 616 | pub const EISDIR = 21; // Is a directory | |
| 617 | pub const EINVAL = 22; // Invalid argument | |
| 618 | pub const ENFILE = 23; // Too many open files in system | |
| 619 | pub const EMFILE = 24; // Too many open files | |
| 620 | pub const ENOTTY = 25; // Inappropriate ioctl for device | |
| 621 | pub const ETXTBSY = 26; // Text file busy | |
| 622 | pub const EFBIG = 27; // File too large | |
| 623 | pub const ENOSPC = 28; // No space left on device | |
| 624 | pub const ESPIPE = 29; // Illegal seek | |
| 625 | pub const EROFS = 30; // Read-only file system | |
| 626 | pub const EMLINK = 31; // Too many links | |
| 627 | pub const EPIPE = 32; // Broken pipe | |
| 628 | ||
| 629 | // math software | |
| 630 | pub const EDOM = 33; // Numerical argument out of domain | |
| 631 | pub const ERANGE = 34; // Result too large or too small | |
| 632 | ||
| 633 | // non-blocking and interrupt i/o | |
| 634 | pub const EAGAIN = 35; // Resource temporarily unavailable | |
| 635 | pub const EWOULDBLOCK = EAGAIN; // Operation would block | |
| 636 | pub const EINPROGRESS = 36; // Operation now in progress | |
| 637 | pub const EALREADY = 37; // Operation already in progress | |
| 638 | ||
| 639 | // ipc/network software -- argument errors | |
| 640 | pub const ENOTSOCK = 38; // Socket operation on non-socket | |
| 641 | pub const EDESTADDRREQ = 39; // Destination address required | |
| 642 | pub const EMSGSIZE = 40; // Message too long | |
| 643 | pub const EPROTOTYPE = 41; // Protocol wrong type for socket | |
| 644 | pub const ENOPROTOOPT = 42; // Protocol option not available | |
| 645 | pub const EPROTONOSUPPORT = 43; // Protocol not supported | |
| 646 | pub const ESOCKTNOSUPPORT = 44; // Socket type not supported | |
| 647 | pub const EOPNOTSUPP = 45; // Operation not supported | |
| 648 | pub const EPFNOSUPPORT = 46; // Protocol family not supported | |
| 649 | pub const EAFNOSUPPORT = 47; // Address family not supported by protocol family | |
| 650 | pub const EADDRINUSE = 48; // Address already in use | |
| 651 | pub const EADDRNOTAVAIL = 49; // Can't assign requested address | |
| 652 | ||
| 653 | // ipc/network software -- operational errors | |
| 654 | pub const ENETDOWN = 50; // Network is down | |
| 655 | pub const ENETUNREACH = 51; // Network is unreachable | |
| 656 | pub const ENETRESET = 52; // Network dropped connection on reset | |
| 657 | pub const ECONNABORTED = 53; // Software caused connection abort | |
| 658 | pub const ECONNRESET = 54; // Connection reset by peer | |
| 659 | pub const ENOBUFS = 55; // No buffer space available | |
| 660 | pub const EISCONN = 56; // Socket is already connected | |
| 661 | pub const ENOTCONN = 57; // Socket is not connected | |
| 662 | pub const ESHUTDOWN = 58; // Can't send after socket shutdown | |
| 663 | pub const ETOOMANYREFS = 59; // Too many references: can't splice | |
| 664 | pub const ETIMEDOUT = 60; // Operation timed out | |
| 665 | pub const ECONNREFUSED = 61; // Connection refused | |
| 666 | ||
| 667 | pub const ELOOP = 62; // Too many levels of symbolic links | |
| 668 | pub const ENAMETOOLONG = 63; // File name too long | |
| 669 | ||
| 670 | // should be rearranged | |
| 671 | pub const EHOSTDOWN = 64; // Host is down | |
| 672 | pub const EHOSTUNREACH = 65; // No route to host | |
| 673 | pub const ENOTEMPTY = 66; // Directory not empty | |
| 674 | ||
| 675 | // quotas & mush | |
| 676 | pub const EPROCLIM = 67; // Too many processes | |
| 677 | pub const EUSERS = 68; // Too many users | |
| 678 | pub const EDQUOT = 69; // Disc quota exceeded | |
| 679 | ||
| 680 | // Network File System | |
| 681 | pub const ESTALE = 70; // Stale NFS file handle | |
| 682 | pub const EREMOTE = 71; // Too many levels of remote in path | |
| 683 | pub const EBADRPC = 72; // RPC struct is bad | |
| 684 | pub const ERPCMISMATCH = 73; // RPC version wrong | |
| 685 | pub const EPROGUNAVAIL = 74; // RPC prog. not avail | |
| 686 | pub const EPROGMISMATCH = 75; // Program version wrong | |
| 687 | pub const EPROCUNAVAIL = 76; // Bad procedure for program | |
| 688 | ||
| 689 | pub const ENOLCK = 77; // No locks available | |
| 690 | pub const ENOSYS = 78; // Function not implemented | |
| 691 | ||
| 692 | pub const EFTYPE = 79; // Inappropriate file type or format | |
| 693 | pub const EAUTH = 80; // Authentication error | |
| 694 | pub const ENEEDAUTH = 81; // Need authenticator | |
| 695 | ||
| 696 | // SystemV IPC | |
| 697 | pub const EIDRM = 82; // Identifier removed | |
| 698 | pub const ENOMSG = 83; // No message of desired type | |
| 699 | pub const EOVERFLOW = 84; // Value too large to be stored in data type | |
| 700 | ||
| 701 | // Wide/multibyte-character handling, ISO/IEC 9899/AMD1:1995 | |
| 702 | pub const EILSEQ = 85; // Illegal byte sequence | |
| 703 | ||
| 704 | // From IEEE Std 1003.1-2001 | |
| 705 | // Base, Realtime, Threads or Thread Priority Scheduling option errors | |
| 706 | pub const ENOTSUP = 86; // Not supported | |
| 707 | ||
| 708 | // Realtime option errors | |
| 709 | pub const ECANCELED = 87; // Operation canceled | |
| 710 | ||
| 711 | // Realtime, XSI STREAMS option errors | |
| 712 | pub const EBADMSG = 88; // Bad or Corrupt message | |
| 713 | ||
| 714 | // XSI STREAMS option errors | |
| 715 | pub const ENODATA = 89; // No message available | |
| 716 | pub const ENOSR = 90; // No STREAM resources | |
| 717 | pub const ENOSTR = 91; // Not a STREAM | |
| 718 | pub const ETIME = 92; // STREAM ioctl timeout | |
| 719 | ||
| 720 | // File system extended attribute errors | |
| 721 | pub const ENOATTR = 93; // Attribute not found | |
| 722 | ||
| 723 | // Realtime, XSI STREAMS option errors | |
| 724 | pub const EMULTIHOP = 94; // Multihop attempted | |
| 725 | pub const ENOLINK = 95; // Link has been severed | |
| 726 | pub const EPROTO = 96; // Protocol error | |
| 727 | ||
| 728 | pub const ELAST = 96; // Must equal largest errno |
std/c/posix/windows.zig deleted-86| ... | ... | @@ -1,86 +0,0 @@ |
| 1 | pub const EPERM = 1; | |
| 2 | pub const ENOENT = 2; | |
| 3 | pub const ESRCH = 3; | |
| 4 | pub const EINTR = 4; | |
| 5 | pub const EIO = 5; | |
| 6 | pub const ENXIO = 6; | |
| 7 | pub const E2BIG = 7; | |
| 8 | pub const ENOEXEC = 8; | |
| 9 | pub const EBADF = 9; | |
| 10 | pub const ECHILD = 10; | |
| 11 | pub const EAGAIN = 11; | |
| 12 | pub const ENOMEM = 12; | |
| 13 | pub const EACCES = 13; | |
| 14 | pub const EFAULT = 14; | |
| 15 | pub const EBUSY = 16; | |
| 16 | pub const EEXIST = 17; | |
| 17 | pub const EXDEV = 18; | |
| 18 | pub const ENODEV = 19; | |
| 19 | pub const ENOTDIR = 20; | |
| 20 | pub const EISDIR = 21; | |
| 21 | pub const ENFILE = 23; | |
| 22 | pub const EMFILE = 24; | |
| 23 | pub const ENOTTY = 25; | |
| 24 | pub const EFBIG = 27; | |
| 25 | pub const ENOSPC = 28; | |
| 26 | pub const ESPIPE = 29; | |
| 27 | pub const EROFS = 30; | |
| 28 | pub const EMLINK = 31; | |
| 29 | pub const EPIPE = 32; | |
| 30 | pub const EDOM = 33; | |
| 31 | pub const EDEADLK = 36; | |
| 32 | pub const ENAMETOOLONG = 38; | |
| 33 | pub const ENOLCK = 39; | |
| 34 | pub const ENOSYS = 40; | |
| 35 | pub const ENOTEMPTY = 41; | |
| 36 | ||
| 37 | pub const EINVAL = 22; | |
| 38 | pub const ERANGE = 34; | |
| 39 | pub const EILSEQ = 42; | |
| 40 | pub const STRUNCATE = 80; | |
| 41 | ||
| 42 | // Support EDEADLOCK for compatibility with older Microsoft C versions | |
| 43 | pub const EDEADLOCK = EDEADLK; | |
| 44 | ||
| 45 | // POSIX Supplement | |
| 46 | pub const EADDRINUSE = 100; | |
| 47 | pub const EADDRNOTAVAIL = 101; | |
| 48 | pub const EAFNOSUPPORT = 102; | |
| 49 | pub const EALREADY = 103; | |
| 50 | pub const EBADMSG = 104; | |
| 51 | pub const ECANCELED = 105; | |
| 52 | pub const ECONNABORTED = 106; | |
| 53 | pub const ECONNREFUSED = 107; | |
| 54 | pub const ECONNRESET = 108; | |
| 55 | pub const EDESTADDRREQ = 109; | |
| 56 | pub const EHOSTUNREACH = 110; | |
| 57 | pub const EIDRM = 111; | |
| 58 | pub const EINPROGRESS = 112; | |
| 59 | pub const EISCONN = 113; | |
| 60 | pub const ELOOP = 114; | |
| 61 | pub const EMSGSIZE = 115; | |
| 62 | pub const ENETDOWN = 116; | |
| 63 | pub const ENETRESET = 117; | |
| 64 | pub const ENETUNREACH = 118; | |
| 65 | pub const ENOBUFS = 119; | |
| 66 | pub const ENODATA = 120; | |
| 67 | pub const ENOLINK = 121; | |
| 68 | pub const ENOMSG = 122; | |
| 69 | pub const ENOPROTOOPT = 123; | |
| 70 | pub const ENOSR = 124; | |
| 71 | pub const ENOSTR = 125; | |
| 72 | pub const ENOTCONN = 126; | |
| 73 | pub const ENOTRECOVERABLE = 127; | |
| 74 | pub const ENOTSOCK = 128; | |
| 75 | pub const ENOTSUP = 129; | |
| 76 | pub const EOPNOTSUPP = 130; | |
| 77 | pub const EOTHER = 131; | |
| 78 | pub const EOVERFLOW = 132; | |
| 79 | pub const EOWNERDEAD = 133; | |
| 80 | pub const EPROTO = 134; | |
| 81 | pub const EPROTONOSUPPORT = 135; | |
| 82 | pub const EPROTOTYPE = 136; | |
| 83 | pub const ETIME = 137; | |
| 84 | pub const ETIMEDOUT = 138; | |
| 85 | pub const ETXTBSY = 139; | |
| 86 | pub const EWOULDBLOCK = 140; |
std/os.zig+3-1| ... | ... | @@ -19,7 +19,7 @@ const builtin = @import("builtin"); |
| 19 | 19 | const MAX_PATH_BYTES = std.fs.MAX_PATH_BYTES; |
| 20 | 20 | |
| 21 | 21 | comptime { |
| 22 | assert(@import("std") == std); // You have to run the std lib tests with --override-std-dir | |
| 22 | assert(@import("std") == std); // std lib tests require --override-std-dir | |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | pub const darwin = @import("os/darwin.zig"); |
| ... | ... | @@ -43,6 +43,8 @@ pub const system = if (builtin.link_libc) std.c else switch (builtin.os) { |
| 43 | 43 | else => struct {}, |
| 44 | 44 | }; |
| 45 | 45 | |
| 46 | pub use @import("os/bits.zig"); | |
| 47 | ||
| 46 | 48 | /// See also `getenv`. |
| 47 | 49 | pub var environ: [][*]u8 = undefined; |
| 48 | 50 |
std/os/bits.zig created+27| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | // Platform-dependent types and values that are used along with OS-specific APIs. | |
| 2 | // These are imported into `std.c`, `std.os`, and `std.os.linux`. | |
| 3 | ||
| 4 | const builtin = @import("builtin"); | |
| 5 | ||
| 6 | pub use switch (builtin.os) { | |
| 7 | .macosx, .ios, .tvos, .watchos => @import("bits/darwin.zig"), | |
| 8 | .freebsd => @import("bits/freebsd.zig"), | |
| 9 | .linux => @import("bits/linux.zig"), | |
| 10 | .netbsd => @import("bits/netbsd.zig"), | |
| 11 | .wasi => @import("bits/wasi.zig"), | |
| 12 | .windows => @import("bits/windows.zig"), | |
| 13 | else => struct {}, | |
| 14 | }; | |
| 15 | ||
| 16 | pub const pthread_t = *@OpaqueType(); | |
| 17 | pub const FILE = @OpaqueType(); | |
| 18 | ||
| 19 | pub const iovec = extern struct { | |
| 20 | iov_base: [*]u8, | |
| 21 | iov_len: usize, | |
| 22 | }; | |
| 23 | ||
| 24 | pub const iovec_const = extern struct { | |
| 25 | iov_base: [*]const u8, | |
| 26 | iov_len: usize, | |
| 27 | }; |
std/os/bits/darwin.zig created+1102| ... | ... | @@ -0,0 +1,1102 @@ |
| 1 | const std = @import("../../std.zig"); | |
| 2 | const assert = std.debug.assert; | |
| 3 | ||
| 4 | pub const fd_t = c_int; | |
| 5 | pub const pid_t = c_int; | |
| 6 | ||
| 7 | pub fn sigaction(sig: u5, noalias act: *const Sigaction, noalias oact: ?*Sigaction) usize { | |
| 8 | assert(sig != SIGKILL); | |
| 9 | assert(sig != SIGSTOP); | |
| 10 | var cact = c.Sigaction{ | |
| 11 | .handler = @ptrCast(extern fn (c_int) void, act.handler), | |
| 12 | .sa_flags = @bitCast(c_int, act.flags), | |
| 13 | .sa_mask = act.mask, | |
| 14 | }; | |
| 15 | var coact: c.Sigaction = undefined; | |
| 16 | const result = errnoWrap(c.sigaction(sig, &cact, &coact)); | |
| 17 | if (result != 0) { | |
| 18 | return result; | |
| 19 | } | |
| 20 | if (oact) |old| { | |
| 21 | old.* = Sigaction{ | |
| 22 | .handler = @ptrCast(extern fn (i32) void, coact.handler), | |
| 23 | .flags = @bitCast(u32, coact.sa_flags), | |
| 24 | .mask = coact.sa_mask, | |
| 25 | }; | |
| 26 | } | |
| 27 | return result; | |
| 28 | } | |
| 29 | ||
| 30 | pub const in_port_t = u16; | |
| 31 | pub const sa_family_t = u8; | |
| 32 | pub const socklen_t = u32; | |
| 33 | pub const sockaddr = extern union { | |
| 34 | in: sockaddr_in, | |
| 35 | in6: sockaddr_in6, | |
| 36 | }; | |
| 37 | pub const sockaddr_in = extern struct { | |
| 38 | len: u8, | |
| 39 | family: sa_family_t, | |
| 40 | port: in_port_t, | |
| 41 | addr: u32, | |
| 42 | zero: [8]u8, | |
| 43 | }; | |
| 44 | pub const sockaddr_in6 = extern struct { | |
| 45 | len: u8, | |
| 46 | family: sa_family_t, | |
| 47 | port: in_port_t, | |
| 48 | flowinfo: u32, | |
| 49 | addr: [16]u8, | |
| 50 | scope_id: u32, | |
| 51 | }; | |
| 52 | ||
| 53 | pub const timeval = extern struct { | |
| 54 | tv_sec: c_long, | |
| 55 | tv_usec: i32, | |
| 56 | }; | |
| 57 | ||
| 58 | pub const timezone = extern struct { | |
| 59 | tz_minuteswest: i32, | |
| 60 | tz_dsttime: i32, | |
| 61 | }; | |
| 62 | ||
| 63 | pub const mach_timebase_info_data = extern struct { | |
| 64 | numer: u32, | |
| 65 | denom: u32, | |
| 66 | }; | |
| 67 | ||
| 68 | /// Renamed to Stat to not conflict with the stat function. | |
| 69 | pub const Stat = extern struct { | |
| 70 | dev: i32, | |
| 71 | mode: u16, | |
| 72 | nlink: u16, | |
| 73 | ino: u64, | |
| 74 | uid: u32, | |
| 75 | gid: u32, | |
| 76 | rdev: i32, | |
| 77 | atime: usize, | |
| 78 | atimensec: usize, | |
| 79 | mtime: usize, | |
| 80 | mtimensec: usize, | |
| 81 | ctime: usize, | |
| 82 | ctimensec: usize, | |
| 83 | birthtime: usize, | |
| 84 | birthtimensec: usize, | |
| 85 | size: i64, | |
| 86 | blocks: i64, | |
| 87 | blksize: i32, | |
| 88 | flags: u32, | |
| 89 | gen: u32, | |
| 90 | lspare: i32, | |
| 91 | qspare: [2]i64, | |
| 92 | }; | |
| 93 | ||
| 94 | pub const timespec = extern struct { | |
| 95 | tv_sec: isize, | |
| 96 | tv_nsec: isize, | |
| 97 | }; | |
| 98 | ||
| 99 | pub const sigset_t = u32; | |
| 100 | pub const empty_sigset = sigset_t(0); | |
| 101 | ||
| 102 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name. | |
| 103 | pub const Sigaction = extern struct { | |
| 104 | handler: extern fn (c_int) void, | |
| 105 | sa_mask: sigset_t, | |
| 106 | sa_flags: c_int, | |
| 107 | }; | |
| 108 | ||
| 109 | pub const dirent = extern struct { | |
| 110 | d_ino: usize, | |
| 111 | d_seekoff: usize, | |
| 112 | d_reclen: u16, | |
| 113 | d_namlen: u16, | |
| 114 | d_type: u8, | |
| 115 | d_name: u8, // field address is address of first byte of name | |
| 116 | }; | |
| 117 | ||
| 118 | pub const pthread_attr_t = extern struct { | |
| 119 | __sig: c_long, | |
| 120 | __opaque: [56]u8, | |
| 121 | }; | |
| 122 | ||
| 123 | /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. | |
| 124 | pub const Kevent = extern struct { | |
| 125 | ident: usize, | |
| 126 | filter: i16, | |
| 127 | flags: u16, | |
| 128 | fflags: u32, | |
| 129 | data: isize, | |
| 130 | udata: usize, | |
| 131 | }; | |
| 132 | ||
| 133 | // sys/types.h on macos uses #pragma pack(4) so these checks are | |
| 134 | // to make sure the struct is laid out the same. These values were | |
| 135 | // produced from C code using the offsetof macro. | |
| 136 | comptime { | |
| 137 | assert(@byteOffsetOf(Kevent, "ident") == 0); | |
| 138 | assert(@byteOffsetOf(Kevent, "filter") == 8); | |
| 139 | assert(@byteOffsetOf(Kevent, "flags") == 10); | |
| 140 | assert(@byteOffsetOf(Kevent, "fflags") == 12); | |
| 141 | assert(@byteOffsetOf(Kevent, "data") == 16); | |
| 142 | assert(@byteOffsetOf(Kevent, "udata") == 24); | |
| 143 | } | |
| 144 | ||
| 145 | pub const kevent64_s = extern struct { | |
| 146 | ident: u64, | |
| 147 | filter: i16, | |
| 148 | flags: u16, | |
| 149 | fflags: u32, | |
| 150 | data: i64, | |
| 151 | udata: u64, | |
| 152 | ext: [2]u64, | |
| 153 | }; | |
| 154 | ||
| 155 | // sys/types.h on macos uses #pragma pack() so these checks are | |
| 156 | // to make sure the struct is laid out the same. These values were | |
| 157 | // produced from C code using the offsetof macro. | |
| 158 | comptime { | |
| 159 | assert(@byteOffsetOf(kevent64_s, "ident") == 0); | |
| 160 | assert(@byteOffsetOf(kevent64_s, "filter") == 8); | |
| 161 | assert(@byteOffsetOf(kevent64_s, "flags") == 10); | |
| 162 | assert(@byteOffsetOf(kevent64_s, "fflags") == 12); | |
| 163 | assert(@byteOffsetOf(kevent64_s, "data") == 16); | |
| 164 | assert(@byteOffsetOf(kevent64_s, "udata") == 24); | |
| 165 | assert(@byteOffsetOf(kevent64_s, "ext") == 32); | |
| 166 | } | |
| 167 | ||
| 168 | pub const mach_port_t = c_uint; | |
| 169 | pub const clock_serv_t = mach_port_t; | |
| 170 | pub const clock_res_t = c_int; | |
| 171 | pub const mach_port_name_t = natural_t; | |
| 172 | pub const natural_t = c_uint; | |
| 173 | pub const mach_timespec_t = extern struct { | |
| 174 | tv_sec: c_uint, | |
| 175 | tv_nsec: clock_res_t, | |
| 176 | }; | |
| 177 | pub const kern_return_t = c_int; | |
| 178 | pub const host_t = mach_port_t; | |
| 179 | pub const CALENDAR_CLOCK = 1; | |
| 180 | ||
| 181 | pub const PATH_MAX = 1024; | |
| 182 | ||
| 183 | pub const STDIN_FILENO = 0; | |
| 184 | pub const STDOUT_FILENO = 1; | |
| 185 | pub const STDERR_FILENO = 2; | |
| 186 | ||
| 187 | /// [MC2] no permissions | |
| 188 | pub const PROT_NONE = 0x00; | |
| 189 | ||
| 190 | /// [MC2] pages can be read | |
| 191 | pub const PROT_READ = 0x01; | |
| 192 | ||
| 193 | /// [MC2] pages can be written | |
| 194 | pub const PROT_WRITE = 0x02; | |
| 195 | ||
| 196 | /// [MC2] pages can be executed | |
| 197 | pub const PROT_EXEC = 0x04; | |
| 198 | ||
| 199 | /// allocated from memory, swap space | |
| 200 | pub const MAP_ANONYMOUS = 0x1000; | |
| 201 | ||
| 202 | /// map from file (default) | |
| 203 | pub const MAP_FILE = 0x0000; | |
| 204 | ||
| 205 | /// interpret addr exactly | |
| 206 | pub const MAP_FIXED = 0x0010; | |
| 207 | ||
| 208 | /// region may contain semaphores | |
| 209 | pub const MAP_HASSEMAPHORE = 0x0200; | |
| 210 | ||
| 211 | /// changes are private | |
| 212 | pub const MAP_PRIVATE = 0x0002; | |
| 213 | ||
| 214 | /// share changes | |
| 215 | pub const MAP_SHARED = 0x0001; | |
| 216 | ||
| 217 | /// don't cache pages for this mapping | |
| 218 | pub const MAP_NOCACHE = 0x0400; | |
| 219 | ||
| 220 | /// don't reserve needed swap area | |
| 221 | pub const MAP_NORESERVE = 0x0040; | |
| 222 | pub const MAP_FAILED = maxInt(usize); | |
| 223 | ||
| 224 | /// [XSI] no hang in wait/no child to reap | |
| 225 | pub const WNOHANG = 0x00000001; | |
| 226 | ||
| 227 | /// [XSI] notify on stop, untraced child | |
| 228 | pub const WUNTRACED = 0x00000002; | |
| 229 | ||
| 230 | /// take signal on signal stack | |
| 231 | pub const SA_ONSTACK = 0x0001; | |
| 232 | ||
| 233 | /// restart system on signal return | |
| 234 | pub const SA_RESTART = 0x0002; | |
| 235 | ||
| 236 | /// reset to SIG_DFL when taking signal | |
| 237 | pub const SA_RESETHAND = 0x0004; | |
| 238 | ||
| 239 | /// do not generate SIGCHLD on child stop | |
| 240 | pub const SA_NOCLDSTOP = 0x0008; | |
| 241 | ||
| 242 | /// don't mask the signal we're delivering | |
| 243 | pub const SA_NODEFER = 0x0010; | |
| 244 | ||
| 245 | /// don't keep zombies around | |
| 246 | pub const SA_NOCLDWAIT = 0x0020; | |
| 247 | ||
| 248 | /// signal handler with SA_SIGINFO args | |
| 249 | pub const SA_SIGINFO = 0x0040; | |
| 250 | ||
| 251 | /// do not bounce off kernel's sigtramp | |
| 252 | pub const SA_USERTRAMP = 0x0100; | |
| 253 | ||
| 254 | /// signal handler with SA_SIGINFO args with 64bit regs information | |
| 255 | pub const SA_64REGSET = 0x0200; | |
| 256 | ||
| 257 | pub const O_LARGEFILE = 0x0000; | |
| 258 | pub const O_PATH = 0x0000; | |
| 259 | ||
| 260 | pub const F_OK = 0; | |
| 261 | pub const X_OK = 1; | |
| 262 | pub const W_OK = 2; | |
| 263 | pub const R_OK = 4; | |
| 264 | ||
| 265 | /// open for reading only | |
| 266 | pub const O_RDONLY = 0x0000; | |
| 267 | ||
| 268 | /// open for writing only | |
| 269 | pub const O_WRONLY = 0x0001; | |
| 270 | ||
| 271 | /// open for reading and writing | |
| 272 | pub const O_RDWR = 0x0002; | |
| 273 | ||
| 274 | /// do not block on open or for data to become available | |
| 275 | pub const O_NONBLOCK = 0x0004; | |
| 276 | ||
| 277 | /// append on each write | |
| 278 | pub const O_APPEND = 0x0008; | |
| 279 | ||
| 280 | /// create file if it does not exist | |
| 281 | pub const O_CREAT = 0x0200; | |
| 282 | ||
| 283 | /// truncate size to 0 | |
| 284 | pub const O_TRUNC = 0x0400; | |
| 285 | ||
| 286 | /// error if O_CREAT and the file exists | |
| 287 | pub const O_EXCL = 0x0800; | |
| 288 | ||
| 289 | /// atomically obtain a shared lock | |
| 290 | pub const O_SHLOCK = 0x0010; | |
| 291 | ||
| 292 | /// atomically obtain an exclusive lock | |
| 293 | pub const O_EXLOCK = 0x0020; | |
| 294 | ||
| 295 | /// do not follow symlinks | |
| 296 | pub const O_NOFOLLOW = 0x0100; | |
| 297 | ||
| 298 | /// allow open of symlinks | |
| 299 | pub const O_SYMLINK = 0x200000; | |
| 300 | ||
| 301 | /// descriptor requested for event notifications only | |
| 302 | pub const O_EVTONLY = 0x8000; | |
| 303 | ||
| 304 | /// mark as close-on-exec | |
| 305 | pub const O_CLOEXEC = 0x1000000; | |
| 306 | ||
| 307 | pub const O_ACCMODE = 3; | |
| 308 | pub const O_ALERT = 536870912; | |
| 309 | pub const O_ASYNC = 64; | |
| 310 | pub const O_DIRECTORY = 1048576; | |
| 311 | pub const O_DP_GETRAWENCRYPTED = 1; | |
| 312 | pub const O_DP_GETRAWUNENCRYPTED = 2; | |
| 313 | pub const O_DSYNC = 4194304; | |
| 314 | pub const O_FSYNC = O_SYNC; | |
| 315 | pub const O_NOCTTY = 131072; | |
| 316 | pub const O_POPUP = 2147483648; | |
| 317 | pub const O_SYNC = 128; | |
| 318 | ||
| 319 | pub const SEEK_SET = 0x0; | |
| 320 | pub const SEEK_CUR = 0x1; | |
| 321 | pub const SEEK_END = 0x2; | |
| 322 | ||
| 323 | pub const DT_UNKNOWN = 0; | |
| 324 | pub const DT_FIFO = 1; | |
| 325 | pub const DT_CHR = 2; | |
| 326 | pub const DT_DIR = 4; | |
| 327 | pub const DT_BLK = 6; | |
| 328 | pub const DT_REG = 8; | |
| 329 | pub const DT_LNK = 10; | |
| 330 | pub const DT_SOCK = 12; | |
| 331 | pub const DT_WHT = 14; | |
| 332 | ||
| 333 | /// block specified signal set | |
| 334 | pub const SIG_BLOCK = 1; | |
| 335 | ||
| 336 | /// unblock specified signal set | |
| 337 | pub const SIG_UNBLOCK = 2; | |
| 338 | ||
| 339 | /// set specified signal set | |
| 340 | pub const SIG_SETMASK = 3; | |
| 341 | ||
| 342 | /// hangup | |
| 343 | pub const SIGHUP = 1; | |
| 344 | ||
| 345 | /// interrupt | |
| 346 | pub const SIGINT = 2; | |
| 347 | ||
| 348 | /// quit | |
| 349 | pub const SIGQUIT = 3; | |
| 350 | ||
| 351 | /// illegal instruction (not reset when caught) | |
| 352 | pub const SIGILL = 4; | |
| 353 | ||
| 354 | /// trace trap (not reset when caught) | |
| 355 | pub const SIGTRAP = 5; | |
| 356 | ||
| 357 | /// abort() | |
| 358 | pub const SIGABRT = 6; | |
| 359 | ||
| 360 | /// pollable event ([XSR] generated, not supported) | |
| 361 | pub const SIGPOLL = 7; | |
| 362 | ||
| 363 | /// compatibility | |
| 364 | pub const SIGIOT = SIGABRT; | |
| 365 | ||
| 366 | /// EMT instruction | |
| 367 | pub const SIGEMT = 7; | |
| 368 | ||
| 369 | /// floating point exception | |
| 370 | pub const SIGFPE = 8; | |
| 371 | ||
| 372 | /// kill (cannot be caught or ignored) | |
| 373 | pub const SIGKILL = 9; | |
| 374 | ||
| 375 | /// bus error | |
| 376 | pub const SIGBUS = 10; | |
| 377 | ||
| 378 | /// segmentation violation | |
| 379 | pub const SIGSEGV = 11; | |
| 380 | ||
| 381 | /// bad argument to system call | |
| 382 | pub const SIGSYS = 12; | |
| 383 | ||
| 384 | /// write on a pipe with no one to read it | |
| 385 | pub const SIGPIPE = 13; | |
| 386 | ||
| 387 | /// alarm clock | |
| 388 | pub const SIGALRM = 14; | |
| 389 | ||
| 390 | /// software termination signal from kill | |
| 391 | pub const SIGTERM = 15; | |
| 392 | ||
| 393 | /// urgent condition on IO channel | |
| 394 | pub const SIGURG = 16; | |
| 395 | ||
| 396 | /// sendable stop signal not from tty | |
| 397 | pub const SIGSTOP = 17; | |
| 398 | ||
| 399 | /// stop signal from tty | |
| 400 | pub const SIGTSTP = 18; | |
| 401 | ||
| 402 | /// continue a stopped process | |
| 403 | pub const SIGCONT = 19; | |
| 404 | ||
| 405 | /// to parent on child stop or exit | |
| 406 | pub const SIGCHLD = 20; | |
| 407 | ||
| 408 | /// to readers pgrp upon background tty read | |
| 409 | pub const SIGTTIN = 21; | |
| 410 | ||
| 411 | /// like TTIN for output if (tp->t_local&LTOSTOP) | |
| 412 | pub const SIGTTOU = 22; | |
| 413 | ||
| 414 | /// input/output possible signal | |
| 415 | pub const SIGIO = 23; | |
| 416 | ||
| 417 | /// exceeded CPU time limit | |
| 418 | pub const SIGXCPU = 24; | |
| 419 | ||
| 420 | /// exceeded file size limit | |
| 421 | pub const SIGXFSZ = 25; | |
| 422 | ||
| 423 | /// virtual time alarm | |
| 424 | pub const SIGVTALRM = 26; | |
| 425 | ||
| 426 | /// profiling time alarm | |
| 427 | pub const SIGPROF = 27; | |
| 428 | ||
| 429 | /// window size changes | |
| 430 | pub const SIGWINCH = 28; | |
| 431 | ||
| 432 | /// information request | |
| 433 | pub const SIGINFO = 29; | |
| 434 | ||
| 435 | /// user defined signal 1 | |
| 436 | pub const SIGUSR1 = 30; | |
| 437 | ||
| 438 | /// user defined signal 2 | |
| 439 | pub const SIGUSR2 = 31; | |
| 440 | ||
| 441 | /// no flag value | |
| 442 | pub const KEVENT_FLAG_NONE = 0x000; | |
| 443 | ||
| 444 | /// immediate timeout | |
| 445 | pub const KEVENT_FLAG_IMMEDIATE = 0x001; | |
| 446 | ||
| 447 | /// output events only include change | |
| 448 | pub const KEVENT_FLAG_ERROR_EVENTS = 0x002; | |
| 449 | ||
| 450 | /// add event to kq (implies enable) | |
| 451 | pub const EV_ADD = 0x0001; | |
| 452 | ||
| 453 | /// delete event from kq | |
| 454 | pub const EV_DELETE = 0x0002; | |
| 455 | ||
| 456 | /// enable event | |
| 457 | pub const EV_ENABLE = 0x0004; | |
| 458 | ||
| 459 | /// disable event (not reported) | |
| 460 | pub const EV_DISABLE = 0x0008; | |
| 461 | ||
| 462 | /// only report one occurrence | |
| 463 | pub const EV_ONESHOT = 0x0010; | |
| 464 | ||
| 465 | /// clear event state after reporting | |
| 466 | pub const EV_CLEAR = 0x0020; | |
| 467 | ||
| 468 | /// force immediate event output | |
| 469 | /// ... with or without EV_ERROR | |
| 470 | /// ... use KEVENT_FLAG_ERROR_EVENTS | |
| 471 | /// on syscalls supporting flags | |
| 472 | pub const EV_RECEIPT = 0x0040; | |
| 473 | ||
| 474 | /// disable event after reporting | |
| 475 | pub const EV_DISPATCH = 0x0080; | |
| 476 | ||
| 477 | /// unique kevent per udata value | |
| 478 | pub const EV_UDATA_SPECIFIC = 0x0100; | |
| 479 | ||
| 480 | /// ... in combination with EV_DELETE | |
| 481 | /// will defer delete until udata-specific | |
| 482 | /// event enabled. EINPROGRESS will be | |
| 483 | /// returned to indicate the deferral | |
| 484 | pub const EV_DISPATCH2 = EV_DISPATCH | EV_UDATA_SPECIFIC; | |
| 485 | ||
| 486 | /// report that source has vanished | |
| 487 | /// ... only valid with EV_DISPATCH2 | |
| 488 | pub const EV_VANISHED = 0x0200; | |
| 489 | ||
| 490 | /// reserved by system | |
| 491 | pub const EV_SYSFLAGS = 0xF000; | |
| 492 | ||
| 493 | /// filter-specific flag | |
| 494 | pub const EV_FLAG0 = 0x1000; | |
| 495 | ||
| 496 | /// filter-specific flag | |
| 497 | pub const EV_FLAG1 = 0x2000; | |
| 498 | ||
| 499 | /// EOF detected | |
| 500 | pub const EV_EOF = 0x8000; | |
| 501 | ||
| 502 | /// error, data contains errno | |
| 503 | pub const EV_ERROR = 0x4000; | |
| 504 | ||
| 505 | pub const EV_POLL = EV_FLAG0; | |
| 506 | pub const EV_OOBAND = EV_FLAG1; | |
| 507 | ||
| 508 | pub const EVFILT_READ = -1; | |
| 509 | pub const EVFILT_WRITE = -2; | |
| 510 | ||
| 511 | /// attached to aio requests | |
| 512 | pub const EVFILT_AIO = -3; | |
| 513 | ||
| 514 | /// attached to vnodes | |
| 515 | pub const EVFILT_VNODE = -4; | |
| 516 | ||
| 517 | /// attached to struct proc | |
| 518 | pub const EVFILT_PROC = -5; | |
| 519 | ||
| 520 | /// attached to struct proc | |
| 521 | pub const EVFILT_SIGNAL = -6; | |
| 522 | ||
| 523 | /// timers | |
| 524 | pub const EVFILT_TIMER = -7; | |
| 525 | ||
| 526 | /// Mach portsets | |
| 527 | pub const EVFILT_MACHPORT = -8; | |
| 528 | ||
| 529 | /// Filesystem events | |
| 530 | pub const EVFILT_FS = -9; | |
| 531 | ||
| 532 | /// User events | |
| 533 | pub const EVFILT_USER = -10; | |
| 534 | ||
| 535 | /// Virtual memory events | |
| 536 | pub const EVFILT_VM = -12; | |
| 537 | ||
| 538 | /// Exception events | |
| 539 | pub const EVFILT_EXCEPT = -15; | |
| 540 | ||
| 541 | pub const EVFILT_SYSCOUNT = 17; | |
| 542 | ||
| 543 | /// On input, NOTE_TRIGGER causes the event to be triggered for output. | |
| 544 | pub const NOTE_TRIGGER = 0x01000000; | |
| 545 | ||
| 546 | /// ignore input fflags | |
| 547 | pub const NOTE_FFNOP = 0x00000000; | |
| 548 | ||
| 549 | /// and fflags | |
| 550 | pub const NOTE_FFAND = 0x40000000; | |
| 551 | ||
| 552 | /// or fflags | |
| 553 | pub const NOTE_FFOR = 0x80000000; | |
| 554 | ||
| 555 | /// copy fflags | |
| 556 | pub const NOTE_FFCOPY = 0xc0000000; | |
| 557 | ||
| 558 | /// mask for operations | |
| 559 | pub const NOTE_FFCTRLMASK = 0xc0000000; | |
| 560 | pub const NOTE_FFLAGSMASK = 0x00ffffff; | |
| 561 | ||
| 562 | /// low water mark | |
| 563 | pub const NOTE_LOWAT = 0x00000001; | |
| 564 | ||
| 565 | /// OOB data | |
| 566 | pub const NOTE_OOB = 0x00000002; | |
| 567 | ||
| 568 | /// vnode was removed | |
| 569 | pub const NOTE_DELETE = 0x00000001; | |
| 570 | ||
| 571 | /// data contents changed | |
| 572 | pub const NOTE_WRITE = 0x00000002; | |
| 573 | ||
| 574 | /// size increased | |
| 575 | pub const NOTE_EXTEND = 0x00000004; | |
| 576 | ||
| 577 | /// attributes changed | |
| 578 | pub const NOTE_ATTRIB = 0x00000008; | |
| 579 | ||
| 580 | /// link count changed | |
| 581 | pub const NOTE_LINK = 0x00000010; | |
| 582 | ||
| 583 | /// vnode was renamed | |
| 584 | pub const NOTE_RENAME = 0x00000020; | |
| 585 | ||
| 586 | /// vnode access was revoked | |
| 587 | pub const NOTE_REVOKE = 0x00000040; | |
| 588 | ||
| 589 | /// No specific vnode event: to test for EVFILT_READ activation | |
| 590 | pub const NOTE_NONE = 0x00000080; | |
| 591 | ||
| 592 | /// vnode was unlocked by flock(2) | |
| 593 | pub const NOTE_FUNLOCK = 0x00000100; | |
| 594 | ||
| 595 | /// process exited | |
| 596 | pub const NOTE_EXIT = 0x80000000; | |
| 597 | ||
| 598 | /// process forked | |
| 599 | pub const NOTE_FORK = 0x40000000; | |
| 600 | ||
| 601 | /// process exec'd | |
| 602 | pub const NOTE_EXEC = 0x20000000; | |
| 603 | ||
| 604 | /// shared with EVFILT_SIGNAL | |
| 605 | pub const NOTE_SIGNAL = 0x08000000; | |
| 606 | ||
| 607 | /// exit status to be returned, valid for child process only | |
| 608 | pub const NOTE_EXITSTATUS = 0x04000000; | |
| 609 | ||
| 610 | /// provide details on reasons for exit | |
| 611 | pub const NOTE_EXIT_DETAIL = 0x02000000; | |
| 612 | ||
| 613 | /// mask for signal & exit status | |
| 614 | pub const NOTE_PDATAMASK = 0x000fffff; | |
| 615 | pub const NOTE_PCTRLMASK = (~NOTE_PDATAMASK); | |
| 616 | ||
| 617 | pub const NOTE_EXIT_DETAIL_MASK = 0x00070000; | |
| 618 | pub const NOTE_EXIT_DECRYPTFAIL = 0x00010000; | |
| 619 | pub const NOTE_EXIT_MEMORY = 0x00020000; | |
| 620 | pub const NOTE_EXIT_CSERROR = 0x00040000; | |
| 621 | ||
| 622 | /// will react on memory pressure | |
| 623 | pub const NOTE_VM_PRESSURE = 0x80000000; | |
| 624 | ||
| 625 | /// will quit on memory pressure, possibly after cleaning up dirty state | |
| 626 | pub const NOTE_VM_PRESSURE_TERMINATE = 0x40000000; | |
| 627 | ||
| 628 | /// will quit immediately on memory pressure | |
| 629 | pub const NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000; | |
| 630 | ||
| 631 | /// there was an error | |
| 632 | pub const NOTE_VM_ERROR = 0x10000000; | |
| 633 | ||
| 634 | /// data is seconds | |
| 635 | pub const NOTE_SECONDS = 0x00000001; | |
| 636 | ||
| 637 | /// data is microseconds | |
| 638 | pub const NOTE_USECONDS = 0x00000002; | |
| 639 | ||
| 640 | /// data is nanoseconds | |
| 641 | pub const NOTE_NSECONDS = 0x00000004; | |
| 642 | ||
| 643 | /// absolute timeout | |
| 644 | pub const NOTE_ABSOLUTE = 0x00000008; | |
| 645 | ||
| 646 | /// ext[1] holds leeway for power aware timers | |
| 647 | pub const NOTE_LEEWAY = 0x00000010; | |
| 648 | ||
| 649 | /// system does minimal timer coalescing | |
| 650 | pub const NOTE_CRITICAL = 0x00000020; | |
| 651 | ||
| 652 | /// system does maximum timer coalescing | |
| 653 | pub const NOTE_BACKGROUND = 0x00000040; | |
| 654 | pub const NOTE_MACH_CONTINUOUS_TIME = 0x00000080; | |
| 655 | ||
| 656 | /// data is mach absolute time units | |
| 657 | pub const NOTE_MACHTIME = 0x00000100; | |
| 658 | ||
| 659 | pub const AF_UNSPEC = 0; | |
| 660 | pub const AF_LOCAL = 1; | |
| 661 | pub const AF_UNIX = AF_LOCAL; | |
| 662 | pub const AF_INET = 2; | |
| 663 | pub const AF_SYS_CONTROL = 2; | |
| 664 | pub const AF_IMPLINK = 3; | |
| 665 | pub const AF_PUP = 4; | |
| 666 | pub const AF_CHAOS = 5; | |
| 667 | pub const AF_NS = 6; | |
| 668 | pub const AF_ISO = 7; | |
| 669 | pub const AF_OSI = AF_ISO; | |
| 670 | pub const AF_ECMA = 8; | |
| 671 | pub const AF_DATAKIT = 9; | |
| 672 | pub const AF_CCITT = 10; | |
| 673 | pub const AF_SNA = 11; | |
| 674 | pub const AF_DECnet = 12; | |
| 675 | pub const AF_DLI = 13; | |
| 676 | pub const AF_LAT = 14; | |
| 677 | pub const AF_HYLINK = 15; | |
| 678 | pub const AF_APPLETALK = 16; | |
| 679 | pub const AF_ROUTE = 17; | |
| 680 | pub const AF_LINK = 18; | |
| 681 | pub const AF_XTP = 19; | |
| 682 | pub const AF_COIP = 20; | |
| 683 | pub const AF_CNT = 21; | |
| 684 | pub const AF_RTIP = 22; | |
| 685 | pub const AF_IPX = 23; | |
| 686 | pub const AF_SIP = 24; | |
| 687 | pub const AF_PIP = 25; | |
| 688 | pub const AF_ISDN = 28; | |
| 689 | pub const AF_E164 = AF_ISDN; | |
| 690 | pub const AF_KEY = 29; | |
| 691 | pub const AF_INET6 = 30; | |
| 692 | pub const AF_NATM = 31; | |
| 693 | pub const AF_SYSTEM = 32; | |
| 694 | pub const AF_NETBIOS = 33; | |
| 695 | pub const AF_PPP = 34; | |
| 696 | pub const AF_MAX = 40; | |
| 697 | ||
| 698 | pub const PF_UNSPEC = AF_UNSPEC; | |
| 699 | pub const PF_LOCAL = AF_LOCAL; | |
| 700 | pub const PF_UNIX = PF_LOCAL; | |
| 701 | pub const PF_INET = AF_INET; | |
| 702 | pub const PF_IMPLINK = AF_IMPLINK; | |
| 703 | pub const PF_PUP = AF_PUP; | |
| 704 | pub const PF_CHAOS = AF_CHAOS; | |
| 705 | pub const PF_NS = AF_NS; | |
| 706 | pub const PF_ISO = AF_ISO; | |
| 707 | pub const PF_OSI = AF_ISO; | |
| 708 | pub const PF_ECMA = AF_ECMA; | |
| 709 | pub const PF_DATAKIT = AF_DATAKIT; | |
| 710 | pub const PF_CCITT = AF_CCITT; | |
| 711 | pub const PF_SNA = AF_SNA; | |
| 712 | pub const PF_DECnet = AF_DECnet; | |
| 713 | pub const PF_DLI = AF_DLI; | |
| 714 | pub const PF_LAT = AF_LAT; | |
| 715 | pub const PF_HYLINK = AF_HYLINK; | |
| 716 | pub const PF_APPLETALK = AF_APPLETALK; | |
| 717 | pub const PF_ROUTE = AF_ROUTE; | |
| 718 | pub const PF_LINK = AF_LINK; | |
| 719 | pub const PF_XTP = AF_XTP; | |
| 720 | pub const PF_COIP = AF_COIP; | |
| 721 | pub const PF_CNT = AF_CNT; | |
| 722 | pub const PF_SIP = AF_SIP; | |
| 723 | pub const PF_IPX = AF_IPX; | |
| 724 | pub const PF_RTIP = AF_RTIP; | |
| 725 | pub const PF_PIP = AF_PIP; | |
| 726 | pub const PF_ISDN = AF_ISDN; | |
| 727 | pub const PF_KEY = AF_KEY; | |
| 728 | pub const PF_INET6 = AF_INET6; | |
| 729 | pub const PF_NATM = AF_NATM; | |
| 730 | pub const PF_SYSTEM = AF_SYSTEM; | |
| 731 | pub const PF_NETBIOS = AF_NETBIOS; | |
| 732 | pub const PF_PPP = AF_PPP; | |
| 733 | pub const PF_MAX = AF_MAX; | |
| 734 | ||
| 735 | pub const SYSPROTO_EVENT = 1; | |
| 736 | pub const SYSPROTO_CONTROL = 2; | |
| 737 | ||
| 738 | pub const SOCK_STREAM = 1; | |
| 739 | pub const SOCK_DGRAM = 2; | |
| 740 | pub const SOCK_RAW = 3; | |
| 741 | pub const SOCK_RDM = 4; | |
| 742 | pub const SOCK_SEQPACKET = 5; | |
| 743 | pub const SOCK_MAXADDRLEN = 255; | |
| 744 | ||
| 745 | pub const IPPROTO_ICMP = 1; | |
| 746 | pub const IPPROTO_ICMPV6 = 58; | |
| 747 | pub const IPPROTO_TCP = 6; | |
| 748 | pub const IPPROTO_UDP = 17; | |
| 749 | pub const IPPROTO_IP = 0; | |
| 750 | pub const IPPROTO_IPV6 = 41; | |
| 751 | ||
| 752 | fn wstatus(x: i32) i32 { | |
| 753 | return x & 0o177; | |
| 754 | } | |
| 755 | const wstopped = 0o177; | |
| 756 | pub fn WEXITSTATUS(x: i32) i32 { | |
| 757 | return x >> 8; | |
| 758 | } | |
| 759 | pub fn WTERMSIG(x: i32) i32 { | |
| 760 | return wstatus(x); | |
| 761 | } | |
| 762 | pub fn WSTOPSIG(x: i32) i32 { | |
| 763 | return x >> 8; | |
| 764 | } | |
| 765 | pub fn WIFEXITED(x: i32) bool { | |
| 766 | return wstatus(x) == 0; | |
| 767 | } | |
| 768 | pub fn WIFSTOPPED(x: i32) bool { | |
| 769 | return wstatus(x) == wstopped and WSTOPSIG(x) != 0x13; | |
| 770 | } | |
| 771 | pub fn WIFSIGNALED(x: i32) bool { | |
| 772 | return wstatus(x) != wstopped and wstatus(x) != 0; | |
| 773 | } | |
| 774 | ||
| 775 | /// Operation not permitted | |
| 776 | pub const EPERM = 1; | |
| 777 | ||
| 778 | /// No such file or directory | |
| 779 | pub const ENOENT = 2; | |
| 780 | ||
| 781 | /// No such process | |
| 782 | pub const ESRCH = 3; | |
| 783 | ||
| 784 | /// Interrupted system call | |
| 785 | pub const EINTR = 4; | |
| 786 | ||
| 787 | /// Input/output error | |
| 788 | pub const EIO = 5; | |
| 789 | ||
| 790 | /// Device not configured | |
| 791 | pub const ENXIO = 6; | |
| 792 | ||
| 793 | /// Argument list too long | |
| 794 | pub const E2BIG = 7; | |
| 795 | ||
| 796 | /// Exec format error | |
| 797 | pub const ENOEXEC = 8; | |
| 798 | ||
| 799 | /// Bad file descriptor | |
| 800 | pub const EBADF = 9; | |
| 801 | ||
| 802 | /// No child processes | |
| 803 | pub const ECHILD = 10; | |
| 804 | ||
| 805 | /// Resource deadlock avoided | |
| 806 | pub const EDEADLK = 11; | |
| 807 | ||
| 808 | /// Cannot allocate memory | |
| 809 | pub const ENOMEM = 12; | |
| 810 | ||
| 811 | /// Permission denied | |
| 812 | pub const EACCES = 13; | |
| 813 | ||
| 814 | /// Bad address | |
| 815 | pub const EFAULT = 14; | |
| 816 | ||
| 817 | /// Block device required | |
| 818 | pub const ENOTBLK = 15; | |
| 819 | ||
| 820 | /// Device / Resource busy | |
| 821 | pub const EBUSY = 16; | |
| 822 | ||
| 823 | /// File exists | |
| 824 | pub const EEXIST = 17; | |
| 825 | ||
| 826 | /// Cross-device link | |
| 827 | pub const EXDEV = 18; | |
| 828 | ||
| 829 | /// Operation not supported by device | |
| 830 | pub const ENODEV = 19; | |
| 831 | ||
| 832 | /// Not a directory | |
| 833 | pub const ENOTDIR = 20; | |
| 834 | ||
| 835 | /// Is a directory | |
| 836 | pub const EISDIR = 21; | |
| 837 | ||
| 838 | /// Invalid argument | |
| 839 | pub const EINVAL = 22; | |
| 840 | ||
| 841 | /// Too many open files in system | |
| 842 | pub const ENFILE = 23; | |
| 843 | ||
| 844 | /// Too many open files | |
| 845 | pub const EMFILE = 24; | |
| 846 | ||
| 847 | /// Inappropriate ioctl for device | |
| 848 | pub const ENOTTY = 25; | |
| 849 | ||
| 850 | /// Text file busy | |
| 851 | pub const ETXTBSY = 26; | |
| 852 | ||
| 853 | /// File too large | |
| 854 | pub const EFBIG = 27; | |
| 855 | ||
| 856 | /// No space left on device | |
| 857 | pub const ENOSPC = 28; | |
| 858 | ||
| 859 | /// Illegal seek | |
| 860 | pub const ESPIPE = 29; | |
| 861 | ||
| 862 | /// Read-only file system | |
| 863 | pub const EROFS = 30; | |
| 864 | ||
| 865 | /// Too many links | |
| 866 | pub const EMLINK = 31; | |
| 867 | /// Broken pipe | |
| 868 | ||
| 869 | // math software | |
| 870 | pub const EPIPE = 32; | |
| 871 | ||
| 872 | /// Numerical argument out of domain | |
| 873 | pub const EDOM = 33; | |
| 874 | /// Result too large | |
| 875 | ||
| 876 | // non-blocking and interrupt i/o | |
| 877 | pub const ERANGE = 34; | |
| 878 | ||
| 879 | /// Resource temporarily unavailable | |
| 880 | pub const EAGAIN = 35; | |
| 881 | ||
| 882 | /// Operation would block | |
| 883 | pub const EWOULDBLOCK = EAGAIN; | |
| 884 | ||
| 885 | /// Operation now in progress | |
| 886 | pub const EINPROGRESS = 36; | |
| 887 | /// Operation already in progress | |
| 888 | ||
| 889 | // ipc/network software -- argument errors | |
| 890 | pub const EALREADY = 37; | |
| 891 | ||
| 892 | /// Socket operation on non-socket | |
| 893 | pub const ENOTSOCK = 38; | |
| 894 | ||
| 895 | /// Destination address required | |
| 896 | pub const EDESTADDRREQ = 39; | |
| 897 | ||
| 898 | /// Message too long | |
| 899 | pub const EMSGSIZE = 40; | |
| 900 | ||
| 901 | /// Protocol wrong type for socket | |
| 902 | pub const EPROTOTYPE = 41; | |
| 903 | ||
| 904 | /// Protocol not available | |
| 905 | pub const ENOPROTOOPT = 42; | |
| 906 | ||
| 907 | /// Protocol not supported | |
| 908 | pub const EPROTONOSUPPORT = 43; | |
| 909 | ||
| 910 | /// Socket type not supported | |
| 911 | pub const ESOCKTNOSUPPORT = 44; | |
| 912 | ||
| 913 | /// Operation not supported | |
| 914 | pub const ENOTSUP = 45; | |
| 915 | ||
| 916 | /// Protocol family not supported | |
| 917 | pub const EPFNOSUPPORT = 46; | |
| 918 | ||
| 919 | /// Address family not supported by protocol family | |
| 920 | pub const EAFNOSUPPORT = 47; | |
| 921 | ||
| 922 | /// Address already in use | |
| 923 | pub const EADDRINUSE = 48; | |
| 924 | /// Can't assign requested address | |
| 925 | ||
| 926 | // ipc/network software -- operational errors | |
| 927 | pub const EADDRNOTAVAIL = 49; | |
| 928 | ||
| 929 | /// Network is down | |
| 930 | pub const ENETDOWN = 50; | |
| 931 | ||
| 932 | /// Network is unreachable | |
| 933 | pub const ENETUNREACH = 51; | |
| 934 | ||
| 935 | /// Network dropped connection on reset | |
| 936 | pub const ENETRESET = 52; | |
| 937 | ||
| 938 | /// Software caused connection abort | |
| 939 | pub const ECONNABORTED = 53; | |
| 940 | ||
| 941 | /// Connection reset by peer | |
| 942 | pub const ECONNRESET = 54; | |
| 943 | ||
| 944 | /// No buffer space available | |
| 945 | pub const ENOBUFS = 55; | |
| 946 | ||
| 947 | /// Socket is already connected | |
| 948 | pub const EISCONN = 56; | |
| 949 | ||
| 950 | /// Socket is not connected | |
| 951 | pub const ENOTCONN = 57; | |
| 952 | ||
| 953 | /// Can't send after socket shutdown | |
| 954 | pub const ESHUTDOWN = 58; | |
| 955 | ||
| 956 | /// Too many references: can't splice | |
| 957 | pub const ETOOMANYREFS = 59; | |
| 958 | ||
| 959 | /// Operation timed out | |
| 960 | pub const ETIMEDOUT = 60; | |
| 961 | ||
| 962 | /// Connection refused | |
| 963 | pub const ECONNREFUSED = 61; | |
| 964 | ||
| 965 | /// Too many levels of symbolic links | |
| 966 | pub const ELOOP = 62; | |
| 967 | ||
| 968 | /// File name too long | |
| 969 | pub const ENAMETOOLONG = 63; | |
| 970 | ||
| 971 | /// Host is down | |
| 972 | pub const EHOSTDOWN = 64; | |
| 973 | ||
| 974 | /// No route to host | |
| 975 | pub const EHOSTUNREACH = 65; | |
| 976 | /// Directory not empty | |
| 977 | ||
| 978 | // quotas & mush | |
| 979 | pub const ENOTEMPTY = 66; | |
| 980 | ||
| 981 | /// Too many processes | |
| 982 | pub const EPROCLIM = 67; | |
| 983 | ||
| 984 | /// Too many users | |
| 985 | pub const EUSERS = 68; | |
| 986 | /// Disc quota exceeded | |
| 987 | ||
| 988 | // Network File System | |
| 989 | pub const EDQUOT = 69; | |
| 990 | ||
| 991 | /// Stale NFS file handle | |
| 992 | pub const ESTALE = 70; | |
| 993 | ||
| 994 | /// Too many levels of remote in path | |
| 995 | pub const EREMOTE = 71; | |
| 996 | ||
| 997 | /// RPC struct is bad | |
| 998 | pub const EBADRPC = 72; | |
| 999 | ||
| 1000 | /// RPC version wrong | |
| 1001 | pub const ERPCMISMATCH = 73; | |
| 1002 | ||
| 1003 | /// RPC prog. not avail | |
| 1004 | pub const EPROGUNAVAIL = 74; | |
| 1005 | ||
| 1006 | /// Program version wrong | |
| 1007 | pub const EPROGMISMATCH = 75; | |
| 1008 | ||
| 1009 | /// Bad procedure for program | |
| 1010 | pub const EPROCUNAVAIL = 76; | |
| 1011 | ||
| 1012 | /// No locks available | |
| 1013 | pub const ENOLCK = 77; | |
| 1014 | ||
| 1015 | /// Function not implemented | |
| 1016 | pub const ENOSYS = 78; | |
| 1017 | ||
| 1018 | /// Inappropriate file type or format | |
| 1019 | pub const EFTYPE = 79; | |
| 1020 | ||
| 1021 | /// Authentication error | |
| 1022 | pub const EAUTH = 80; | |
| 1023 | /// Need authenticator | |
| 1024 | ||
| 1025 | // Intelligent device errors | |
| 1026 | pub const ENEEDAUTH = 81; | |
| 1027 | ||
| 1028 | /// Device power is off | |
| 1029 | pub const EPWROFF = 82; | |
| 1030 | ||
| 1031 | /// Device error, e.g. paper out | |
| 1032 | pub const EDEVERR = 83; | |
| 1033 | /// Value too large to be stored in data type | |
| 1034 | ||
| 1035 | // Program loading errors | |
| 1036 | pub const EOVERFLOW = 84; | |
| 1037 | ||
| 1038 | /// Bad executable | |
| 1039 | pub const EBADEXEC = 85; | |
| 1040 | ||
| 1041 | /// Bad CPU type in executable | |
| 1042 | pub const EBADARCH = 86; | |
| 1043 | ||
| 1044 | /// Shared library version mismatch | |
| 1045 | pub const ESHLIBVERS = 87; | |
| 1046 | ||
| 1047 | /// Malformed Macho file | |
| 1048 | pub const EBADMACHO = 88; | |
| 1049 | ||
| 1050 | /// Operation canceled | |
| 1051 | pub const ECANCELED = 89; | |
| 1052 | ||
| 1053 | /// Identifier removed | |
| 1054 | pub const EIDRM = 90; | |
| 1055 | ||
| 1056 | /// No message of desired type | |
| 1057 | pub const ENOMSG = 91; | |
| 1058 | ||
| 1059 | /// Illegal byte sequence | |
| 1060 | pub const EILSEQ = 92; | |
| 1061 | ||
| 1062 | /// Attribute not found | |
| 1063 | pub const ENOATTR = 93; | |
| 1064 | ||
| 1065 | /// Bad message | |
| 1066 | pub const EBADMSG = 94; | |
| 1067 | ||
| 1068 | /// Reserved | |
| 1069 | pub const EMULTIHOP = 95; | |
| 1070 | ||
| 1071 | /// No message available on STREAM | |
| 1072 | pub const ENODATA = 96; | |
| 1073 | ||
| 1074 | /// Reserved | |
| 1075 | pub const ENOLINK = 97; | |
| 1076 | ||
| 1077 | /// No STREAM resources | |
| 1078 | pub const ENOSR = 98; | |
| 1079 | ||
| 1080 | /// Not a STREAM | |
| 1081 | pub const ENOSTR = 99; | |
| 1082 | ||
| 1083 | /// Protocol error | |
| 1084 | pub const EPROTO = 100; | |
| 1085 | ||
| 1086 | /// STREAM ioctl timeout | |
| 1087 | pub const ETIME = 101; | |
| 1088 | ||
| 1089 | /// No such policy registered | |
| 1090 | pub const ENOPOLICY = 103; | |
| 1091 | ||
| 1092 | /// State not recoverable | |
| 1093 | pub const ENOTRECOVERABLE = 104; | |
| 1094 | ||
| 1095 | /// Previous owner died | |
| 1096 | pub const EOWNERDEAD = 105; | |
| 1097 | ||
| 1098 | /// Interface output queue is full | |
| 1099 | pub const EQFULL = 106; | |
| 1100 | ||
| 1101 | /// Must be equal largest errno | |
| 1102 | pub const ELAST = 106; |
std/os/bits/freebsd.zig created+840| ... | ... | @@ -0,0 +1,840 @@ |
| 1 | pub const fd_t = c_int; | |
| 2 | pub const pid_t = c_int; | |
| 3 | ||
| 4 | /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. | |
| 5 | pub const Kevent = extern struct { | |
| 6 | ident: usize, | |
| 7 | filter: i16, | |
| 8 | flags: u16, | |
| 9 | fflags: u32, | |
| 10 | data: i64, | |
| 11 | udata: usize, | |
| 12 | // TODO ext | |
| 13 | }; | |
| 14 | ||
| 15 | pub const pthread_attr_t = extern struct { | |
| 16 | __size: [56]u8, | |
| 17 | __align: c_long, | |
| 18 | }; | |
| 19 | ||
| 20 | pub const msghdr = extern struct { | |
| 21 | /// optional address | |
| 22 | msg_name: ?*sockaddr, | |
| 23 | ||
| 24 | /// size of address | |
| 25 | msg_namelen: socklen_t, | |
| 26 | ||
| 27 | /// scatter/gather array | |
| 28 | msg_iov: [*]iovec, | |
| 29 | ||
| 30 | /// # elements in msg_iov | |
| 31 | msg_iovlen: i32, | |
| 32 | ||
| 33 | /// ancillary data | |
| 34 | msg_control: ?*c_void, | |
| 35 | ||
| 36 | /// ancillary data buffer len | |
| 37 | msg_controllen: socklen_t, | |
| 38 | ||
| 39 | /// flags on received message | |
| 40 | msg_flags: i32, | |
| 41 | }; | |
| 42 | ||
| 43 | pub const msghdr_const = extern struct { | |
| 44 | /// optional address | |
| 45 | msg_name: ?*const sockaddr, | |
| 46 | ||
| 47 | /// size of address | |
| 48 | msg_namelen: socklen_t, | |
| 49 | ||
| 50 | /// scatter/gather array | |
| 51 | msg_iov: [*]iovec_const, | |
| 52 | ||
| 53 | /// # elements in msg_iov | |
| 54 | msg_iovlen: i32, | |
| 55 | ||
| 56 | /// ancillary data | |
| 57 | msg_control: ?*c_void, | |
| 58 | ||
| 59 | /// ancillary data buffer len | |
| 60 | msg_controllen: socklen_t, | |
| 61 | ||
| 62 | /// flags on received message | |
| 63 | msg_flags: i32, | |
| 64 | }; | |
| 65 | ||
| 66 | pub const Stat = extern struct { | |
| 67 | dev: u64, | |
| 68 | ino: u64, | |
| 69 | nlink: usize, | |
| 70 | ||
| 71 | mode: u16, | |
| 72 | __pad0: u16, | |
| 73 | uid: u32, | |
| 74 | gid: u32, | |
| 75 | __pad1: u32, | |
| 76 | rdev: u64, | |
| 77 | ||
| 78 | atim: timespec, | |
| 79 | mtim: timespec, | |
| 80 | ctim: timespec, | |
| 81 | birthtim: timespec, | |
| 82 | ||
| 83 | size: i64, | |
| 84 | blocks: i64, | |
| 85 | blksize: isize, | |
| 86 | flags: u32, | |
| 87 | gen: u64, | |
| 88 | __spare: [10]u64, | |
| 89 | }; | |
| 90 | ||
| 91 | pub const timespec = extern struct { | |
| 92 | tv_sec: isize, | |
| 93 | tv_nsec: isize, | |
| 94 | }; | |
| 95 | ||
| 96 | pub const dirent = extern struct { | |
| 97 | d_fileno: usize, | |
| 98 | d_off: i64, | |
| 99 | d_reclen: u16, | |
| 100 | d_type: u8, | |
| 101 | d_pad0: u8, | |
| 102 | d_namlen: u16, | |
| 103 | d_pad1: u16, | |
| 104 | d_name: [256]u8, | |
| 105 | }; | |
| 106 | ||
| 107 | pub const in_port_t = u16; | |
| 108 | pub const sa_family_t = u16; | |
| 109 | ||
| 110 | pub const sockaddr = extern union { | |
| 111 | in: sockaddr_in, | |
| 112 | in6: sockaddr_in6, | |
| 113 | }; | |
| 114 | ||
| 115 | pub const sockaddr_in = extern struct { | |
| 116 | len: u8, | |
| 117 | family: sa_family_t, | |
| 118 | port: in_port_t, | |
| 119 | addr: [16]u8, | |
| 120 | zero: [8]u8, | |
| 121 | }; | |
| 122 | ||
| 123 | pub const sockaddr_in6 = extern struct { | |
| 124 | len: u8, | |
| 125 | family: sa_family_t, | |
| 126 | port: in_port_t, | |
| 127 | flowinfo: u32, | |
| 128 | addr: [16]u8, | |
| 129 | scope_id: u32, | |
| 130 | }; | |
| 131 | ||
| 132 | pub const CTL_KERN = 1; | |
| 133 | pub const CTL_DEBUG = 5; | |
| 134 | ||
| 135 | pub const KERN_PROC = 14; // struct: process entries | |
| 136 | pub const KERN_PROC_PATHNAME = 12; // path to executable | |
| 137 | ||
| 138 | pub const PATH_MAX = 1024; | |
| 139 | ||
| 140 | pub const STDIN_FILENO = 0; | |
| 141 | pub const STDOUT_FILENO = 1; | |
| 142 | pub const STDERR_FILENO = 2; | |
| 143 | ||
| 144 | pub const PROT_NONE = 0; | |
| 145 | pub const PROT_READ = 1; | |
| 146 | pub const PROT_WRITE = 2; | |
| 147 | pub const PROT_EXEC = 4; | |
| 148 | ||
| 149 | pub const CLOCK_REALTIME = 0; | |
| 150 | pub const CLOCK_VIRTUAL = 1; | |
| 151 | pub const CLOCK_PROF = 2; | |
| 152 | pub const CLOCK_MONOTONIC = 4; | |
| 153 | pub const CLOCK_UPTIME = 5; | |
| 154 | pub const CLOCK_UPTIME_PRECISE = 7; | |
| 155 | pub const CLOCK_UPTIME_FAST = 8; | |
| 156 | pub const CLOCK_REALTIME_PRECISE = 9; | |
| 157 | pub const CLOCK_REALTIME_FAST = 10; | |
| 158 | pub const CLOCK_MONOTONIC_PRECISE = 11; | |
| 159 | pub const CLOCK_MONOTONIC_FAST = 12; | |
| 160 | pub const CLOCK_SECOND = 13; | |
| 161 | pub const CLOCK_THREAD_CPUTIME_ID = 14; | |
| 162 | pub const CLOCK_PROCESS_CPUTIME_ID = 15; | |
| 163 | ||
| 164 | pub const MAP_FAILED = maxInt(usize); | |
| 165 | pub const MAP_SHARED = 0x0001; | |
| 166 | pub const MAP_PRIVATE = 0x0002; | |
| 167 | pub const MAP_FIXED = 0x0010; | |
| 168 | pub const MAP_STACK = 0x0400; | |
| 169 | pub const MAP_NOSYNC = 0x0800; | |
| 170 | pub const MAP_ANON = 0x1000; | |
| 171 | pub const MAP_ANONYMOUS = MAP_ANON; | |
| 172 | pub const MAP_FILE = 0; | |
| 173 | pub const MAP_NORESERVE = 0; | |
| 174 | ||
| 175 | pub const MAP_GUARD = 0x00002000; | |
| 176 | pub const MAP_EXCL = 0x00004000; | |
| 177 | pub const MAP_NOCORE = 0x00020000; | |
| 178 | pub const MAP_PREFAULT_READ = 0x00040000; | |
| 179 | pub const MAP_32BIT = 0x00080000; | |
| 180 | ||
| 181 | pub const WNOHANG = 1; | |
| 182 | pub const WUNTRACED = 2; | |
| 183 | pub const WSTOPPED = WUNTRACED; | |
| 184 | pub const WCONTINUED = 4; | |
| 185 | pub const WNOWAIT = 8; | |
| 186 | pub const WEXITED = 16; | |
| 187 | pub const WTRAPPED = 32; | |
| 188 | ||
| 189 | pub const SA_ONSTACK = 0x0001; | |
| 190 | pub const SA_RESTART = 0x0002; | |
| 191 | pub const SA_RESETHAND = 0x0004; | |
| 192 | pub const SA_NOCLDSTOP = 0x0008; | |
| 193 | pub const SA_NODEFER = 0x0010; | |
| 194 | pub const SA_NOCLDWAIT = 0x0020; | |
| 195 | pub const SA_SIGINFO = 0x0040; | |
| 196 | ||
| 197 | pub const SIGHUP = 1; | |
| 198 | pub const SIGINT = 2; | |
| 199 | pub const SIGQUIT = 3; | |
| 200 | pub const SIGILL = 4; | |
| 201 | pub const SIGTRAP = 5; | |
| 202 | pub const SIGABRT = 6; | |
| 203 | pub const SIGIOT = SIGABRT; | |
| 204 | pub const SIGEMT = 7; | |
| 205 | pub const SIGFPE = 8; | |
| 206 | pub const SIGKILL = 9; | |
| 207 | pub const SIGBUS = 10; | |
| 208 | pub const SIGSEGV = 11; | |
| 209 | pub const SIGSYS = 12; | |
| 210 | pub const SIGPIPE = 13; | |
| 211 | pub const SIGALRM = 14; | |
| 212 | pub const SIGTERM = 15; | |
| 213 | pub const SIGURG = 16; | |
| 214 | pub const SIGSTOP = 17; | |
| 215 | pub const SIGTSTP = 18; | |
| 216 | pub const SIGCONT = 19; | |
| 217 | pub const SIGCHLD = 20; | |
| 218 | pub const SIGTTIN = 21; | |
| 219 | pub const SIGTTOU = 22; | |
| 220 | pub const SIGIO = 23; | |
| 221 | pub const SIGXCPU = 24; | |
| 222 | pub const SIGXFSZ = 25; | |
| 223 | pub const SIGVTALRM = 26; | |
| 224 | pub const SIGPROF = 27; | |
| 225 | pub const SIGWINCH = 28; | |
| 226 | pub const SIGINFO = 29; | |
| 227 | pub const SIGUSR1 = 30; | |
| 228 | pub const SIGUSR2 = 31; | |
| 229 | pub const SIGTHR = 32; | |
| 230 | pub const SIGLWP = SIGTHR; | |
| 231 | pub const SIGLIBRT = 33; | |
| 232 | ||
| 233 | pub const SIGRTMIN = 65; | |
| 234 | pub const SIGRTMAX = 126; | |
| 235 | ||
| 236 | // access function | |
| 237 | pub const F_OK = 0; // test for existence of file | |
| 238 | pub const X_OK = 1; // test for execute or search permission | |
| 239 | pub const W_OK = 2; // test for write permission | |
| 240 | pub const R_OK = 4; // test for read permission | |
| 241 | ||
| 242 | pub const O_RDONLY = 0x0000; | |
| 243 | pub const O_WRONLY = 0x0001; | |
| 244 | pub const O_RDWR = 0x0002; | |
| 245 | pub const O_ACCMODE = 0x0003; | |
| 246 | ||
| 247 | pub const O_CREAT = 0x0200; | |
| 248 | pub const O_EXCL = 0x0800; | |
| 249 | pub const O_NOCTTY = 0x8000; | |
| 250 | pub const O_TRUNC = 0x0400; | |
| 251 | pub const O_APPEND = 0x0008; | |
| 252 | pub const O_NONBLOCK = 0x0004; | |
| 253 | pub const O_DSYNC = 0o10000; | |
| 254 | pub const O_SYNC = 0x0080; | |
| 255 | pub const O_RSYNC = 0o4010000; | |
| 256 | pub const O_DIRECTORY = 0o200000; | |
| 257 | pub const O_NOFOLLOW = 0x0100; | |
| 258 | pub const O_CLOEXEC = 0x00100000; | |
| 259 | ||
| 260 | pub const O_ASYNC = 0x0040; | |
| 261 | pub const O_DIRECT = 0x00010000; | |
| 262 | pub const O_LARGEFILE = 0; | |
| 263 | pub const O_NOATIME = 0o1000000; | |
| 264 | pub const O_PATH = 0o10000000; | |
| 265 | pub const O_TMPFILE = 0o20200000; | |
| 266 | pub const O_NDELAY = O_NONBLOCK; | |
| 267 | ||
| 268 | pub const F_DUPFD = 0; | |
| 269 | pub const F_GETFD = 1; | |
| 270 | pub const F_SETFD = 2; | |
| 271 | pub const F_GETFL = 3; | |
| 272 | pub const F_SETFL = 4; | |
| 273 | ||
| 274 | pub const F_SETOWN = 8; | |
| 275 | pub const F_GETOWN = 9; | |
| 276 | pub const F_SETSIG = 10; | |
| 277 | pub const F_GETSIG = 11; | |
| 278 | ||
| 279 | pub const F_GETLK = 5; | |
| 280 | pub const F_SETLK = 6; | |
| 281 | pub const F_SETLKW = 7; | |
| 282 | ||
| 283 | pub const F_SETOWN_EX = 15; | |
| 284 | pub const F_GETOWN_EX = 16; | |
| 285 | ||
| 286 | pub const F_GETOWNER_UIDS = 17; | |
| 287 | ||
| 288 | pub const SEEK_SET = 0; | |
| 289 | pub const SEEK_CUR = 1; | |
| 290 | pub const SEEK_END = 2; | |
| 291 | ||
| 292 | pub const SIG_BLOCK = 1; | |
| 293 | pub const SIG_UNBLOCK = 2; | |
| 294 | pub const SIG_SETMASK = 3; | |
| 295 | ||
| 296 | pub const SOCK_STREAM = 1; | |
| 297 | pub const SOCK_DGRAM = 2; | |
| 298 | pub const SOCK_RAW = 3; | |
| 299 | pub const SOCK_RDM = 4; | |
| 300 | pub const SOCK_SEQPACKET = 5; | |
| 301 | ||
| 302 | pub const SOCK_CLOEXEC = 0x10000000; | |
| 303 | pub const SOCK_NONBLOCK = 0x20000000; | |
| 304 | ||
| 305 | pub const PROTO_ip = 0o000; | |
| 306 | pub const PROTO_icmp = 0o001; | |
| 307 | pub const PROTO_igmp = 0o002; | |
| 308 | pub const PROTO_ggp = 0o003; | |
| 309 | pub const PROTO_ipencap = 0o004; | |
| 310 | pub const PROTO_st = 0o005; | |
| 311 | pub const PROTO_tcp = 0o006; | |
| 312 | pub const PROTO_egp = 0o010; | |
| 313 | pub const PROTO_pup = 0o014; | |
| 314 | pub const PROTO_udp = 0o021; | |
| 315 | pub const PROTO_hmp = 0o024; | |
| 316 | pub const PROTO_xns_idp = 0o026; | |
| 317 | pub const PROTO_rdp = 0o033; | |
| 318 | pub const PROTO_iso_tp4 = 0o035; | |
| 319 | pub const PROTO_xtp = 0o044; | |
| 320 | pub const PROTO_ddp = 0o045; | |
| 321 | pub const PROTO_idpr_cmtp = 0o046; | |
| 322 | pub const PROTO_ipv6 = 0o051; | |
| 323 | pub const PROTO_ipv6_route = 0o053; | |
| 324 | pub const PROTO_ipv6_frag = 0o054; | |
| 325 | pub const PROTO_idrp = 0o055; | |
| 326 | pub const PROTO_rsvp = 0o056; | |
| 327 | pub const PROTO_gre = 0o057; | |
| 328 | pub const PROTO_esp = 0o062; | |
| 329 | pub const PROTO_ah = 0o063; | |
| 330 | pub const PROTO_skip = 0o071; | |
| 331 | pub const PROTO_ipv6_icmp = 0o072; | |
| 332 | pub const PROTO_ipv6_nonxt = 0o073; | |
| 333 | pub const PROTO_ipv6_opts = 0o074; | |
| 334 | pub const PROTO_rspf = 0o111; | |
| 335 | pub const PROTO_vmtp = 0o121; | |
| 336 | pub const PROTO_ospf = 0o131; | |
| 337 | pub const PROTO_ipip = 0o136; | |
| 338 | pub const PROTO_encap = 0o142; | |
| 339 | pub const PROTO_pim = 0o147; | |
| 340 | pub const PROTO_raw = 0o377; | |
| 341 | ||
| 342 | pub const PF_UNSPEC = 0; | |
| 343 | pub const PF_LOCAL = 1; | |
| 344 | pub const PF_UNIX = PF_LOCAL; | |
| 345 | pub const PF_FILE = PF_LOCAL; | |
| 346 | pub const PF_INET = 2; | |
| 347 | pub const PF_AX25 = 3; | |
| 348 | pub const PF_IPX = 4; | |
| 349 | pub const PF_APPLETALK = 5; | |
| 350 | pub const PF_NETROM = 6; | |
| 351 | pub const PF_BRIDGE = 7; | |
| 352 | pub const PF_ATMPVC = 8; | |
| 353 | pub const PF_X25 = 9; | |
| 354 | pub const PF_INET6 = 10; | |
| 355 | pub const PF_ROSE = 11; | |
| 356 | pub const PF_DECnet = 12; | |
| 357 | pub const PF_NETBEUI = 13; | |
| 358 | pub const PF_SECURITY = 14; | |
| 359 | pub const PF_KEY = 15; | |
| 360 | pub const PF_NETLINK = 16; | |
| 361 | pub const PF_ROUTE = PF_NETLINK; | |
| 362 | pub const PF_PACKET = 17; | |
| 363 | pub const PF_ASH = 18; | |
| 364 | pub const PF_ECONET = 19; | |
| 365 | pub const PF_ATMSVC = 20; | |
| 366 | pub const PF_RDS = 21; | |
| 367 | pub const PF_SNA = 22; | |
| 368 | pub const PF_IRDA = 23; | |
| 369 | pub const PF_PPPOX = 24; | |
| 370 | pub const PF_WANPIPE = 25; | |
| 371 | pub const PF_LLC = 26; | |
| 372 | pub const PF_IB = 27; | |
| 373 | pub const PF_MPLS = 28; | |
| 374 | pub const PF_CAN = 29; | |
| 375 | pub const PF_TIPC = 30; | |
| 376 | pub const PF_BLUETOOTH = 31; | |
| 377 | pub const PF_IUCV = 32; | |
| 378 | pub const PF_RXRPC = 33; | |
| 379 | pub const PF_ISDN = 34; | |
| 380 | pub const PF_PHONET = 35; | |
| 381 | pub const PF_IEEE802154 = 36; | |
| 382 | pub const PF_CAIF = 37; | |
| 383 | pub const PF_ALG = 38; | |
| 384 | pub const PF_NFC = 39; | |
| 385 | pub const PF_VSOCK = 40; | |
| 386 | pub const PF_MAX = 41; | |
| 387 | ||
| 388 | pub const AF_UNSPEC = PF_UNSPEC; | |
| 389 | pub const AF_LOCAL = PF_LOCAL; | |
| 390 | pub const AF_UNIX = AF_LOCAL; | |
| 391 | pub const AF_FILE = AF_LOCAL; | |
| 392 | pub const AF_INET = PF_INET; | |
| 393 | pub const AF_AX25 = PF_AX25; | |
| 394 | pub const AF_IPX = PF_IPX; | |
| 395 | pub const AF_APPLETALK = PF_APPLETALK; | |
| 396 | pub const AF_NETROM = PF_NETROM; | |
| 397 | pub const AF_BRIDGE = PF_BRIDGE; | |
| 398 | pub const AF_ATMPVC = PF_ATMPVC; | |
| 399 | pub const AF_X25 = PF_X25; | |
| 400 | pub const AF_INET6 = PF_INET6; | |
| 401 | pub const AF_ROSE = PF_ROSE; | |
| 402 | pub const AF_DECnet = PF_DECnet; | |
| 403 | pub const AF_NETBEUI = PF_NETBEUI; | |
| 404 | pub const AF_SECURITY = PF_SECURITY; | |
| 405 | pub const AF_KEY = PF_KEY; | |
| 406 | pub const AF_NETLINK = PF_NETLINK; | |
| 407 | pub const AF_ROUTE = PF_ROUTE; | |
| 408 | pub const AF_PACKET = PF_PACKET; | |
| 409 | pub const AF_ASH = PF_ASH; | |
| 410 | pub const AF_ECONET = PF_ECONET; | |
| 411 | pub const AF_ATMSVC = PF_ATMSVC; | |
| 412 | pub const AF_RDS = PF_RDS; | |
| 413 | pub const AF_SNA = PF_SNA; | |
| 414 | pub const AF_IRDA = PF_IRDA; | |
| 415 | pub const AF_PPPOX = PF_PPPOX; | |
| 416 | pub const AF_WANPIPE = PF_WANPIPE; | |
| 417 | pub const AF_LLC = PF_LLC; | |
| 418 | pub const AF_IB = PF_IB; | |
| 419 | pub const AF_MPLS = PF_MPLS; | |
| 420 | pub const AF_CAN = PF_CAN; | |
| 421 | pub const AF_TIPC = PF_TIPC; | |
| 422 | pub const AF_BLUETOOTH = PF_BLUETOOTH; | |
| 423 | pub const AF_IUCV = PF_IUCV; | |
| 424 | pub const AF_RXRPC = PF_RXRPC; | |
| 425 | pub const AF_ISDN = PF_ISDN; | |
| 426 | pub const AF_PHONET = PF_PHONET; | |
| 427 | pub const AF_IEEE802154 = PF_IEEE802154; | |
| 428 | pub const AF_CAIF = PF_CAIF; | |
| 429 | pub const AF_ALG = PF_ALG; | |
| 430 | pub const AF_NFC = PF_NFC; | |
| 431 | pub const AF_VSOCK = PF_VSOCK; | |
| 432 | pub const AF_MAX = PF_MAX; | |
| 433 | ||
| 434 | pub const DT_UNKNOWN = 0; | |
| 435 | pub const DT_FIFO = 1; | |
| 436 | pub const DT_CHR = 2; | |
| 437 | pub const DT_DIR = 4; | |
| 438 | pub const DT_BLK = 6; | |
| 439 | pub const DT_REG = 8; | |
| 440 | pub const DT_LNK = 10; | |
| 441 | pub const DT_SOCK = 12; | |
| 442 | pub const DT_WHT = 14; | |
| 443 | ||
| 444 | /// add event to kq (implies enable) | |
| 445 | pub const EV_ADD = 0x0001; | |
| 446 | ||
| 447 | /// delete event from kq | |
| 448 | pub const EV_DELETE = 0x0002; | |
| 449 | ||
| 450 | /// enable event | |
| 451 | pub const EV_ENABLE = 0x0004; | |
| 452 | ||
| 453 | /// disable event (not reported) | |
| 454 | pub const EV_DISABLE = 0x0008; | |
| 455 | ||
| 456 | /// only report one occurrence | |
| 457 | pub const EV_ONESHOT = 0x0010; | |
| 458 | ||
| 459 | /// clear event state after reporting | |
| 460 | pub const EV_CLEAR = 0x0020; | |
| 461 | ||
| 462 | /// force immediate event output | |
| 463 | /// ... with or without EV_ERROR | |
| 464 | /// ... use KEVENT_FLAG_ERROR_EVENTS | |
| 465 | /// on syscalls supporting flags | |
| 466 | pub const EV_RECEIPT = 0x0040; | |
| 467 | ||
| 468 | /// disable event after reporting | |
| 469 | pub const EV_DISPATCH = 0x0080; | |
| 470 | ||
| 471 | pub const EVFILT_READ = -1; | |
| 472 | pub const EVFILT_WRITE = -2; | |
| 473 | ||
| 474 | /// attached to aio requests | |
| 475 | pub const EVFILT_AIO = -3; | |
| 476 | ||
| 477 | /// attached to vnodes | |
| 478 | pub const EVFILT_VNODE = -4; | |
| 479 | ||
| 480 | /// attached to struct proc | |
| 481 | pub const EVFILT_PROC = -5; | |
| 482 | ||
| 483 | /// attached to struct proc | |
| 484 | pub const EVFILT_SIGNAL = -6; | |
| 485 | ||
| 486 | /// timers | |
| 487 | pub const EVFILT_TIMER = -7; | |
| 488 | ||
| 489 | /// Process descriptors | |
| 490 | pub const EVFILT_PROCDESC = -8; | |
| 491 | ||
| 492 | /// Filesystem events | |
| 493 | pub const EVFILT_FS = -9; | |
| 494 | ||
| 495 | pub const EVFILT_LIO = -10; | |
| 496 | ||
| 497 | /// User events | |
| 498 | pub const EVFILT_USER = -11; | |
| 499 | ||
| 500 | /// Sendfile events | |
| 501 | pub const EVFILT_SENDFILE = -12; | |
| 502 | ||
| 503 | pub const EVFILT_EMPTY = -13; | |
| 504 | ||
| 505 | /// On input, NOTE_TRIGGER causes the event to be triggered for output. | |
| 506 | pub const NOTE_TRIGGER = 0x01000000; | |
| 507 | ||
| 508 | /// ignore input fflags | |
| 509 | pub const NOTE_FFNOP = 0x00000000; | |
| 510 | ||
| 511 | /// and fflags | |
| 512 | pub const NOTE_FFAND = 0x40000000; | |
| 513 | ||
| 514 | /// or fflags | |
| 515 | pub const NOTE_FFOR = 0x80000000; | |
| 516 | ||
| 517 | /// copy fflags | |
| 518 | pub const NOTE_FFCOPY = 0xc0000000; | |
| 519 | ||
| 520 | /// mask for operations | |
| 521 | pub const NOTE_FFCTRLMASK = 0xc0000000; | |
| 522 | pub const NOTE_FFLAGSMASK = 0x00ffffff; | |
| 523 | ||
| 524 | /// low water mark | |
| 525 | pub const NOTE_LOWAT = 0x00000001; | |
| 526 | ||
| 527 | /// behave like poll() | |
| 528 | pub const NOTE_FILE_POLL = 0x00000002; | |
| 529 | ||
| 530 | /// vnode was removed | |
| 531 | pub const NOTE_DELETE = 0x00000001; | |
| 532 | ||
| 533 | /// data contents changed | |
| 534 | pub const NOTE_WRITE = 0x00000002; | |
| 535 | ||
| 536 | /// size increased | |
| 537 | pub const NOTE_EXTEND = 0x00000004; | |
| 538 | ||
| 539 | /// attributes changed | |
| 540 | pub const NOTE_ATTRIB = 0x00000008; | |
| 541 | ||
| 542 | /// link count changed | |
| 543 | pub const NOTE_LINK = 0x00000010; | |
| 544 | ||
| 545 | /// vnode was renamed | |
| 546 | pub const NOTE_RENAME = 0x00000020; | |
| 547 | ||
| 548 | /// vnode access was revoked | |
| 549 | pub const NOTE_REVOKE = 0x00000040; | |
| 550 | ||
| 551 | /// vnode was opened | |
| 552 | pub const NOTE_OPEN = 0x00000080; | |
| 553 | ||
| 554 | /// file closed, fd did not allow write | |
| 555 | pub const NOTE_CLOSE = 0x00000100; | |
| 556 | ||
| 557 | /// file closed, fd did allow write | |
| 558 | pub const NOTE_CLOSE_WRITE = 0x00000200; | |
| 559 | ||
| 560 | /// file was read | |
| 561 | pub const NOTE_READ = 0x00000400; | |
| 562 | ||
| 563 | /// process exited | |
| 564 | pub const NOTE_EXIT = 0x80000000; | |
| 565 | ||
| 566 | /// process forked | |
| 567 | pub const NOTE_FORK = 0x40000000; | |
| 568 | ||
| 569 | /// process exec'd | |
| 570 | pub const NOTE_EXEC = 0x20000000; | |
| 571 | ||
| 572 | /// mask for signal & exit status | |
| 573 | pub const NOTE_PDATAMASK = 0x000fffff; | |
| 574 | pub const NOTE_PCTRLMASK = (~NOTE_PDATAMASK); | |
| 575 | ||
| 576 | /// data is seconds | |
| 577 | pub const NOTE_SECONDS = 0x00000001; | |
| 578 | ||
| 579 | /// data is milliseconds | |
| 580 | pub const NOTE_MSECONDS = 0x00000002; | |
| 581 | ||
| 582 | /// data is microseconds | |
| 583 | pub const NOTE_USECONDS = 0x00000004; | |
| 584 | ||
| 585 | /// data is nanoseconds | |
| 586 | pub const NOTE_NSECONDS = 0x00000008; | |
| 587 | ||
| 588 | /// timeout is absolute | |
| 589 | pub const NOTE_ABSTIME = 0x00000010; | |
| 590 | ||
| 591 | pub const TCGETS = 0x5401; | |
| 592 | pub const TCSETS = 0x5402; | |
| 593 | pub const TCSETSW = 0x5403; | |
| 594 | pub const TCSETSF = 0x5404; | |
| 595 | pub const TCGETA = 0x5405; | |
| 596 | pub const TCSETA = 0x5406; | |
| 597 | pub const TCSETAW = 0x5407; | |
| 598 | pub const TCSETAF = 0x5408; | |
| 599 | pub const TCSBRK = 0x5409; | |
| 600 | pub const TCXONC = 0x540A; | |
| 601 | pub const TCFLSH = 0x540B; | |
| 602 | pub const TIOCEXCL = 0x540C; | |
| 603 | pub const TIOCNXCL = 0x540D; | |
| 604 | pub const TIOCSCTTY = 0x540E; | |
| 605 | pub const TIOCGPGRP = 0x540F; | |
| 606 | pub const TIOCSPGRP = 0x5410; | |
| 607 | pub const TIOCOUTQ = 0x5411; | |
| 608 | pub const TIOCSTI = 0x5412; | |
| 609 | pub const TIOCGWINSZ = 0x5413; | |
| 610 | pub const TIOCSWINSZ = 0x5414; | |
| 611 | pub const TIOCMGET = 0x5415; | |
| 612 | pub const TIOCMBIS = 0x5416; | |
| 613 | pub const TIOCMBIC = 0x5417; | |
| 614 | pub const TIOCMSET = 0x5418; | |
| 615 | pub const TIOCGSOFTCAR = 0x5419; | |
| 616 | pub const TIOCSSOFTCAR = 0x541A; | |
| 617 | pub const FIONREAD = 0x541B; | |
| 618 | pub const TIOCINQ = FIONREAD; | |
| 619 | pub const TIOCLINUX = 0x541C; | |
| 620 | pub const TIOCCONS = 0x541D; | |
| 621 | pub const TIOCGSERIAL = 0x541E; | |
| 622 | pub const TIOCSSERIAL = 0x541F; | |
| 623 | pub const TIOCPKT = 0x5420; | |
| 624 | pub const FIONBIO = 0x5421; | |
| 625 | pub const TIOCNOTTY = 0x5422; | |
| 626 | pub const TIOCSETD = 0x5423; | |
| 627 | pub const TIOCGETD = 0x5424; | |
| 628 | pub const TCSBRKP = 0x5425; | |
| 629 | pub const TIOCSBRK = 0x5427; | |
| 630 | pub const TIOCCBRK = 0x5428; | |
| 631 | pub const TIOCGSID = 0x5429; | |
| 632 | pub const TIOCGRS485 = 0x542E; | |
| 633 | pub const TIOCSRS485 = 0x542F; | |
| 634 | pub const TIOCGPTN = 0x80045430; | |
| 635 | pub const TIOCSPTLCK = 0x40045431; | |
| 636 | pub const TIOCGDEV = 0x80045432; | |
| 637 | pub const TCGETX = 0x5432; | |
| 638 | pub const TCSETX = 0x5433; | |
| 639 | pub const TCSETXF = 0x5434; | |
| 640 | pub const TCSETXW = 0x5435; | |
| 641 | pub const TIOCSIG = 0x40045436; | |
| 642 | pub const TIOCVHANGUP = 0x5437; | |
| 643 | pub const TIOCGPKT = 0x80045438; | |
| 644 | pub const TIOCGPTLCK = 0x80045439; | |
| 645 | pub const TIOCGEXCL = 0x80045440; | |
| 646 | ||
| 647 | fn unsigned(s: i32) u32 { | |
| 648 | return @bitCast(u32, s); | |
| 649 | } | |
| 650 | fn signed(s: u32) i32 { | |
| 651 | return @bitCast(i32, s); | |
| 652 | } | |
| 653 | pub fn WEXITSTATUS(s: i32) i32 { | |
| 654 | return signed((unsigned(s) & 0xff00) >> 8); | |
| 655 | } | |
| 656 | pub fn WTERMSIG(s: i32) i32 { | |
| 657 | return signed(unsigned(s) & 0x7f); | |
| 658 | } | |
| 659 | pub fn WSTOPSIG(s: i32) i32 { | |
| 660 | return WEXITSTATUS(s); | |
| 661 | } | |
| 662 | pub fn WIFEXITED(s: i32) bool { | |
| 663 | return WTERMSIG(s) == 0; | |
| 664 | } | |
| 665 | pub fn WIFSTOPPED(s: i32) bool { | |
| 666 | return @intCast(u16, (((unsigned(s) & 0xffff) *% 0x10001) >> 8)) > 0x7f00; | |
| 667 | } | |
| 668 | pub fn WIFSIGNALED(s: i32) bool { | |
| 669 | return (unsigned(s) & 0xffff) -% 1 < 0xff; | |
| 670 | } | |
| 671 | ||
| 672 | pub const winsize = extern struct { | |
| 673 | ws_row: u16, | |
| 674 | ws_col: u16, | |
| 675 | ws_xpixel: u16, | |
| 676 | ws_ypixel: u16, | |
| 677 | }; | |
| 678 | ||
| 679 | const NSIG = 32; | |
| 680 | ||
| 681 | pub const SIG_ERR = @intToPtr(extern fn (i32) void, maxInt(usize)); | |
| 682 | pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0); | |
| 683 | pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1); | |
| 684 | ||
| 685 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. | |
| 686 | pub const Sigaction = extern struct { | |
| 687 | /// signal handler | |
| 688 | __sigaction_u: extern union { | |
| 689 | __sa_handler: extern fn (i32) void, | |
| 690 | __sa_sigaction: extern fn (i32, *__siginfo, usize) void, | |
| 691 | }, | |
| 692 | ||
| 693 | /// see signal options | |
| 694 | sa_flags: u32, | |
| 695 | ||
| 696 | /// signal mask to apply | |
| 697 | sa_mask: sigset_t, | |
| 698 | }; | |
| 699 | ||
| 700 | pub const _SIG_WORDS = 4; | |
| 701 | pub const _SIG_MAXSIG = 128; | |
| 702 | ||
| 703 | pub inline fn _SIG_IDX(sig: usize) usize { | |
| 704 | return sig - 1; | |
| 705 | } | |
| 706 | pub inline fn _SIG_WORD(sig: usize) usize { | |
| 707 | return_SIG_IDX(sig) >> 5; | |
| 708 | } | |
| 709 | pub inline fn _SIG_BIT(sig: usize) usize { | |
| 710 | return 1 << (_SIG_IDX(sig) & 31); | |
| 711 | } | |
| 712 | pub inline fn _SIG_VALID(sig: usize) usize { | |
| 713 | return sig <= _SIG_MAXSIG and sig > 0; | |
| 714 | } | |
| 715 | ||
| 716 | pub const sigset_t = extern struct { | |
| 717 | __bits: [_SIG_WORDS]u32, | |
| 718 | }; | |
| 719 | ||
| 720 | pub const EPERM = 1; // Operation not permitted | |
| 721 | pub const ENOENT = 2; // No such file or directory | |
| 722 | pub const ESRCH = 3; // No such process | |
| 723 | pub const EINTR = 4; // Interrupted system call | |
| 724 | pub const EIO = 5; // Input/output error | |
| 725 | pub const ENXIO = 6; // Device not configured | |
| 726 | pub const E2BIG = 7; // Argument list too long | |
| 727 | pub const ENOEXEC = 8; // Exec format error | |
| 728 | pub const EBADF = 9; // Bad file descriptor | |
| 729 | pub const ECHILD = 10; // No child processes | |
| 730 | pub const EDEADLK = 11; // Resource deadlock avoided | |
| 731 | // 11 was EAGAIN | |
| 732 | pub const ENOMEM = 12; // Cannot allocate memory | |
| 733 | pub const EACCES = 13; // Permission denied | |
| 734 | pub const EFAULT = 14; // Bad address | |
| 735 | pub const ENOTBLK = 15; // Block device required | |
| 736 | pub const EBUSY = 16; // Device busy | |
| 737 | pub const EEXIST = 17; // File exists | |
| 738 | pub const EXDEV = 18; // Cross-device link | |
| 739 | pub const ENODEV = 19; // Operation not supported by device | |
| 740 | pub const ENOTDIR = 20; // Not a directory | |
| 741 | pub const EISDIR = 21; // Is a directory | |
| 742 | pub const EINVAL = 22; // Invalid argument | |
| 743 | pub const ENFILE = 23; // Too many open files in system | |
| 744 | pub const EMFILE = 24; // Too many open files | |
| 745 | pub const ENOTTY = 25; // Inappropriate ioctl for device | |
| 746 | pub const ETXTBSY = 26; // Text file busy | |
| 747 | pub const EFBIG = 27; // File too large | |
| 748 | pub const ENOSPC = 28; // No space left on device | |
| 749 | pub const ESPIPE = 29; // Illegal seek | |
| 750 | pub const EROFS = 30; // Read-only filesystem | |
| 751 | pub const EMLINK = 31; // Too many links | |
| 752 | pub const EPIPE = 32; // Broken pipe | |
| 753 | ||
| 754 | // math software | |
| 755 | pub const EDOM = 33; // Numerical argument out of domain | |
| 756 | pub const ERANGE = 34; // Result too large | |
| 757 | ||
| 758 | // non-blocking and interrupt i/o | |
| 759 | pub const EAGAIN = 35; // Resource temporarily unavailable | |
| 760 | pub const EWOULDBLOCK = EAGAIN; // Operation would block | |
| 761 | pub const EINPROGRESS = 36; // Operation now in progress | |
| 762 | pub const EALREADY = 37; // Operation already in progress | |
| 763 | ||
| 764 | // ipc/network software -- argument errors | |
| 765 | pub const ENOTSOCK = 38; // Socket operation on non-socket | |
| 766 | pub const EDESTADDRREQ = 39; // Destination address required | |
| 767 | pub const EMSGSIZE = 40; // Message too long | |
| 768 | pub const EPROTOTYPE = 41; // Protocol wrong type for socket | |
| 769 | pub const ENOPROTOOPT = 42; // Protocol not available | |
| 770 | pub const EPROTONOSUPPORT = 43; // Protocol not supported | |
| 771 | pub const ESOCKTNOSUPPORT = 44; // Socket type not supported | |
| 772 | pub const EOPNOTSUPP = 45; // Operation not supported | |
| 773 | pub const ENOTSUP = EOPNOTSUPP; // Operation not supported | |
| 774 | pub const EPFNOSUPPORT = 46; // Protocol family not supported | |
| 775 | pub const EAFNOSUPPORT = 47; // Address family not supported by protocol family | |
| 776 | pub const EADDRINUSE = 48; // Address already in use | |
| 777 | pub const EADDRNOTAVAIL = 49; // Can't assign requested address | |
| 778 | ||
| 779 | // ipc/network software -- operational errors | |
| 780 | pub const ENETDOWN = 50; // Network is down | |
| 781 | pub const ENETUNREACH = 51; // Network is unreachable | |
| 782 | pub const ENETRESET = 52; // Network dropped connection on reset | |
| 783 | pub const ECONNABORTED = 53; // Software caused connection abort | |
| 784 | pub const ECONNRESET = 54; // Connection reset by peer | |
| 785 | pub const ENOBUFS = 55; // No buffer space available | |
| 786 | pub const EISCONN = 56; // Socket is already connected | |
| 787 | pub const ENOTCONN = 57; // Socket is not connected | |
| 788 | pub const ESHUTDOWN = 58; // Can't send after socket shutdown | |
| 789 | pub const ETOOMANYREFS = 59; // Too many references: can't splice | |
| 790 | pub const ETIMEDOUT = 60; // Operation timed out | |
| 791 | pub const ECONNREFUSED = 61; // Connection refused | |
| 792 | ||
| 793 | pub const ELOOP = 62; // Too many levels of symbolic links | |
| 794 | pub const ENAMETOOLONG = 63; // File name too long | |
| 795 | ||
| 796 | // should be rearranged | |
| 797 | pub const EHOSTDOWN = 64; // Host is down | |
| 798 | pub const EHOSTUNREACH = 65; // No route to host | |
| 799 | pub const ENOTEMPTY = 66; // Directory not empty | |
| 800 | ||
| 801 | // quotas & mush | |
| 802 | pub const EPROCLIM = 67; // Too many processes | |
| 803 | pub const EUSERS = 68; // Too many users | |
| 804 | pub const EDQUOT = 69; // Disc quota exceeded | |
| 805 | ||
| 806 | // Network File System | |
| 807 | pub const ESTALE = 70; // Stale NFS file handle | |
| 808 | pub const EREMOTE = 71; // Too many levels of remote in path | |
| 809 | pub const EBADRPC = 72; // RPC struct is bad | |
| 810 | pub const ERPCMISMATCH = 73; // RPC version wrong | |
| 811 | pub const EPROGUNAVAIL = 74; // RPC prog. not avail | |
| 812 | pub const EPROGMISMATCH = 75; // Program version wrong | |
| 813 | pub const EPROCUNAVAIL = 76; // Bad procedure for program | |
| 814 | ||
| 815 | pub const ENOLCK = 77; // No locks available | |
| 816 | pub const ENOSYS = 78; // Function not implemented | |
| 817 | ||
| 818 | pub const EFTYPE = 79; // Inappropriate file type or format | |
| 819 | pub const EAUTH = 80; // Authentication error | |
| 820 | pub const ENEEDAUTH = 81; // Need authenticator | |
| 821 | pub const EIDRM = 82; // Identifier removed | |
| 822 | pub const ENOMSG = 83; // No message of desired type | |
| 823 | pub const EOVERFLOW = 84; // Value too large to be stored in data type | |
| 824 | pub const ECANCELED = 85; // Operation canceled | |
| 825 | pub const EILSEQ = 86; // Illegal byte sequence | |
| 826 | pub const ENOATTR = 87; // Attribute not found | |
| 827 | ||
| 828 | pub const EDOOFUS = 88; // Programming error | |
| 829 | ||
| 830 | pub const EBADMSG = 89; // Bad message | |
| 831 | pub const EMULTIHOP = 90; // Multihop attempted | |
| 832 | pub const ENOLINK = 91; // Link has been severed | |
| 833 | pub const EPROTO = 92; // Protocol error | |
| 834 | ||
| 835 | pub const ENOTCAPABLE = 93; // Capabilities insufficient | |
| 836 | pub const ECAPMODE = 94; // Not permitted in capability mode | |
| 837 | pub const ENOTRECOVERABLE = 95; // State not recoverable | |
| 838 | pub const EOWNERDEAD = 96; // Previous owner died | |
| 839 | ||
| 840 | pub const ELAST = 96; // Must be equal largest errno |
std/os/bits/linux.zig created+919| ... | ... | @@ -0,0 +1,919 @@ |
| 1 | pub use @import("errno.zig"); | |
| 2 | pub use switch (builtin.arch) { | |
| 3 | .x86_64 => @import("linux/x86_64.zig"), | |
| 4 | .aarch64 => @import("linux/arm64.zig"), | |
| 5 | else => struct {}, | |
| 6 | }; | |
| 7 | ||
| 8 | pub const pid_t = i32; | |
| 9 | pub const fd_t = i32; | |
| 10 | ||
| 11 | pub const PATH_MAX = 4096; | |
| 12 | pub const IOV_MAX = 1024; | |
| 13 | ||
| 14 | pub const STDIN_FILENO = 0; | |
| 15 | pub const STDOUT_FILENO = 1; | |
| 16 | pub const STDERR_FILENO = 2; | |
| 17 | ||
| 18 | pub const FUTEX_WAIT = 0; | |
| 19 | pub const FUTEX_WAKE = 1; | |
| 20 | pub const FUTEX_FD = 2; | |
| 21 | pub const FUTEX_REQUEUE = 3; | |
| 22 | pub const FUTEX_CMP_REQUEUE = 4; | |
| 23 | pub const FUTEX_WAKE_OP = 5; | |
| 24 | pub const FUTEX_LOCK_PI = 6; | |
| 25 | pub const FUTEX_UNLOCK_PI = 7; | |
| 26 | pub const FUTEX_TRYLOCK_PI = 8; | |
| 27 | pub const FUTEX_WAIT_BITSET = 9; | |
| 28 | ||
| 29 | pub const FUTEX_PRIVATE_FLAG = 128; | |
| 30 | ||
| 31 | pub const FUTEX_CLOCK_REALTIME = 256; | |
| 32 | ||
| 33 | pub const PROT_NONE = 0; | |
| 34 | pub const PROT_READ = 1; | |
| 35 | pub const PROT_WRITE = 2; | |
| 36 | pub const PROT_EXEC = 4; | |
| 37 | pub const PROT_GROWSDOWN = 0x01000000; | |
| 38 | pub const PROT_GROWSUP = 0x02000000; | |
| 39 | ||
| 40 | pub const MAP_FAILED = maxInt(usize); | |
| 41 | pub const MAP_SHARED = 0x01; | |
| 42 | pub const MAP_PRIVATE = 0x02; | |
| 43 | pub const MAP_TYPE = 0x0f; | |
| 44 | pub const MAP_FIXED = 0x10; | |
| 45 | pub const MAP_ANONYMOUS = 0x20; | |
| 46 | pub const MAP_NORESERVE = 0x4000; | |
| 47 | pub const MAP_GROWSDOWN = 0x0100; | |
| 48 | pub const MAP_DENYWRITE = 0x0800; | |
| 49 | pub const MAP_EXECUTABLE = 0x1000; | |
| 50 | pub const MAP_LOCKED = 0x2000; | |
| 51 | pub const MAP_POPULATE = 0x8000; | |
| 52 | pub const MAP_NONBLOCK = 0x10000; | |
| 53 | pub const MAP_STACK = 0x20000; | |
| 54 | pub const MAP_HUGETLB = 0x40000; | |
| 55 | pub const MAP_FILE = 0; | |
| 56 | ||
| 57 | pub const F_OK = 0; | |
| 58 | pub const X_OK = 1; | |
| 59 | pub const W_OK = 2; | |
| 60 | pub const R_OK = 4; | |
| 61 | ||
| 62 | pub const WNOHANG = 1; | |
| 63 | pub const WUNTRACED = 2; | |
| 64 | pub const WSTOPPED = 2; | |
| 65 | pub const WEXITED = 4; | |
| 66 | pub const WCONTINUED = 8; | |
| 67 | pub const WNOWAIT = 0x1000000; | |
| 68 | ||
| 69 | pub const SA_NOCLDSTOP = 1; | |
| 70 | pub const SA_NOCLDWAIT = 2; | |
| 71 | pub const SA_SIGINFO = 4; | |
| 72 | pub const SA_ONSTACK = 0x08000000; | |
| 73 | pub const SA_RESTART = 0x10000000; | |
| 74 | pub const SA_NODEFER = 0x40000000; | |
| 75 | pub const SA_RESETHAND = 0x80000000; | |
| 76 | pub const SA_RESTORER = 0x04000000; | |
| 77 | ||
| 78 | pub const SIGHUP = 1; | |
| 79 | pub const SIGINT = 2; | |
| 80 | pub const SIGQUIT = 3; | |
| 81 | pub const SIGILL = 4; | |
| 82 | pub const SIGTRAP = 5; | |
| 83 | pub const SIGABRT = 6; | |
| 84 | pub const SIGIOT = SIGABRT; | |
| 85 | pub const SIGBUS = 7; | |
| 86 | pub const SIGFPE = 8; | |
| 87 | pub const SIGKILL = 9; | |
| 88 | pub const SIGUSR1 = 10; | |
| 89 | pub const SIGSEGV = 11; | |
| 90 | pub const SIGUSR2 = 12; | |
| 91 | pub const SIGPIPE = 13; | |
| 92 | pub const SIGALRM = 14; | |
| 93 | pub const SIGTERM = 15; | |
| 94 | pub const SIGSTKFLT = 16; | |
| 95 | pub const SIGCHLD = 17; | |
| 96 | pub const SIGCONT = 18; | |
| 97 | pub const SIGSTOP = 19; | |
| 98 | pub const SIGTSTP = 20; | |
| 99 | pub const SIGTTIN = 21; | |
| 100 | pub const SIGTTOU = 22; | |
| 101 | pub const SIGURG = 23; | |
| 102 | pub const SIGXCPU = 24; | |
| 103 | pub const SIGXFSZ = 25; | |
| 104 | pub const SIGVTALRM = 26; | |
| 105 | pub const SIGPROF = 27; | |
| 106 | pub const SIGWINCH = 28; | |
| 107 | pub const SIGIO = 29; | |
| 108 | pub const SIGPOLL = 29; | |
| 109 | pub const SIGPWR = 30; | |
| 110 | pub const SIGSYS = 31; | |
| 111 | pub const SIGUNUSED = SIGSYS; | |
| 112 | ||
| 113 | pub const O_RDONLY = 0o0; | |
| 114 | pub const O_WRONLY = 0o1; | |
| 115 | pub const O_RDWR = 0o2; | |
| 116 | ||
| 117 | pub const SEEK_SET = 0; | |
| 118 | pub const SEEK_CUR = 1; | |
| 119 | pub const SEEK_END = 2; | |
| 120 | ||
| 121 | pub const SIG_BLOCK = 0; | |
| 122 | pub const SIG_UNBLOCK = 1; | |
| 123 | pub const SIG_SETMASK = 2; | |
| 124 | ||
| 125 | pub const PROTO_ip = 0o000; | |
| 126 | pub const PROTO_icmp = 0o001; | |
| 127 | pub const PROTO_igmp = 0o002; | |
| 128 | pub const PROTO_ggp = 0o003; | |
| 129 | pub const PROTO_ipencap = 0o004; | |
| 130 | pub const PROTO_st = 0o005; | |
| 131 | pub const PROTO_tcp = 0o006; | |
| 132 | pub const PROTO_egp = 0o010; | |
| 133 | pub const PROTO_pup = 0o014; | |
| 134 | pub const PROTO_udp = 0o021; | |
| 135 | pub const PROTO_hmp = 0o024; | |
| 136 | pub const PROTO_xns_idp = 0o026; | |
| 137 | pub const PROTO_rdp = 0o033; | |
| 138 | pub const PROTO_iso_tp4 = 0o035; | |
| 139 | pub const PROTO_xtp = 0o044; | |
| 140 | pub const PROTO_ddp = 0o045; | |
| 141 | pub const PROTO_idpr_cmtp = 0o046; | |
| 142 | pub const PROTO_ipv6 = 0o051; | |
| 143 | pub const PROTO_ipv6_route = 0o053; | |
| 144 | pub const PROTO_ipv6_frag = 0o054; | |
| 145 | pub const PROTO_idrp = 0o055; | |
| 146 | pub const PROTO_rsvp = 0o056; | |
| 147 | pub const PROTO_gre = 0o057; | |
| 148 | pub const PROTO_esp = 0o062; | |
| 149 | pub const PROTO_ah = 0o063; | |
| 150 | pub const PROTO_skip = 0o071; | |
| 151 | pub const PROTO_ipv6_icmp = 0o072; | |
| 152 | pub const PROTO_ipv6_nonxt = 0o073; | |
| 153 | pub const PROTO_ipv6_opts = 0o074; | |
| 154 | pub const PROTO_rspf = 0o111; | |
| 155 | pub const PROTO_vmtp = 0o121; | |
| 156 | pub const PROTO_ospf = 0o131; | |
| 157 | pub const PROTO_ipip = 0o136; | |
| 158 | pub const PROTO_encap = 0o142; | |
| 159 | pub const PROTO_pim = 0o147; | |
| 160 | pub const PROTO_raw = 0o377; | |
| 161 | ||
| 162 | pub const SHUT_RD = 0; | |
| 163 | pub const SHUT_WR = 1; | |
| 164 | pub const SHUT_RDWR = 2; | |
| 165 | ||
| 166 | pub const SOCK_STREAM = 1; | |
| 167 | pub const SOCK_DGRAM = 2; | |
| 168 | pub const SOCK_RAW = 3; | |
| 169 | pub const SOCK_RDM = 4; | |
| 170 | pub const SOCK_SEQPACKET = 5; | |
| 171 | pub const SOCK_DCCP = 6; | |
| 172 | pub const SOCK_PACKET = 10; | |
| 173 | pub const SOCK_CLOEXEC = 0o2000000; | |
| 174 | pub const SOCK_NONBLOCK = 0o4000; | |
| 175 | ||
| 176 | pub const PF_UNSPEC = 0; | |
| 177 | pub const PF_LOCAL = 1; | |
| 178 | pub const PF_UNIX = PF_LOCAL; | |
| 179 | pub const PF_FILE = PF_LOCAL; | |
| 180 | pub const PF_INET = 2; | |
| 181 | pub const PF_AX25 = 3; | |
| 182 | pub const PF_IPX = 4; | |
| 183 | pub const PF_APPLETALK = 5; | |
| 184 | pub const PF_NETROM = 6; | |
| 185 | pub const PF_BRIDGE = 7; | |
| 186 | pub const PF_ATMPVC = 8; | |
| 187 | pub const PF_X25 = 9; | |
| 188 | pub const PF_INET6 = 10; | |
| 189 | pub const PF_ROSE = 11; | |
| 190 | pub const PF_DECnet = 12; | |
| 191 | pub const PF_NETBEUI = 13; | |
| 192 | pub const PF_SECURITY = 14; | |
| 193 | pub const PF_KEY = 15; | |
| 194 | pub const PF_NETLINK = 16; | |
| 195 | pub const PF_ROUTE = PF_NETLINK; | |
| 196 | pub const PF_PACKET = 17; | |
| 197 | pub const PF_ASH = 18; | |
| 198 | pub const PF_ECONET = 19; | |
| 199 | pub const PF_ATMSVC = 20; | |
| 200 | pub const PF_RDS = 21; | |
| 201 | pub const PF_SNA = 22; | |
| 202 | pub const PF_IRDA = 23; | |
| 203 | pub const PF_PPPOX = 24; | |
| 204 | pub const PF_WANPIPE = 25; | |
| 205 | pub const PF_LLC = 26; | |
| 206 | pub const PF_IB = 27; | |
| 207 | pub const PF_MPLS = 28; | |
| 208 | pub const PF_CAN = 29; | |
| 209 | pub const PF_TIPC = 30; | |
| 210 | pub const PF_BLUETOOTH = 31; | |
| 211 | pub const PF_IUCV = 32; | |
| 212 | pub const PF_RXRPC = 33; | |
| 213 | pub const PF_ISDN = 34; | |
| 214 | pub const PF_PHONET = 35; | |
| 215 | pub const PF_IEEE802154 = 36; | |
| 216 | pub const PF_CAIF = 37; | |
| 217 | pub const PF_ALG = 38; | |
| 218 | pub const PF_NFC = 39; | |
| 219 | pub const PF_VSOCK = 40; | |
| 220 | pub const PF_KCM = 41; | |
| 221 | pub const PF_QIPCRTR = 42; | |
| 222 | pub const PF_SMC = 43; | |
| 223 | pub const PF_MAX = 44; | |
| 224 | ||
| 225 | pub const AF_UNSPEC = PF_UNSPEC; | |
| 226 | pub const AF_LOCAL = PF_LOCAL; | |
| 227 | pub const AF_UNIX = AF_LOCAL; | |
| 228 | pub const AF_FILE = AF_LOCAL; | |
| 229 | pub const AF_INET = PF_INET; | |
| 230 | pub const AF_AX25 = PF_AX25; | |
| 231 | pub const AF_IPX = PF_IPX; | |
| 232 | pub const AF_APPLETALK = PF_APPLETALK; | |
| 233 | pub const AF_NETROM = PF_NETROM; | |
| 234 | pub const AF_BRIDGE = PF_BRIDGE; | |
| 235 | pub const AF_ATMPVC = PF_ATMPVC; | |
| 236 | pub const AF_X25 = PF_X25; | |
| 237 | pub const AF_INET6 = PF_INET6; | |
| 238 | pub const AF_ROSE = PF_ROSE; | |
| 239 | pub const AF_DECnet = PF_DECnet; | |
| 240 | pub const AF_NETBEUI = PF_NETBEUI; | |
| 241 | pub const AF_SECURITY = PF_SECURITY; | |
| 242 | pub const AF_KEY = PF_KEY; | |
| 243 | pub const AF_NETLINK = PF_NETLINK; | |
| 244 | pub const AF_ROUTE = PF_ROUTE; | |
| 245 | pub const AF_PACKET = PF_PACKET; | |
| 246 | pub const AF_ASH = PF_ASH; | |
| 247 | pub const AF_ECONET = PF_ECONET; | |
| 248 | pub const AF_ATMSVC = PF_ATMSVC; | |
| 249 | pub const AF_RDS = PF_RDS; | |
| 250 | pub const AF_SNA = PF_SNA; | |
| 251 | pub const AF_IRDA = PF_IRDA; | |
| 252 | pub const AF_PPPOX = PF_PPPOX; | |
| 253 | pub const AF_WANPIPE = PF_WANPIPE; | |
| 254 | pub const AF_LLC = PF_LLC; | |
| 255 | pub const AF_IB = PF_IB; | |
| 256 | pub const AF_MPLS = PF_MPLS; | |
| 257 | pub const AF_CAN = PF_CAN; | |
| 258 | pub const AF_TIPC = PF_TIPC; | |
| 259 | pub const AF_BLUETOOTH = PF_BLUETOOTH; | |
| 260 | pub const AF_IUCV = PF_IUCV; | |
| 261 | pub const AF_RXRPC = PF_RXRPC; | |
| 262 | pub const AF_ISDN = PF_ISDN; | |
| 263 | pub const AF_PHONET = PF_PHONET; | |
| 264 | pub const AF_IEEE802154 = PF_IEEE802154; | |
| 265 | pub const AF_CAIF = PF_CAIF; | |
| 266 | pub const AF_ALG = PF_ALG; | |
| 267 | pub const AF_NFC = PF_NFC; | |
| 268 | pub const AF_VSOCK = PF_VSOCK; | |
| 269 | pub const AF_KCM = PF_KCM; | |
| 270 | pub const AF_QIPCRTR = PF_QIPCRTR; | |
| 271 | pub const AF_SMC = PF_SMC; | |
| 272 | pub const AF_MAX = PF_MAX; | |
| 273 | ||
| 274 | pub const SO_DEBUG = 1; | |
| 275 | pub const SO_REUSEADDR = 2; | |
| 276 | pub const SO_TYPE = 3; | |
| 277 | pub const SO_ERROR = 4; | |
| 278 | pub const SO_DONTROUTE = 5; | |
| 279 | pub const SO_BROADCAST = 6; | |
| 280 | pub const SO_SNDBUF = 7; | |
| 281 | pub const SO_RCVBUF = 8; | |
| 282 | pub const SO_KEEPALIVE = 9; | |
| 283 | pub const SO_OOBINLINE = 10; | |
| 284 | pub const SO_NO_CHECK = 11; | |
| 285 | pub const SO_PRIORITY = 12; | |
| 286 | pub const SO_LINGER = 13; | |
| 287 | pub const SO_BSDCOMPAT = 14; | |
| 288 | pub const SO_REUSEPORT = 15; | |
| 289 | pub const SO_PASSCRED = 16; | |
| 290 | pub const SO_PEERCRED = 17; | |
| 291 | pub const SO_RCVLOWAT = 18; | |
| 292 | pub const SO_SNDLOWAT = 19; | |
| 293 | pub const SO_RCVTIMEO = 20; | |
| 294 | pub const SO_SNDTIMEO = 21; | |
| 295 | pub const SO_ACCEPTCONN = 30; | |
| 296 | pub const SO_SNDBUFFORCE = 32; | |
| 297 | pub const SO_RCVBUFFORCE = 33; | |
| 298 | pub const SO_PROTOCOL = 38; | |
| 299 | pub const SO_DOMAIN = 39; | |
| 300 | ||
| 301 | pub const SO_SECURITY_AUTHENTICATION = 22; | |
| 302 | pub const SO_SECURITY_ENCRYPTION_TRANSPORT = 23; | |
| 303 | pub const SO_SECURITY_ENCRYPTION_NETWORK = 24; | |
| 304 | ||
| 305 | pub const SO_BINDTODEVICE = 25; | |
| 306 | ||
| 307 | pub const SO_ATTACH_FILTER = 26; | |
| 308 | pub const SO_DETACH_FILTER = 27; | |
| 309 | pub const SO_GET_FILTER = SO_ATTACH_FILTER; | |
| 310 | ||
| 311 | pub const SO_PEERNAME = 28; | |
| 312 | pub const SO_TIMESTAMP = 29; | |
| 313 | pub const SCM_TIMESTAMP = SO_TIMESTAMP; | |
| 314 | ||
| 315 | pub const SO_PEERSEC = 31; | |
| 316 | pub const SO_PASSSEC = 34; | |
| 317 | pub const SO_TIMESTAMPNS = 35; | |
| 318 | pub const SCM_TIMESTAMPNS = SO_TIMESTAMPNS; | |
| 319 | pub const SO_MARK = 36; | |
| 320 | pub const SO_TIMESTAMPING = 37; | |
| 321 | pub const SCM_TIMESTAMPING = SO_TIMESTAMPING; | |
| 322 | pub const SO_RXQ_OVFL = 40; | |
| 323 | pub const SO_WIFI_STATUS = 41; | |
| 324 | pub const SCM_WIFI_STATUS = SO_WIFI_STATUS; | |
| 325 | pub const SO_PEEK_OFF = 42; | |
| 326 | pub const SO_NOFCS = 43; | |
| 327 | pub const SO_LOCK_FILTER = 44; | |
| 328 | pub const SO_SELECT_ERR_QUEUE = 45; | |
| 329 | pub const SO_BUSY_POLL = 46; | |
| 330 | pub const SO_MAX_PACING_RATE = 47; | |
| 331 | pub const SO_BPF_EXTENSIONS = 48; | |
| 332 | pub const SO_INCOMING_CPU = 49; | |
| 333 | pub const SO_ATTACH_BPF = 50; | |
| 334 | pub const SO_DETACH_BPF = SO_DETACH_FILTER; | |
| 335 | pub const SO_ATTACH_REUSEPORT_CBPF = 51; | |
| 336 | pub const SO_ATTACH_REUSEPORT_EBPF = 52; | |
| 337 | pub const SO_CNX_ADVICE = 53; | |
| 338 | pub const SCM_TIMESTAMPING_OPT_STATS = 54; | |
| 339 | pub const SO_MEMINFO = 55; | |
| 340 | pub const SO_INCOMING_NAPI_ID = 56; | |
| 341 | pub const SO_COOKIE = 57; | |
| 342 | pub const SCM_TIMESTAMPING_PKTINFO = 58; | |
| 343 | pub const SO_PEERGROUPS = 59; | |
| 344 | pub const SO_ZEROCOPY = 60; | |
| 345 | ||
| 346 | pub const SOL_SOCKET = 1; | |
| 347 | ||
| 348 | pub const SOL_IP = 0; | |
| 349 | pub const SOL_IPV6 = 41; | |
| 350 | pub const SOL_ICMPV6 = 58; | |
| 351 | ||
| 352 | pub const SOL_RAW = 255; | |
| 353 | pub const SOL_DECNET = 261; | |
| 354 | pub const SOL_X25 = 262; | |
| 355 | pub const SOL_PACKET = 263; | |
| 356 | pub const SOL_ATM = 264; | |
| 357 | pub const SOL_AAL = 265; | |
| 358 | pub const SOL_IRDA = 266; | |
| 359 | pub const SOL_NETBEUI = 267; | |
| 360 | pub const SOL_LLC = 268; | |
| 361 | pub const SOL_DCCP = 269; | |
| 362 | pub const SOL_NETLINK = 270; | |
| 363 | pub const SOL_TIPC = 271; | |
| 364 | pub const SOL_RXRPC = 272; | |
| 365 | pub const SOL_PPPOL2TP = 273; | |
| 366 | pub const SOL_BLUETOOTH = 274; | |
| 367 | pub const SOL_PNPIPE = 275; | |
| 368 | pub const SOL_RDS = 276; | |
| 369 | pub const SOL_IUCV = 277; | |
| 370 | pub const SOL_CAIF = 278; | |
| 371 | pub const SOL_ALG = 279; | |
| 372 | pub const SOL_NFC = 280; | |
| 373 | pub const SOL_KCM = 281; | |
| 374 | pub const SOL_TLS = 282; | |
| 375 | ||
| 376 | pub const SOMAXCONN = 128; | |
| 377 | ||
| 378 | pub const MSG_OOB = 0x0001; | |
| 379 | pub const MSG_PEEK = 0x0002; | |
| 380 | pub const MSG_DONTROUTE = 0x0004; | |
| 381 | pub const MSG_CTRUNC = 0x0008; | |
| 382 | pub const MSG_PROXY = 0x0010; | |
| 383 | pub const MSG_TRUNC = 0x0020; | |
| 384 | pub const MSG_DONTWAIT = 0x0040; | |
| 385 | pub const MSG_EOR = 0x0080; | |
| 386 | pub const MSG_WAITALL = 0x0100; | |
| 387 | pub const MSG_FIN = 0x0200; | |
| 388 | pub const MSG_SYN = 0x0400; | |
| 389 | pub const MSG_CONFIRM = 0x0800; | |
| 390 | pub const MSG_RST = 0x1000; | |
| 391 | pub const MSG_ERRQUEUE = 0x2000; | |
| 392 | pub const MSG_NOSIGNAL = 0x4000; | |
| 393 | pub const MSG_MORE = 0x8000; | |
| 394 | pub const MSG_WAITFORONE = 0x10000; | |
| 395 | pub const MSG_BATCH = 0x40000; | |
| 396 | pub const MSG_ZEROCOPY = 0x4000000; | |
| 397 | pub const MSG_FASTOPEN = 0x20000000; | |
| 398 | pub const MSG_CMSG_CLOEXEC = 0x40000000; | |
| 399 | ||
| 400 | pub const DT_UNKNOWN = 0; | |
| 401 | pub const DT_FIFO = 1; | |
| 402 | pub const DT_CHR = 2; | |
| 403 | pub const DT_DIR = 4; | |
| 404 | pub const DT_BLK = 6; | |
| 405 | pub const DT_REG = 8; | |
| 406 | pub const DT_LNK = 10; | |
| 407 | pub const DT_SOCK = 12; | |
| 408 | pub const DT_WHT = 14; | |
| 409 | ||
| 410 | pub const TCGETS = 0x5401; | |
| 411 | pub const TCSETS = 0x5402; | |
| 412 | pub const TCSETSW = 0x5403; | |
| 413 | pub const TCSETSF = 0x5404; | |
| 414 | pub const TCGETA = 0x5405; | |
| 415 | pub const TCSETA = 0x5406; | |
| 416 | pub const TCSETAW = 0x5407; | |
| 417 | pub const TCSETAF = 0x5408; | |
| 418 | pub const TCSBRK = 0x5409; | |
| 419 | pub const TCXONC = 0x540A; | |
| 420 | pub const TCFLSH = 0x540B; | |
| 421 | pub const TIOCEXCL = 0x540C; | |
| 422 | pub const TIOCNXCL = 0x540D; | |
| 423 | pub const TIOCSCTTY = 0x540E; | |
| 424 | pub const TIOCGPGRP = 0x540F; | |
| 425 | pub const TIOCSPGRP = 0x5410; | |
| 426 | pub const TIOCOUTQ = 0x5411; | |
| 427 | pub const TIOCSTI = 0x5412; | |
| 428 | pub const TIOCGWINSZ = 0x5413; | |
| 429 | pub const TIOCSWINSZ = 0x5414; | |
| 430 | pub const TIOCMGET = 0x5415; | |
| 431 | pub const TIOCMBIS = 0x5416; | |
| 432 | pub const TIOCMBIC = 0x5417; | |
| 433 | pub const TIOCMSET = 0x5418; | |
| 434 | pub const TIOCGSOFTCAR = 0x5419; | |
| 435 | pub const TIOCSSOFTCAR = 0x541A; | |
| 436 | pub const FIONREAD = 0x541B; | |
| 437 | pub const TIOCINQ = FIONREAD; | |
| 438 | pub const TIOCLINUX = 0x541C; | |
| 439 | pub const TIOCCONS = 0x541D; | |
| 440 | pub const TIOCGSERIAL = 0x541E; | |
| 441 | pub const TIOCSSERIAL = 0x541F; | |
| 442 | pub const TIOCPKT = 0x5420; | |
| 443 | pub const FIONBIO = 0x5421; | |
| 444 | pub const TIOCNOTTY = 0x5422; | |
| 445 | pub const TIOCSETD = 0x5423; | |
| 446 | pub const TIOCGETD = 0x5424; | |
| 447 | pub const TCSBRKP = 0x5425; | |
| 448 | pub const TIOCSBRK = 0x5427; | |
| 449 | pub const TIOCCBRK = 0x5428; | |
| 450 | pub const TIOCGSID = 0x5429; | |
| 451 | pub const TIOCGRS485 = 0x542E; | |
| 452 | pub const TIOCSRS485 = 0x542F; | |
| 453 | pub const TIOCGPTN = 0x80045430; | |
| 454 | pub const TIOCSPTLCK = 0x40045431; | |
| 455 | pub const TIOCGDEV = 0x80045432; | |
| 456 | pub const TCGETX = 0x5432; | |
| 457 | pub const TCSETX = 0x5433; | |
| 458 | pub const TCSETXF = 0x5434; | |
| 459 | pub const TCSETXW = 0x5435; | |
| 460 | pub const TIOCSIG = 0x40045436; | |
| 461 | pub const TIOCVHANGUP = 0x5437; | |
| 462 | pub const TIOCGPKT = 0x80045438; | |
| 463 | pub const TIOCGPTLCK = 0x80045439; | |
| 464 | pub const TIOCGEXCL = 0x80045440; | |
| 465 | ||
| 466 | pub const EPOLL_CLOEXEC = O_CLOEXEC; | |
| 467 | ||
| 468 | pub const EPOLL_CTL_ADD = 1; | |
| 469 | pub const EPOLL_CTL_DEL = 2; | |
| 470 | pub const EPOLL_CTL_MOD = 3; | |
| 471 | ||
| 472 | pub const EPOLLIN = 0x001; | |
| 473 | pub const EPOLLPRI = 0x002; | |
| 474 | pub const EPOLLOUT = 0x004; | |
| 475 | pub const EPOLLRDNORM = 0x040; | |
| 476 | pub const EPOLLRDBAND = 0x080; | |
| 477 | pub const EPOLLWRNORM = 0x100; | |
| 478 | pub const EPOLLWRBAND = 0x200; | |
| 479 | pub const EPOLLMSG = 0x400; | |
| 480 | pub const EPOLLERR = 0x008; | |
| 481 | pub const EPOLLHUP = 0x010; | |
| 482 | pub const EPOLLRDHUP = 0x2000; | |
| 483 | pub const EPOLLEXCLUSIVE = (u32(1) << 28); | |
| 484 | pub const EPOLLWAKEUP = (u32(1) << 29); | |
| 485 | pub const EPOLLONESHOT = (u32(1) << 30); | |
| 486 | pub const EPOLLET = (u32(1) << 31); | |
| 487 | ||
| 488 | pub const CLOCK_REALTIME = 0; | |
| 489 | pub const CLOCK_MONOTONIC = 1; | |
| 490 | pub const CLOCK_PROCESS_CPUTIME_ID = 2; | |
| 491 | pub const CLOCK_THREAD_CPUTIME_ID = 3; | |
| 492 | pub const CLOCK_MONOTONIC_RAW = 4; | |
| 493 | pub const CLOCK_REALTIME_COARSE = 5; | |
| 494 | pub const CLOCK_MONOTONIC_COARSE = 6; | |
| 495 | pub const CLOCK_BOOTTIME = 7; | |
| 496 | pub const CLOCK_REALTIME_ALARM = 8; | |
| 497 | pub const CLOCK_BOOTTIME_ALARM = 9; | |
| 498 | pub const CLOCK_SGI_CYCLE = 10; | |
| 499 | pub const CLOCK_TAI = 11; | |
| 500 | ||
| 501 | pub const CSIGNAL = 0x000000ff; | |
| 502 | pub const CLONE_VM = 0x00000100; | |
| 503 | pub const CLONE_FS = 0x00000200; | |
| 504 | pub const CLONE_FILES = 0x00000400; | |
| 505 | pub const CLONE_SIGHAND = 0x00000800; | |
| 506 | pub const CLONE_PTRACE = 0x00002000; | |
| 507 | pub const CLONE_VFORK = 0x00004000; | |
| 508 | pub const CLONE_PARENT = 0x00008000; | |
| 509 | pub const CLONE_THREAD = 0x00010000; | |
| 510 | pub const CLONE_NEWNS = 0x00020000; | |
| 511 | pub const CLONE_SYSVSEM = 0x00040000; | |
| 512 | pub const CLONE_SETTLS = 0x00080000; | |
| 513 | pub const CLONE_PARENT_SETTID = 0x00100000; | |
| 514 | pub const CLONE_CHILD_CLEARTID = 0x00200000; | |
| 515 | pub const CLONE_DETACHED = 0x00400000; | |
| 516 | pub const CLONE_UNTRACED = 0x00800000; | |
| 517 | pub const CLONE_CHILD_SETTID = 0x01000000; | |
| 518 | pub const CLONE_NEWCGROUP = 0x02000000; | |
| 519 | pub const CLONE_NEWUTS = 0x04000000; | |
| 520 | pub const CLONE_NEWIPC = 0x08000000; | |
| 521 | pub const CLONE_NEWUSER = 0x10000000; | |
| 522 | pub const CLONE_NEWPID = 0x20000000; | |
| 523 | pub const CLONE_NEWNET = 0x40000000; | |
| 524 | pub const CLONE_IO = 0x80000000; | |
| 525 | ||
| 526 | pub const EFD_SEMAPHORE = 1; | |
| 527 | pub const EFD_CLOEXEC = O_CLOEXEC; | |
| 528 | pub const EFD_NONBLOCK = O_NONBLOCK; | |
| 529 | ||
| 530 | pub const MS_RDONLY = 1; | |
| 531 | pub const MS_NOSUID = 2; | |
| 532 | pub const MS_NODEV = 4; | |
| 533 | pub const MS_NOEXEC = 8; | |
| 534 | pub const MS_SYNCHRONOUS = 16; | |
| 535 | pub const MS_REMOUNT = 32; | |
| 536 | pub const MS_MANDLOCK = 64; | |
| 537 | pub const MS_DIRSYNC = 128; | |
| 538 | pub const MS_NOATIME = 1024; | |
| 539 | pub const MS_NODIRATIME = 2048; | |
| 540 | pub const MS_BIND = 4096; | |
| 541 | pub const MS_MOVE = 8192; | |
| 542 | pub const MS_REC = 16384; | |
| 543 | pub const MS_SILENT = 32768; | |
| 544 | pub const MS_POSIXACL = (1 << 16); | |
| 545 | pub const MS_UNBINDABLE = (1 << 17); | |
| 546 | pub const MS_PRIVATE = (1 << 18); | |
| 547 | pub const MS_SLAVE = (1 << 19); | |
| 548 | pub const MS_SHARED = (1 << 20); | |
| 549 | pub const MS_RELATIME = (1 << 21); | |
| 550 | pub const MS_KERNMOUNT = (1 << 22); | |
| 551 | pub const MS_I_VERSION = (1 << 23); | |
| 552 | pub const MS_STRICTATIME = (1 << 24); | |
| 553 | pub const MS_LAZYTIME = (1 << 25); | |
| 554 | pub const MS_NOREMOTELOCK = (1 << 27); | |
| 555 | pub const MS_NOSEC = (1 << 28); | |
| 556 | pub const MS_BORN = (1 << 29); | |
| 557 | pub const MS_ACTIVE = (1 << 30); | |
| 558 | pub const MS_NOUSER = (1 << 31); | |
| 559 | ||
| 560 | pub const MS_RMT_MASK = (MS_RDONLY | MS_SYNCHRONOUS | MS_MANDLOCK | MS_I_VERSION | MS_LAZYTIME); | |
| 561 | ||
| 562 | pub const MS_MGC_VAL = 0xc0ed0000; | |
| 563 | pub const MS_MGC_MSK = 0xffff0000; | |
| 564 | ||
| 565 | pub const MNT_FORCE = 1; | |
| 566 | pub const MNT_DETACH = 2; | |
| 567 | pub const MNT_EXPIRE = 4; | |
| 568 | pub const UMOUNT_NOFOLLOW = 8; | |
| 569 | ||
| 570 | pub const IN_CLOEXEC = O_CLOEXEC; | |
| 571 | pub const IN_NONBLOCK = O_NONBLOCK; | |
| 572 | ||
| 573 | pub const IN_ACCESS = 0x00000001; | |
| 574 | pub const IN_MODIFY = 0x00000002; | |
| 575 | pub const IN_ATTRIB = 0x00000004; | |
| 576 | pub const IN_CLOSE_WRITE = 0x00000008; | |
| 577 | pub const IN_CLOSE_NOWRITE = 0x00000010; | |
| 578 | pub const IN_CLOSE = IN_CLOSE_WRITE | IN_CLOSE_NOWRITE; | |
| 579 | pub const IN_OPEN = 0x00000020; | |
| 580 | pub const IN_MOVED_FROM = 0x00000040; | |
| 581 | pub const IN_MOVED_TO = 0x00000080; | |
| 582 | pub const IN_MOVE = IN_MOVED_FROM | IN_MOVED_TO; | |
| 583 | pub const IN_CREATE = 0x00000100; | |
| 584 | pub const IN_DELETE = 0x00000200; | |
| 585 | pub const IN_DELETE_SELF = 0x00000400; | |
| 586 | pub const IN_MOVE_SELF = 0x00000800; | |
| 587 | pub const IN_ALL_EVENTS = 0x00000fff; | |
| 588 | ||
| 589 | pub const IN_UNMOUNT = 0x00002000; | |
| 590 | pub const IN_Q_OVERFLOW = 0x00004000; | |
| 591 | pub const IN_IGNORED = 0x00008000; | |
| 592 | ||
| 593 | pub const IN_ONLYDIR = 0x01000000; | |
| 594 | pub const IN_DONT_FOLLOW = 0x02000000; | |
| 595 | pub const IN_EXCL_UNLINK = 0x04000000; | |
| 596 | pub const IN_MASK_ADD = 0x20000000; | |
| 597 | ||
| 598 | pub const IN_ISDIR = 0x40000000; | |
| 599 | pub const IN_ONESHOT = 0x80000000; | |
| 600 | ||
| 601 | pub const S_IFMT = 0o170000; | |
| 602 | ||
| 603 | pub const S_IFDIR = 0o040000; | |
| 604 | pub const S_IFCHR = 0o020000; | |
| 605 | pub const S_IFBLK = 0o060000; | |
| 606 | pub const S_IFREG = 0o100000; | |
| 607 | pub const S_IFIFO = 0o010000; | |
| 608 | pub const S_IFLNK = 0o120000; | |
| 609 | pub const S_IFSOCK = 0o140000; | |
| 610 | ||
| 611 | pub const S_ISUID = 0o4000; | |
| 612 | pub const S_ISGID = 0o2000; | |
| 613 | pub const S_ISVTX = 0o1000; | |
| 614 | pub const S_IRUSR = 0o400; | |
| 615 | pub const S_IWUSR = 0o200; | |
| 616 | pub const S_IXUSR = 0o100; | |
| 617 | pub const S_IRWXU = 0o700; | |
| 618 | pub const S_IRGRP = 0o040; | |
| 619 | pub const S_IWGRP = 0o020; | |
| 620 | pub const S_IXGRP = 0o010; | |
| 621 | pub const S_IRWXG = 0o070; | |
| 622 | pub const S_IROTH = 0o004; | |
| 623 | pub const S_IWOTH = 0o002; | |
| 624 | pub const S_IXOTH = 0o001; | |
| 625 | pub const S_IRWXO = 0o007; | |
| 626 | ||
| 627 | pub fn S_ISREG(m: u32) bool { | |
| 628 | return m & S_IFMT == S_IFREG; | |
| 629 | } | |
| 630 | ||
| 631 | pub fn S_ISDIR(m: u32) bool { | |
| 632 | return m & S_IFMT == S_IFDIR; | |
| 633 | } | |
| 634 | ||
| 635 | pub fn S_ISCHR(m: u32) bool { | |
| 636 | return m & S_IFMT == S_IFCHR; | |
| 637 | } | |
| 638 | ||
| 639 | pub fn S_ISBLK(m: u32) bool { | |
| 640 | return m & S_IFMT == S_IFBLK; | |
| 641 | } | |
| 642 | ||
| 643 | pub fn S_ISFIFO(m: u32) bool { | |
| 644 | return m & S_IFMT == S_IFIFO; | |
| 645 | } | |
| 646 | ||
| 647 | pub fn S_ISLNK(m: u32) bool { | |
| 648 | return m & S_IFMT == S_IFLNK; | |
| 649 | } | |
| 650 | ||
| 651 | pub fn S_ISSOCK(m: u32) bool { | |
| 652 | return m & S_IFMT == S_IFSOCK; | |
| 653 | } | |
| 654 | ||
| 655 | pub const TFD_NONBLOCK = O_NONBLOCK; | |
| 656 | pub const TFD_CLOEXEC = O_CLOEXEC; | |
| 657 | ||
| 658 | pub const TFD_TIMER_ABSTIME = 1; | |
| 659 | pub const TFD_TIMER_CANCEL_ON_SET = (1 << 1); | |
| 660 | ||
| 661 | fn unsigned(s: i32) u32 { | |
| 662 | return @bitCast(u32, s); | |
| 663 | } | |
| 664 | fn signed(s: u32) i32 { | |
| 665 | return @bitCast(i32, s); | |
| 666 | } | |
| 667 | pub fn WEXITSTATUS(s: i32) i32 { | |
| 668 | return signed((unsigned(s) & 0xff00) >> 8); | |
| 669 | } | |
| 670 | pub fn WTERMSIG(s: i32) i32 { | |
| 671 | return signed(unsigned(s) & 0x7f); | |
| 672 | } | |
| 673 | pub fn WSTOPSIG(s: i32) i32 { | |
| 674 | return WEXITSTATUS(s); | |
| 675 | } | |
| 676 | pub fn WIFEXITED(s: i32) bool { | |
| 677 | return WTERMSIG(s) == 0; | |
| 678 | } | |
| 679 | pub fn WIFSTOPPED(s: i32) bool { | |
| 680 | return @intCast(u16, ((unsigned(s) & 0xffff) *% 0x10001) >> 8) > 0x7f00; | |
| 681 | } | |
| 682 | pub fn WIFSIGNALED(s: i32) bool { | |
| 683 | return (unsigned(s) & 0xffff) -% 1 < 0xff; | |
| 684 | } | |
| 685 | ||
| 686 | pub const winsize = extern struct { | |
| 687 | ws_row: u16, | |
| 688 | ws_col: u16, | |
| 689 | ws_xpixel: u16, | |
| 690 | ws_ypixel: u16, | |
| 691 | }; | |
| 692 | ||
| 693 | const NSIG = 65; | |
| 694 | const sigset_t = [128 / @sizeOf(usize)]usize; | |
| 695 | const all_mask = []u32{ 0xffffffff, 0xffffffff }; | |
| 696 | const app_mask = []u32{ 0xfffffffc, 0x7fffffff }; | |
| 697 | ||
| 698 | const k_sigaction = extern struct { | |
| 699 | handler: extern fn (i32) void, | |
| 700 | flags: usize, | |
| 701 | restorer: extern fn () void, | |
| 702 | mask: [2]u32, | |
| 703 | }; | |
| 704 | ||
| 705 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. | |
| 706 | pub const Sigaction = struct { | |
| 707 | handler: extern fn (i32) void, | |
| 708 | mask: sigset_t, | |
| 709 | flags: u32, | |
| 710 | }; | |
| 711 | ||
| 712 | pub const SIG_ERR = @intToPtr(extern fn (i32) void, maxInt(usize)); | |
| 713 | pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0); | |
| 714 | pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1); | |
| 715 | pub const empty_sigset = []usize{0} ** sigset_t.len; | |
| 716 | ||
| 717 | pub const in_port_t = u16; | |
| 718 | pub const sa_family_t = u16; | |
| 719 | pub const socklen_t = u32; | |
| 720 | ||
| 721 | /// This intentionally only has ip4 and ip6 | |
| 722 | pub const sockaddr = extern union { | |
| 723 | in: sockaddr_in, | |
| 724 | in6: sockaddr_in6, | |
| 725 | }; | |
| 726 | ||
| 727 | pub const sockaddr_in = extern struct { | |
| 728 | family: sa_family_t, | |
| 729 | port: in_port_t, | |
| 730 | addr: u32, | |
| 731 | zero: [8]u8, | |
| 732 | }; | |
| 733 | ||
| 734 | pub const sockaddr_in6 = extern struct { | |
| 735 | family: sa_family_t, | |
| 736 | port: in_port_t, | |
| 737 | flowinfo: u32, | |
| 738 | addr: [16]u8, | |
| 739 | scope_id: u32, | |
| 740 | }; | |
| 741 | ||
| 742 | pub const sockaddr_un = extern struct { | |
| 743 | family: sa_family_t, | |
| 744 | path: [108]u8, | |
| 745 | }; | |
| 746 | ||
| 747 | pub const iovec = extern struct { | |
| 748 | iov_base: [*]u8, | |
| 749 | iov_len: usize, | |
| 750 | }; | |
| 751 | ||
| 752 | pub const iovec_const = extern struct { | |
| 753 | iov_base: [*]const u8, | |
| 754 | iov_len: usize, | |
| 755 | }; | |
| 756 | ||
| 757 | pub const mmsghdr = extern struct { | |
| 758 | msg_hdr: msghdr, | |
| 759 | msg_len: u32, | |
| 760 | }; | |
| 761 | ||
| 762 | pub const mmsghdr_const = extern struct { | |
| 763 | msg_hdr: msghdr_const, | |
| 764 | msg_len: u32, | |
| 765 | }; | |
| 766 | ||
| 767 | pub const epoll_data = extern union { | |
| 768 | ptr: usize, | |
| 769 | fd: i32, | |
| 770 | @"u32": u32, | |
| 771 | @"u64": u64, | |
| 772 | }; | |
| 773 | ||
| 774 | // On x86_64 the structure is packed so that it matches the definition of its | |
| 775 | // 32bit counterpart | |
| 776 | pub const epoll_event = if (builtin.arch != .x86_64) | |
| 777 | extern struct { | |
| 778 | events: u32, | |
| 779 | data: epoll_data, | |
| 780 | } | |
| 781 | else | |
| 782 | packed struct { | |
| 783 | events: u32, | |
| 784 | data: epoll_data, | |
| 785 | }; | |
| 786 | ||
| 787 | pub const _LINUX_CAPABILITY_VERSION_1 = 0x19980330; | |
| 788 | pub const _LINUX_CAPABILITY_U32S_1 = 1; | |
| 789 | ||
| 790 | pub const _LINUX_CAPABILITY_VERSION_2 = 0x20071026; | |
| 791 | pub const _LINUX_CAPABILITY_U32S_2 = 2; | |
| 792 | ||
| 793 | pub const _LINUX_CAPABILITY_VERSION_3 = 0x20080522; | |
| 794 | pub const _LINUX_CAPABILITY_U32S_3 = 2; | |
| 795 | ||
| 796 | pub const VFS_CAP_REVISION_MASK = 0xFF000000; | |
| 797 | pub const VFS_CAP_REVISION_SHIFT = 24; | |
| 798 | pub const VFS_CAP_FLAGS_MASK = ~VFS_CAP_REVISION_MASK; | |
| 799 | pub const VFS_CAP_FLAGS_EFFECTIVE = 0x000001; | |
| 800 | ||
| 801 | pub const VFS_CAP_REVISION_1 = 0x01000000; | |
| 802 | pub const VFS_CAP_U32_1 = 1; | |
| 803 | pub const XATTR_CAPS_SZ_1 = @sizeOf(u32) * (1 + 2 * VFS_CAP_U32_1); | |
| 804 | ||
| 805 | pub const VFS_CAP_REVISION_2 = 0x02000000; | |
| 806 | pub const VFS_CAP_U32_2 = 2; | |
| 807 | pub const XATTR_CAPS_SZ_2 = @sizeOf(u32) * (1 + 2 * VFS_CAP_U32_2); | |
| 808 | ||
| 809 | pub const XATTR_CAPS_SZ = XATTR_CAPS_SZ_2; | |
| 810 | pub const VFS_CAP_U32 = VFS_CAP_U32_2; | |
| 811 | pub const VFS_CAP_REVISION = VFS_CAP_REVISION_2; | |
| 812 | ||
| 813 | pub const vfs_cap_data = extern struct { | |
| 814 | //all of these are mandated as little endian | |
| 815 | //when on disk. | |
| 816 | const Data = struct { | |
| 817 | permitted: u32, | |
| 818 | inheritable: u32, | |
| 819 | }; | |
| 820 | ||
| 821 | magic_etc: u32, | |
| 822 | data: [VFS_CAP_U32]Data, | |
| 823 | }; | |
| 824 | ||
| 825 | pub const CAP_CHOWN = 0; | |
| 826 | pub const CAP_DAC_OVERRIDE = 1; | |
| 827 | pub const CAP_DAC_READ_SEARCH = 2; | |
| 828 | pub const CAP_FOWNER = 3; | |
| 829 | pub const CAP_FSETID = 4; | |
| 830 | pub const CAP_KILL = 5; | |
| 831 | pub const CAP_SETGID = 6; | |
| 832 | pub const CAP_SETUID = 7; | |
| 833 | pub const CAP_SETPCAP = 8; | |
| 834 | pub const CAP_LINUX_IMMUTABLE = 9; | |
| 835 | pub const CAP_NET_BIND_SERVICE = 10; | |
| 836 | pub const CAP_NET_BROADCAST = 11; | |
| 837 | pub const CAP_NET_ADMIN = 12; | |
| 838 | pub const CAP_NET_RAW = 13; | |
| 839 | pub const CAP_IPC_LOCK = 14; | |
| 840 | pub const CAP_IPC_OWNER = 15; | |
| 841 | pub const CAP_SYS_MODULE = 16; | |
| 842 | pub const CAP_SYS_RAWIO = 17; | |
| 843 | pub const CAP_SYS_CHROOT = 18; | |
| 844 | pub const CAP_SYS_PTRACE = 19; | |
| 845 | pub const CAP_SYS_PACCT = 20; | |
| 846 | pub const CAP_SYS_ADMIN = 21; | |
| 847 | pub const CAP_SYS_BOOT = 22; | |
| 848 | pub const CAP_SYS_NICE = 23; | |
| 849 | pub const CAP_SYS_RESOURCE = 24; | |
| 850 | pub const CAP_SYS_TIME = 25; | |
| 851 | pub const CAP_SYS_TTY_CONFIG = 26; | |
| 852 | pub const CAP_MKNOD = 27; | |
| 853 | pub const CAP_LEASE = 28; | |
| 854 | pub const CAP_AUDIT_WRITE = 29; | |
| 855 | pub const CAP_AUDIT_CONTROL = 30; | |
| 856 | pub const CAP_SETFCAP = 31; | |
| 857 | pub const CAP_MAC_OVERRIDE = 32; | |
| 858 | pub const CAP_MAC_ADMIN = 33; | |
| 859 | pub const CAP_SYSLOG = 34; | |
| 860 | pub const CAP_WAKE_ALARM = 35; | |
| 861 | pub const CAP_BLOCK_SUSPEND = 36; | |
| 862 | pub const CAP_AUDIT_READ = 37; | |
| 863 | pub const CAP_LAST_CAP = CAP_AUDIT_READ; | |
| 864 | ||
| 865 | pub fn cap_valid(u8: x) bool { | |
| 866 | return x >= 0 and x <= CAP_LAST_CAP; | |
| 867 | } | |
| 868 | ||
| 869 | pub fn CAP_TO_MASK(cap: u8) u32 { | |
| 870 | return u32(1) << u5(cap & 31); | |
| 871 | } | |
| 872 | ||
| 873 | pub fn CAP_TO_INDEX(cap: u8) u8 { | |
| 874 | return cap >> 5; | |
| 875 | } | |
| 876 | ||
| 877 | pub const cap_t = extern struct { | |
| 878 | hdrp: *cap_user_header_t, | |
| 879 | datap: *cap_user_data_t, | |
| 880 | }; | |
| 881 | ||
| 882 | pub const cap_user_header_t = extern struct { | |
| 883 | version: u32, | |
| 884 | pid: usize, | |
| 885 | }; | |
| 886 | ||
| 887 | pub const cap_user_data_t = extern struct { | |
| 888 | effective: u32, | |
| 889 | permitted: u32, | |
| 890 | inheritable: u32, | |
| 891 | }; | |
| 892 | ||
| 893 | pub const inotify_event = extern struct { | |
| 894 | wd: i32, | |
| 895 | mask: u32, | |
| 896 | cookie: u32, | |
| 897 | len: u32, | |
| 898 | //name: [?]u8, | |
| 899 | }; | |
| 900 | ||
| 901 | pub const dirent64 = extern struct { | |
| 902 | d_ino: u64, | |
| 903 | d_off: u64, | |
| 904 | d_reclen: u16, | |
| 905 | d_type: u8, | |
| 906 | d_name: u8, // field address is the address of first byte of name https://github.com/ziglang/zig/issues/173 | |
| 907 | }; | |
| 908 | ||
| 909 | pub const dl_phdr_info = extern struct { | |
| 910 | dlpi_addr: usize, | |
| 911 | dlpi_name: ?[*]const u8, | |
| 912 | dlpi_phdr: [*]elf.Phdr, | |
| 913 | dlpi_phnum: u16, | |
| 914 | }; | |
| 915 | ||
| 916 | pub const pthread_attr_t = extern struct { | |
| 917 | __size: [56]u8, | |
| 918 | __align: c_long, | |
| 919 | }; |
std/os/bits/linux/arm64.zig created+405| ... | ... | @@ -0,0 +1,405 @@ |
| 1 | // arm64-specific declarations that are intended to be imported into the POSIX namespace. | |
| 2 | // This does include Linux-only APIs. | |
| 3 | ||
| 4 | const std = @import("../../std.zig"); | |
| 5 | const linux = std.os.linux; | |
| 6 | const socklen_t = linux.socklen_t; | |
| 7 | const iovec = linux.iovec; | |
| 8 | const iovec_const = linux.iovec_const; | |
| 9 | ||
| 10 | pub const SYS_io_setup = 0; | |
| 11 | pub const SYS_io_destroy = 1; | |
| 12 | pub const SYS_io_submit = 2; | |
| 13 | pub const SYS_io_cancel = 3; | |
| 14 | pub const SYS_io_getevents = 4; | |
| 15 | pub const SYS_setxattr = 5; | |
| 16 | pub const SYS_lsetxattr = 6; | |
| 17 | pub const SYS_fsetxattr = 7; | |
| 18 | pub const SYS_getxattr = 8; | |
| 19 | pub const SYS_lgetxattr = 9; | |
| 20 | pub const SYS_fgetxattr = 10; | |
| 21 | pub const SYS_listxattr = 11; | |
| 22 | pub const SYS_llistxattr = 12; | |
| 23 | pub const SYS_flistxattr = 13; | |
| 24 | pub const SYS_removexattr = 14; | |
| 25 | pub const SYS_lremovexattr = 15; | |
| 26 | pub const SYS_fremovexattr = 16; | |
| 27 | pub const SYS_getcwd = 17; | |
| 28 | pub const SYS_lookup_dcookie = 18; | |
| 29 | pub const SYS_eventfd2 = 19; | |
| 30 | pub const SYS_epoll_create1 = 20; | |
| 31 | pub const SYS_epoll_ctl = 21; | |
| 32 | pub const SYS_epoll_pwait = 22; | |
| 33 | pub const SYS_dup = 23; | |
| 34 | pub const SYS_dup3 = 24; | |
| 35 | pub const SYS_fcntl = 25; | |
| 36 | pub const SYS_inotify_init1 = 26; | |
| 37 | pub const SYS_inotify_add_watch = 27; | |
| 38 | pub const SYS_inotify_rm_watch = 28; | |
| 39 | pub const SYS_ioctl = 29; | |
| 40 | pub const SYS_ioprio_set = 30; | |
| 41 | pub const SYS_ioprio_get = 31; | |
| 42 | pub const SYS_flock = 32; | |
| 43 | pub const SYS_mknodat = 33; | |
| 44 | pub const SYS_mkdirat = 34; | |
| 45 | pub const SYS_unlinkat = 35; | |
| 46 | pub const SYS_symlinkat = 36; | |
| 47 | pub const SYS_linkat = 37; | |
| 48 | pub const SYS_renameat = 38; | |
| 49 | pub const SYS_umount2 = 39; | |
| 50 | pub const SYS_mount = 40; | |
| 51 | pub const SYS_pivot_root = 41; | |
| 52 | pub const SYS_nfsservctl = 42; | |
| 53 | pub const SYS_statfs = 43; | |
| 54 | pub const SYS_fstatfs = 44; | |
| 55 | pub const SYS_truncate = 45; | |
| 56 | pub const SYS_ftruncate = 46; | |
| 57 | pub const SYS_fallocate = 47; | |
| 58 | pub const SYS_faccessat = 48; | |
| 59 | pub const SYS_chdir = 49; | |
| 60 | pub const SYS_fchdir = 50; | |
| 61 | pub const SYS_chroot = 51; | |
| 62 | pub const SYS_fchmod = 52; | |
| 63 | pub const SYS_fchmodat = 53; | |
| 64 | pub const SYS_fchownat = 54; | |
| 65 | pub const SYS_fchown = 55; | |
| 66 | pub const SYS_openat = 56; | |
| 67 | pub const SYS_close = 57; | |
| 68 | pub const SYS_vhangup = 58; | |
| 69 | pub const SYS_pipe2 = 59; | |
| 70 | pub const SYS_quotactl = 60; | |
| 71 | pub const SYS_getdents64 = 61; | |
| 72 | pub const SYS_lseek = 62; | |
| 73 | pub const SYS_read = 63; | |
| 74 | pub const SYS_write = 64; | |
| 75 | pub const SYS_readv = 65; | |
| 76 | pub const SYS_writev = 66; | |
| 77 | pub const SYS_pread64 = 67; | |
| 78 | pub const SYS_pwrite64 = 68; | |
| 79 | pub const SYS_preadv = 69; | |
| 80 | pub const SYS_pwritev = 70; | |
| 81 | pub const SYS_pselect6 = 72; | |
| 82 | pub const SYS_ppoll = 73; | |
| 83 | pub const SYS_signalfd4 = 74; | |
| 84 | pub const SYS_vmsplice = 75; | |
| 85 | pub const SYS_splice = 76; | |
| 86 | pub const SYS_tee = 77; | |
| 87 | pub const SYS_readlinkat = 78; | |
| 88 | pub const SYS_fstatat = 79; | |
| 89 | pub const SYS_fstat = 80; | |
| 90 | pub const SYS_sync = 81; | |
| 91 | pub const SYS_fsync = 82; | |
| 92 | pub const SYS_fdatasync = 83; | |
| 93 | pub const SYS_sync_file_range2 = 84; | |
| 94 | pub const SYS_sync_file_range = 84; | |
| 95 | pub const SYS_timerfd_create = 85; | |
| 96 | pub const SYS_timerfd_settime = 86; | |
| 97 | pub const SYS_timerfd_gettime = 87; | |
| 98 | pub const SYS_utimensat = 88; | |
| 99 | pub const SYS_acct = 89; | |
| 100 | pub const SYS_capget = 90; | |
| 101 | pub const SYS_capset = 91; | |
| 102 | pub const SYS_personality = 92; | |
| 103 | pub const SYS_exit = 93; | |
| 104 | pub const SYS_exit_group = 94; | |
| 105 | pub const SYS_waitid = 95; | |
| 106 | pub const SYS_set_tid_address = 96; | |
| 107 | pub const SYS_unshare = 97; | |
| 108 | pub const SYS_futex = 98; | |
| 109 | pub const SYS_set_robust_list = 99; | |
| 110 | pub const SYS_get_robust_list = 100; | |
| 111 | pub const SYS_nanosleep = 101; | |
| 112 | pub const SYS_getitimer = 102; | |
| 113 | pub const SYS_setitimer = 103; | |
| 114 | pub const SYS_kexec_load = 104; | |
| 115 | pub const SYS_init_module = 105; | |
| 116 | pub const SYS_delete_module = 106; | |
| 117 | pub const SYS_timer_create = 107; | |
| 118 | pub const SYS_timer_gettime = 108; | |
| 119 | pub const SYS_timer_getoverrun = 109; | |
| 120 | pub const SYS_timer_settime = 110; | |
| 121 | pub const SYS_timer_delete = 111; | |
| 122 | pub const SYS_clock_settime = 112; | |
| 123 | pub const SYS_clock_gettime = 113; | |
| 124 | pub const SYS_clock_getres = 114; | |
| 125 | pub const SYS_clock_nanosleep = 115; | |
| 126 | pub const SYS_syslog = 116; | |
| 127 | pub const SYS_ptrace = 117; | |
| 128 | pub const SYS_sched_setparam = 118; | |
| 129 | pub const SYS_sched_setscheduler = 119; | |
| 130 | pub const SYS_sched_getscheduler = 120; | |
| 131 | pub const SYS_sched_getparam = 121; | |
| 132 | pub const SYS_sched_setaffinity = 122; | |
| 133 | pub const SYS_sched_getaffinity = 123; | |
| 134 | pub const SYS_sched_yield = 124; | |
| 135 | pub const SYS_sched_get_priority_max = 125; | |
| 136 | pub const SYS_sched_get_priority_min = 126; | |
| 137 | pub const SYS_sched_rr_get_interval = 127; | |
| 138 | pub const SYS_restart_syscall = 128; | |
| 139 | pub const SYS_kill = 129; | |
| 140 | pub const SYS_tkill = 130; | |
| 141 | pub const SYS_tgkill = 131; | |
| 142 | pub const SYS_sigaltstack = 132; | |
| 143 | pub const SYS_rt_sigsuspend = 133; | |
| 144 | pub const SYS_rt_sigaction = 134; | |
| 145 | pub const SYS_rt_sigprocmask = 135; | |
| 146 | pub const SYS_rt_sigpending = 136; | |
| 147 | pub const SYS_rt_sigtimedwait = 137; | |
| 148 | pub const SYS_rt_sigqueueinfo = 138; | |
| 149 | pub const SYS_rt_sigreturn = 139; | |
| 150 | pub const SYS_setpriority = 140; | |
| 151 | pub const SYS_getpriority = 141; | |
| 152 | pub const SYS_reboot = 142; | |
| 153 | pub const SYS_setregid = 143; | |
| 154 | pub const SYS_setgid = 144; | |
| 155 | pub const SYS_setreuid = 145; | |
| 156 | pub const SYS_setuid = 146; | |
| 157 | pub const SYS_setresuid = 147; | |
| 158 | pub const SYS_getresuid = 148; | |
| 159 | pub const SYS_setresgid = 149; | |
| 160 | pub const SYS_getresgid = 150; | |
| 161 | pub const SYS_setfsuid = 151; | |
| 162 | pub const SYS_setfsgid = 152; | |
| 163 | pub const SYS_times = 153; | |
| 164 | pub const SYS_setpgid = 154; | |
| 165 | pub const SYS_getpgid = 155; | |
| 166 | pub const SYS_getsid = 156; | |
| 167 | pub const SYS_setsid = 157; | |
| 168 | pub const SYS_getgroups = 158; | |
| 169 | pub const SYS_setgroups = 159; | |
| 170 | pub const SYS_uname = 160; | |
| 171 | pub const SYS_sethostname = 161; | |
| 172 | pub const SYS_setdomainname = 162; | |
| 173 | pub const SYS_getrlimit = 163; | |
| 174 | pub const SYS_setrlimit = 164; | |
| 175 | pub const SYS_getrusage = 165; | |
| 176 | pub const SYS_umask = 166; | |
| 177 | pub const SYS_prctl = 167; | |
| 178 | pub const SYS_getcpu = 168; | |
| 179 | pub const SYS_gettimeofday = 169; | |
| 180 | pub const SYS_settimeofday = 170; | |
| 181 | pub const SYS_adjtimex = 171; | |
| 182 | pub const SYS_getpid = 172; | |
| 183 | pub const SYS_getppid = 173; | |
| 184 | pub const SYS_getuid = 174; | |
| 185 | pub const SYS_geteuid = 175; | |
| 186 | pub const SYS_getgid = 176; | |
| 187 | pub const SYS_getegid = 177; | |
| 188 | pub const SYS_gettid = 178; | |
| 189 | pub const SYS_sysinfo = 179; | |
| 190 | pub const SYS_mq_open = 180; | |
| 191 | pub const SYS_mq_unlink = 181; | |
| 192 | pub const SYS_mq_timedsend = 182; | |
| 193 | pub const SYS_mq_timedreceive = 183; | |
| 194 | pub const SYS_mq_notify = 184; | |
| 195 | pub const SYS_mq_getsetattr = 185; | |
| 196 | pub const SYS_msgget = 186; | |
| 197 | pub const SYS_msgctl = 187; | |
| 198 | pub const SYS_msgrcv = 188; | |
| 199 | pub const SYS_msgsnd = 189; | |
| 200 | pub const SYS_semget = 190; | |
| 201 | pub const SYS_semctl = 191; | |
| 202 | pub const SYS_semtimedop = 192; | |
| 203 | pub const SYS_semop = 193; | |
| 204 | pub const SYS_shmget = 194; | |
| 205 | pub const SYS_shmctl = 195; | |
| 206 | pub const SYS_shmat = 196; | |
| 207 | pub const SYS_shmdt = 197; | |
| 208 | pub const SYS_socket = 198; | |
| 209 | pub const SYS_socketpair = 199; | |
| 210 | pub const SYS_bind = 200; | |
| 211 | pub const SYS_listen = 201; | |
| 212 | pub const SYS_accept = 202; | |
| 213 | pub const SYS_connect = 203; | |
| 214 | pub const SYS_getsockname = 204; | |
| 215 | pub const SYS_getpeername = 205; | |
| 216 | pub const SYS_sendto = 206; | |
| 217 | pub const SYS_recvfrom = 207; | |
| 218 | pub const SYS_setsockopt = 208; | |
| 219 | pub const SYS_getsockopt = 209; | |
| 220 | pub const SYS_shutdown = 210; | |
| 221 | pub const SYS_sendmsg = 211; | |
| 222 | pub const SYS_recvmsg = 212; | |
| 223 | pub const SYS_readahead = 213; | |
| 224 | pub const SYS_brk = 214; | |
| 225 | pub const SYS_munmap = 215; | |
| 226 | pub const SYS_mremap = 216; | |
| 227 | pub const SYS_add_key = 217; | |
| 228 | pub const SYS_request_key = 218; | |
| 229 | pub const SYS_keyctl = 219; | |
| 230 | pub const SYS_clone = 220; | |
| 231 | pub const SYS_execve = 221; | |
| 232 | pub const SYS_mmap = 222; | |
| 233 | pub const SYS_fadvise64 = 223; | |
| 234 | pub const SYS_swapon = 224; | |
| 235 | pub const SYS_swapoff = 225; | |
| 236 | pub const SYS_mprotect = 226; | |
| 237 | pub const SYS_msync = 227; | |
| 238 | pub const SYS_mlock = 228; | |
| 239 | pub const SYS_munlock = 229; | |
| 240 | pub const SYS_mlockall = 230; | |
| 241 | pub const SYS_munlockall = 231; | |
| 242 | pub const SYS_mincore = 232; | |
| 243 | pub const SYS_madvise = 233; | |
| 244 | pub const SYS_remap_file_pages = 234; | |
| 245 | pub const SYS_mbind = 235; | |
| 246 | pub const SYS_get_mempolicy = 236; | |
| 247 | pub const SYS_set_mempolicy = 237; | |
| 248 | pub const SYS_migrate_pages = 238; | |
| 249 | pub const SYS_move_pages = 239; | |
| 250 | pub const SYS_rt_tgsigqueueinfo = 240; | |
| 251 | pub const SYS_perf_event_open = 241; | |
| 252 | pub const SYS_accept4 = 242; | |
| 253 | pub const SYS_recvmmsg = 243; | |
| 254 | pub const SYS_arch_specific_syscall = 244; | |
| 255 | pub const SYS_wait4 = 260; | |
| 256 | pub const SYS_prlimit64 = 261; | |
| 257 | pub const SYS_fanotify_init = 262; | |
| 258 | pub const SYS_fanotify_mark = 263; | |
| 259 | pub const SYS_clock_adjtime = 266; | |
| 260 | pub const SYS_syncfs = 267; | |
| 261 | pub const SYS_setns = 268; | |
| 262 | pub const SYS_sendmmsg = 269; | |
| 263 | pub const SYS_process_vm_readv = 270; | |
| 264 | pub const SYS_process_vm_writev = 271; | |
| 265 | pub const SYS_kcmp = 272; | |
| 266 | pub const SYS_finit_module = 273; | |
| 267 | pub const SYS_sched_setattr = 274; | |
| 268 | pub const SYS_sched_getattr = 275; | |
| 269 | pub const SYS_renameat2 = 276; | |
| 270 | pub const SYS_seccomp = 277; | |
| 271 | pub const SYS_getrandom = 278; | |
| 272 | pub const SYS_memfd_create = 279; | |
| 273 | pub const SYS_bpf = 280; | |
| 274 | pub const SYS_execveat = 281; | |
| 275 | pub const SYS_userfaultfd = 282; | |
| 276 | pub const SYS_membarrier = 283; | |
| 277 | pub const SYS_mlock2 = 284; | |
| 278 | pub const SYS_copy_file_range = 285; | |
| 279 | pub const SYS_preadv2 = 286; | |
| 280 | pub const SYS_pwritev2 = 287; | |
| 281 | pub const SYS_pkey_mprotect = 288; | |
| 282 | pub const SYS_pkey_alloc = 289; | |
| 283 | pub const SYS_pkey_free = 290; | |
| 284 | pub const SYS_statx = 291; | |
| 285 | pub const SYS_io_pgetevents = 292; | |
| 286 | pub const SYS_rseq = 293; | |
| 287 | pub const SYS_kexec_file_load = 294; | |
| 288 | pub const SYS_pidfd_send_signal = 424; | |
| 289 | pub const SYS_io_uring_setup = 425; | |
| 290 | pub const SYS_io_uring_enter = 426; | |
| 291 | pub const SYS_io_uring_register = 427; | |
| 292 | ||
| 293 | pub const O_CREAT = 0o100; | |
| 294 | pub const O_EXCL = 0o200; | |
| 295 | pub const O_NOCTTY = 0o400; | |
| 296 | pub const O_TRUNC = 0o1000; | |
| 297 | pub const O_APPEND = 0o2000; | |
| 298 | pub const O_NONBLOCK = 0o4000; | |
| 299 | pub const O_DSYNC = 0o10000; | |
| 300 | pub const O_SYNC = 0o4010000; | |
| 301 | pub const O_RSYNC = 0o4010000; | |
| 302 | pub const O_DIRECTORY = 0o200000; | |
| 303 | pub const O_NOFOLLOW = 0o400000; | |
| 304 | pub const O_CLOEXEC = 0o2000000; | |
| 305 | ||
| 306 | pub const O_ASYNC = 0o20000; | |
| 307 | pub const O_DIRECT = 0o40000; | |
| 308 | pub const O_LARGEFILE = 0; | |
| 309 | pub const O_NOATIME = 0o1000000; | |
| 310 | pub const O_PATH = 0o10000000; | |
| 311 | pub const O_TMPFILE = 0o20200000; | |
| 312 | pub const O_NDELAY = O_NONBLOCK; | |
| 313 | ||
| 314 | pub const F_DUPFD = 0; | |
| 315 | pub const F_GETFD = 1; | |
| 316 | pub const F_SETFD = 2; | |
| 317 | pub const F_GETFL = 3; | |
| 318 | pub const F_SETFL = 4; | |
| 319 | ||
| 320 | pub const F_SETOWN = 8; | |
| 321 | pub const F_GETOWN = 9; | |
| 322 | pub const F_SETSIG = 10; | |
| 323 | pub const F_GETSIG = 11; | |
| 324 | ||
| 325 | pub const F_GETLK = 5; | |
| 326 | pub const F_SETLK = 6; | |
| 327 | pub const F_SETLKW = 7; | |
| 328 | ||
| 329 | pub const F_SETOWN_EX = 15; | |
| 330 | pub const F_GETOWN_EX = 16; | |
| 331 | ||
| 332 | pub const F_GETOWNER_UIDS = 17; | |
| 333 | ||
| 334 | pub const AT_FDCWD = -100; | |
| 335 | pub const AT_SYMLINK_NOFOLLOW = 0x100; | |
| 336 | pub const AT_REMOVEDIR = 0x200; | |
| 337 | pub const AT_SYMLINK_FOLLOW = 0x400; | |
| 338 | pub const AT_NO_AUTOMOUNT = 0x800; | |
| 339 | pub const AT_EMPTY_PATH = 0x1000; | |
| 340 | ||
| 341 | pub const VDSO_USEFUL = true; | |
| 342 | pub const VDSO_CGT_SYM = "__kernel_clock_gettime"; | |
| 343 | pub const VDSO_CGT_VER = "LINUX_2.6.39"; | |
| 344 | ||
| 345 | pub const msghdr = extern struct { | |
| 346 | msg_name: ?*sockaddr, | |
| 347 | msg_namelen: socklen_t, | |
| 348 | msg_iov: [*]iovec, | |
| 349 | msg_iovlen: i32, | |
| 350 | __pad1: i32, | |
| 351 | msg_control: ?*c_void, | |
| 352 | msg_controllen: socklen_t, | |
| 353 | __pad2: socklen_t, | |
| 354 | msg_flags: i32, | |
| 355 | }; | |
| 356 | ||
| 357 | pub const msghdr_const = extern struct { | |
| 358 | msg_name: ?*const sockaddr, | |
| 359 | msg_namelen: socklen_t, | |
| 360 | msg_iov: [*]iovec_const, | |
| 361 | msg_iovlen: i32, | |
| 362 | __pad1: i32, | |
| 363 | msg_control: ?*c_void, | |
| 364 | msg_controllen: socklen_t, | |
| 365 | __pad2: socklen_t, | |
| 366 | msg_flags: i32, | |
| 367 | }; | |
| 368 | ||
| 369 | /// Renamed to Stat to not conflict with the stat function. | |
| 370 | pub const Stat = extern struct { | |
| 371 | dev: u64, | |
| 372 | ino: u64, | |
| 373 | nlink: usize, | |
| 374 | ||
| 375 | mode: u32, | |
| 376 | uid: u32, | |
| 377 | gid: u32, | |
| 378 | __pad0: u32, | |
| 379 | rdev: u64, | |
| 380 | size: i64, | |
| 381 | blksize: isize, | |
| 382 | blocks: i64, | |
| 383 | ||
| 384 | atim: timespec, | |
| 385 | mtim: timespec, | |
| 386 | ctim: timespec, | |
| 387 | __unused: [3]isize, | |
| 388 | }; | |
| 389 | ||
| 390 | pub const timespec = extern struct { | |
| 391 | tv_sec: isize, | |
| 392 | tv_nsec: isize, | |
| 393 | }; | |
| 394 | ||
| 395 | pub const timeval = extern struct { | |
| 396 | tv_sec: isize, | |
| 397 | tv_usec: isize, | |
| 398 | }; | |
| 399 | ||
| 400 | pub const timezone = extern struct { | |
| 401 | tz_minuteswest: i32, | |
| 402 | tz_dsttime: i32, | |
| 403 | }; | |
| 404 | ||
| 405 | pub const Elf_Symndx = u32; |
std/os/bits/linux/errno.zig created+427| ... | ... | @@ -0,0 +1,427 @@ |
| 1 | /// Operation not permitted | |
| 2 | pub const EPERM = 1; | |
| 3 | ||
| 4 | /// No such file or directory | |
| 5 | pub const ENOENT = 2; | |
| 6 | ||
| 7 | /// No such process | |
| 8 | pub const ESRCH = 3; | |
| 9 | ||
| 10 | /// Interrupted system call | |
| 11 | pub const EINTR = 4; | |
| 12 | ||
| 13 | /// I/O error | |
| 14 | pub const EIO = 5; | |
| 15 | ||
| 16 | /// No such device or address | |
| 17 | pub const ENXIO = 6; | |
| 18 | ||
| 19 | /// Arg list too long | |
| 20 | pub const E2BIG = 7; | |
| 21 | ||
| 22 | /// Exec format error | |
| 23 | pub const ENOEXEC = 8; | |
| 24 | ||
| 25 | /// Bad file number | |
| 26 | pub const EBADF = 9; | |
| 27 | ||
| 28 | /// No child processes | |
| 29 | pub const ECHILD = 10; | |
| 30 | ||
| 31 | /// Try again | |
| 32 | pub const EAGAIN = 11; | |
| 33 | ||
| 34 | /// Out of memory | |
| 35 | pub const ENOMEM = 12; | |
| 36 | ||
| 37 | /// Permission denied | |
| 38 | pub const EACCES = 13; | |
| 39 | ||
| 40 | /// Bad address | |
| 41 | pub const EFAULT = 14; | |
| 42 | ||
| 43 | /// Block device required | |
| 44 | pub const ENOTBLK = 15; | |
| 45 | ||
| 46 | /// Device or resource busy | |
| 47 | pub const EBUSY = 16; | |
| 48 | ||
| 49 | /// File exists | |
| 50 | pub const EEXIST = 17; | |
| 51 | ||
| 52 | /// Cross-device link | |
| 53 | pub const EXDEV = 18; | |
| 54 | ||
| 55 | /// No such device | |
| 56 | pub const ENODEV = 19; | |
| 57 | ||
| 58 | /// Not a directory | |
| 59 | pub const ENOTDIR = 20; | |
| 60 | ||
| 61 | /// Is a directory | |
| 62 | pub const EISDIR = 21; | |
| 63 | ||
| 64 | /// Invalid argument | |
| 65 | pub const EINVAL = 22; | |
| 66 | ||
| 67 | /// File table overflow | |
| 68 | pub const ENFILE = 23; | |
| 69 | ||
| 70 | /// Too many open files | |
| 71 | pub const EMFILE = 24; | |
| 72 | ||
| 73 | /// Not a typewriter | |
| 74 | pub const ENOTTY = 25; | |
| 75 | ||
| 76 | /// Text file busy | |
| 77 | pub const ETXTBSY = 26; | |
| 78 | ||
| 79 | /// File too large | |
| 80 | pub const EFBIG = 27; | |
| 81 | ||
| 82 | /// No space left on device | |
| 83 | pub const ENOSPC = 28; | |
| 84 | ||
| 85 | /// Illegal seek | |
| 86 | pub const ESPIPE = 29; | |
| 87 | ||
| 88 | /// Read-only file system | |
| 89 | pub const EROFS = 30; | |
| 90 | ||
| 91 | /// Too many links | |
| 92 | pub const EMLINK = 31; | |
| 93 | ||
| 94 | /// Broken pipe | |
| 95 | pub const EPIPE = 32; | |
| 96 | ||
| 97 | /// Math argument out of domain of func | |
| 98 | pub const EDOM = 33; | |
| 99 | ||
| 100 | /// Math result not representable | |
| 101 | pub const ERANGE = 34; | |
| 102 | ||
| 103 | /// Resource deadlock would occur | |
| 104 | pub const EDEADLK = 35; | |
| 105 | ||
| 106 | /// File name too long | |
| 107 | pub const ENAMETOOLONG = 36; | |
| 108 | ||
| 109 | /// No record locks available | |
| 110 | pub const ENOLCK = 37; | |
| 111 | ||
| 112 | /// Function not implemented | |
| 113 | pub const ENOSYS = 38; | |
| 114 | ||
| 115 | /// Directory not empty | |
| 116 | pub const ENOTEMPTY = 39; | |
| 117 | ||
| 118 | /// Too many symbolic links encountered | |
| 119 | pub const ELOOP = 40; | |
| 120 | ||
| 121 | /// Operation would block | |
| 122 | pub const EWOULDBLOCK = EAGAIN; | |
| 123 | ||
| 124 | /// No message of desired type | |
| 125 | pub const ENOMSG = 42; | |
| 126 | ||
| 127 | /// Identifier removed | |
| 128 | pub const EIDRM = 43; | |
| 129 | ||
| 130 | /// Channel number out of range | |
| 131 | pub const ECHRNG = 44; | |
| 132 | ||
| 133 | /// Level 2 not synchronized | |
| 134 | pub const EL2NSYNC = 45; | |
| 135 | ||
| 136 | /// Level 3 halted | |
| 137 | pub const EL3HLT = 46; | |
| 138 | ||
| 139 | /// Level 3 reset | |
| 140 | pub const EL3RST = 47; | |
| 141 | ||
| 142 | /// Link number out of range | |
| 143 | pub const ELNRNG = 48; | |
| 144 | ||
| 145 | /// Protocol driver not attached | |
| 146 | pub const EUNATCH = 49; | |
| 147 | ||
| 148 | /// No CSI structure available | |
| 149 | pub const ENOCSI = 50; | |
| 150 | ||
| 151 | /// Level 2 halted | |
| 152 | pub const EL2HLT = 51; | |
| 153 | ||
| 154 | /// Invalid exchange | |
| 155 | pub const EBADE = 52; | |
| 156 | ||
| 157 | /// Invalid request descriptor | |
| 158 | pub const EBADR = 53; | |
| 159 | ||
| 160 | /// Exchange full | |
| 161 | pub const EXFULL = 54; | |
| 162 | ||
| 163 | /// No anode | |
| 164 | pub const ENOANO = 55; | |
| 165 | ||
| 166 | /// Invalid request code | |
| 167 | pub const EBADRQC = 56; | |
| 168 | ||
| 169 | /// Invalid slot | |
| 170 | pub const EBADSLT = 57; | |
| 171 | ||
| 172 | /// Bad font file format | |
| 173 | pub const EBFONT = 59; | |
| 174 | ||
| 175 | /// Device not a stream | |
| 176 | pub const ENOSTR = 60; | |
| 177 | ||
| 178 | /// No data available | |
| 179 | pub const ENODATA = 61; | |
| 180 | ||
| 181 | /// Timer expired | |
| 182 | pub const ETIME = 62; | |
| 183 | ||
| 184 | /// Out of streams resources | |
| 185 | pub const ENOSR = 63; | |
| 186 | ||
| 187 | /// Machine is not on the network | |
| 188 | pub const ENONET = 64; | |
| 189 | ||
| 190 | /// Package not installed | |
| 191 | pub const ENOPKG = 65; | |
| 192 | ||
| 193 | /// Object is remote | |
| 194 | pub const EREMOTE = 66; | |
| 195 | ||
| 196 | /// Link has been severed | |
| 197 | pub const ENOLINK = 67; | |
| 198 | ||
| 199 | /// Advertise error | |
| 200 | pub const EADV = 68; | |
| 201 | ||
| 202 | /// Srmount error | |
| 203 | pub const ESRMNT = 69; | |
| 204 | ||
| 205 | /// Communication error on send | |
| 206 | pub const ECOMM = 70; | |
| 207 | ||
| 208 | /// Protocol error | |
| 209 | pub const EPROTO = 71; | |
| 210 | ||
| 211 | /// Multihop attempted | |
| 212 | pub const EMULTIHOP = 72; | |
| 213 | ||
| 214 | /// RFS specific error | |
| 215 | pub const EDOTDOT = 73; | |
| 216 | ||
| 217 | /// Not a data message | |
| 218 | pub const EBADMSG = 74; | |
| 219 | ||
| 220 | /// Value too large for defined data type | |
| 221 | pub const EOVERFLOW = 75; | |
| 222 | ||
| 223 | /// Name not unique on network | |
| 224 | pub const ENOTUNIQ = 76; | |
| 225 | ||
| 226 | /// File descriptor in bad state | |
| 227 | pub const EBADFD = 77; | |
| 228 | ||
| 229 | /// Remote address changed | |
| 230 | pub const EREMCHG = 78; | |
| 231 | ||
| 232 | /// Can not access a needed shared library | |
| 233 | pub const ELIBACC = 79; | |
| 234 | ||
| 235 | /// Accessing a corrupted shared library | |
| 236 | pub const ELIBBAD = 80; | |
| 237 | ||
| 238 | /// .lib section in a.out corrupted | |
| 239 | pub const ELIBSCN = 81; | |
| 240 | ||
| 241 | /// Attempting to link in too many shared libraries | |
| 242 | pub const ELIBMAX = 82; | |
| 243 | ||
| 244 | /// Cannot exec a shared library directly | |
| 245 | pub const ELIBEXEC = 83; | |
| 246 | ||
| 247 | /// Illegal byte sequence | |
| 248 | pub const EILSEQ = 84; | |
| 249 | ||
| 250 | /// Interrupted system call should be restarted | |
| 251 | pub const ERESTART = 85; | |
| 252 | ||
| 253 | /// Streams pipe error | |
| 254 | pub const ESTRPIPE = 86; | |
| 255 | ||
| 256 | /// Too many users | |
| 257 | pub const EUSERS = 87; | |
| 258 | ||
| 259 | /// Socket operation on non-socket | |
| 260 | pub const ENOTSOCK = 88; | |
| 261 | ||
| 262 | /// Destination address required | |
| 263 | pub const EDESTADDRREQ = 89; | |
| 264 | ||
| 265 | /// Message too long | |
| 266 | pub const EMSGSIZE = 90; | |
| 267 | ||
| 268 | /// Protocol wrong type for socket | |
| 269 | pub const EPROTOTYPE = 91; | |
| 270 | ||
| 271 | /// Protocol not available | |
| 272 | pub const ENOPROTOOPT = 92; | |
| 273 | ||
| 274 | /// Protocol not supported | |
| 275 | pub const EPROTONOSUPPORT = 93; | |
| 276 | ||
| 277 | /// Socket type not supported | |
| 278 | pub const ESOCKTNOSUPPORT = 94; | |
| 279 | ||
| 280 | /// Operation not supported on transport endpoint | |
| 281 | pub const EOPNOTSUPP = 95; | |
| 282 | ||
| 283 | /// Protocol family not supported | |
| 284 | pub const EPFNOSUPPORT = 96; | |
| 285 | ||
| 286 | /// Address family not supported by protocol | |
| 287 | pub const EAFNOSUPPORT = 97; | |
| 288 | ||
| 289 | /// Address already in use | |
| 290 | pub const EADDRINUSE = 98; | |
| 291 | ||
| 292 | /// Cannot assign requested address | |
| 293 | pub const EADDRNOTAVAIL = 99; | |
| 294 | ||
| 295 | /// Network is down | |
| 296 | pub const ENETDOWN = 100; | |
| 297 | ||
| 298 | /// Network is unreachable | |
| 299 | pub const ENETUNREACH = 101; | |
| 300 | ||
| 301 | /// Network dropped connection because of reset | |
| 302 | pub const ENETRESET = 102; | |
| 303 | ||
| 304 | /// Software caused connection abort | |
| 305 | pub const ECONNABORTED = 103; | |
| 306 | ||
| 307 | /// Connection reset by peer | |
| 308 | pub const ECONNRESET = 104; | |
| 309 | ||
| 310 | /// No buffer space available | |
| 311 | pub const ENOBUFS = 105; | |
| 312 | ||
| 313 | /// Transport endpoint is already connected | |
| 314 | pub const EISCONN = 106; | |
| 315 | ||
| 316 | /// Transport endpoint is not connected | |
| 317 | pub const ENOTCONN = 107; | |
| 318 | ||
| 319 | /// Cannot send after transport endpoint shutdown | |
| 320 | pub const ESHUTDOWN = 108; | |
| 321 | ||
| 322 | /// Too many references: cannot splice | |
| 323 | pub const ETOOMANYREFS = 109; | |
| 324 | ||
| 325 | /// Connection timed out | |
| 326 | pub const ETIMEDOUT = 110; | |
| 327 | ||
| 328 | /// Connection refused | |
| 329 | pub const ECONNREFUSED = 111; | |
| 330 | ||
| 331 | /// Host is down | |
| 332 | pub const EHOSTDOWN = 112; | |
| 333 | ||
| 334 | /// No route to host | |
| 335 | pub const EHOSTUNREACH = 113; | |
| 336 | ||
| 337 | /// Operation already in progress | |
| 338 | pub const EALREADY = 114; | |
| 339 | ||
| 340 | /// Operation now in progress | |
| 341 | pub const EINPROGRESS = 115; | |
| 342 | ||
| 343 | /// Stale NFS file handle | |
| 344 | pub const ESTALE = 116; | |
| 345 | ||
| 346 | /// Structure needs cleaning | |
| 347 | pub const EUCLEAN = 117; | |
| 348 | ||
| 349 | /// Not a XENIX named type file | |
| 350 | pub const ENOTNAM = 118; | |
| 351 | ||
| 352 | /// No XENIX semaphores available | |
| 353 | pub const ENAVAIL = 119; | |
| 354 | ||
| 355 | /// Is a named type file | |
| 356 | pub const EISNAM = 120; | |
| 357 | ||
| 358 | /// Remote I/O error | |
| 359 | pub const EREMOTEIO = 121; | |
| 360 | ||
| 361 | /// Quota exceeded | |
| 362 | pub const EDQUOT = 122; | |
| 363 | ||
| 364 | /// No medium found | |
| 365 | pub const ENOMEDIUM = 123; | |
| 366 | ||
| 367 | /// Wrong medium type | |
| 368 | pub const EMEDIUMTYPE = 124; | |
| 369 | ||
| 370 | // nameserver query return codes | |
| 371 | ||
| 372 | /// DNS server returned answer with no data | |
| 373 | pub const ENSROK = 0; | |
| 374 | ||
| 375 | /// DNS server returned answer with no data | |
| 376 | pub const ENSRNODATA = 160; | |
| 377 | ||
| 378 | /// DNS server claims query was misformatted | |
| 379 | pub const ENSRFORMERR = 161; | |
| 380 | ||
| 381 | /// DNS server returned general failure | |
| 382 | pub const ENSRSERVFAIL = 162; | |
| 383 | ||
| 384 | /// Domain name not found | |
| 385 | pub const ENSRNOTFOUND = 163; | |
| 386 | ||
| 387 | /// DNS server does not implement requested operation | |
| 388 | pub const ENSRNOTIMP = 164; | |
| 389 | ||
| 390 | /// DNS server refused query | |
| 391 | pub const ENSRREFUSED = 165; | |
| 392 | ||
| 393 | /// Misformatted DNS query | |
| 394 | pub const ENSRBADQUERY = 166; | |
| 395 | ||
| 396 | /// Misformatted domain name | |
| 397 | pub const ENSRBADNAME = 167; | |
| 398 | ||
| 399 | /// Unsupported address family | |
| 400 | pub const ENSRBADFAMILY = 168; | |
| 401 | ||
| 402 | /// Misformatted DNS reply | |
| 403 | pub const ENSRBADRESP = 169; | |
| 404 | ||
| 405 | /// Could not contact DNS servers | |
| 406 | pub const ENSRCONNREFUSED = 170; | |
| 407 | ||
| 408 | /// Timeout while contacting DNS servers | |
| 409 | pub const ENSRTIMEOUT = 171; | |
| 410 | ||
| 411 | /// End of file | |
| 412 | pub const ENSROF = 172; | |
| 413 | ||
| 414 | /// Error reading file | |
| 415 | pub const ENSRFILE = 173; | |
| 416 | ||
| 417 | /// Out of memory | |
| 418 | pub const ENSRNOMEM = 174; | |
| 419 | ||
| 420 | /// Application terminated lookup | |
| 421 | pub const ENSRDESTRUCTION = 175; | |
| 422 | ||
| 423 | /// Domain name is too long | |
| 424 | pub const ENSRQUERYDOMAINTOOLONG = 176; | |
| 425 | ||
| 426 | /// Domain name is too long | |
| 427 | pub const ENSRCNAMELOOP = 177; |
std/os/bits/linux/x86_64.zig created+470| ... | ... | @@ -0,0 +1,470 @@ |
| 1 | // x86-64-specific declarations that are intended to be imported into the POSIX namespace. | |
| 2 | const std = @import("../../../std.zig"); | |
| 3 | ||
| 4 | const linux = std.os.linux; | |
| 5 | const sockaddr = linux.sockaddr; | |
| 6 | const socklen_t = linux.socklen_t; | |
| 7 | const iovec = linux.iovec; | |
| 8 | const iovec_const = linux.iovec_const; | |
| 9 | ||
| 10 | pub const SYS_read = 0; | |
| 11 | pub const SYS_write = 1; | |
| 12 | pub const SYS_open = 2; | |
| 13 | pub const SYS_close = 3; | |
| 14 | pub const SYS_stat = 4; | |
| 15 | pub const SYS_fstat = 5; | |
| 16 | pub const SYS_lstat = 6; | |
| 17 | pub const SYS_poll = 7; | |
| 18 | pub const SYS_lseek = 8; | |
| 19 | pub const SYS_mmap = 9; | |
| 20 | pub const SYS_mprotect = 10; | |
| 21 | pub const SYS_munmap = 11; | |
| 22 | pub const SYS_brk = 12; | |
| 23 | pub const SYS_rt_sigaction = 13; | |
| 24 | pub const SYS_rt_sigprocmask = 14; | |
| 25 | pub const SYS_rt_sigreturn = 15; | |
| 26 | pub const SYS_ioctl = 16; | |
| 27 | pub const SYS_pread = 17; | |
| 28 | pub const SYS_pwrite = 18; | |
| 29 | pub const SYS_readv = 19; | |
| 30 | pub const SYS_writev = 20; | |
| 31 | pub const SYS_access = 21; | |
| 32 | pub const SYS_pipe = 22; | |
| 33 | pub const SYS_select = 23; | |
| 34 | pub const SYS_sched_yield = 24; | |
| 35 | pub const SYS_mremap = 25; | |
| 36 | pub const SYS_msync = 26; | |
| 37 | pub const SYS_mincore = 27; | |
| 38 | pub const SYS_madvise = 28; | |
| 39 | pub const SYS_shmget = 29; | |
| 40 | pub const SYS_shmat = 30; | |
| 41 | pub const SYS_shmctl = 31; | |
| 42 | pub const SYS_dup = 32; | |
| 43 | pub const SYS_dup2 = 33; | |
| 44 | pub const SYS_pause = 34; | |
| 45 | pub const SYS_nanosleep = 35; | |
| 46 | pub const SYS_getitimer = 36; | |
| 47 | pub const SYS_alarm = 37; | |
| 48 | pub const SYS_setitimer = 38; | |
| 49 | pub const SYS_getpid = 39; | |
| 50 | pub const SYS_sendfile = 40; | |
| 51 | pub const SYS_socket = 41; | |
| 52 | pub const SYS_connect = 42; | |
| 53 | pub const SYS_accept = 43; | |
| 54 | pub const SYS_sendto = 44; | |
| 55 | pub const SYS_recvfrom = 45; | |
| 56 | pub const SYS_sendmsg = 46; | |
| 57 | pub const SYS_recvmsg = 47; | |
| 58 | pub const SYS_shutdown = 48; | |
| 59 | pub const SYS_bind = 49; | |
| 60 | pub const SYS_listen = 50; | |
| 61 | pub const SYS_getsockname = 51; | |
| 62 | pub const SYS_getpeername = 52; | |
| 63 | pub const SYS_socketpair = 53; | |
| 64 | pub const SYS_setsockopt = 54; | |
| 65 | pub const SYS_getsockopt = 55; | |
| 66 | pub const SYS_clone = 56; | |
| 67 | pub const SYS_fork = 57; | |
| 68 | pub const SYS_vfork = 58; | |
| 69 | pub const SYS_execve = 59; | |
| 70 | pub const SYS_exit = 60; | |
| 71 | pub const SYS_wait4 = 61; | |
| 72 | pub const SYS_kill = 62; | |
| 73 | pub const SYS_uname = 63; | |
| 74 | pub const SYS_semget = 64; | |
| 75 | pub const SYS_semop = 65; | |
| 76 | pub const SYS_semctl = 66; | |
| 77 | pub const SYS_shmdt = 67; | |
| 78 | pub const SYS_msgget = 68; | |
| 79 | pub const SYS_msgsnd = 69; | |
| 80 | pub const SYS_msgrcv = 70; | |
| 81 | pub const SYS_msgctl = 71; | |
| 82 | pub const SYS_fcntl = 72; | |
| 83 | pub const SYS_flock = 73; | |
| 84 | pub const SYS_fsync = 74; | |
| 85 | pub const SYS_fdatasync = 75; | |
| 86 | pub const SYS_truncate = 76; | |
| 87 | pub const SYS_ftruncate = 77; | |
| 88 | pub const SYS_getdents = 78; | |
| 89 | pub const SYS_getcwd = 79; | |
| 90 | pub const SYS_chdir = 80; | |
| 91 | pub const SYS_fchdir = 81; | |
| 92 | pub const SYS_rename = 82; | |
| 93 | pub const SYS_mkdir = 83; | |
| 94 | pub const SYS_rmdir = 84; | |
| 95 | pub const SYS_creat = 85; | |
| 96 | pub const SYS_link = 86; | |
| 97 | pub const SYS_unlink = 87; | |
| 98 | pub const SYS_symlink = 88; | |
| 99 | pub const SYS_readlink = 89; | |
| 100 | pub const SYS_chmod = 90; | |
| 101 | pub const SYS_fchmod = 91; | |
| 102 | pub const SYS_chown = 92; | |
| 103 | pub const SYS_fchown = 93; | |
| 104 | pub const SYS_lchown = 94; | |
| 105 | pub const SYS_umask = 95; | |
| 106 | pub const SYS_gettimeofday = 96; | |
| 107 | pub const SYS_getrlimit = 97; | |
| 108 | pub const SYS_getrusage = 98; | |
| 109 | pub const SYS_sysinfo = 99; | |
| 110 | pub const SYS_times = 100; | |
| 111 | pub const SYS_ptrace = 101; | |
| 112 | pub const SYS_getuid = 102; | |
| 113 | pub const SYS_syslog = 103; | |
| 114 | pub const SYS_getgid = 104; | |
| 115 | pub const SYS_setuid = 105; | |
| 116 | pub const SYS_setgid = 106; | |
| 117 | pub const SYS_geteuid = 107; | |
| 118 | pub const SYS_getegid = 108; | |
| 119 | pub const SYS_setpgid = 109; | |
| 120 | pub const SYS_getppid = 110; | |
| 121 | pub const SYS_getpgrp = 111; | |
| 122 | pub const SYS_setsid = 112; | |
| 123 | pub const SYS_setreuid = 113; | |
| 124 | pub const SYS_setregid = 114; | |
| 125 | pub const SYS_getgroups = 115; | |
| 126 | pub const SYS_setgroups = 116; | |
| 127 | pub const SYS_setresuid = 117; | |
| 128 | pub const SYS_getresuid = 118; | |
| 129 | pub const SYS_setresgid = 119; | |
| 130 | pub const SYS_getresgid = 120; | |
| 131 | pub const SYS_getpgid = 121; | |
| 132 | pub const SYS_setfsuid = 122; | |
| 133 | pub const SYS_setfsgid = 123; | |
| 134 | pub const SYS_getsid = 124; | |
| 135 | pub const SYS_capget = 125; | |
| 136 | pub const SYS_capset = 126; | |
| 137 | pub const SYS_rt_sigpending = 127; | |
| 138 | pub const SYS_rt_sigtimedwait = 128; | |
| 139 | pub const SYS_rt_sigqueueinfo = 129; | |
| 140 | pub const SYS_rt_sigsuspend = 130; | |
| 141 | pub const SYS_sigaltstack = 131; | |
| 142 | pub const SYS_utime = 132; | |
| 143 | pub const SYS_mknod = 133; | |
| 144 | pub const SYS_uselib = 134; | |
| 145 | pub const SYS_personality = 135; | |
| 146 | pub const SYS_ustat = 136; | |
| 147 | pub const SYS_statfs = 137; | |
| 148 | pub const SYS_fstatfs = 138; | |
| 149 | pub const SYS_sysfs = 139; | |
| 150 | pub const SYS_getpriority = 140; | |
| 151 | pub const SYS_setpriority = 141; | |
| 152 | pub const SYS_sched_setparam = 142; | |
| 153 | pub const SYS_sched_getparam = 143; | |
| 154 | pub const SYS_sched_setscheduler = 144; | |
| 155 | pub const SYS_sched_getscheduler = 145; | |
| 156 | pub const SYS_sched_get_priority_max = 146; | |
| 157 | pub const SYS_sched_get_priority_min = 147; | |
| 158 | pub const SYS_sched_rr_get_interval = 148; | |
| 159 | pub const SYS_mlock = 149; | |
| 160 | pub const SYS_munlock = 150; | |
| 161 | pub const SYS_mlockall = 151; | |
| 162 | pub const SYS_munlockall = 152; | |
| 163 | pub const SYS_vhangup = 153; | |
| 164 | pub const SYS_modify_ldt = 154; | |
| 165 | pub const SYS_pivot_root = 155; | |
| 166 | pub const SYS__sysctl = 156; | |
| 167 | pub const SYS_prctl = 157; | |
| 168 | pub const SYS_arch_prctl = 158; | |
| 169 | pub const SYS_adjtimex = 159; | |
| 170 | pub const SYS_setrlimit = 160; | |
| 171 | pub const SYS_chroot = 161; | |
| 172 | pub const SYS_sync = 162; | |
| 173 | pub const SYS_acct = 163; | |
| 174 | pub const SYS_settimeofday = 164; | |
| 175 | pub const SYS_mount = 165; | |
| 176 | pub const SYS_umount2 = 166; | |
| 177 | pub const SYS_swapon = 167; | |
| 178 | pub const SYS_swapoff = 168; | |
| 179 | pub const SYS_reboot = 169; | |
| 180 | pub const SYS_sethostname = 170; | |
| 181 | pub const SYS_setdomainname = 171; | |
| 182 | pub const SYS_iopl = 172; | |
| 183 | pub const SYS_ioperm = 173; | |
| 184 | pub const SYS_create_module = 174; | |
| 185 | pub const SYS_init_module = 175; | |
| 186 | pub const SYS_delete_module = 176; | |
| 187 | pub const SYS_get_kernel_syms = 177; | |
| 188 | pub const SYS_query_module = 178; | |
| 189 | pub const SYS_quotactl = 179; | |
| 190 | pub const SYS_nfsservctl = 180; | |
| 191 | pub const SYS_getpmsg = 181; | |
| 192 | pub const SYS_putpmsg = 182; | |
| 193 | pub const SYS_afs_syscall = 183; | |
| 194 | pub const SYS_tuxcall = 184; | |
| 195 | pub const SYS_security = 185; | |
| 196 | pub const SYS_gettid = 186; | |
| 197 | pub const SYS_readahead = 187; | |
| 198 | pub const SYS_setxattr = 188; | |
| 199 | pub const SYS_lsetxattr = 189; | |
| 200 | pub const SYS_fsetxattr = 190; | |
| 201 | pub const SYS_getxattr = 191; | |
| 202 | pub const SYS_lgetxattr = 192; | |
| 203 | pub const SYS_fgetxattr = 193; | |
| 204 | pub const SYS_listxattr = 194; | |
| 205 | pub const SYS_llistxattr = 195; | |
| 206 | pub const SYS_flistxattr = 196; | |
| 207 | pub const SYS_removexattr = 197; | |
| 208 | pub const SYS_lremovexattr = 198; | |
| 209 | pub const SYS_fremovexattr = 199; | |
| 210 | pub const SYS_tkill = 200; | |
| 211 | pub const SYS_time = 201; | |
| 212 | pub const SYS_futex = 202; | |
| 213 | pub const SYS_sched_setaffinity = 203; | |
| 214 | pub const SYS_sched_getaffinity = 204; | |
| 215 | pub const SYS_set_thread_area = 205; | |
| 216 | pub const SYS_io_setup = 206; | |
| 217 | pub const SYS_io_destroy = 207; | |
| 218 | pub const SYS_io_getevents = 208; | |
| 219 | pub const SYS_io_submit = 209; | |
| 220 | pub const SYS_io_cancel = 210; | |
| 221 | pub const SYS_get_thread_area = 211; | |
| 222 | pub const SYS_lookup_dcookie = 212; | |
| 223 | pub const SYS_epoll_create = 213; | |
| 224 | pub const SYS_epoll_ctl_old = 214; | |
| 225 | pub const SYS_epoll_wait_old = 215; | |
| 226 | pub const SYS_remap_file_pages = 216; | |
| 227 | pub const SYS_getdents64 = 217; | |
| 228 | pub const SYS_set_tid_address = 218; | |
| 229 | pub const SYS_restart_syscall = 219; | |
| 230 | pub const SYS_semtimedop = 220; | |
| 231 | pub const SYS_fadvise64 = 221; | |
| 232 | pub const SYS_timer_create = 222; | |
| 233 | pub const SYS_timer_settime = 223; | |
| 234 | pub const SYS_timer_gettime = 224; | |
| 235 | pub const SYS_timer_getoverrun = 225; | |
| 236 | pub const SYS_timer_delete = 226; | |
| 237 | pub const SYS_clock_settime = 227; | |
| 238 | pub const SYS_clock_gettime = 228; | |
| 239 | pub const SYS_clock_getres = 229; | |
| 240 | pub const SYS_clock_nanosleep = 230; | |
| 241 | pub const SYS_exit_group = 231; | |
| 242 | pub const SYS_epoll_wait = 232; | |
| 243 | pub const SYS_epoll_ctl = 233; | |
| 244 | pub const SYS_tgkill = 234; | |
| 245 | pub const SYS_utimes = 235; | |
| 246 | pub const SYS_vserver = 236; | |
| 247 | pub const SYS_mbind = 237; | |
| 248 | pub const SYS_set_mempolicy = 238; | |
| 249 | pub const SYS_get_mempolicy = 239; | |
| 250 | pub const SYS_mq_open = 240; | |
| 251 | pub const SYS_mq_unlink = 241; | |
| 252 | pub const SYS_mq_timedsend = 242; | |
| 253 | pub const SYS_mq_timedreceive = 243; | |
| 254 | pub const SYS_mq_notify = 244; | |
| 255 | pub const SYS_mq_getsetattr = 245; | |
| 256 | pub const SYS_kexec_load = 246; | |
| 257 | pub const SYS_waitid = 247; | |
| 258 | pub const SYS_add_key = 248; | |
| 259 | pub const SYS_request_key = 249; | |
| 260 | pub const SYS_keyctl = 250; | |
| 261 | pub const SYS_ioprio_set = 251; | |
| 262 | pub const SYS_ioprio_get = 252; | |
| 263 | pub const SYS_inotify_init = 253; | |
| 264 | pub const SYS_inotify_add_watch = 254; | |
| 265 | pub const SYS_inotify_rm_watch = 255; | |
| 266 | pub const SYS_migrate_pages = 256; | |
| 267 | pub const SYS_openat = 257; | |
| 268 | pub const SYS_mkdirat = 258; | |
| 269 | pub const SYS_mknodat = 259; | |
| 270 | pub const SYS_fchownat = 260; | |
| 271 | pub const SYS_futimesat = 261; | |
| 272 | pub const SYS_newfstatat = 262; | |
| 273 | pub const SYS_fstatat = 262; | |
| 274 | pub const SYS_unlinkat = 263; | |
| 275 | pub const SYS_renameat = 264; | |
| 276 | pub const SYS_linkat = 265; | |
| 277 | pub const SYS_symlinkat = 266; | |
| 278 | pub const SYS_readlinkat = 267; | |
| 279 | pub const SYS_fchmodat = 268; | |
| 280 | pub const SYS_faccessat = 269; | |
| 281 | pub const SYS_pselect6 = 270; | |
| 282 | pub const SYS_ppoll = 271; | |
| 283 | pub const SYS_unshare = 272; | |
| 284 | pub const SYS_set_robust_list = 273; | |
| 285 | pub const SYS_get_robust_list = 274; | |
| 286 | pub const SYS_splice = 275; | |
| 287 | pub const SYS_tee = 276; | |
| 288 | pub const SYS_sync_file_range = 277; | |
| 289 | pub const SYS_vmsplice = 278; | |
| 290 | pub const SYS_move_pages = 279; | |
| 291 | pub const SYS_utimensat = 280; | |
| 292 | pub const SYS_epoll_pwait = 281; | |
| 293 | pub const SYS_signalfd = 282; | |
| 294 | pub const SYS_timerfd_create = 283; | |
| 295 | pub const SYS_eventfd = 284; | |
| 296 | pub const SYS_fallocate = 285; | |
| 297 | pub const SYS_timerfd_settime = 286; | |
| 298 | pub const SYS_timerfd_gettime = 287; | |
| 299 | pub const SYS_accept4 = 288; | |
| 300 | pub const SYS_signalfd4 = 289; | |
| 301 | pub const SYS_eventfd2 = 290; | |
| 302 | pub const SYS_epoll_create1 = 291; | |
| 303 | pub const SYS_dup3 = 292; | |
| 304 | pub const SYS_pipe2 = 293; | |
| 305 | pub const SYS_inotify_init1 = 294; | |
| 306 | pub const SYS_preadv = 295; | |
| 307 | pub const SYS_pwritev = 296; | |
| 308 | pub const SYS_rt_tgsigqueueinfo = 297; | |
| 309 | pub const SYS_perf_event_open = 298; | |
| 310 | pub const SYS_recvmmsg = 299; | |
| 311 | pub const SYS_fanotify_init = 300; | |
| 312 | pub const SYS_fanotify_mark = 301; | |
| 313 | pub const SYS_prlimit64 = 302; | |
| 314 | pub const SYS_name_to_handle_at = 303; | |
| 315 | pub const SYS_open_by_handle_at = 304; | |
| 316 | pub const SYS_clock_adjtime = 305; | |
| 317 | pub const SYS_syncfs = 306; | |
| 318 | pub const SYS_sendmmsg = 307; | |
| 319 | pub const SYS_setns = 308; | |
| 320 | pub const SYS_getcpu = 309; | |
| 321 | pub const SYS_process_vm_readv = 310; | |
| 322 | pub const SYS_process_vm_writev = 311; | |
| 323 | pub const SYS_kcmp = 312; | |
| 324 | pub const SYS_finit_module = 313; | |
| 325 | pub const SYS_sched_setattr = 314; | |
| 326 | pub const SYS_sched_getattr = 315; | |
| 327 | pub const SYS_renameat2 = 316; | |
| 328 | pub const SYS_seccomp = 317; | |
| 329 | pub const SYS_getrandom = 318; | |
| 330 | pub const SYS_memfd_create = 319; | |
| 331 | pub const SYS_kexec_file_load = 320; | |
| 332 | pub const SYS_bpf = 321; | |
| 333 | pub const SYS_execveat = 322; | |
| 334 | pub const SYS_userfaultfd = 323; | |
| 335 | pub const SYS_membarrier = 324; | |
| 336 | pub const SYS_mlock2 = 325; | |
| 337 | pub const SYS_copy_file_range = 326; | |
| 338 | pub const SYS_preadv2 = 327; | |
| 339 | pub const SYS_pwritev2 = 328; | |
| 340 | pub const SYS_pkey_mprotect = 329; | |
| 341 | pub const SYS_pkey_alloc = 330; | |
| 342 | pub const SYS_pkey_free = 331; | |
| 343 | pub const SYS_statx = 332; | |
| 344 | pub const SYS_io_pgetevents = 333; | |
| 345 | pub const SYS_rseq = 334; | |
| 346 | pub const SYS_pidfd_send_signal = 424; | |
| 347 | pub const SYS_io_uring_setup = 425; | |
| 348 | pub const SYS_io_uring_enter = 426; | |
| 349 | pub const SYS_io_uring_register = 427; | |
| 350 | ||
| 351 | pub const O_CREAT = 0o100; | |
| 352 | pub const O_EXCL = 0o200; | |
| 353 | pub const O_NOCTTY = 0o400; | |
| 354 | pub const O_TRUNC = 0o1000; | |
| 355 | pub const O_APPEND = 0o2000; | |
| 356 | pub const O_NONBLOCK = 0o4000; | |
| 357 | pub const O_DSYNC = 0o10000; | |
| 358 | pub const O_SYNC = 0o4010000; | |
| 359 | pub const O_RSYNC = 0o4010000; | |
| 360 | pub const O_DIRECTORY = 0o200000; | |
| 361 | pub const O_NOFOLLOW = 0o400000; | |
| 362 | pub const O_CLOEXEC = 0o2000000; | |
| 363 | ||
| 364 | pub const O_ASYNC = 0o20000; | |
| 365 | pub const O_DIRECT = 0o40000; | |
| 366 | pub const O_LARGEFILE = 0; | |
| 367 | pub const O_NOATIME = 0o1000000; | |
| 368 | pub const O_PATH = 0o10000000; | |
| 369 | pub const O_TMPFILE = 0o20200000; | |
| 370 | pub const O_NDELAY = O_NONBLOCK; | |
| 371 | ||
| 372 | pub const F_DUPFD = 0; | |
| 373 | pub const F_GETFD = 1; | |
| 374 | pub const F_SETFD = 2; | |
| 375 | pub const F_GETFL = 3; | |
| 376 | pub const F_SETFL = 4; | |
| 377 | ||
| 378 | pub const F_SETOWN = 8; | |
| 379 | pub const F_GETOWN = 9; | |
| 380 | pub const F_SETSIG = 10; | |
| 381 | pub const F_GETSIG = 11; | |
| 382 | ||
| 383 | pub const F_GETLK = 5; | |
| 384 | pub const F_SETLK = 6; | |
| 385 | pub const F_SETLKW = 7; | |
| 386 | ||
| 387 | pub const F_SETOWN_EX = 15; | |
| 388 | pub const F_GETOWN_EX = 16; | |
| 389 | ||
| 390 | pub const F_GETOWNER_UIDS = 17; | |
| 391 | ||
| 392 | pub const AT_FDCWD = -100; | |
| 393 | pub const AT_SYMLINK_NOFOLLOW = 0x100; | |
| 394 | pub const AT_REMOVEDIR = 0x200; | |
| 395 | pub const AT_SYMLINK_FOLLOW = 0x400; | |
| 396 | pub const AT_NO_AUTOMOUNT = 0x800; | |
| 397 | pub const AT_EMPTY_PATH = 0x1000; | |
| 398 | ||
| 399 | pub const VDSO_USEFUL = true; | |
| 400 | pub const VDSO_CGT_SYM = "__vdso_clock_gettime"; | |
| 401 | pub const VDSO_CGT_VER = "LINUX_2.6"; | |
| 402 | pub const VDSO_GETCPU_SYM = "__vdso_getcpu"; | |
| 403 | pub const VDSO_GETCPU_VER = "LINUX_2.6"; | |
| 404 | ||
| 405 | pub const ARCH_SET_GS = 0x1001; | |
| 406 | pub const ARCH_SET_FS = 0x1002; | |
| 407 | pub const ARCH_GET_FS = 0x1003; | |
| 408 | pub const ARCH_GET_GS = 0x1004; | |
| 409 | ||
| 410 | pub const msghdr = extern struct { | |
| 411 | msg_name: ?*sockaddr, | |
| 412 | msg_namelen: socklen_t, | |
| 413 | msg_iov: [*]iovec, | |
| 414 | msg_iovlen: i32, | |
| 415 | __pad1: i32, | |
| 416 | msg_control: ?*c_void, | |
| 417 | msg_controllen: socklen_t, | |
| 418 | __pad2: socklen_t, | |
| 419 | msg_flags: i32, | |
| 420 | }; | |
| 421 | ||
| 422 | pub const msghdr_const = extern struct { | |
| 423 | msg_name: ?*const sockaddr, | |
| 424 | msg_namelen: socklen_t, | |
| 425 | msg_iov: [*]iovec_const, | |
| 426 | msg_iovlen: i32, | |
| 427 | __pad1: i32, | |
| 428 | msg_control: ?*c_void, | |
| 429 | msg_controllen: socklen_t, | |
| 430 | __pad2: socklen_t, | |
| 431 | msg_flags: i32, | |
| 432 | }; | |
| 433 | ||
| 434 | /// Renamed to Stat to not conflict with the stat function. | |
| 435 | pub const Stat = extern struct { | |
| 436 | dev: u64, | |
| 437 | ino: u64, | |
| 438 | nlink: usize, | |
| 439 | ||
| 440 | mode: u32, | |
| 441 | uid: u32, | |
| 442 | gid: u32, | |
| 443 | __pad0: u32, | |
| 444 | rdev: u64, | |
| 445 | size: i64, | |
| 446 | blksize: isize, | |
| 447 | blocks: i64, | |
| 448 | ||
| 449 | atim: timespec, | |
| 450 | mtim: timespec, | |
| 451 | ctim: timespec, | |
| 452 | __unused: [3]isize, | |
| 453 | }; | |
| 454 | ||
| 455 | pub const timespec = extern struct { | |
| 456 | tv_sec: isize, | |
| 457 | tv_nsec: isize, | |
| 458 | }; | |
| 459 | ||
| 460 | pub const timeval = extern struct { | |
| 461 | tv_sec: isize, | |
| 462 | tv_usec: isize, | |
| 463 | }; | |
| 464 | ||
| 465 | pub const timezone = extern struct { | |
| 466 | tz_minuteswest: i32, | |
| 467 | tz_dsttime: i32, | |
| 468 | }; | |
| 469 | ||
| 470 | pub const Elf_Symndx = u32; |
std/os/bits/netbsd.zig created+731| ... | ... | @@ -0,0 +1,731 @@ |
| 1 | const std = @import("../../std.zig"); | |
| 2 | const maxInt = std.math.maxInt; | |
| 3 | ||
| 4 | pub const fd_t = c_int; | |
| 5 | pub const pid_t = c_int; | |
| 6 | ||
| 7 | /// Renamed from `kevent` to `Kevent` to avoid conflict with function name. | |
| 8 | pub const Kevent = extern struct { | |
| 9 | ident: usize, | |
| 10 | filter: i32, | |
| 11 | flags: u32, | |
| 12 | fflags: u32, | |
| 13 | data: i64, | |
| 14 | udata: usize, | |
| 15 | }; | |
| 16 | ||
| 17 | pub const pthread_attr_t = extern struct { | |
| 18 | pta_magic: u32, | |
| 19 | pta_flags: c_int, | |
| 20 | pta_private: *c_void, | |
| 21 | }; | |
| 22 | ||
| 23 | pub const msghdr = extern struct { | |
| 24 | /// optional address | |
| 25 | msg_name: ?*sockaddr, | |
| 26 | ||
| 27 | /// size of address | |
| 28 | msg_namelen: socklen_t, | |
| 29 | ||
| 30 | /// scatter/gather array | |
| 31 | msg_iov: [*]iovec, | |
| 32 | ||
| 33 | /// # elements in msg_iov | |
| 34 | msg_iovlen: i32, | |
| 35 | ||
| 36 | /// ancillary data | |
| 37 | msg_control: ?*c_void, | |
| 38 | ||
| 39 | /// ancillary data buffer len | |
| 40 | msg_controllen: socklen_t, | |
| 41 | ||
| 42 | /// flags on received message | |
| 43 | msg_flags: i32, | |
| 44 | }; | |
| 45 | ||
| 46 | pub const msghdr_const = extern struct { | |
| 47 | /// optional address | |
| 48 | msg_name: ?*const sockaddr, | |
| 49 | ||
| 50 | /// size of address | |
| 51 | msg_namelen: socklen_t, | |
| 52 | ||
| 53 | /// scatter/gather array | |
| 54 | msg_iov: [*]iovec_const, | |
| 55 | ||
| 56 | /// # elements in msg_iov | |
| 57 | msg_iovlen: i32, | |
| 58 | ||
| 59 | /// ancillary data | |
| 60 | msg_control: ?*c_void, | |
| 61 | ||
| 62 | /// ancillary data buffer len | |
| 63 | msg_controllen: socklen_t, | |
| 64 | ||
| 65 | /// flags on received message | |
| 66 | msg_flags: i32, | |
| 67 | }; | |
| 68 | ||
| 69 | pub const Stat = extern struct { | |
| 70 | dev: u64, | |
| 71 | mode: u32, | |
| 72 | ino: u64, | |
| 73 | nlink: usize, | |
| 74 | ||
| 75 | uid: u32, | |
| 76 | gid: u32, | |
| 77 | rdev: u64, | |
| 78 | ||
| 79 | atim: timespec, | |
| 80 | mtim: timespec, | |
| 81 | ctim: timespec, | |
| 82 | birthtim: timespec, | |
| 83 | ||
| 84 | size: i64, | |
| 85 | blocks: i64, | |
| 86 | blksize: isize, | |
| 87 | flags: u32, | |
| 88 | gen: u32, | |
| 89 | __spare: [2]u32, | |
| 90 | }; | |
| 91 | ||
| 92 | pub const timespec = extern struct { | |
| 93 | tv_sec: i64, | |
| 94 | tv_nsec: isize, | |
| 95 | }; | |
| 96 | ||
| 97 | pub const dirent = extern struct { | |
| 98 | d_fileno: u64, | |
| 99 | d_reclen: u16, | |
| 100 | d_namlen: u16, | |
| 101 | d_type: u8, | |
| 102 | d_off: i64, | |
| 103 | d_name: [512]u8, | |
| 104 | }; | |
| 105 | ||
| 106 | pub const in_port_t = u16; | |
| 107 | pub const sa_family_t = u8; | |
| 108 | ||
| 109 | pub const sockaddr = extern union { | |
| 110 | in: sockaddr_in, | |
| 111 | in6: sockaddr_in6, | |
| 112 | }; | |
| 113 | ||
| 114 | pub const sockaddr_in = extern struct { | |
| 115 | len: u8, | |
| 116 | family: sa_family_t, | |
| 117 | port: in_port_t, | |
| 118 | addr: u32, | |
| 119 | zero: [8]u8, | |
| 120 | }; | |
| 121 | ||
| 122 | pub const sockaddr_in6 = extern struct { | |
| 123 | len: u8, | |
| 124 | family: sa_family_t, | |
| 125 | port: in_port_t, | |
| 126 | flowinfo: u32, | |
| 127 | addr: [16]u8, | |
| 128 | scope_id: u32, | |
| 129 | }; | |
| 130 | ||
| 131 | pub const CTL_KERN = 1; | |
| 132 | pub const CTL_DEBUG = 5; | |
| 133 | ||
| 134 | pub const KERN_PROC_ARGS = 48; // struct: process argv/env | |
| 135 | pub const KERN_PROC_PATHNAME = 5; // path to executable | |
| 136 | ||
| 137 | pub const PATH_MAX = 1024; | |
| 138 | ||
| 139 | pub const STDIN_FILENO = 0; | |
| 140 | pub const STDOUT_FILENO = 1; | |
| 141 | pub const STDERR_FILENO = 2; | |
| 142 | ||
| 143 | pub const PROT_NONE = 0; | |
| 144 | pub const PROT_READ = 1; | |
| 145 | pub const PROT_WRITE = 2; | |
| 146 | pub const PROT_EXEC = 4; | |
| 147 | ||
| 148 | pub const CLOCK_REALTIME = 0; | |
| 149 | pub const CLOCK_VIRTUAL = 1; | |
| 150 | pub const CLOCK_PROF = 2; | |
| 151 | pub const CLOCK_MONOTONIC = 3; | |
| 152 | pub const CLOCK_THREAD_CPUTIME_ID = 0x20000000; | |
| 153 | pub const CLOCK_PROCESS_CPUTIME_ID = 0x40000000; | |
| 154 | ||
| 155 | pub const MAP_FAILED = maxInt(usize); | |
| 156 | pub const MAP_SHARED = 0x0001; | |
| 157 | pub const MAP_PRIVATE = 0x0002; | |
| 158 | pub const MAP_REMAPDUP = 0x0004; | |
| 159 | pub const MAP_FIXED = 0x0010; | |
| 160 | pub const MAP_RENAME = 0x0020; | |
| 161 | pub const MAP_NORESERVE = 0x0040; | |
| 162 | pub const MAP_INHERIT = 0x0080; | |
| 163 | pub const MAP_HASSEMAPHORE = 0x0200; | |
| 164 | pub const MAP_TRYFIXED = 0x0400; | |
| 165 | pub const MAP_WIRED = 0x0800; | |
| 166 | ||
| 167 | pub const MAP_FILE = 0x0000; | |
| 168 | pub const MAP_NOSYNC = 0x0800; | |
| 169 | pub const MAP_ANON = 0x1000; | |
| 170 | pub const MAP_ANONYMOUS = MAP_ANON; | |
| 171 | pub const MAP_STACK = 0x2000; | |
| 172 | ||
| 173 | pub const WNOHANG = 0x00000001; | |
| 174 | pub const WUNTRACED = 0x00000002; | |
| 175 | pub const WSTOPPED = WUNTRACED; | |
| 176 | pub const WCONTINUED = 0x00000010; | |
| 177 | pub const WNOWAIT = 0x00010000; | |
| 178 | pub const WEXITED = 0x00000020; | |
| 179 | pub const WTRAPPED = 0x00000040; | |
| 180 | ||
| 181 | pub const SA_ONSTACK = 0x0001; | |
| 182 | pub const SA_RESTART = 0x0002; | |
| 183 | pub const SA_RESETHAND = 0x0004; | |
| 184 | pub const SA_NOCLDSTOP = 0x0008; | |
| 185 | pub const SA_NODEFER = 0x0010; | |
| 186 | pub const SA_NOCLDWAIT = 0x0020; | |
| 187 | pub const SA_SIGINFO = 0x0040; | |
| 188 | ||
| 189 | pub const SIGHUP = 1; | |
| 190 | pub const SIGINT = 2; | |
| 191 | pub const SIGQUIT = 3; | |
| 192 | pub const SIGILL = 4; | |
| 193 | pub const SIGTRAP = 5; | |
| 194 | pub const SIGABRT = 6; | |
| 195 | pub const SIGIOT = SIGABRT; | |
| 196 | pub const SIGEMT = 7; | |
| 197 | pub const SIGFPE = 8; | |
| 198 | pub const SIGKILL = 9; | |
| 199 | pub const SIGBUS = 10; | |
| 200 | pub const SIGSEGV = 11; | |
| 201 | pub const SIGSYS = 12; | |
| 202 | pub const SIGPIPE = 13; | |
| 203 | pub const SIGALRM = 14; | |
| 204 | pub const SIGTERM = 15; | |
| 205 | pub const SIGURG = 16; | |
| 206 | pub const SIGSTOP = 17; | |
| 207 | pub const SIGTSTP = 18; | |
| 208 | pub const SIGCONT = 19; | |
| 209 | pub const SIGCHLD = 20; | |
| 210 | pub const SIGTTIN = 21; | |
| 211 | pub const SIGTTOU = 22; | |
| 212 | pub const SIGIO = 23; | |
| 213 | pub const SIGXCPU = 24; | |
| 214 | pub const SIGXFSZ = 25; | |
| 215 | pub const SIGVTALRM = 26; | |
| 216 | pub const SIGPROF = 27; | |
| 217 | pub const SIGWINCH = 28; | |
| 218 | pub const SIGINFO = 29; | |
| 219 | pub const SIGUSR1 = 30; | |
| 220 | pub const SIGUSR2 = 31; | |
| 221 | pub const SIGPWR = 32; | |
| 222 | ||
| 223 | pub const SIGRTMIN = 33; | |
| 224 | pub const SIGRTMAX = 63; | |
| 225 | ||
| 226 | // access function | |
| 227 | pub const F_OK = 0; // test for existence of file | |
| 228 | pub const X_OK = 1; // test for execute or search permission | |
| 229 | pub const W_OK = 2; // test for write permission | |
| 230 | pub const R_OK = 4; // test for read permission | |
| 231 | ||
| 232 | pub const O_RDONLY = 0x0000; | |
| 233 | pub const O_WRONLY = 0x0001; | |
| 234 | pub const O_RDWR = 0x0002; | |
| 235 | pub const O_ACCMODE = 0x0003; | |
| 236 | ||
| 237 | pub const O_CREAT = 0x0200; | |
| 238 | pub const O_EXCL = 0x0800; | |
| 239 | pub const O_NOCTTY = 0x8000; | |
| 240 | pub const O_TRUNC = 0x0400; | |
| 241 | pub const O_APPEND = 0x0008; | |
| 242 | pub const O_NONBLOCK = 0x0004; | |
| 243 | pub const O_DSYNC = 0x00010000; | |
| 244 | pub const O_SYNC = 0x0080; | |
| 245 | pub const O_RSYNC = 0x00020000; | |
| 246 | pub const O_DIRECTORY = 0x00080000; | |
| 247 | pub const O_NOFOLLOW = 0x00000100; | |
| 248 | pub const O_CLOEXEC = 0x00400000; | |
| 249 | ||
| 250 | pub const O_ASYNC = 0x0040; | |
| 251 | pub const O_DIRECT = 0x00080000; | |
| 252 | pub const O_LARGEFILE = 0; | |
| 253 | pub const O_NOATIME = 0; | |
| 254 | pub const O_PATH = 0; | |
| 255 | pub const O_TMPFILE = 0; | |
| 256 | pub const O_NDELAY = O_NONBLOCK; | |
| 257 | ||
| 258 | pub const F_DUPFD = 0; | |
| 259 | pub const F_GETFD = 1; | |
| 260 | pub const F_SETFD = 2; | |
| 261 | pub const F_GETFL = 3; | |
| 262 | pub const F_SETFL = 4; | |
| 263 | ||
| 264 | pub const F_GETOWN = 5; | |
| 265 | pub const F_SETOWN = 6; | |
| 266 | ||
| 267 | pub const F_GETLK = 7; | |
| 268 | pub const F_SETLK = 8; | |
| 269 | pub const F_SETLKW = 9; | |
| 270 | ||
| 271 | pub const SEEK_SET = 0; | |
| 272 | pub const SEEK_CUR = 1; | |
| 273 | pub const SEEK_END = 2; | |
| 274 | ||
| 275 | pub const SIG_BLOCK = 1; | |
| 276 | pub const SIG_UNBLOCK = 2; | |
| 277 | pub const SIG_SETMASK = 3; | |
| 278 | ||
| 279 | pub const SOCK_STREAM = 1; | |
| 280 | pub const SOCK_DGRAM = 2; | |
| 281 | pub const SOCK_RAW = 3; | |
| 282 | pub const SOCK_RDM = 4; | |
| 283 | pub const SOCK_SEQPACKET = 5; | |
| 284 | ||
| 285 | pub const SOCK_CLOEXEC = 0x10000000; | |
| 286 | pub const SOCK_NONBLOCK = 0x20000000; | |
| 287 | ||
| 288 | pub const PROTO_ip = 0; | |
| 289 | pub const PROTO_icmp = 1; | |
| 290 | pub const PROTO_igmp = 2; | |
| 291 | pub const PROTO_ggp = 3; | |
| 292 | pub const PROTO_ipencap = 4; | |
| 293 | pub const PROTO_tcp = 6; | |
| 294 | pub const PROTO_egp = 8; | |
| 295 | pub const PROTO_pup = 12; | |
| 296 | pub const PROTO_udp = 17; | |
| 297 | pub const PROTO_xns_idp = 22; | |
| 298 | pub const PROTO_iso_tp4 = 29; | |
| 299 | pub const PROTO_ipv6 = 41; | |
| 300 | pub const PROTO_ipv6_route = 43; | |
| 301 | pub const PROTO_ipv6_frag = 44; | |
| 302 | pub const PROTO_rsvp = 46; | |
| 303 | pub const PROTO_gre = 47; | |
| 304 | pub const PROTO_esp = 50; | |
| 305 | pub const PROTO_ah = 51; | |
| 306 | pub const PROTO_ipv6_icmp = 58; | |
| 307 | pub const PROTO_ipv6_nonxt = 59; | |
| 308 | pub const PROTO_ipv6_opts = 60; | |
| 309 | pub const PROTO_encap = 98; | |
| 310 | pub const PROTO_pim = 103; | |
| 311 | pub const PROTO_raw = 255; | |
| 312 | ||
| 313 | pub const PF_UNSPEC = 0; | |
| 314 | pub const PF_LOCAL = 1; | |
| 315 | pub const PF_UNIX = PF_LOCAL; | |
| 316 | pub const PF_FILE = PF_LOCAL; | |
| 317 | pub const PF_INET = 2; | |
| 318 | pub const PF_APPLETALK = 16; | |
| 319 | pub const PF_INET6 = 24; | |
| 320 | pub const PF_DECnet = 12; | |
| 321 | pub const PF_KEY = 29; | |
| 322 | pub const PF_ROUTE = 34; | |
| 323 | pub const PF_SNA = 11; | |
| 324 | pub const PF_MPLS = 33; | |
| 325 | pub const PF_CAN = 35; | |
| 326 | pub const PF_BLUETOOTH = 31; | |
| 327 | pub const PF_ISDN = 26; | |
| 328 | pub const PF_MAX = 37; | |
| 329 | ||
| 330 | pub const AF_UNSPEC = PF_UNSPEC; | |
| 331 | pub const AF_LOCAL = PF_LOCAL; | |
| 332 | pub const AF_UNIX = AF_LOCAL; | |
| 333 | pub const AF_FILE = AF_LOCAL; | |
| 334 | pub const AF_INET = PF_INET; | |
| 335 | pub const AF_APPLETALK = PF_APPLETALK; | |
| 336 | pub const AF_INET6 = PF_INET6; | |
| 337 | pub const AF_KEY = PF_KEY; | |
| 338 | pub const AF_ROUTE = PF_ROUTE; | |
| 339 | pub const AF_SNA = PF_SNA; | |
| 340 | pub const AF_MPLS = PF_MPLS; | |
| 341 | pub const AF_CAN = PF_CAN; | |
| 342 | pub const AF_BLUETOOTH = PF_BLUETOOTH; | |
| 343 | pub const AF_ISDN = PF_ISDN; | |
| 344 | pub const AF_MAX = PF_MAX; | |
| 345 | ||
| 346 | pub const DT_UNKNOWN = 0; | |
| 347 | pub const DT_FIFO = 1; | |
| 348 | pub const DT_CHR = 2; | |
| 349 | pub const DT_DIR = 4; | |
| 350 | pub const DT_BLK = 6; | |
| 351 | pub const DT_REG = 8; | |
| 352 | pub const DT_LNK = 10; | |
| 353 | pub const DT_SOCK = 12; | |
| 354 | pub const DT_WHT = 14; | |
| 355 | ||
| 356 | /// add event to kq (implies enable) | |
| 357 | pub const EV_ADD = 0x0001; | |
| 358 | ||
| 359 | /// delete event from kq | |
| 360 | pub const EV_DELETE = 0x0002; | |
| 361 | ||
| 362 | /// enable event | |
| 363 | pub const EV_ENABLE = 0x0004; | |
| 364 | ||
| 365 | /// disable event (not reported) | |
| 366 | pub const EV_DISABLE = 0x0008; | |
| 367 | ||
| 368 | /// only report one occurrence | |
| 369 | pub const EV_ONESHOT = 0x0010; | |
| 370 | ||
| 371 | /// clear event state after reporting | |
| 372 | pub const EV_CLEAR = 0x0020; | |
| 373 | ||
| 374 | /// force immediate event output | |
| 375 | /// ... with or without EV_ERROR | |
| 376 | /// ... use KEVENT_FLAG_ERROR_EVENTS | |
| 377 | /// on syscalls supporting flags | |
| 378 | pub const EV_RECEIPT = 0x0040; | |
| 379 | ||
| 380 | /// disable event after reporting | |
| 381 | pub const EV_DISPATCH = 0x0080; | |
| 382 | ||
| 383 | pub const EVFILT_READ = 0; | |
| 384 | pub const EVFILT_WRITE = 1; | |
| 385 | ||
| 386 | /// attached to aio requests | |
| 387 | pub const EVFILT_AIO = 2; | |
| 388 | ||
| 389 | /// attached to vnodes | |
| 390 | pub const EVFILT_VNODE = 3; | |
| 391 | ||
| 392 | /// attached to struct proc | |
| 393 | pub const EVFILT_PROC = 4; | |
| 394 | ||
| 395 | /// attached to struct proc | |
| 396 | pub const EVFILT_SIGNAL = 5; | |
| 397 | ||
| 398 | /// timers | |
| 399 | pub const EVFILT_TIMER = 6; | |
| 400 | ||
| 401 | /// Filesystem events | |
| 402 | pub const EVFILT_FS = 7; | |
| 403 | ||
| 404 | /// On input, NOTE_TRIGGER causes the event to be triggered for output. | |
| 405 | pub const NOTE_TRIGGER = 0x08000000; | |
| 406 | ||
| 407 | /// low water mark | |
| 408 | pub const NOTE_LOWAT = 0x00000001; | |
| 409 | ||
| 410 | /// vnode was removed | |
| 411 | pub const NOTE_DELETE = 0x00000001; | |
| 412 | ||
| 413 | /// data contents changed | |
| 414 | pub const NOTE_WRITE = 0x00000002; | |
| 415 | ||
| 416 | /// size increased | |
| 417 | pub const NOTE_EXTEND = 0x00000004; | |
| 418 | ||
| 419 | /// attributes changed | |
| 420 | pub const NOTE_ATTRIB = 0x00000008; | |
| 421 | ||
| 422 | /// link count changed | |
| 423 | pub const NOTE_LINK = 0x00000010; | |
| 424 | ||
| 425 | /// vnode was renamed | |
| 426 | pub const NOTE_RENAME = 0x00000020; | |
| 427 | ||
| 428 | /// vnode access was revoked | |
| 429 | pub const NOTE_REVOKE = 0x00000040; | |
| 430 | ||
| 431 | /// process exited | |
| 432 | pub const NOTE_EXIT = 0x80000000; | |
| 433 | ||
| 434 | /// process forked | |
| 435 | pub const NOTE_FORK = 0x40000000; | |
| 436 | ||
| 437 | /// process exec'd | |
| 438 | pub const NOTE_EXEC = 0x20000000; | |
| 439 | ||
| 440 | /// mask for signal & exit status | |
| 441 | pub const NOTE_PDATAMASK = 0x000fffff; | |
| 442 | pub const NOTE_PCTRLMASK = 0xf0000000; | |
| 443 | ||
| 444 | pub const TIOCCBRK = 0x2000747a; | |
| 445 | pub const TIOCCDTR = 0x20007478; | |
| 446 | pub const TIOCCONS = 0x80047462; | |
| 447 | pub const TIOCDCDTIMESTAMP = 0x40107458; | |
| 448 | pub const TIOCDRAIN = 0x2000745e; | |
| 449 | pub const TIOCEXCL = 0x2000740d; | |
| 450 | pub const TIOCEXT = 0x80047460; | |
| 451 | pub const TIOCFLAG_CDTRCTS = 0x10; | |
| 452 | pub const TIOCFLAG_CLOCAL = 0x2; | |
| 453 | pub const TIOCFLAG_CRTSCTS = 0x4; | |
| 454 | pub const TIOCFLAG_MDMBUF = 0x8; | |
| 455 | pub const TIOCFLAG_SOFTCAR = 0x1; | |
| 456 | pub const TIOCFLUSH = 0x80047410; | |
| 457 | pub const TIOCGETA = 0x402c7413; | |
| 458 | pub const TIOCGETD = 0x4004741a; | |
| 459 | pub const TIOCGFLAGS = 0x4004745d; | |
| 460 | pub const TIOCGLINED = 0x40207442; | |
| 461 | pub const TIOCGPGRP = 0x40047477; | |
| 462 | pub const TIOCGQSIZE = 0x40047481; | |
| 463 | pub const TIOCGRANTPT = 0x20007447; | |
| 464 | pub const TIOCGSID = 0x40047463; | |
| 465 | pub const TIOCGSIZE = 0x40087468; | |
| 466 | pub const TIOCGWINSZ = 0x40087468; | |
| 467 | pub const TIOCMBIC = 0x8004746b; | |
| 468 | pub const TIOCMBIS = 0x8004746c; | |
| 469 | pub const TIOCMGET = 0x4004746a; | |
| 470 | pub const TIOCMSET = 0x8004746d; | |
| 471 | pub const TIOCM_CAR = 0x40; | |
| 472 | pub const TIOCM_CD = 0x40; | |
| 473 | pub const TIOCM_CTS = 0x20; | |
| 474 | pub const TIOCM_DSR = 0x100; | |
| 475 | pub const TIOCM_DTR = 0x2; | |
| 476 | pub const TIOCM_LE = 0x1; | |
| 477 | pub const TIOCM_RI = 0x80; | |
| 478 | pub const TIOCM_RNG = 0x80; | |
| 479 | pub const TIOCM_RTS = 0x4; | |
| 480 | pub const TIOCM_SR = 0x10; | |
| 481 | pub const TIOCM_ST = 0x8; | |
| 482 | pub const TIOCNOTTY = 0x20007471; | |
| 483 | pub const TIOCNXCL = 0x2000740e; | |
| 484 | pub const TIOCOUTQ = 0x40047473; | |
| 485 | pub const TIOCPKT = 0x80047470; | |
| 486 | pub const TIOCPKT_DATA = 0x0; | |
| 487 | pub const TIOCPKT_DOSTOP = 0x20; | |
| 488 | pub const TIOCPKT_FLUSHREAD = 0x1; | |
| 489 | pub const TIOCPKT_FLUSHWRITE = 0x2; | |
| 490 | pub const TIOCPKT_IOCTL = 0x40; | |
| 491 | pub const TIOCPKT_NOSTOP = 0x10; | |
| 492 | pub const TIOCPKT_START = 0x8; | |
| 493 | pub const TIOCPKT_STOP = 0x4; | |
| 494 | pub const TIOCPTMGET = 0x40287446; | |
| 495 | pub const TIOCPTSNAME = 0x40287448; | |
| 496 | pub const TIOCRCVFRAME = 0x80087445; | |
| 497 | pub const TIOCREMOTE = 0x80047469; | |
| 498 | pub const TIOCSBRK = 0x2000747b; | |
| 499 | pub const TIOCSCTTY = 0x20007461; | |
| 500 | pub const TIOCSDTR = 0x20007479; | |
| 501 | pub const TIOCSETA = 0x802c7414; | |
| 502 | pub const TIOCSETAF = 0x802c7416; | |
| 503 | pub const TIOCSETAW = 0x802c7415; | |
| 504 | pub const TIOCSETD = 0x8004741b; | |
| 505 | pub const TIOCSFLAGS = 0x8004745c; | |
| 506 | pub const TIOCSIG = 0x2000745f; | |
| 507 | pub const TIOCSLINED = 0x80207443; | |
| 508 | pub const TIOCSPGRP = 0x80047476; | |
| 509 | pub const TIOCSQSIZE = 0x80047480; | |
| 510 | pub const TIOCSSIZE = 0x80087467; | |
| 511 | pub const TIOCSTART = 0x2000746e; | |
| 512 | pub const TIOCSTAT = 0x80047465; | |
| 513 | pub const TIOCSTI = 0x80017472; | |
| 514 | pub const TIOCSTOP = 0x2000746f; | |
| 515 | pub const TIOCSWINSZ = 0x80087467; | |
| 516 | pub const TIOCUCNTL = 0x80047466; | |
| 517 | pub const TIOCXMTFRAME = 0x80087444; | |
| 518 | ||
| 519 | fn unsigned(s: i32) u32 { | |
| 520 | return @bitCast(u32, s); | |
| 521 | } | |
| 522 | fn signed(s: u32) i32 { | |
| 523 | return @bitCast(i32, s); | |
| 524 | } | |
| 525 | pub fn WEXITSTATUS(s: i32) i32 { | |
| 526 | return signed((unsigned(s) >> 8) & 0xff); | |
| 527 | } | |
| 528 | pub fn WTERMSIG(s: i32) i32 { | |
| 529 | return signed(unsigned(s) & 0x7f); | |
| 530 | } | |
| 531 | pub fn WSTOPSIG(s: i32) i32 { | |
| 532 | return WEXITSTATUS(s); | |
| 533 | } | |
| 534 | pub fn WIFEXITED(s: i32) bool { | |
| 535 | return WTERMSIG(s) == 0; | |
| 536 | } | |
| 537 | ||
| 538 | pub fn WIFCONTINUED(s: i32) bool { | |
| 539 | return ((s & 0x7f) == 0xffff); | |
| 540 | } | |
| 541 | ||
| 542 | pub fn WIFSTOPPED(s: i32) bool { | |
| 543 | return ((s & 0x7f != 0x7f) and !WIFCONTINUED(s)); | |
| 544 | } | |
| 545 | ||
| 546 | pub fn WIFSIGNALED(s: i32) bool { | |
| 547 | return !WIFSTOPPED(s) and !WIFCONTINUED(s) and !WIFEXITED(s); | |
| 548 | } | |
| 549 | ||
| 550 | pub const winsize = extern struct { | |
| 551 | ws_row: u16, | |
| 552 | ws_col: u16, | |
| 553 | ws_xpixel: u16, | |
| 554 | ws_ypixel: u16, | |
| 555 | }; | |
| 556 | ||
| 557 | const NSIG = 32; | |
| 558 | ||
| 559 | pub const SIG_ERR = @intToPtr(extern fn (i32) void, maxInt(usize)); | |
| 560 | pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0); | |
| 561 | pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1); | |
| 562 | ||
| 563 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. | |
| 564 | pub const Sigaction = extern struct { | |
| 565 | /// signal handler | |
| 566 | __sigaction_u: extern union { | |
| 567 | __sa_handler: extern fn (i32) void, | |
| 568 | __sa_sigaction: extern fn (i32, *__siginfo, usize) void, | |
| 569 | }, | |
| 570 | ||
| 571 | /// see signal options | |
| 572 | sa_flags: u32, | |
| 573 | ||
| 574 | /// signal mask to apply | |
| 575 | sa_mask: sigset_t, | |
| 576 | }; | |
| 577 | ||
| 578 | pub const _SIG_WORDS = 4; | |
| 579 | pub const _SIG_MAXSIG = 128; | |
| 580 | ||
| 581 | pub inline fn _SIG_IDX(sig: usize) usize { | |
| 582 | return sig - 1; | |
| 583 | } | |
| 584 | pub inline fn _SIG_WORD(sig: usize) usize { | |
| 585 | return_SIG_IDX(sig) >> 5; | |
| 586 | } | |
| 587 | pub inline fn _SIG_BIT(sig: usize) usize { | |
| 588 | return 1 << (_SIG_IDX(sig) & 31); | |
| 589 | } | |
| 590 | pub inline fn _SIG_VALID(sig: usize) usize { | |
| 591 | return sig <= _SIG_MAXSIG and sig > 0; | |
| 592 | } | |
| 593 | ||
| 594 | pub const sigset_t = extern struct { | |
| 595 | __bits: [_SIG_WORDS]u32, | |
| 596 | }; | |
| 597 | ||
| 598 | pub const EPERM = 1; // Operation not permitted | |
| 599 | pub const ENOENT = 2; // No such file or directory | |
| 600 | pub const ESRCH = 3; // No such process | |
| 601 | pub const EINTR = 4; // Interrupted system call | |
| 602 | pub const EIO = 5; // Input/output error | |
| 603 | pub const ENXIO = 6; // Device not configured | |
| 604 | pub const E2BIG = 7; // Argument list too long | |
| 605 | pub const ENOEXEC = 8; // Exec format error | |
| 606 | pub const EBADF = 9; // Bad file descriptor | |
| 607 | pub const ECHILD = 10; // No child processes | |
| 608 | pub const EDEADLK = 11; // Resource deadlock avoided | |
| 609 | // 11 was EAGAIN | |
| 610 | pub const ENOMEM = 12; // Cannot allocate memory | |
| 611 | pub const EACCES = 13; // Permission denied | |
| 612 | pub const EFAULT = 14; // Bad address | |
| 613 | pub const ENOTBLK = 15; // Block device required | |
| 614 | pub const EBUSY = 16; // Device busy | |
| 615 | pub const EEXIST = 17; // File exists | |
| 616 | pub const EXDEV = 18; // Cross-device link | |
| 617 | pub const ENODEV = 19; // Operation not supported by device | |
| 618 | pub const ENOTDIR = 20; // Not a directory | |
| 619 | pub const EISDIR = 21; // Is a directory | |
| 620 | pub const EINVAL = 22; // Invalid argument | |
| 621 | pub const ENFILE = 23; // Too many open files in system | |
| 622 | pub const EMFILE = 24; // Too many open files | |
| 623 | pub const ENOTTY = 25; // Inappropriate ioctl for device | |
| 624 | pub const ETXTBSY = 26; // Text file busy | |
| 625 | pub const EFBIG = 27; // File too large | |
| 626 | pub const ENOSPC = 28; // No space left on device | |
| 627 | pub const ESPIPE = 29; // Illegal seek | |
| 628 | pub const EROFS = 30; // Read-only file system | |
| 629 | pub const EMLINK = 31; // Too many links | |
| 630 | pub const EPIPE = 32; // Broken pipe | |
| 631 | ||
| 632 | // math software | |
| 633 | pub const EDOM = 33; // Numerical argument out of domain | |
| 634 | pub const ERANGE = 34; // Result too large or too small | |
| 635 | ||
| 636 | // non-blocking and interrupt i/o | |
| 637 | pub const EAGAIN = 35; // Resource temporarily unavailable | |
| 638 | pub const EWOULDBLOCK = EAGAIN; // Operation would block | |
| 639 | pub const EINPROGRESS = 36; // Operation now in progress | |
| 640 | pub const EALREADY = 37; // Operation already in progress | |
| 641 | ||
| 642 | // ipc/network software -- argument errors | |
| 643 | pub const ENOTSOCK = 38; // Socket operation on non-socket | |
| 644 | pub const EDESTADDRREQ = 39; // Destination address required | |
| 645 | pub const EMSGSIZE = 40; // Message too long | |
| 646 | pub const EPROTOTYPE = 41; // Protocol wrong type for socket | |
| 647 | pub const ENOPROTOOPT = 42; // Protocol option not available | |
| 648 | pub const EPROTONOSUPPORT = 43; // Protocol not supported | |
| 649 | pub const ESOCKTNOSUPPORT = 44; // Socket type not supported | |
| 650 | pub const EOPNOTSUPP = 45; // Operation not supported | |
| 651 | pub const EPFNOSUPPORT = 46; // Protocol family not supported | |
| 652 | pub const EAFNOSUPPORT = 47; // Address family not supported by protocol family | |
| 653 | pub const EADDRINUSE = 48; // Address already in use | |
| 654 | pub const EADDRNOTAVAIL = 49; // Can't assign requested address | |
| 655 | ||
| 656 | // ipc/network software -- operational errors | |
| 657 | pub const ENETDOWN = 50; // Network is down | |
| 658 | pub const ENETUNREACH = 51; // Network is unreachable | |
| 659 | pub const ENETRESET = 52; // Network dropped connection on reset | |
| 660 | pub const ECONNABORTED = 53; // Software caused connection abort | |
| 661 | pub const ECONNRESET = 54; // Connection reset by peer | |
| 662 | pub const ENOBUFS = 55; // No buffer space available | |
| 663 | pub const EISCONN = 56; // Socket is already connected | |
| 664 | pub const ENOTCONN = 57; // Socket is not connected | |
| 665 | pub const ESHUTDOWN = 58; // Can't send after socket shutdown | |
| 666 | pub const ETOOMANYREFS = 59; // Too many references: can't splice | |
| 667 | pub const ETIMEDOUT = 60; // Operation timed out | |
| 668 | pub const ECONNREFUSED = 61; // Connection refused | |
| 669 | ||
| 670 | pub const ELOOP = 62; // Too many levels of symbolic links | |
| 671 | pub const ENAMETOOLONG = 63; // File name too long | |
| 672 | ||
| 673 | // should be rearranged | |
| 674 | pub const EHOSTDOWN = 64; // Host is down | |
| 675 | pub const EHOSTUNREACH = 65; // No route to host | |
| 676 | pub const ENOTEMPTY = 66; // Directory not empty | |
| 677 | ||
| 678 | // quotas & mush | |
| 679 | pub const EPROCLIM = 67; // Too many processes | |
| 680 | pub const EUSERS = 68; // Too many users | |
| 681 | pub const EDQUOT = 69; // Disc quota exceeded | |
| 682 | ||
| 683 | // Network File System | |
| 684 | pub const ESTALE = 70; // Stale NFS file handle | |
| 685 | pub const EREMOTE = 71; // Too many levels of remote in path | |
| 686 | pub const EBADRPC = 72; // RPC struct is bad | |
| 687 | pub const ERPCMISMATCH = 73; // RPC version wrong | |
| 688 | pub const EPROGUNAVAIL = 74; // RPC prog. not avail | |
| 689 | pub const EPROGMISMATCH = 75; // Program version wrong | |
| 690 | pub const EPROCUNAVAIL = 76; // Bad procedure for program | |
| 691 | ||
| 692 | pub const ENOLCK = 77; // No locks available | |
| 693 | pub const ENOSYS = 78; // Function not implemented | |
| 694 | ||
| 695 | pub const EFTYPE = 79; // Inappropriate file type or format | |
| 696 | pub const EAUTH = 80; // Authentication error | |
| 697 | pub const ENEEDAUTH = 81; // Need authenticator | |
| 698 | ||
| 699 | // SystemV IPC | |
| 700 | pub const EIDRM = 82; // Identifier removed | |
| 701 | pub const ENOMSG = 83; // No message of desired type | |
| 702 | pub const EOVERFLOW = 84; // Value too large to be stored in data type | |
| 703 | ||
| 704 | // Wide/multibyte-character handling, ISO/IEC 9899/AMD1:1995 | |
| 705 | pub const EILSEQ = 85; // Illegal byte sequence | |
| 706 | ||
| 707 | // From IEEE Std 1003.1-2001 | |
| 708 | // Base, Realtime, Threads or Thread Priority Scheduling option errors | |
| 709 | pub const ENOTSUP = 86; // Not supported | |
| 710 | ||
| 711 | // Realtime option errors | |
| 712 | pub const ECANCELED = 87; // Operation canceled | |
| 713 | ||
| 714 | // Realtime, XSI STREAMS option errors | |
| 715 | pub const EBADMSG = 88; // Bad or Corrupt message | |
| 716 | ||
| 717 | // XSI STREAMS option errors | |
| 718 | pub const ENODATA = 89; // No message available | |
| 719 | pub const ENOSR = 90; // No STREAM resources | |
| 720 | pub const ENOSTR = 91; // Not a STREAM | |
| 721 | pub const ETIME = 92; // STREAM ioctl timeout | |
| 722 | ||
| 723 | // File system extended attribute errors | |
| 724 | pub const ENOATTR = 93; // Attribute not found | |
| 725 | ||
| 726 | // Realtime, XSI STREAMS option errors | |
| 727 | pub const EMULTIHOP = 94; // Multihop attempted | |
| 728 | pub const ENOLINK = 95; // Link has been severed | |
| 729 | pub const EPROTO = 96; // Protocol error | |
| 730 | ||
| 731 | pub const ELAST = 96; // Must equal largest errno |
std/os/bits/wasi.zig created+320| ... | ... | @@ -0,0 +1,320 @@ |
| 1 | // Declarations that are intended to be imported into the POSIX namespace. | |
| 2 | // This includes WASI-only APIs. | |
| 3 | ||
| 4 | pub const STDIN_FILENO = 0; | |
| 5 | pub const STDOUT_FILENO = 1; | |
| 6 | pub const STDERR_FILENO = 2; | |
| 7 | ||
| 8 | pub const advice_t = u8; | |
| 9 | pub const ADVICE_NORMAL: advice_t = 0; | |
| 10 | pub const ADVICE_SEQUENTIAL: advice_t = 1; | |
| 11 | pub const ADVICE_RANDOM: advice_t = 2; | |
| 12 | pub const ADVICE_WILLNEED: advice_t = 3; | |
| 13 | pub const ADVICE_DONTNEED: advice_t = 4; | |
| 14 | pub const ADVICE_NOREUSE: advice_t = 5; | |
| 15 | ||
| 16 | pub const ciovec_t = extern struct { | |
| 17 | buf: [*]const u8, | |
| 18 | buf_len: usize, | |
| 19 | }; | |
| 20 | ||
| 21 | pub const clockid_t = u32; | |
| 22 | pub const CLOCK_REALTIME: clockid_t = 0; | |
| 23 | pub const CLOCK_MONOTONIC: clockid_t = 1; | |
| 24 | pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2; | |
| 25 | pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3; | |
| 26 | ||
| 27 | pub const device_t = u64; | |
| 28 | ||
| 29 | pub const dircookie_t = u64; | |
| 30 | pub const DIRCOOKIE_START: dircookie_t = 0; | |
| 31 | ||
| 32 | pub const dirent_t = extern struct { | |
| 33 | d_next: dircookie_t, | |
| 34 | d_ino: inode_t, | |
| 35 | d_namlen: u32, | |
| 36 | d_type: filetype_t, | |
| 37 | }; | |
| 38 | ||
| 39 | pub const errno_t = u16; | |
| 40 | pub const ESUCCESS: errno_t = 0; | |
| 41 | pub const E2BIG: errno_t = 1; | |
| 42 | pub const EACCES: errno_t = 2; | |
| 43 | pub const EADDRINUSE: errno_t = 3; | |
| 44 | pub const EADDRNOTAVAIL: errno_t = 4; | |
| 45 | pub const EAFNOSUPPORT: errno_t = 5; | |
| 46 | pub const EAGAIN: errno_t = 6; | |
| 47 | pub const EALREADY: errno_t = 7; | |
| 48 | pub const EBADF: errno_t = 8; | |
| 49 | pub const EBADMSG: errno_t = 9; | |
| 50 | pub const EBUSY: errno_t = 10; | |
| 51 | pub const ECANCELED: errno_t = 11; | |
| 52 | pub const ECHILD: errno_t = 12; | |
| 53 | pub const ECONNABORTED: errno_t = 13; | |
| 54 | pub const ECONNREFUSED: errno_t = 14; | |
| 55 | pub const ECONNRESET: errno_t = 15; | |
| 56 | pub const EDEADLK: errno_t = 16; | |
| 57 | pub const EDESTADDRREQ: errno_t = 17; | |
| 58 | pub const EDOM: errno_t = 18; | |
| 59 | pub const EDQUOT: errno_t = 19; | |
| 60 | pub const EEXIST: errno_t = 20; | |
| 61 | pub const EFAULT: errno_t = 21; | |
| 62 | pub const EFBIG: errno_t = 22; | |
| 63 | pub const EHOSTUNREACH: errno_t = 23; | |
| 64 | pub const EIDRM: errno_t = 24; | |
| 65 | pub const EILSEQ: errno_t = 25; | |
| 66 | pub const EINPROGRESS: errno_t = 26; | |
| 67 | pub const EINTR: errno_t = 27; | |
| 68 | pub const EINVAL: errno_t = 28; | |
| 69 | pub const EIO: errno_t = 29; | |
| 70 | pub const EISCONN: errno_t = 30; | |
| 71 | pub const EISDIR: errno_t = 31; | |
| 72 | pub const ELOOP: errno_t = 32; | |
| 73 | pub const EMFILE: errno_t = 33; | |
| 74 | pub const EMLINK: errno_t = 34; | |
| 75 | pub const EMSGSIZE: errno_t = 35; | |
| 76 | pub const EMULTIHOP: errno_t = 36; | |
| 77 | pub const ENAMETOOLONG: errno_t = 37; | |
| 78 | pub const ENETDOWN: errno_t = 38; | |
| 79 | pub const ENETRESET: errno_t = 39; | |
| 80 | pub const ENETUNREACH: errno_t = 40; | |
| 81 | pub const ENFILE: errno_t = 41; | |
| 82 | pub const ENOBUFS: errno_t = 42; | |
| 83 | pub const ENODEV: errno_t = 43; | |
| 84 | pub const ENOENT: errno_t = 44; | |
| 85 | pub const ENOEXEC: errno_t = 45; | |
| 86 | pub const ENOLCK: errno_t = 46; | |
| 87 | pub const ENOLINK: errno_t = 47; | |
| 88 | pub const ENOMEM: errno_t = 48; | |
| 89 | pub const ENOMSG: errno_t = 49; | |
| 90 | pub const ENOPROTOOPT: errno_t = 50; | |
| 91 | pub const ENOSPC: errno_t = 51; | |
| 92 | pub const ENOSYS: errno_t = 52; | |
| 93 | pub const ENOTCONN: errno_t = 53; | |
| 94 | pub const ENOTDIR: errno_t = 54; | |
| 95 | pub const ENOTEMPTY: errno_t = 55; | |
| 96 | pub const ENOTRECOVERABLE: errno_t = 56; | |
| 97 | pub const ENOTSOCK: errno_t = 57; | |
| 98 | pub const ENOTSUP: errno_t = 58; | |
| 99 | pub const ENOTTY: errno_t = 59; | |
| 100 | pub const ENXIO: errno_t = 60; | |
| 101 | pub const EOVERFLOW: errno_t = 61; | |
| 102 | pub const EOWNERDEAD: errno_t = 62; | |
| 103 | pub const EPERM: errno_t = 63; | |
| 104 | pub const EPIPE: errno_t = 64; | |
| 105 | pub const EPROTO: errno_t = 65; | |
| 106 | pub const EPROTONOSUPPORT: errno_t = 66; | |
| 107 | pub const EPROTOTYPE: errno_t = 67; | |
| 108 | pub const ERANGE: errno_t = 68; | |
| 109 | pub const EROFS: errno_t = 69; | |
| 110 | pub const ESPIPE: errno_t = 70; | |
| 111 | pub const ESRCH: errno_t = 71; | |
| 112 | pub const ESTALE: errno_t = 72; | |
| 113 | pub const ETIMEDOUT: errno_t = 73; | |
| 114 | pub const ETXTBSY: errno_t = 74; | |
| 115 | pub const EXDEV: errno_t = 75; | |
| 116 | pub const ENOTCAPABLE: errno_t = 76; | |
| 117 | ||
| 118 | pub const event_t = extern struct { | |
| 119 | userdata: userdata_t, | |
| 120 | @"error": errno_t, | |
| 121 | @"type": eventtype_t, | |
| 122 | u: extern union { | |
| 123 | fd_readwrite: extern struct { | |
| 124 | nbytes: filesize_t, | |
| 125 | flags: eventrwflags_t, | |
| 126 | }, | |
| 127 | }, | |
| 128 | }; | |
| 129 | ||
| 130 | pub const eventrwflags_t = u16; | |
| 131 | pub const EVENT_FD_READWRITE_HANGUP: eventrwflags_t = 0x0001; | |
| 132 | ||
| 133 | pub const eventtype_t = u8; | |
| 134 | pub const EVENTTYPE_CLOCK: eventtype_t = 0; | |
| 135 | pub const EVENTTYPE_FD_READ: eventtype_t = 1; | |
| 136 | pub const EVENTTYPE_FD_WRITE: eventtype_t = 2; | |
| 137 | ||
| 138 | pub const exitcode_t = u32; | |
| 139 | ||
| 140 | pub const fd_t = u32; | |
| 141 | ||
| 142 | pub const fdflags_t = u16; | |
| 143 | pub const FDFLAG_APPEND: fdflags_t = 0x0001; | |
| 144 | pub const FDFLAG_DSYNC: fdflags_t = 0x0002; | |
| 145 | pub const FDFLAG_NONBLOCK: fdflags_t = 0x0004; | |
| 146 | pub const FDFLAG_RSYNC: fdflags_t = 0x0008; | |
| 147 | pub const FDFLAG_SYNC: fdflags_t = 0x0010; | |
| 148 | ||
| 149 | const fdstat_t = extern struct { | |
| 150 | fs_filetype: filetype_t, | |
| 151 | fs_flags: fdflags_t, | |
| 152 | fs_rights_base: rights_t, | |
| 153 | fs_rights_inheriting: rights_t, | |
| 154 | }; | |
| 155 | ||
| 156 | pub const filedelta_t = i64; | |
| 157 | ||
| 158 | pub const filesize_t = u64; | |
| 159 | ||
| 160 | pub const filestat_t = extern struct { | |
| 161 | st_dev: device_t, | |
| 162 | st_ino: inode_t, | |
| 163 | st_filetype: filetype_t, | |
| 164 | st_nlink: linkcount_t, | |
| 165 | st_size: filesize_t, | |
| 166 | st_atim: timestamp_t, | |
| 167 | st_mtim: timestamp_t, | |
| 168 | st_ctim: timestamp_t, | |
| 169 | }; | |
| 170 | ||
| 171 | pub const filetype_t = u8; | |
| 172 | pub const FILETYPE_UNKNOWN: filetype_t = 0; | |
| 173 | pub const FILETYPE_BLOCK_DEVICE: filetype_t = 1; | |
| 174 | pub const FILETYPE_CHARACTER_DEVICE: filetype_t = 2; | |
| 175 | pub const FILETYPE_DIRECTORY: filetype_t = 3; | |
| 176 | pub const FILETYPE_REGULAR_FILE: filetype_t = 4; | |
| 177 | pub const FILETYPE_SOCKET_DGRAM: filetype_t = 5; | |
| 178 | pub const FILETYPE_SOCKET_STREAM: filetype_t = 6; | |
| 179 | pub const FILETYPE_SYMBOLIC_LINK: filetype_t = 7; | |
| 180 | ||
| 181 | pub const fstflags_t = u16; | |
| 182 | pub const FILESTAT_SET_ATIM: fstflags_t = 0x0001; | |
| 183 | pub const FILESTAT_SET_ATIM_NOW: fstflags_t = 0x0002; | |
| 184 | pub const FILESTAT_SET_MTIM: fstflags_t = 0x0004; | |
| 185 | pub const FILESTAT_SET_MTIM_NOW: fstflags_t = 0x0008; | |
| 186 | ||
| 187 | pub const inode_t = u64; | |
| 188 | ||
| 189 | pub const iovec_t = extern struct { | |
| 190 | buf: [*]u8, | |
| 191 | buf_len: usize, | |
| 192 | }; | |
| 193 | ||
| 194 | pub const linkcount_t = u32; | |
| 195 | ||
| 196 | pub const lookupflags_t = u32; | |
| 197 | pub const LOOKUP_SYMLINK_FOLLOW: lookupflags_t = 0x00000001; | |
| 198 | ||
| 199 | pub const oflags_t = u16; | |
| 200 | pub const O_CREAT: oflags_t = 0x0001; | |
| 201 | pub const O_DIRECTORY: oflags_t = 0x0002; | |
| 202 | pub const O_EXCL: oflags_t = 0x0004; | |
| 203 | pub const O_TRUNC: oflags_t = 0x0008; | |
| 204 | ||
| 205 | pub const preopentype_t = u8; | |
| 206 | pub const PREOPENTYPE_DIR: preopentype_t = 0; | |
| 207 | ||
| 208 | pub const prestat_t = extern struct { | |
| 209 | pr_type: preopentype_t, | |
| 210 | u: extern union { | |
| 211 | dir: extern struct { | |
| 212 | pr_name_len: usize, | |
| 213 | }, | |
| 214 | }, | |
| 215 | }; | |
| 216 | ||
| 217 | pub const riflags_t = u16; | |
| 218 | pub const SOCK_RECV_PEEK: riflags_t = 0x0001; | |
| 219 | pub const SOCK_RECV_WAITALL: riflags_t = 0x0002; | |
| 220 | ||
| 221 | pub const rights_t = u64; | |
| 222 | pub const RIGHT_FD_DATASYNC: rights_t = 0x0000000000000001; | |
| 223 | pub const RIGHT_FD_READ: rights_t = 0x0000000000000002; | |
| 224 | pub const RIGHT_FD_SEEK: rights_t = 0x0000000000000004; | |
| 225 | pub const RIGHT_FD_FDSTAT_SET_FLAGS: rights_t = 0x0000000000000008; | |
| 226 | pub const RIGHT_FD_SYNC: rights_t = 0x0000000000000010; | |
| 227 | pub const RIGHT_FD_TELL: rights_t = 0x0000000000000020; | |
| 228 | pub const RIGHT_FD_WRITE: rights_t = 0x0000000000000040; | |
| 229 | pub const RIGHT_FD_ADVISE: rights_t = 0x0000000000000080; | |
| 230 | pub const RIGHT_FD_ALLOCATE: rights_t = 0x0000000000000100; | |
| 231 | pub const RIGHT_PATH_CREATE_DIRECTORY: rights_t = 0x0000000000000200; | |
| 232 | pub const RIGHT_PATH_CREATE_FILE: rights_t = 0x0000000000000400; | |
| 233 | pub const RIGHT_PATH_LINK_SOURCE: rights_t = 0x0000000000000800; | |
| 234 | pub const RIGHT_PATH_LINK_TARGET: rights_t = 0x0000000000001000; | |
| 235 | pub const RIGHT_PATH_OPEN: rights_t = 0x0000000000002000; | |
| 236 | pub const RIGHT_FD_READDIR: rights_t = 0x0000000000004000; | |
| 237 | pub const RIGHT_PATH_READLINK: rights_t = 0x0000000000008000; | |
| 238 | pub const RIGHT_PATH_RENAME_SOURCE: rights_t = 0x0000000000010000; | |
| 239 | pub const RIGHT_PATH_RENAME_TARGET: rights_t = 0x0000000000020000; | |
| 240 | pub const RIGHT_PATH_FILESTAT_GET: rights_t = 0x0000000000040000; | |
| 241 | pub const RIGHT_PATH_FILESTAT_SET_SIZE: rights_t = 0x0000000000080000; | |
| 242 | pub const RIGHT_PATH_FILESTAT_SET_TIMES: rights_t = 0x0000000000100000; | |
| 243 | pub const RIGHT_FD_FILESTAT_GET: rights_t = 0x0000000000200000; | |
| 244 | pub const RIGHT_FD_FILESTAT_SET_SIZE: rights_t = 0x0000000000400000; | |
| 245 | pub const RIGHT_FD_FILESTAT_SET_TIMES: rights_t = 0x0000000000800000; | |
| 246 | pub const RIGHT_PATH_SYMLINK: rights_t = 0x0000000001000000; | |
| 247 | pub const RIGHT_PATH_REMOVE_DIRECTORY: rights_t = 0x0000000002000000; | |
| 248 | pub const RIGHT_PATH_UNLINK_FILE: rights_t = 0x0000000004000000; | |
| 249 | pub const RIGHT_POLL_FD_READWRITE: rights_t = 0x0000000008000000; | |
| 250 | pub const RIGHT_SOCK_SHUTDOWN: rights_t = 0x0000000010000000; | |
| 251 | ||
| 252 | pub const roflags_t = u16; | |
| 253 | pub const SOCK_RECV_DATA_TRUNCATED: roflags_t = 0x0001; | |
| 254 | ||
| 255 | pub const sdflags_t = u8; | |
| 256 | pub const SHUT_RD: sdflags_t = 0x01; | |
| 257 | pub const SHUT_WR: sdflags_t = 0x02; | |
| 258 | ||
| 259 | pub const siflags_t = u16; | |
| 260 | ||
| 261 | pub const signal_t = u8; | |
| 262 | pub const SIGHUP: signal_t = 1; | |
| 263 | pub const SIGINT: signal_t = 2; | |
| 264 | pub const SIGQUIT: signal_t = 3; | |
| 265 | pub const SIGILL: signal_t = 4; | |
| 266 | pub const SIGTRAP: signal_t = 5; | |
| 267 | pub const SIGABRT: signal_t = 6; | |
| 268 | pub const SIGBUS: signal_t = 7; | |
| 269 | pub const SIGFPE: signal_t = 8; | |
| 270 | pub const SIGKILL: signal_t = 9; | |
| 271 | pub const SIGUSR1: signal_t = 10; | |
| 272 | pub const SIGSEGV: signal_t = 11; | |
| 273 | pub const SIGUSR2: signal_t = 12; | |
| 274 | pub const SIGPIPE: signal_t = 13; | |
| 275 | pub const SIGALRM: signal_t = 14; | |
| 276 | pub const SIGTERM: signal_t = 15; | |
| 277 | pub const SIGCHLD: signal_t = 16; | |
| 278 | pub const SIGCONT: signal_t = 17; | |
| 279 | pub const SIGSTOP: signal_t = 18; | |
| 280 | pub const SIGTSTP: signal_t = 19; | |
| 281 | pub const SIGTTIN: signal_t = 20; | |
| 282 | pub const SIGTTOU: signal_t = 21; | |
| 283 | pub const SIGURG: signal_t = 22; | |
| 284 | pub const SIGXCPU: signal_t = 23; | |
| 285 | pub const SIGXFSZ: signal_t = 24; | |
| 286 | pub const SIGVTALRM: signal_t = 25; | |
| 287 | pub const SIGPROF: signal_t = 26; | |
| 288 | pub const SIGWINCH: signal_t = 27; | |
| 289 | pub const SIGPOLL: signal_t = 28; | |
| 290 | pub const SIGPWR: signal_t = 29; | |
| 291 | pub const SIGSYS: signal_t = 30; | |
| 292 | ||
| 293 | pub const subclockflags_t = u16; | |
| 294 | pub const SUBSCRIPTION_CLOCK_ABSTIME: subclockflags_t = 0x0001; | |
| 295 | ||
| 296 | pub const subscription_t = extern struct { | |
| 297 | userdata: userdata_t, | |
| 298 | @"type": eventtype_t, | |
| 299 | u: extern union { | |
| 300 | clock: extern struct { | |
| 301 | identifier: userdata_t, | |
| 302 | clock_id: clockid_t, | |
| 303 | timeout: timestamp_t, | |
| 304 | precision: timestamp_t, | |
| 305 | flags: subclockflags_t, | |
| 306 | }, | |
| 307 | fd_readwrite: extern struct { | |
| 308 | fd: fd_t, | |
| 309 | }, | |
| 310 | }, | |
| 311 | }; | |
| 312 | ||
| 313 | pub const timestamp_t = u64; | |
| 314 | ||
| 315 | pub const userdata_t = u64; | |
| 316 | ||
| 317 | pub const whence_t = u8; | |
| 318 | pub const WHENCE_CUR: whence_t = 0; | |
| 319 | pub const WHENCE_END: whence_t = 1; | |
| 320 | pub const WHENCE_SET: whence_t = 2; |
std/os/bits/windows.zig created+91| ... | ... | @@ -0,0 +1,91 @@ |
| 1 | use @import("../windows.zig"); | |
| 2 | ||
| 3 | pub const fd_t = HANDLE; | |
| 4 | pub const pid_t = HANDLE; | |
| 5 | ||
| 6 | pub const EPERM = 1; | |
| 7 | pub const ENOENT = 2; | |
| 8 | pub const ESRCH = 3; | |
| 9 | pub const EINTR = 4; | |
| 10 | pub const EIO = 5; | |
| 11 | pub const ENXIO = 6; | |
| 12 | pub const E2BIG = 7; | |
| 13 | pub const ENOEXEC = 8; | |
| 14 | pub const EBADF = 9; | |
| 15 | pub const ECHILD = 10; | |
| 16 | pub const EAGAIN = 11; | |
| 17 | pub const ENOMEM = 12; | |
| 18 | pub const EACCES = 13; | |
| 19 | pub const EFAULT = 14; | |
| 20 | pub const EBUSY = 16; | |
| 21 | pub const EEXIST = 17; | |
| 22 | pub const EXDEV = 18; | |
| 23 | pub const ENODEV = 19; | |
| 24 | pub const ENOTDIR = 20; | |
| 25 | pub const EISDIR = 21; | |
| 26 | pub const ENFILE = 23; | |
| 27 | pub const EMFILE = 24; | |
| 28 | pub const ENOTTY = 25; | |
| 29 | pub const EFBIG = 27; | |
| 30 | pub const ENOSPC = 28; | |
| 31 | pub const ESPIPE = 29; | |
| 32 | pub const EROFS = 30; | |
| 33 | pub const EMLINK = 31; | |
| 34 | pub const EPIPE = 32; | |
| 35 | pub const EDOM = 33; | |
| 36 | pub const EDEADLK = 36; | |
| 37 | pub const ENAMETOOLONG = 38; | |
| 38 | pub const ENOLCK = 39; | |
| 39 | pub const ENOSYS = 40; | |
| 40 | pub const ENOTEMPTY = 41; | |
| 41 | ||
| 42 | pub const EINVAL = 22; | |
| 43 | pub const ERANGE = 34; | |
| 44 | pub const EILSEQ = 42; | |
| 45 | pub const STRUNCATE = 80; | |
| 46 | ||
| 47 | // Support EDEADLOCK for compatibility with older Microsoft C versions | |
| 48 | pub const EDEADLOCK = EDEADLK; | |
| 49 | ||
| 50 | // POSIX Supplement | |
| 51 | pub const EADDRINUSE = 100; | |
| 52 | pub const EADDRNOTAVAIL = 101; | |
| 53 | pub const EAFNOSUPPORT = 102; | |
| 54 | pub const EALREADY = 103; | |
| 55 | pub const EBADMSG = 104; | |
| 56 | pub const ECANCELED = 105; | |
| 57 | pub const ECONNABORTED = 106; | |
| 58 | pub const ECONNREFUSED = 107; | |
| 59 | pub const ECONNRESET = 108; | |
| 60 | pub const EDESTADDRREQ = 109; | |
| 61 | pub const EHOSTUNREACH = 110; | |
| 62 | pub const EIDRM = 111; | |
| 63 | pub const EINPROGRESS = 112; | |
| 64 | pub const EISCONN = 113; | |
| 65 | pub const ELOOP = 114; | |
| 66 | pub const EMSGSIZE = 115; | |
| 67 | pub const ENETDOWN = 116; | |
| 68 | pub const ENETRESET = 117; | |
| 69 | pub const ENETUNREACH = 118; | |
| 70 | pub const ENOBUFS = 119; | |
| 71 | pub const ENODATA = 120; | |
| 72 | pub const ENOLINK = 121; | |
| 73 | pub const ENOMSG = 122; | |
| 74 | pub const ENOPROTOOPT = 123; | |
| 75 | pub const ENOSR = 124; | |
| 76 | pub const ENOSTR = 125; | |
| 77 | pub const ENOTCONN = 126; | |
| 78 | pub const ENOTRECOVERABLE = 127; | |
| 79 | pub const ENOTSOCK = 128; | |
| 80 | pub const ENOTSUP = 129; | |
| 81 | pub const EOPNOTSUPP = 130; | |
| 82 | pub const EOTHER = 131; | |
| 83 | pub const EOVERFLOW = 132; | |
| 84 | pub const EOWNERDEAD = 133; | |
| 85 | pub const EPROTO = 134; | |
| 86 | pub const EPROTONOSUPPORT = 135; | |
| 87 | pub const EPROTOTYPE = 136; | |
| 88 | pub const ETIME = 137; | |
| 89 | pub const ETIMEDOUT = 138; | |
| 90 | pub const ETXTBSY = 139; | |
| 91 | pub const EWOULDBLOCK = 140; |
std/os/linux.zig+1-1| ... | ... | @@ -4,7 +4,7 @@ pub const is_the_target = builtin.os == .linux; |
| 4 | 4 | pub const sys = @import("linux/sys.zig"); |
| 5 | 5 | pub use if (builtin.link_libc) std.c else sys; |
| 6 | 6 | |
| 7 | test "import" { | |
| 7 | test "" { | |
| 8 | 8 | if (is_the_target) { |
| 9 | 9 | _ = @import("linux/test.zig"); |
| 10 | 10 | } |
std/os/linux/errno.zig deleted-427| ... | ... | @@ -1,427 +0,0 @@ |
| 1 | /// Operation not permitted | |
| 2 | pub const EPERM = 1; | |
| 3 | ||
| 4 | /// No such file or directory | |
| 5 | pub const ENOENT = 2; | |
| 6 | ||
| 7 | /// No such process | |
| 8 | pub const ESRCH = 3; | |
| 9 | ||
| 10 | /// Interrupted system call | |
| 11 | pub const EINTR = 4; | |
| 12 | ||
| 13 | /// I/O error | |
| 14 | pub const EIO = 5; | |
| 15 | ||
| 16 | /// No such device or address | |
| 17 | pub const ENXIO = 6; | |
| 18 | ||
| 19 | /// Arg list too long | |
| 20 | pub const E2BIG = 7; | |
| 21 | ||
| 22 | /// Exec format error | |
| 23 | pub const ENOEXEC = 8; | |
| 24 | ||
| 25 | /// Bad file number | |
| 26 | pub const EBADF = 9; | |
| 27 | ||
| 28 | /// No child processes | |
| 29 | pub const ECHILD = 10; | |
| 30 | ||
| 31 | /// Try again | |
| 32 | pub const EAGAIN = 11; | |
| 33 | ||
| 34 | /// Out of memory | |
| 35 | pub const ENOMEM = 12; | |
| 36 | ||
| 37 | /// Permission denied | |
| 38 | pub const EACCES = 13; | |
| 39 | ||
| 40 | /// Bad address | |
| 41 | pub const EFAULT = 14; | |
| 42 | ||
| 43 | /// Block device required | |
| 44 | pub const ENOTBLK = 15; | |
| 45 | ||
| 46 | /// Device or resource busy | |
| 47 | pub const EBUSY = 16; | |
| 48 | ||
| 49 | /// File exists | |
| 50 | pub const EEXIST = 17; | |
| 51 | ||
| 52 | /// Cross-device link | |
| 53 | pub const EXDEV = 18; | |
| 54 | ||
| 55 | /// No such device | |
| 56 | pub const ENODEV = 19; | |
| 57 | ||
| 58 | /// Not a directory | |
| 59 | pub const ENOTDIR = 20; | |
| 60 | ||
| 61 | /// Is a directory | |
| 62 | pub const EISDIR = 21; | |
| 63 | ||
| 64 | /// Invalid argument | |
| 65 | pub const EINVAL = 22; | |
| 66 | ||
| 67 | /// File table overflow | |
| 68 | pub const ENFILE = 23; | |
| 69 | ||
| 70 | /// Too many open files | |
| 71 | pub const EMFILE = 24; | |
| 72 | ||
| 73 | /// Not a typewriter | |
| 74 | pub const ENOTTY = 25; | |
| 75 | ||
| 76 | /// Text file busy | |
| 77 | pub const ETXTBSY = 26; | |
| 78 | ||
| 79 | /// File too large | |
| 80 | pub const EFBIG = 27; | |
| 81 | ||
| 82 | /// No space left on device | |
| 83 | pub const ENOSPC = 28; | |
| 84 | ||
| 85 | /// Illegal seek | |
| 86 | pub const ESPIPE = 29; | |
| 87 | ||
| 88 | /// Read-only file system | |
| 89 | pub const EROFS = 30; | |
| 90 | ||
| 91 | /// Too many links | |
| 92 | pub const EMLINK = 31; | |
| 93 | ||
| 94 | /// Broken pipe | |
| 95 | pub const EPIPE = 32; | |
| 96 | ||
| 97 | /// Math argument out of domain of func | |
| 98 | pub const EDOM = 33; | |
| 99 | ||
| 100 | /// Math result not representable | |
| 101 | pub const ERANGE = 34; | |
| 102 | ||
| 103 | /// Resource deadlock would occur | |
| 104 | pub const EDEADLK = 35; | |
| 105 | ||
| 106 | /// File name too long | |
| 107 | pub const ENAMETOOLONG = 36; | |
| 108 | ||
| 109 | /// No record locks available | |
| 110 | pub const ENOLCK = 37; | |
| 111 | ||
| 112 | /// Function not implemented | |
| 113 | pub const ENOSYS = 38; | |
| 114 | ||
| 115 | /// Directory not empty | |
| 116 | pub const ENOTEMPTY = 39; | |
| 117 | ||
| 118 | /// Too many symbolic links encountered | |
| 119 | pub const ELOOP = 40; | |
| 120 | ||
| 121 | /// Operation would block | |
| 122 | pub const EWOULDBLOCK = EAGAIN; | |
| 123 | ||
| 124 | /// No message of desired type | |
| 125 | pub const ENOMSG = 42; | |
| 126 | ||
| 127 | /// Identifier removed | |
| 128 | pub const EIDRM = 43; | |
| 129 | ||
| 130 | /// Channel number out of range | |
| 131 | pub const ECHRNG = 44; | |
| 132 | ||
| 133 | /// Level 2 not synchronized | |
| 134 | pub const EL2NSYNC = 45; | |
| 135 | ||
| 136 | /// Level 3 halted | |
| 137 | pub const EL3HLT = 46; | |
| 138 | ||
| 139 | /// Level 3 reset | |
| 140 | pub const EL3RST = 47; | |
| 141 | ||
| 142 | /// Link number out of range | |
| 143 | pub const ELNRNG = 48; | |
| 144 | ||
| 145 | /// Protocol driver not attached | |
| 146 | pub const EUNATCH = 49; | |
| 147 | ||
| 148 | /// No CSI structure available | |
| 149 | pub const ENOCSI = 50; | |
| 150 | ||
| 151 | /// Level 2 halted | |
| 152 | pub const EL2HLT = 51; | |
| 153 | ||
| 154 | /// Invalid exchange | |
| 155 | pub const EBADE = 52; | |
| 156 | ||
| 157 | /// Invalid request descriptor | |
| 158 | pub const EBADR = 53; | |
| 159 | ||
| 160 | /// Exchange full | |
| 161 | pub const EXFULL = 54; | |
| 162 | ||
| 163 | /// No anode | |
| 164 | pub const ENOANO = 55; | |
| 165 | ||
| 166 | /// Invalid request code | |
| 167 | pub const EBADRQC = 56; | |
| 168 | ||
| 169 | /// Invalid slot | |
| 170 | pub const EBADSLT = 57; | |
| 171 | ||
| 172 | /// Bad font file format | |
| 173 | pub const EBFONT = 59; | |
| 174 | ||
| 175 | /// Device not a stream | |
| 176 | pub const ENOSTR = 60; | |
| 177 | ||
| 178 | /// No data available | |
| 179 | pub const ENODATA = 61; | |
| 180 | ||
| 181 | /// Timer expired | |
| 182 | pub const ETIME = 62; | |
| 183 | ||
| 184 | /// Out of streams resources | |
| 185 | pub const ENOSR = 63; | |
| 186 | ||
| 187 | /// Machine is not on the network | |
| 188 | pub const ENONET = 64; | |
| 189 | ||
| 190 | /// Package not installed | |
| 191 | pub const ENOPKG = 65; | |
| 192 | ||
| 193 | /// Object is remote | |
| 194 | pub const EREMOTE = 66; | |
| 195 | ||
| 196 | /// Link has been severed | |
| 197 | pub const ENOLINK = 67; | |
| 198 | ||
| 199 | /// Advertise error | |
| 200 | pub const EADV = 68; | |
| 201 | ||
| 202 | /// Srmount error | |
| 203 | pub const ESRMNT = 69; | |
| 204 | ||
| 205 | /// Communication error on send | |
| 206 | pub const ECOMM = 70; | |
| 207 | ||
| 208 | /// Protocol error | |
| 209 | pub const EPROTO = 71; | |
| 210 | ||
| 211 | /// Multihop attempted | |
| 212 | pub const EMULTIHOP = 72; | |
| 213 | ||
| 214 | /// RFS specific error | |
| 215 | pub const EDOTDOT = 73; | |
| 216 | ||
| 217 | /// Not a data message | |
| 218 | pub const EBADMSG = 74; | |
| 219 | ||
| 220 | /// Value too large for defined data type | |
| 221 | pub const EOVERFLOW = 75; | |
| 222 | ||
| 223 | /// Name not unique on network | |
| 224 | pub const ENOTUNIQ = 76; | |
| 225 | ||
| 226 | /// File descriptor in bad state | |
| 227 | pub const EBADFD = 77; | |
| 228 | ||
| 229 | /// Remote address changed | |
| 230 | pub const EREMCHG = 78; | |
| 231 | ||
| 232 | /// Can not access a needed shared library | |
| 233 | pub const ELIBACC = 79; | |
| 234 | ||
| 235 | /// Accessing a corrupted shared library | |
| 236 | pub const ELIBBAD = 80; | |
| 237 | ||
| 238 | /// .lib section in a.out corrupted | |
| 239 | pub const ELIBSCN = 81; | |
| 240 | ||
| 241 | /// Attempting to link in too many shared libraries | |
| 242 | pub const ELIBMAX = 82; | |
| 243 | ||
| 244 | /// Cannot exec a shared library directly | |
| 245 | pub const ELIBEXEC = 83; | |
| 246 | ||
| 247 | /// Illegal byte sequence | |
| 248 | pub const EILSEQ = 84; | |
| 249 | ||
| 250 | /// Interrupted system call should be restarted | |
| 251 | pub const ERESTART = 85; | |
| 252 | ||
| 253 | /// Streams pipe error | |
| 254 | pub const ESTRPIPE = 86; | |
| 255 | ||
| 256 | /// Too many users | |
| 257 | pub const EUSERS = 87; | |
| 258 | ||
| 259 | /// Socket operation on non-socket | |
| 260 | pub const ENOTSOCK = 88; | |
| 261 | ||
| 262 | /// Destination address required | |
| 263 | pub const EDESTADDRREQ = 89; | |
| 264 | ||
| 265 | /// Message too long | |
| 266 | pub const EMSGSIZE = 90; | |
| 267 | ||
| 268 | /// Protocol wrong type for socket | |
| 269 | pub const EPROTOTYPE = 91; | |
| 270 | ||
| 271 | /// Protocol not available | |
| 272 | pub const ENOPROTOOPT = 92; | |
| 273 | ||
| 274 | /// Protocol not supported | |
| 275 | pub const EPROTONOSUPPORT = 93; | |
| 276 | ||
| 277 | /// Socket type not supported | |
| 278 | pub const ESOCKTNOSUPPORT = 94; | |
| 279 | ||
| 280 | /// Operation not supported on transport endpoint | |
| 281 | pub const EOPNOTSUPP = 95; | |
| 282 | ||
| 283 | /// Protocol family not supported | |
| 284 | pub const EPFNOSUPPORT = 96; | |
| 285 | ||
| 286 | /// Address family not supported by protocol | |
| 287 | pub const EAFNOSUPPORT = 97; | |
| 288 | ||
| 289 | /// Address already in use | |
| 290 | pub const EADDRINUSE = 98; | |
| 291 | ||
| 292 | /// Cannot assign requested address | |
| 293 | pub const EADDRNOTAVAIL = 99; | |
| 294 | ||
| 295 | /// Network is down | |
| 296 | pub const ENETDOWN = 100; | |
| 297 | ||
| 298 | /// Network is unreachable | |
| 299 | pub const ENETUNREACH = 101; | |
| 300 | ||
| 301 | /// Network dropped connection because of reset | |
| 302 | pub const ENETRESET = 102; | |
| 303 | ||
| 304 | /// Software caused connection abort | |
| 305 | pub const ECONNABORTED = 103; | |
| 306 | ||
| 307 | /// Connection reset by peer | |
| 308 | pub const ECONNRESET = 104; | |
| 309 | ||
| 310 | /// No buffer space available | |
| 311 | pub const ENOBUFS = 105; | |
| 312 | ||
| 313 | /// Transport endpoint is already connected | |
| 314 | pub const EISCONN = 106; | |
| 315 | ||
| 316 | /// Transport endpoint is not connected | |
| 317 | pub const ENOTCONN = 107; | |
| 318 | ||
| 319 | /// Cannot send after transport endpoint shutdown | |
| 320 | pub const ESHUTDOWN = 108; | |
| 321 | ||
| 322 | /// Too many references: cannot splice | |
| 323 | pub const ETOOMANYREFS = 109; | |
| 324 | ||
| 325 | /// Connection timed out | |
| 326 | pub const ETIMEDOUT = 110; | |
| 327 | ||
| 328 | /// Connection refused | |
| 329 | pub const ECONNREFUSED = 111; | |
| 330 | ||
| 331 | /// Host is down | |
| 332 | pub const EHOSTDOWN = 112; | |
| 333 | ||
| 334 | /// No route to host | |
| 335 | pub const EHOSTUNREACH = 113; | |
| 336 | ||
| 337 | /// Operation already in progress | |
| 338 | pub const EALREADY = 114; | |
| 339 | ||
| 340 | /// Operation now in progress | |
| 341 | pub const EINPROGRESS = 115; | |
| 342 | ||
| 343 | /// Stale NFS file handle | |
| 344 | pub const ESTALE = 116; | |
| 345 | ||
| 346 | /// Structure needs cleaning | |
| 347 | pub const EUCLEAN = 117; | |
| 348 | ||
| 349 | /// Not a XENIX named type file | |
| 350 | pub const ENOTNAM = 118; | |
| 351 | ||
| 352 | /// No XENIX semaphores available | |
| 353 | pub const ENAVAIL = 119; | |
| 354 | ||
| 355 | /// Is a named type file | |
| 356 | pub const EISNAM = 120; | |
| 357 | ||
| 358 | /// Remote I/O error | |
| 359 | pub const EREMOTEIO = 121; | |
| 360 | ||
| 361 | /// Quota exceeded | |
| 362 | pub const EDQUOT = 122; | |
| 363 | ||
| 364 | /// No medium found | |
| 365 | pub const ENOMEDIUM = 123; | |
| 366 | ||
| 367 | /// Wrong medium type | |
| 368 | pub const EMEDIUMTYPE = 124; | |
| 369 | ||
| 370 | // nameserver query return codes | |
| 371 | ||
| 372 | /// DNS server returned answer with no data | |
| 373 | pub const ENSROK = 0; | |
| 374 | ||
| 375 | /// DNS server returned answer with no data | |
| 376 | pub const ENSRNODATA = 160; | |
| 377 | ||
| 378 | /// DNS server claims query was misformatted | |
| 379 | pub const ENSRFORMERR = 161; | |
| 380 | ||
| 381 | /// DNS server returned general failure | |
| 382 | pub const ENSRSERVFAIL = 162; | |
| 383 | ||
| 384 | /// Domain name not found | |
| 385 | pub const ENSRNOTFOUND = 163; | |
| 386 | ||
| 387 | /// DNS server does not implement requested operation | |
| 388 | pub const ENSRNOTIMP = 164; | |
| 389 | ||
| 390 | /// DNS server refused query | |
| 391 | pub const ENSRREFUSED = 165; | |
| 392 | ||
| 393 | /// Misformatted DNS query | |
| 394 | pub const ENSRBADQUERY = 166; | |
| 395 | ||
| 396 | /// Misformatted domain name | |
| 397 | pub const ENSRBADNAME = 167; | |
| 398 | ||
| 399 | /// Unsupported address family | |
| 400 | pub const ENSRBADFAMILY = 168; | |
| 401 | ||
| 402 | /// Misformatted DNS reply | |
| 403 | pub const ENSRBADRESP = 169; | |
| 404 | ||
| 405 | /// Could not contact DNS servers | |
| 406 | pub const ENSRCONNREFUSED = 170; | |
| 407 | ||
| 408 | /// Timeout while contacting DNS servers | |
| 409 | pub const ENSRTIMEOUT = 171; | |
| 410 | ||
| 411 | /// End of file | |
| 412 | pub const ENSROF = 172; | |
| 413 | ||
| 414 | /// Error reading file | |
| 415 | pub const ENSRFILE = 173; | |
| 416 | ||
| 417 | /// Out of memory | |
| 418 | pub const ENSRNOMEM = 174; | |
| 419 | ||
| 420 | /// Application terminated lookup | |
| 421 | pub const ENSRDESTRUCTION = 175; | |
| 422 | ||
| 423 | /// Domain name is too long | |
| 424 | pub const ENSRQUERYDOMAINTOOLONG = 176; | |
| 425 | ||
| 426 | /// Domain name is too long | |
| 427 | pub const ENSRCNAMELOOP = 177; |
std/os/linux/posix.zig deleted-917| ... | ... | @@ -1,917 +0,0 @@ |
| 1 | // Declarations that are intended to be imported into the POSIX namespace. | |
| 2 | // This includes Linux-only APIs. | |
| 3 | ||
| 4 | pub use @import("errno.zig"); | |
| 5 | pub use switch (builtin.arch) { | |
| 6 | .x86_64 => @import("posix/x86_64.zig"), | |
| 7 | .aarch64 => @import("posix/arm64.zig"), | |
| 8 | else => struct {}, | |
| 9 | }; | |
| 10 | ||
| 11 | pub const pid_t = i32; | |
| 12 | pub const fd_t = i32; | |
| 13 | ||
| 14 | pub const PATH_MAX = 4096; | |
| 15 | pub const IOV_MAX = 1024; | |
| 16 | ||
| 17 | pub const STDIN_FILENO = 0; | |
| 18 | pub const STDOUT_FILENO = 1; | |
| 19 | pub const STDERR_FILENO = 2; | |
| 20 | ||
| 21 | pub const FUTEX_WAIT = 0; | |
| 22 | pub const FUTEX_WAKE = 1; | |
| 23 | pub const FUTEX_FD = 2; | |
| 24 | pub const FUTEX_REQUEUE = 3; | |
| 25 | pub const FUTEX_CMP_REQUEUE = 4; | |
| 26 | pub const FUTEX_WAKE_OP = 5; | |
| 27 | pub const FUTEX_LOCK_PI = 6; | |
| 28 | pub const FUTEX_UNLOCK_PI = 7; | |
| 29 | pub const FUTEX_TRYLOCK_PI = 8; | |
| 30 | pub const FUTEX_WAIT_BITSET = 9; | |
| 31 | ||
| 32 | pub const FUTEX_PRIVATE_FLAG = 128; | |
| 33 | ||
| 34 | pub const FUTEX_CLOCK_REALTIME = 256; | |
| 35 | ||
| 36 | pub const PROT_NONE = 0; | |
| 37 | pub const PROT_READ = 1; | |
| 38 | pub const PROT_WRITE = 2; | |
| 39 | pub const PROT_EXEC = 4; | |
| 40 | pub const PROT_GROWSDOWN = 0x01000000; | |
| 41 | pub const PROT_GROWSUP = 0x02000000; | |
| 42 | ||
| 43 | pub const MAP_FAILED = maxInt(usize); | |
| 44 | pub const MAP_SHARED = 0x01; | |
| 45 | pub const MAP_PRIVATE = 0x02; | |
| 46 | pub const MAP_TYPE = 0x0f; | |
| 47 | pub const MAP_FIXED = 0x10; | |
| 48 | pub const MAP_ANONYMOUS = 0x20; | |
| 49 | pub const MAP_NORESERVE = 0x4000; | |
| 50 | pub const MAP_GROWSDOWN = 0x0100; | |
| 51 | pub const MAP_DENYWRITE = 0x0800; | |
| 52 | pub const MAP_EXECUTABLE = 0x1000; | |
| 53 | pub const MAP_LOCKED = 0x2000; | |
| 54 | pub const MAP_POPULATE = 0x8000; | |
| 55 | pub const MAP_NONBLOCK = 0x10000; | |
| 56 | pub const MAP_STACK = 0x20000; | |
| 57 | pub const MAP_HUGETLB = 0x40000; | |
| 58 | pub const MAP_FILE = 0; | |
| 59 | ||
| 60 | pub const F_OK = 0; | |
| 61 | pub const X_OK = 1; | |
| 62 | pub const W_OK = 2; | |
| 63 | pub const R_OK = 4; | |
| 64 | ||
| 65 | pub const WNOHANG = 1; | |
| 66 | pub const WUNTRACED = 2; | |
| 67 | pub const WSTOPPED = 2; | |
| 68 | pub const WEXITED = 4; | |
| 69 | pub const WCONTINUED = 8; | |
| 70 | pub const WNOWAIT = 0x1000000; | |
| 71 | ||
| 72 | pub const SA_NOCLDSTOP = 1; | |
| 73 | pub const SA_NOCLDWAIT = 2; | |
| 74 | pub const SA_SIGINFO = 4; | |
| 75 | pub const SA_ONSTACK = 0x08000000; | |
| 76 | pub const SA_RESTART = 0x10000000; | |
| 77 | pub const SA_NODEFER = 0x40000000; | |
| 78 | pub const SA_RESETHAND = 0x80000000; | |
| 79 | pub const SA_RESTORER = 0x04000000; | |
| 80 | ||
| 81 | pub const SIGHUP = 1; | |
| 82 | pub const SIGINT = 2; | |
| 83 | pub const SIGQUIT = 3; | |
| 84 | pub const SIGILL = 4; | |
| 85 | pub const SIGTRAP = 5; | |
| 86 | pub const SIGABRT = 6; | |
| 87 | pub const SIGIOT = SIGABRT; | |
| 88 | pub const SIGBUS = 7; | |
| 89 | pub const SIGFPE = 8; | |
| 90 | pub const SIGKILL = 9; | |
| 91 | pub const SIGUSR1 = 10; | |
| 92 | pub const SIGSEGV = 11; | |
| 93 | pub const SIGUSR2 = 12; | |
| 94 | pub const SIGPIPE = 13; | |
| 95 | pub const SIGALRM = 14; | |
| 96 | pub const SIGTERM = 15; | |
| 97 | pub const SIGSTKFLT = 16; | |
| 98 | pub const SIGCHLD = 17; | |
| 99 | pub const SIGCONT = 18; | |
| 100 | pub const SIGSTOP = 19; | |
| 101 | pub const SIGTSTP = 20; | |
| 102 | pub const SIGTTIN = 21; | |
| 103 | pub const SIGTTOU = 22; | |
| 104 | pub const SIGURG = 23; | |
| 105 | pub const SIGXCPU = 24; | |
| 106 | pub const SIGXFSZ = 25; | |
| 107 | pub const SIGVTALRM = 26; | |
| 108 | pub const SIGPROF = 27; | |
| 109 | pub const SIGWINCH = 28; | |
| 110 | pub const SIGIO = 29; | |
| 111 | pub const SIGPOLL = 29; | |
| 112 | pub const SIGPWR = 30; | |
| 113 | pub const SIGSYS = 31; | |
| 114 | pub const SIGUNUSED = SIGSYS; | |
| 115 | ||
| 116 | pub const O_RDONLY = 0o0; | |
| 117 | pub const O_WRONLY = 0o1; | |
| 118 | pub const O_RDWR = 0o2; | |
| 119 | ||
| 120 | pub const SEEK_SET = 0; | |
| 121 | pub const SEEK_CUR = 1; | |
| 122 | pub const SEEK_END = 2; | |
| 123 | ||
| 124 | pub const SIG_BLOCK = 0; | |
| 125 | pub const SIG_UNBLOCK = 1; | |
| 126 | pub const SIG_SETMASK = 2; | |
| 127 | ||
| 128 | pub const PROTO_ip = 0o000; | |
| 129 | pub const PROTO_icmp = 0o001; | |
| 130 | pub const PROTO_igmp = 0o002; | |
| 131 | pub const PROTO_ggp = 0o003; | |
| 132 | pub const PROTO_ipencap = 0o004; | |
| 133 | pub const PROTO_st = 0o005; | |
| 134 | pub const PROTO_tcp = 0o006; | |
| 135 | pub const PROTO_egp = 0o010; | |
| 136 | pub const PROTO_pup = 0o014; | |
| 137 | pub const PROTO_udp = 0o021; | |
| 138 | pub const PROTO_hmp = 0o024; | |
| 139 | pub const PROTO_xns_idp = 0o026; | |
| 140 | pub const PROTO_rdp = 0o033; | |
| 141 | pub const PROTO_iso_tp4 = 0o035; | |
| 142 | pub const PROTO_xtp = 0o044; | |
| 143 | pub const PROTO_ddp = 0o045; | |
| 144 | pub const PROTO_idpr_cmtp = 0o046; | |
| 145 | pub const PROTO_ipv6 = 0o051; | |
| 146 | pub const PROTO_ipv6_route = 0o053; | |
| 147 | pub const PROTO_ipv6_frag = 0o054; | |
| 148 | pub const PROTO_idrp = 0o055; | |
| 149 | pub const PROTO_rsvp = 0o056; | |
| 150 | pub const PROTO_gre = 0o057; | |
| 151 | pub const PROTO_esp = 0o062; | |
| 152 | pub const PROTO_ah = 0o063; | |
| 153 | pub const PROTO_skip = 0o071; | |
| 154 | pub const PROTO_ipv6_icmp = 0o072; | |
| 155 | pub const PROTO_ipv6_nonxt = 0o073; | |
| 156 | pub const PROTO_ipv6_opts = 0o074; | |
| 157 | pub const PROTO_rspf = 0o111; | |
| 158 | pub const PROTO_vmtp = 0o121; | |
| 159 | pub const PROTO_ospf = 0o131; | |
| 160 | pub const PROTO_ipip = 0o136; | |
| 161 | pub const PROTO_encap = 0o142; | |
| 162 | pub const PROTO_pim = 0o147; | |
| 163 | pub const PROTO_raw = 0o377; | |
| 164 | ||
| 165 | pub const SHUT_RD = 0; | |
| 166 | pub const SHUT_WR = 1; | |
| 167 | pub const SHUT_RDWR = 2; | |
| 168 | ||
| 169 | pub const SOCK_STREAM = 1; | |
| 170 | pub const SOCK_DGRAM = 2; | |
| 171 | pub const SOCK_RAW = 3; | |
| 172 | pub const SOCK_RDM = 4; | |
| 173 | pub const SOCK_SEQPACKET = 5; | |
| 174 | pub const SOCK_DCCP = 6; | |
| 175 | pub const SOCK_PACKET = 10; | |
| 176 | pub const SOCK_CLOEXEC = 0o2000000; | |
| 177 | pub const SOCK_NONBLOCK = 0o4000; | |
| 178 | ||
| 179 | pub const PF_UNSPEC = 0; | |
| 180 | pub const PF_LOCAL = 1; | |
| 181 | pub const PF_UNIX = PF_LOCAL; | |
| 182 | pub const PF_FILE = PF_LOCAL; | |
| 183 | pub const PF_INET = 2; | |
| 184 | pub const PF_AX25 = 3; | |
| 185 | pub const PF_IPX = 4; | |
| 186 | pub const PF_APPLETALK = 5; | |
| 187 | pub const PF_NETROM = 6; | |
| 188 | pub const PF_BRIDGE = 7; | |
| 189 | pub const PF_ATMPVC = 8; | |
| 190 | pub const PF_X25 = 9; | |
| 191 | pub const PF_INET6 = 10; | |
| 192 | pub const PF_ROSE = 11; | |
| 193 | pub const PF_DECnet = 12; | |
| 194 | pub const PF_NETBEUI = 13; | |
| 195 | pub const PF_SECURITY = 14; | |
| 196 | pub const PF_KEY = 15; | |
| 197 | pub const PF_NETLINK = 16; | |
| 198 | pub const PF_ROUTE = PF_NETLINK; | |
| 199 | pub const PF_PACKET = 17; | |
| 200 | pub const PF_ASH = 18; | |
| 201 | pub const PF_ECONET = 19; | |
| 202 | pub const PF_ATMSVC = 20; | |
| 203 | pub const PF_RDS = 21; | |
| 204 | pub const PF_SNA = 22; | |
| 205 | pub const PF_IRDA = 23; | |
| 206 | pub const PF_PPPOX = 24; | |
| 207 | pub const PF_WANPIPE = 25; | |
| 208 | pub const PF_LLC = 26; | |
| 209 | pub const PF_IB = 27; | |
| 210 | pub const PF_MPLS = 28; | |
| 211 | pub const PF_CAN = 29; | |
| 212 | pub const PF_TIPC = 30; | |
| 213 | pub const PF_BLUETOOTH = 31; | |
| 214 | pub const PF_IUCV = 32; | |
| 215 | pub const PF_RXRPC = 33; | |
| 216 | pub const PF_ISDN = 34; | |
| 217 | pub const PF_PHONET = 35; | |
| 218 | pub const PF_IEEE802154 = 36; | |
| 219 | pub const PF_CAIF = 37; | |
| 220 | pub const PF_ALG = 38; | |
| 221 | pub const PF_NFC = 39; | |
| 222 | pub const PF_VSOCK = 40; | |
| 223 | pub const PF_KCM = 41; | |
| 224 | pub const PF_QIPCRTR = 42; | |
| 225 | pub const PF_SMC = 43; | |
| 226 | pub const PF_MAX = 44; | |
| 227 | ||
| 228 | pub const AF_UNSPEC = PF_UNSPEC; | |
| 229 | pub const AF_LOCAL = PF_LOCAL; | |
| 230 | pub const AF_UNIX = AF_LOCAL; | |
| 231 | pub const AF_FILE = AF_LOCAL; | |
| 232 | pub const AF_INET = PF_INET; | |
| 233 | pub const AF_AX25 = PF_AX25; | |
| 234 | pub const AF_IPX = PF_IPX; | |
| 235 | pub const AF_APPLETALK = PF_APPLETALK; | |
| 236 | pub const AF_NETROM = PF_NETROM; | |
| 237 | pub const AF_BRIDGE = PF_BRIDGE; | |
| 238 | pub const AF_ATMPVC = PF_ATMPVC; | |
| 239 | pub const AF_X25 = PF_X25; | |
| 240 | pub const AF_INET6 = PF_INET6; | |
| 241 | pub const AF_ROSE = PF_ROSE; | |
| 242 | pub const AF_DECnet = PF_DECnet; | |
| 243 | pub const AF_NETBEUI = PF_NETBEUI; | |
| 244 | pub const AF_SECURITY = PF_SECURITY; | |
| 245 | pub const AF_KEY = PF_KEY; | |
| 246 | pub const AF_NETLINK = PF_NETLINK; | |
| 247 | pub const AF_ROUTE = PF_ROUTE; | |
| 248 | pub const AF_PACKET = PF_PACKET; | |
| 249 | pub const AF_ASH = PF_ASH; | |
| 250 | pub const AF_ECONET = PF_ECONET; | |
| 251 | pub const AF_ATMSVC = PF_ATMSVC; | |
| 252 | pub const AF_RDS = PF_RDS; | |
| 253 | pub const AF_SNA = PF_SNA; | |
| 254 | pub const AF_IRDA = PF_IRDA; | |
| 255 | pub const AF_PPPOX = PF_PPPOX; | |
| 256 | pub const AF_WANPIPE = PF_WANPIPE; | |
| 257 | pub const AF_LLC = PF_LLC; | |
| 258 | pub const AF_IB = PF_IB; | |
| 259 | pub const AF_MPLS = PF_MPLS; | |
| 260 | pub const AF_CAN = PF_CAN; | |
| 261 | pub const AF_TIPC = PF_TIPC; | |
| 262 | pub const AF_BLUETOOTH = PF_BLUETOOTH; | |
| 263 | pub const AF_IUCV = PF_IUCV; | |
| 264 | pub const AF_RXRPC = PF_RXRPC; | |
| 265 | pub const AF_ISDN = PF_ISDN; | |
| 266 | pub const AF_PHONET = PF_PHONET; | |
| 267 | pub const AF_IEEE802154 = PF_IEEE802154; | |
| 268 | pub const AF_CAIF = PF_CAIF; | |
| 269 | pub const AF_ALG = PF_ALG; | |
| 270 | pub const AF_NFC = PF_NFC; | |
| 271 | pub const AF_VSOCK = PF_VSOCK; | |
| 272 | pub const AF_KCM = PF_KCM; | |
| 273 | pub const AF_QIPCRTR = PF_QIPCRTR; | |
| 274 | pub const AF_SMC = PF_SMC; | |
| 275 | pub const AF_MAX = PF_MAX; | |
| 276 | ||
| 277 | pub const SO_DEBUG = 1; | |
| 278 | pub const SO_REUSEADDR = 2; | |
| 279 | pub const SO_TYPE = 3; | |
| 280 | pub const SO_ERROR = 4; | |
| 281 | pub const SO_DONTROUTE = 5; | |
| 282 | pub const SO_BROADCAST = 6; | |
| 283 | pub const SO_SNDBUF = 7; | |
| 284 | pub const SO_RCVBUF = 8; | |
| 285 | pub const SO_KEEPALIVE = 9; | |
| 286 | pub const SO_OOBINLINE = 10; | |
| 287 | pub const SO_NO_CHECK = 11; | |
| 288 | pub const SO_PRIORITY = 12; | |
| 289 | pub const SO_LINGER = 13; | |
| 290 | pub const SO_BSDCOMPAT = 14; | |
| 291 | pub const SO_REUSEPORT = 15; | |
| 292 | pub const SO_PASSCRED = 16; | |
| 293 | pub const SO_PEERCRED = 17; | |
| 294 | pub const SO_RCVLOWAT = 18; | |
| 295 | pub const SO_SNDLOWAT = 19; | |
| 296 | pub const SO_RCVTIMEO = 20; | |
| 297 | pub const SO_SNDTIMEO = 21; | |
| 298 | pub const SO_ACCEPTCONN = 30; | |
| 299 | pub const SO_SNDBUFFORCE = 32; | |
| 300 | pub const SO_RCVBUFFORCE = 33; | |
| 301 | pub const SO_PROTOCOL = 38; | |
| 302 | pub const SO_DOMAIN = 39; | |
| 303 | ||
| 304 | pub const SO_SECURITY_AUTHENTICATION = 22; | |
| 305 | pub const SO_SECURITY_ENCRYPTION_TRANSPORT = 23; | |
| 306 | pub const SO_SECURITY_ENCRYPTION_NETWORK = 24; | |
| 307 | ||
| 308 | pub const SO_BINDTODEVICE = 25; | |
| 309 | ||
| 310 | pub const SO_ATTACH_FILTER = 26; | |
| 311 | pub const SO_DETACH_FILTER = 27; | |
| 312 | pub const SO_GET_FILTER = SO_ATTACH_FILTER; | |
| 313 | ||
| 314 | pub const SO_PEERNAME = 28; | |
| 315 | pub const SO_TIMESTAMP = 29; | |
| 316 | pub const SCM_TIMESTAMP = SO_TIMESTAMP; | |
| 317 | ||
| 318 | pub const SO_PEERSEC = 31; | |
| 319 | pub const SO_PASSSEC = 34; | |
| 320 | pub const SO_TIMESTAMPNS = 35; | |
| 321 | pub const SCM_TIMESTAMPNS = SO_TIMESTAMPNS; | |
| 322 | pub const SO_MARK = 36; | |
| 323 | pub const SO_TIMESTAMPING = 37; | |
| 324 | pub const SCM_TIMESTAMPING = SO_TIMESTAMPING; | |
| 325 | pub const SO_RXQ_OVFL = 40; | |
| 326 | pub const SO_WIFI_STATUS = 41; | |
| 327 | pub const SCM_WIFI_STATUS = SO_WIFI_STATUS; | |
| 328 | pub const SO_PEEK_OFF = 42; | |
| 329 | pub const SO_NOFCS = 43; | |
| 330 | pub const SO_LOCK_FILTER = 44; | |
| 331 | pub const SO_SELECT_ERR_QUEUE = 45; | |
| 332 | pub const SO_BUSY_POLL = 46; | |
| 333 | pub const SO_MAX_PACING_RATE = 47; | |
| 334 | pub const SO_BPF_EXTENSIONS = 48; | |
| 335 | pub const SO_INCOMING_CPU = 49; | |
| 336 | pub const SO_ATTACH_BPF = 50; | |
| 337 | pub const SO_DETACH_BPF = SO_DETACH_FILTER; | |
| 338 | pub const SO_ATTACH_REUSEPORT_CBPF = 51; | |
| 339 | pub const SO_ATTACH_REUSEPORT_EBPF = 52; | |
| 340 | pub const SO_CNX_ADVICE = 53; | |
| 341 | pub const SCM_TIMESTAMPING_OPT_STATS = 54; | |
| 342 | pub const SO_MEMINFO = 55; | |
| 343 | pub const SO_INCOMING_NAPI_ID = 56; | |
| 344 | pub const SO_COOKIE = 57; | |
| 345 | pub const SCM_TIMESTAMPING_PKTINFO = 58; | |
| 346 | pub const SO_PEERGROUPS = 59; | |
| 347 | pub const SO_ZEROCOPY = 60; | |
| 348 | ||
| 349 | pub const SOL_SOCKET = 1; | |
| 350 | ||
| 351 | pub const SOL_IP = 0; | |
| 352 | pub const SOL_IPV6 = 41; | |
| 353 | pub const SOL_ICMPV6 = 58; | |
| 354 | ||
| 355 | pub const SOL_RAW = 255; | |
| 356 | pub const SOL_DECNET = 261; | |
| 357 | pub const SOL_X25 = 262; | |
| 358 | pub const SOL_PACKET = 263; | |
| 359 | pub const SOL_ATM = 264; | |
| 360 | pub const SOL_AAL = 265; | |
| 361 | pub const SOL_IRDA = 266; | |
| 362 | pub const SOL_NETBEUI = 267; | |
| 363 | pub const SOL_LLC = 268; | |
| 364 | pub const SOL_DCCP = 269; | |
| 365 | pub const SOL_NETLINK = 270; | |
| 366 | pub const SOL_TIPC = 271; | |
| 367 | pub const SOL_RXRPC = 272; | |
| 368 | pub const SOL_PPPOL2TP = 273; | |
| 369 | pub const SOL_BLUETOOTH = 274; | |
| 370 | pub const SOL_PNPIPE = 275; | |
| 371 | pub const SOL_RDS = 276; | |
| 372 | pub const SOL_IUCV = 277; | |
| 373 | pub const SOL_CAIF = 278; | |
| 374 | pub const SOL_ALG = 279; | |
| 375 | pub const SOL_NFC = 280; | |
| 376 | pub const SOL_KCM = 281; | |
| 377 | pub const SOL_TLS = 282; | |
| 378 | ||
| 379 | pub const SOMAXCONN = 128; | |
| 380 | ||
| 381 | pub const MSG_OOB = 0x0001; | |
| 382 | pub const MSG_PEEK = 0x0002; | |
| 383 | pub const MSG_DONTROUTE = 0x0004; | |
| 384 | pub const MSG_CTRUNC = 0x0008; | |
| 385 | pub const MSG_PROXY = 0x0010; | |
| 386 | pub const MSG_TRUNC = 0x0020; | |
| 387 | pub const MSG_DONTWAIT = 0x0040; | |
| 388 | pub const MSG_EOR = 0x0080; | |
| 389 | pub const MSG_WAITALL = 0x0100; | |
| 390 | pub const MSG_FIN = 0x0200; | |
| 391 | pub const MSG_SYN = 0x0400; | |
| 392 | pub const MSG_CONFIRM = 0x0800; | |
| 393 | pub const MSG_RST = 0x1000; | |
| 394 | pub const MSG_ERRQUEUE = 0x2000; | |
| 395 | pub const MSG_NOSIGNAL = 0x4000; | |
| 396 | pub const MSG_MORE = 0x8000; | |
| 397 | pub const MSG_WAITFORONE = 0x10000; | |
| 398 | pub const MSG_BATCH = 0x40000; | |
| 399 | pub const MSG_ZEROCOPY = 0x4000000; | |
| 400 | pub const MSG_FASTOPEN = 0x20000000; | |
| 401 | pub const MSG_CMSG_CLOEXEC = 0x40000000; | |
| 402 | ||
| 403 | pub const DT_UNKNOWN = 0; | |
| 404 | pub const DT_FIFO = 1; | |
| 405 | pub const DT_CHR = 2; | |
| 406 | pub const DT_DIR = 4; | |
| 407 | pub const DT_BLK = 6; | |
| 408 | pub const DT_REG = 8; | |
| 409 | pub const DT_LNK = 10; | |
| 410 | pub const DT_SOCK = 12; | |
| 411 | pub const DT_WHT = 14; | |
| 412 | ||
| 413 | pub const TCGETS = 0x5401; | |
| 414 | pub const TCSETS = 0x5402; | |
| 415 | pub const TCSETSW = 0x5403; | |
| 416 | pub const TCSETSF = 0x5404; | |
| 417 | pub const TCGETA = 0x5405; | |
| 418 | pub const TCSETA = 0x5406; | |
| 419 | pub const TCSETAW = 0x5407; | |
| 420 | pub const TCSETAF = 0x5408; | |
| 421 | pub const TCSBRK = 0x5409; | |
| 422 | pub const TCXONC = 0x540A; | |
| 423 | pub const TCFLSH = 0x540B; | |
| 424 | pub const TIOCEXCL = 0x540C; | |
| 425 | pub const TIOCNXCL = 0x540D; | |
| 426 | pub const TIOCSCTTY = 0x540E; | |
| 427 | pub const TIOCGPGRP = 0x540F; | |
| 428 | pub const TIOCSPGRP = 0x5410; | |
| 429 | pub const TIOCOUTQ = 0x5411; | |
| 430 | pub const TIOCSTI = 0x5412; | |
| 431 | pub const TIOCGWINSZ = 0x5413; | |
| 432 | pub const TIOCSWINSZ = 0x5414; | |
| 433 | pub const TIOCMGET = 0x5415; | |
| 434 | pub const TIOCMBIS = 0x5416; | |
| 435 | pub const TIOCMBIC = 0x5417; | |
| 436 | pub const TIOCMSET = 0x5418; | |
| 437 | pub const TIOCGSOFTCAR = 0x5419; | |
| 438 | pub const TIOCSSOFTCAR = 0x541A; | |
| 439 | pub const FIONREAD = 0x541B; | |
| 440 | pub const TIOCINQ = FIONREAD; | |
| 441 | pub const TIOCLINUX = 0x541C; | |
| 442 | pub const TIOCCONS = 0x541D; | |
| 443 | pub const TIOCGSERIAL = 0x541E; | |
| 444 | pub const TIOCSSERIAL = 0x541F; | |
| 445 | pub const TIOCPKT = 0x5420; | |
| 446 | pub const FIONBIO = 0x5421; | |
| 447 | pub const TIOCNOTTY = 0x5422; | |
| 448 | pub const TIOCSETD = 0x5423; | |
| 449 | pub const TIOCGETD = 0x5424; | |
| 450 | pub const TCSBRKP = 0x5425; | |
| 451 | pub const TIOCSBRK = 0x5427; | |
| 452 | pub const TIOCCBRK = 0x5428; | |
| 453 | pub const TIOCGSID = 0x5429; | |
| 454 | pub const TIOCGRS485 = 0x542E; | |
| 455 | pub const TIOCSRS485 = 0x542F; | |
| 456 | pub const TIOCGPTN = 0x80045430; | |
| 457 | pub const TIOCSPTLCK = 0x40045431; | |
| 458 | pub const TIOCGDEV = 0x80045432; | |
| 459 | pub const TCGETX = 0x5432; | |
| 460 | pub const TCSETX = 0x5433; | |
| 461 | pub const TCSETXF = 0x5434; | |
| 462 | pub const TCSETXW = 0x5435; | |
| 463 | pub const TIOCSIG = 0x40045436; | |
| 464 | pub const TIOCVHANGUP = 0x5437; | |
| 465 | pub const TIOCGPKT = 0x80045438; | |
| 466 | pub const TIOCGPTLCK = 0x80045439; | |
| 467 | pub const TIOCGEXCL = 0x80045440; | |
| 468 | ||
| 469 | pub const EPOLL_CLOEXEC = O_CLOEXEC; | |
| 470 | ||
| 471 | pub const EPOLL_CTL_ADD = 1; | |
| 472 | pub const EPOLL_CTL_DEL = 2; | |
| 473 | pub const EPOLL_CTL_MOD = 3; | |
| 474 | ||
| 475 | pub const EPOLLIN = 0x001; | |
| 476 | pub const EPOLLPRI = 0x002; | |
| 477 | pub const EPOLLOUT = 0x004; | |
| 478 | pub const EPOLLRDNORM = 0x040; | |
| 479 | pub const EPOLLRDBAND = 0x080; | |
| 480 | pub const EPOLLWRNORM = 0x100; | |
| 481 | pub const EPOLLWRBAND = 0x200; | |
| 482 | pub const EPOLLMSG = 0x400; | |
| 483 | pub const EPOLLERR = 0x008; | |
| 484 | pub const EPOLLHUP = 0x010; | |
| 485 | pub const EPOLLRDHUP = 0x2000; | |
| 486 | pub const EPOLLEXCLUSIVE = (u32(1) << 28); | |
| 487 | pub const EPOLLWAKEUP = (u32(1) << 29); | |
| 488 | pub const EPOLLONESHOT = (u32(1) << 30); | |
| 489 | pub const EPOLLET = (u32(1) << 31); | |
| 490 | ||
| 491 | pub const CLOCK_REALTIME = 0; | |
| 492 | pub const CLOCK_MONOTONIC = 1; | |
| 493 | pub const CLOCK_PROCESS_CPUTIME_ID = 2; | |
| 494 | pub const CLOCK_THREAD_CPUTIME_ID = 3; | |
| 495 | pub const CLOCK_MONOTONIC_RAW = 4; | |
| 496 | pub const CLOCK_REALTIME_COARSE = 5; | |
| 497 | pub const CLOCK_MONOTONIC_COARSE = 6; | |
| 498 | pub const CLOCK_BOOTTIME = 7; | |
| 499 | pub const CLOCK_REALTIME_ALARM = 8; | |
| 500 | pub const CLOCK_BOOTTIME_ALARM = 9; | |
| 501 | pub const CLOCK_SGI_CYCLE = 10; | |
| 502 | pub const CLOCK_TAI = 11; | |
| 503 | ||
| 504 | pub const CSIGNAL = 0x000000ff; | |
| 505 | pub const CLONE_VM = 0x00000100; | |
| 506 | pub const CLONE_FS = 0x00000200; | |
| 507 | pub const CLONE_FILES = 0x00000400; | |
| 508 | pub const CLONE_SIGHAND = 0x00000800; | |
| 509 | pub const CLONE_PTRACE = 0x00002000; | |
| 510 | pub const CLONE_VFORK = 0x00004000; | |
| 511 | pub const CLONE_PARENT = 0x00008000; | |
| 512 | pub const CLONE_THREAD = 0x00010000; | |
| 513 | pub const CLONE_NEWNS = 0x00020000; | |
| 514 | pub const CLONE_SYSVSEM = 0x00040000; | |
| 515 | pub const CLONE_SETTLS = 0x00080000; | |
| 516 | pub const CLONE_PARENT_SETTID = 0x00100000; | |
| 517 | pub const CLONE_CHILD_CLEARTID = 0x00200000; | |
| 518 | pub const CLONE_DETACHED = 0x00400000; | |
| 519 | pub const CLONE_UNTRACED = 0x00800000; | |
| 520 | pub const CLONE_CHILD_SETTID = 0x01000000; | |
| 521 | pub const CLONE_NEWCGROUP = 0x02000000; | |
| 522 | pub const CLONE_NEWUTS = 0x04000000; | |
| 523 | pub const CLONE_NEWIPC = 0x08000000; | |
| 524 | pub const CLONE_NEWUSER = 0x10000000; | |
| 525 | pub const CLONE_NEWPID = 0x20000000; | |
| 526 | pub const CLONE_NEWNET = 0x40000000; | |
| 527 | pub const CLONE_IO = 0x80000000; | |
| 528 | ||
| 529 | pub const EFD_SEMAPHORE = 1; | |
| 530 | pub const EFD_CLOEXEC = O_CLOEXEC; | |
| 531 | pub const EFD_NONBLOCK = O_NONBLOCK; | |
| 532 | ||
| 533 | pub const MS_RDONLY = 1; | |
| 534 | pub const MS_NOSUID = 2; | |
| 535 | pub const MS_NODEV = 4; | |
| 536 | pub const MS_NOEXEC = 8; | |
| 537 | pub const MS_SYNCHRONOUS = 16; | |
| 538 | pub const MS_REMOUNT = 32; | |
| 539 | pub const MS_MANDLOCK = 64; | |
| 540 | pub const MS_DIRSYNC = 128; | |
| 541 | pub const MS_NOATIME = 1024; | |
| 542 | pub const MS_NODIRATIME = 2048; | |
| 543 | pub const MS_BIND = 4096; | |
| 544 | pub const MS_MOVE = 8192; | |
| 545 | pub const MS_REC = 16384; | |
| 546 | pub const MS_SILENT = 32768; | |
| 547 | pub const MS_POSIXACL = (1 << 16); | |
| 548 | pub const MS_UNBINDABLE = (1 << 17); | |
| 549 | pub const MS_PRIVATE = (1 << 18); | |
| 550 | pub const MS_SLAVE = (1 << 19); | |
| 551 | pub const MS_SHARED = (1 << 20); | |
| 552 | pub const MS_RELATIME = (1 << 21); | |
| 553 | pub const MS_KERNMOUNT = (1 << 22); | |
| 554 | pub const MS_I_VERSION = (1 << 23); | |
| 555 | pub const MS_STRICTATIME = (1 << 24); | |
| 556 | pub const MS_LAZYTIME = (1 << 25); | |
| 557 | pub const MS_NOREMOTELOCK = (1 << 27); | |
| 558 | pub const MS_NOSEC = (1 << 28); | |
| 559 | pub const MS_BORN = (1 << 29); | |
| 560 | pub const MS_ACTIVE = (1 << 30); | |
| 561 | pub const MS_NOUSER = (1 << 31); | |
| 562 | ||
| 563 | pub const MS_RMT_MASK = (MS_RDONLY | MS_SYNCHRONOUS | MS_MANDLOCK | MS_I_VERSION | MS_LAZYTIME); | |
| 564 | ||
| 565 | pub const MS_MGC_VAL = 0xc0ed0000; | |
| 566 | pub const MS_MGC_MSK = 0xffff0000; | |
| 567 | ||
| 568 | pub const MNT_FORCE = 1; | |
| 569 | pub const MNT_DETACH = 2; | |
| 570 | pub const MNT_EXPIRE = 4; | |
| 571 | pub const UMOUNT_NOFOLLOW = 8; | |
| 572 | ||
| 573 | pub const IN_CLOEXEC = O_CLOEXEC; | |
| 574 | pub const IN_NONBLOCK = O_NONBLOCK; | |
| 575 | ||
| 576 | pub const IN_ACCESS = 0x00000001; | |
| 577 | pub const IN_MODIFY = 0x00000002; | |
| 578 | pub const IN_ATTRIB = 0x00000004; | |
| 579 | pub const IN_CLOSE_WRITE = 0x00000008; | |
| 580 | pub const IN_CLOSE_NOWRITE = 0x00000010; | |
| 581 | pub const IN_CLOSE = IN_CLOSE_WRITE | IN_CLOSE_NOWRITE; | |
| 582 | pub const IN_OPEN = 0x00000020; | |
| 583 | pub const IN_MOVED_FROM = 0x00000040; | |
| 584 | pub const IN_MOVED_TO = 0x00000080; | |
| 585 | pub const IN_MOVE = IN_MOVED_FROM | IN_MOVED_TO; | |
| 586 | pub const IN_CREATE = 0x00000100; | |
| 587 | pub const IN_DELETE = 0x00000200; | |
| 588 | pub const IN_DELETE_SELF = 0x00000400; | |
| 589 | pub const IN_MOVE_SELF = 0x00000800; | |
| 590 | pub const IN_ALL_EVENTS = 0x00000fff; | |
| 591 | ||
| 592 | pub const IN_UNMOUNT = 0x00002000; | |
| 593 | pub const IN_Q_OVERFLOW = 0x00004000; | |
| 594 | pub const IN_IGNORED = 0x00008000; | |
| 595 | ||
| 596 | pub const IN_ONLYDIR = 0x01000000; | |
| 597 | pub const IN_DONT_FOLLOW = 0x02000000; | |
| 598 | pub const IN_EXCL_UNLINK = 0x04000000; | |
| 599 | pub const IN_MASK_ADD = 0x20000000; | |
| 600 | ||
| 601 | pub const IN_ISDIR = 0x40000000; | |
| 602 | pub const IN_ONESHOT = 0x80000000; | |
| 603 | ||
| 604 | pub const S_IFMT = 0o170000; | |
| 605 | ||
| 606 | pub const S_IFDIR = 0o040000; | |
| 607 | pub const S_IFCHR = 0o020000; | |
| 608 | pub const S_IFBLK = 0o060000; | |
| 609 | pub const S_IFREG = 0o100000; | |
| 610 | pub const S_IFIFO = 0o010000; | |
| 611 | pub const S_IFLNK = 0o120000; | |
| 612 | pub const S_IFSOCK = 0o140000; | |
| 613 | ||
| 614 | pub const S_ISUID = 0o4000; | |
| 615 | pub const S_ISGID = 0o2000; | |
| 616 | pub const S_ISVTX = 0o1000; | |
| 617 | pub const S_IRUSR = 0o400; | |
| 618 | pub const S_IWUSR = 0o200; | |
| 619 | pub const S_IXUSR = 0o100; | |
| 620 | pub const S_IRWXU = 0o700; | |
| 621 | pub const S_IRGRP = 0o040; | |
| 622 | pub const S_IWGRP = 0o020; | |
| 623 | pub const S_IXGRP = 0o010; | |
| 624 | pub const S_IRWXG = 0o070; | |
| 625 | pub const S_IROTH = 0o004; | |
| 626 | pub const S_IWOTH = 0o002; | |
| 627 | pub const S_IXOTH = 0o001; | |
| 628 | pub const S_IRWXO = 0o007; | |
| 629 | ||
| 630 | pub fn S_ISREG(m: u32) bool { | |
| 631 | return m & S_IFMT == S_IFREG; | |
| 632 | } | |
| 633 | ||
| 634 | pub fn S_ISDIR(m: u32) bool { | |
| 635 | return m & S_IFMT == S_IFDIR; | |
| 636 | } | |
| 637 | ||
| 638 | pub fn S_ISCHR(m: u32) bool { | |
| 639 | return m & S_IFMT == S_IFCHR; | |
| 640 | } | |
| 641 | ||
| 642 | pub fn S_ISBLK(m: u32) bool { | |
| 643 | return m & S_IFMT == S_IFBLK; | |
| 644 | } | |
| 645 | ||
| 646 | pub fn S_ISFIFO(m: u32) bool { | |
| 647 | return m & S_IFMT == S_IFIFO; | |
| 648 | } | |
| 649 | ||
| 650 | pub fn S_ISLNK(m: u32) bool { | |
| 651 | return m & S_IFMT == S_IFLNK; | |
| 652 | } | |
| 653 | ||
| 654 | pub fn S_ISSOCK(m: u32) bool { | |
| 655 | return m & S_IFMT == S_IFSOCK; | |
| 656 | } | |
| 657 | ||
| 658 | pub const TFD_NONBLOCK = O_NONBLOCK; | |
| 659 | pub const TFD_CLOEXEC = O_CLOEXEC; | |
| 660 | ||
| 661 | pub const TFD_TIMER_ABSTIME = 1; | |
| 662 | pub const TFD_TIMER_CANCEL_ON_SET = (1 << 1); | |
| 663 | ||
| 664 | fn unsigned(s: i32) u32 { | |
| 665 | return @bitCast(u32, s); | |
| 666 | } | |
| 667 | fn signed(s: u32) i32 { | |
| 668 | return @bitCast(i32, s); | |
| 669 | } | |
| 670 | pub fn WEXITSTATUS(s: i32) i32 { | |
| 671 | return signed((unsigned(s) & 0xff00) >> 8); | |
| 672 | } | |
| 673 | pub fn WTERMSIG(s: i32) i32 { | |
| 674 | return signed(unsigned(s) & 0x7f); | |
| 675 | } | |
| 676 | pub fn WSTOPSIG(s: i32) i32 { | |
| 677 | return WEXITSTATUS(s); | |
| 678 | } | |
| 679 | pub fn WIFEXITED(s: i32) bool { | |
| 680 | return WTERMSIG(s) == 0; | |
| 681 | } | |
| 682 | pub fn WIFSTOPPED(s: i32) bool { | |
| 683 | return @intCast(u16, ((unsigned(s) & 0xffff) *% 0x10001) >> 8) > 0x7f00; | |
| 684 | } | |
| 685 | pub fn WIFSIGNALED(s: i32) bool { | |
| 686 | return (unsigned(s) & 0xffff) -% 1 < 0xff; | |
| 687 | } | |
| 688 | ||
| 689 | pub const winsize = extern struct { | |
| 690 | ws_row: u16, | |
| 691 | ws_col: u16, | |
| 692 | ws_xpixel: u16, | |
| 693 | ws_ypixel: u16, | |
| 694 | }; | |
| 695 | ||
| 696 | const NSIG = 65; | |
| 697 | const sigset_t = [128 / @sizeOf(usize)]usize; | |
| 698 | const all_mask = []u32{ 0xffffffff, 0xffffffff }; | |
| 699 | const app_mask = []u32{ 0xfffffffc, 0x7fffffff }; | |
| 700 | ||
| 701 | const k_sigaction = extern struct { | |
| 702 | handler: extern fn (i32) void, | |
| 703 | flags: usize, | |
| 704 | restorer: extern fn () void, | |
| 705 | mask: [2]u32, | |
| 706 | }; | |
| 707 | ||
| 708 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. | |
| 709 | pub const Sigaction = struct { | |
| 710 | handler: extern fn (i32) void, | |
| 711 | mask: sigset_t, | |
| 712 | flags: u32, | |
| 713 | }; | |
| 714 | ||
| 715 | pub const SIG_ERR = @intToPtr(extern fn (i32) void, maxInt(usize)); | |
| 716 | pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0); | |
| 717 | pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1); | |
| 718 | pub const empty_sigset = []usize{0} ** sigset_t.len; | |
| 719 | ||
| 720 | pub const in_port_t = u16; | |
| 721 | pub const sa_family_t = u16; | |
| 722 | pub const socklen_t = u32; | |
| 723 | ||
| 724 | /// This intentionally only has ip4 and ip6 | |
| 725 | pub const sockaddr = extern union { | |
| 726 | in: sockaddr_in, | |
| 727 | in6: sockaddr_in6, | |
| 728 | }; | |
| 729 | ||
| 730 | pub const sockaddr_in = extern struct { | |
| 731 | family: sa_family_t, | |
| 732 | port: in_port_t, | |
| 733 | addr: u32, | |
| 734 | zero: [8]u8, | |
| 735 | }; | |
| 736 | ||
| 737 | pub const sockaddr_in6 = extern struct { | |
| 738 | family: sa_family_t, | |
| 739 | port: in_port_t, | |
| 740 | flowinfo: u32, | |
| 741 | addr: [16]u8, | |
| 742 | scope_id: u32, | |
| 743 | }; | |
| 744 | ||
| 745 | pub const sockaddr_un = extern struct { | |
| 746 | family: sa_family_t, | |
| 747 | path: [108]u8, | |
| 748 | }; | |
| 749 | ||
| 750 | pub const iovec = extern struct { | |
| 751 | iov_base: [*]u8, | |
| 752 | iov_len: usize, | |
| 753 | }; | |
| 754 | ||
| 755 | pub const iovec_const = extern struct { | |
| 756 | iov_base: [*]const u8, | |
| 757 | iov_len: usize, | |
| 758 | }; | |
| 759 | ||
| 760 | pub const mmsghdr = extern struct { | |
| 761 | msg_hdr: msghdr, | |
| 762 | msg_len: u32, | |
| 763 | }; | |
| 764 | ||
| 765 | pub const mmsghdr_const = extern struct { | |
| 766 | msg_hdr: msghdr_const, | |
| 767 | msg_len: u32, | |
| 768 | }; | |
| 769 | ||
| 770 | pub const epoll_data = extern union { | |
| 771 | ptr: usize, | |
| 772 | fd: i32, | |
| 773 | @"u32": u32, | |
| 774 | @"u64": u64, | |
| 775 | }; | |
| 776 | ||
| 777 | // On x86_64 the structure is packed so that it matches the definition of its | |
| 778 | // 32bit counterpart | |
| 779 | pub const epoll_event = if (builtin.arch != .x86_64) | |
| 780 | extern struct { | |
| 781 | events: u32, | |
| 782 | data: epoll_data, | |
| 783 | } | |
| 784 | else | |
| 785 | packed struct { | |
| 786 | events: u32, | |
| 787 | data: epoll_data, | |
| 788 | }; | |
| 789 | ||
| 790 | pub const _LINUX_CAPABILITY_VERSION_1 = 0x19980330; | |
| 791 | pub const _LINUX_CAPABILITY_U32S_1 = 1; | |
| 792 | ||
| 793 | pub const _LINUX_CAPABILITY_VERSION_2 = 0x20071026; | |
| 794 | pub const _LINUX_CAPABILITY_U32S_2 = 2; | |
| 795 | ||
| 796 | pub const _LINUX_CAPABILITY_VERSION_3 = 0x20080522; | |
| 797 | pub const _LINUX_CAPABILITY_U32S_3 = 2; | |
| 798 | ||
| 799 | pub const VFS_CAP_REVISION_MASK = 0xFF000000; | |
| 800 | pub const VFS_CAP_REVISION_SHIFT = 24; | |
| 801 | pub const VFS_CAP_FLAGS_MASK = ~VFS_CAP_REVISION_MASK; | |
| 802 | pub const VFS_CAP_FLAGS_EFFECTIVE = 0x000001; | |
| 803 | ||
| 804 | pub const VFS_CAP_REVISION_1 = 0x01000000; | |
| 805 | pub const VFS_CAP_U32_1 = 1; | |
| 806 | pub const XATTR_CAPS_SZ_1 = @sizeOf(u32) * (1 + 2 * VFS_CAP_U32_1); | |
| 807 | ||
| 808 | pub const VFS_CAP_REVISION_2 = 0x02000000; | |
| 809 | pub const VFS_CAP_U32_2 = 2; | |
| 810 | pub const XATTR_CAPS_SZ_2 = @sizeOf(u32) * (1 + 2 * VFS_CAP_U32_2); | |
| 811 | ||
| 812 | pub const XATTR_CAPS_SZ = XATTR_CAPS_SZ_2; | |
| 813 | pub const VFS_CAP_U32 = VFS_CAP_U32_2; | |
| 814 | pub const VFS_CAP_REVISION = VFS_CAP_REVISION_2; | |
| 815 | ||
| 816 | pub const vfs_cap_data = extern struct { | |
| 817 | //all of these are mandated as little endian | |
| 818 | //when on disk. | |
| 819 | const Data = struct { | |
| 820 | permitted: u32, | |
| 821 | inheritable: u32, | |
| 822 | }; | |
| 823 | ||
| 824 | magic_etc: u32, | |
| 825 | data: [VFS_CAP_U32]Data, | |
| 826 | }; | |
| 827 | ||
| 828 | pub const CAP_CHOWN = 0; | |
| 829 | pub const CAP_DAC_OVERRIDE = 1; | |
| 830 | pub const CAP_DAC_READ_SEARCH = 2; | |
| 831 | pub const CAP_FOWNER = 3; | |
| 832 | pub const CAP_FSETID = 4; | |
| 833 | pub const CAP_KILL = 5; | |
| 834 | pub const CAP_SETGID = 6; | |
| 835 | pub const CAP_SETUID = 7; | |
| 836 | pub const CAP_SETPCAP = 8; | |
| 837 | pub const CAP_LINUX_IMMUTABLE = 9; | |
| 838 | pub const CAP_NET_BIND_SERVICE = 10; | |
| 839 | pub const CAP_NET_BROADCAST = 11; | |
| 840 | pub const CAP_NET_ADMIN = 12; | |
| 841 | pub const CAP_NET_RAW = 13; | |
| 842 | pub const CAP_IPC_LOCK = 14; | |
| 843 | pub const CAP_IPC_OWNER = 15; | |
| 844 | pub const CAP_SYS_MODULE = 16; | |
| 845 | pub const CAP_SYS_RAWIO = 17; | |
| 846 | pub const CAP_SYS_CHROOT = 18; | |
| 847 | pub const CAP_SYS_PTRACE = 19; | |
| 848 | pub const CAP_SYS_PACCT = 20; | |
| 849 | pub const CAP_SYS_ADMIN = 21; | |
| 850 | pub const CAP_SYS_BOOT = 22; | |
| 851 | pub const CAP_SYS_NICE = 23; | |
| 852 | pub const CAP_SYS_RESOURCE = 24; | |
| 853 | pub const CAP_SYS_TIME = 25; | |
| 854 | pub const CAP_SYS_TTY_CONFIG = 26; | |
| 855 | pub const CAP_MKNOD = 27; | |
| 856 | pub const CAP_LEASE = 28; | |
| 857 | pub const CAP_AUDIT_WRITE = 29; | |
| 858 | pub const CAP_AUDIT_CONTROL = 30; | |
| 859 | pub const CAP_SETFCAP = 31; | |
| 860 | pub const CAP_MAC_OVERRIDE = 32; | |
| 861 | pub const CAP_MAC_ADMIN = 33; | |
| 862 | pub const CAP_SYSLOG = 34; | |
| 863 | pub const CAP_WAKE_ALARM = 35; | |
| 864 | pub const CAP_BLOCK_SUSPEND = 36; | |
| 865 | pub const CAP_AUDIT_READ = 37; | |
| 866 | pub const CAP_LAST_CAP = CAP_AUDIT_READ; | |
| 867 | ||
| 868 | pub fn cap_valid(u8: x) bool { | |
| 869 | return x >= 0 and x <= CAP_LAST_CAP; | |
| 870 | } | |
| 871 | ||
| 872 | pub fn CAP_TO_MASK(cap: u8) u32 { | |
| 873 | return u32(1) << u5(cap & 31); | |
| 874 | } | |
| 875 | ||
| 876 | pub fn CAP_TO_INDEX(cap: u8) u8 { | |
| 877 | return cap >> 5; | |
| 878 | } | |
| 879 | ||
| 880 | pub const cap_t = extern struct { | |
| 881 | hdrp: *cap_user_header_t, | |
| 882 | datap: *cap_user_data_t, | |
| 883 | }; | |
| 884 | ||
| 885 | pub const cap_user_header_t = extern struct { | |
| 886 | version: u32, | |
| 887 | pid: usize, | |
| 888 | }; | |
| 889 | ||
| 890 | pub const cap_user_data_t = extern struct { | |
| 891 | effective: u32, | |
| 892 | permitted: u32, | |
| 893 | inheritable: u32, | |
| 894 | }; | |
| 895 | ||
| 896 | pub const inotify_event = extern struct { | |
| 897 | wd: i32, | |
| 898 | mask: u32, | |
| 899 | cookie: u32, | |
| 900 | len: u32, | |
| 901 | //name: [?]u8, | |
| 902 | }; | |
| 903 | ||
| 904 | pub const dirent64 = extern struct { | |
| 905 | d_ino: u64, | |
| 906 | d_off: u64, | |
| 907 | d_reclen: u16, | |
| 908 | d_type: u8, | |
| 909 | d_name: u8, // field address is the address of first byte of name https://github.com/ziglang/zig/issues/173 | |
| 910 | }; | |
| 911 | ||
| 912 | pub const dl_phdr_info = extern struct { | |
| 913 | dlpi_addr: usize, | |
| 914 | dlpi_name: ?[*]const u8, | |
| 915 | dlpi_phdr: [*]elf.Phdr, | |
| 916 | dlpi_phnum: u16, | |
| 917 | }; |
std/os/linux/posix/arm64.zig deleted-405| ... | ... | @@ -1,405 +0,0 @@ |
| 1 | // arm64-specific declarations that are intended to be imported into the POSIX namespace. | |
| 2 | // This does include Linux-only APIs. | |
| 3 | ||
| 4 | const std = @import("../../std.zig"); | |
| 5 | const linux = std.os.linux; | |
| 6 | const socklen_t = linux.socklen_t; | |
| 7 | const iovec = linux.iovec; | |
| 8 | const iovec_const = linux.iovec_const; | |
| 9 | ||
| 10 | pub const SYS_io_setup = 0; | |
| 11 | pub const SYS_io_destroy = 1; | |
| 12 | pub const SYS_io_submit = 2; | |
| 13 | pub const SYS_io_cancel = 3; | |
| 14 | pub const SYS_io_getevents = 4; | |
| 15 | pub const SYS_setxattr = 5; | |
| 16 | pub const SYS_lsetxattr = 6; | |
| 17 | pub const SYS_fsetxattr = 7; | |
| 18 | pub const SYS_getxattr = 8; | |
| 19 | pub const SYS_lgetxattr = 9; | |
| 20 | pub const SYS_fgetxattr = 10; | |
| 21 | pub const SYS_listxattr = 11; | |
| 22 | pub const SYS_llistxattr = 12; | |
| 23 | pub const SYS_flistxattr = 13; | |
| 24 | pub const SYS_removexattr = 14; | |
| 25 | pub const SYS_lremovexattr = 15; | |
| 26 | pub const SYS_fremovexattr = 16; | |
| 27 | pub const SYS_getcwd = 17; | |
| 28 | pub const SYS_lookup_dcookie = 18; | |
| 29 | pub const SYS_eventfd2 = 19; | |
| 30 | pub const SYS_epoll_create1 = 20; | |
| 31 | pub const SYS_epoll_ctl = 21; | |
| 32 | pub const SYS_epoll_pwait = 22; | |
| 33 | pub const SYS_dup = 23; | |
| 34 | pub const SYS_dup3 = 24; | |
| 35 | pub const SYS_fcntl = 25; | |
| 36 | pub const SYS_inotify_init1 = 26; | |
| 37 | pub const SYS_inotify_add_watch = 27; | |
| 38 | pub const SYS_inotify_rm_watch = 28; | |
| 39 | pub const SYS_ioctl = 29; | |
| 40 | pub const SYS_ioprio_set = 30; | |
| 41 | pub const SYS_ioprio_get = 31; | |
| 42 | pub const SYS_flock = 32; | |
| 43 | pub const SYS_mknodat = 33; | |
| 44 | pub const SYS_mkdirat = 34; | |
| 45 | pub const SYS_unlinkat = 35; | |
| 46 | pub const SYS_symlinkat = 36; | |
| 47 | pub const SYS_linkat = 37; | |
| 48 | pub const SYS_renameat = 38; | |
| 49 | pub const SYS_umount2 = 39; | |
| 50 | pub const SYS_mount = 40; | |
| 51 | pub const SYS_pivot_root = 41; | |
| 52 | pub const SYS_nfsservctl = 42; | |
| 53 | pub const SYS_statfs = 43; | |
| 54 | pub const SYS_fstatfs = 44; | |
| 55 | pub const SYS_truncate = 45; | |
| 56 | pub const SYS_ftruncate = 46; | |
| 57 | pub const SYS_fallocate = 47; | |
| 58 | pub const SYS_faccessat = 48; | |
| 59 | pub const SYS_chdir = 49; | |
| 60 | pub const SYS_fchdir = 50; | |
| 61 | pub const SYS_chroot = 51; | |
| 62 | pub const SYS_fchmod = 52; | |
| 63 | pub const SYS_fchmodat = 53; | |
| 64 | pub const SYS_fchownat = 54; | |
| 65 | pub const SYS_fchown = 55; | |
| 66 | pub const SYS_openat = 56; | |
| 67 | pub const SYS_close = 57; | |
| 68 | pub const SYS_vhangup = 58; | |
| 69 | pub const SYS_pipe2 = 59; | |
| 70 | pub const SYS_quotactl = 60; | |
| 71 | pub const SYS_getdents64 = 61; | |
| 72 | pub const SYS_lseek = 62; | |
| 73 | pub const SYS_read = 63; | |
| 74 | pub const SYS_write = 64; | |
| 75 | pub const SYS_readv = 65; | |
| 76 | pub const SYS_writev = 66; | |
| 77 | pub const SYS_pread64 = 67; | |
| 78 | pub const SYS_pwrite64 = 68; | |
| 79 | pub const SYS_preadv = 69; | |
| 80 | pub const SYS_pwritev = 70; | |
| 81 | pub const SYS_pselect6 = 72; | |
| 82 | pub const SYS_ppoll = 73; | |
| 83 | pub const SYS_signalfd4 = 74; | |
| 84 | pub const SYS_vmsplice = 75; | |
| 85 | pub const SYS_splice = 76; | |
| 86 | pub const SYS_tee = 77; | |
| 87 | pub const SYS_readlinkat = 78; | |
| 88 | pub const SYS_fstatat = 79; | |
| 89 | pub const SYS_fstat = 80; | |
| 90 | pub const SYS_sync = 81; | |
| 91 | pub const SYS_fsync = 82; | |
| 92 | pub const SYS_fdatasync = 83; | |
| 93 | pub const SYS_sync_file_range2 = 84; | |
| 94 | pub const SYS_sync_file_range = 84; | |
| 95 | pub const SYS_timerfd_create = 85; | |
| 96 | pub const SYS_timerfd_settime = 86; | |
| 97 | pub const SYS_timerfd_gettime = 87; | |
| 98 | pub const SYS_utimensat = 88; | |
| 99 | pub const SYS_acct = 89; | |
| 100 | pub const SYS_capget = 90; | |
| 101 | pub const SYS_capset = 91; | |
| 102 | pub const SYS_personality = 92; | |
| 103 | pub const SYS_exit = 93; | |
| 104 | pub const SYS_exit_group = 94; | |
| 105 | pub const SYS_waitid = 95; | |
| 106 | pub const SYS_set_tid_address = 96; | |
| 107 | pub const SYS_unshare = 97; | |
| 108 | pub const SYS_futex = 98; | |
| 109 | pub const SYS_set_robust_list = 99; | |
| 110 | pub const SYS_get_robust_list = 100; | |
| 111 | pub const SYS_nanosleep = 101; | |
| 112 | pub const SYS_getitimer = 102; | |
| 113 | pub const SYS_setitimer = 103; | |
| 114 | pub const SYS_kexec_load = 104; | |
| 115 | pub const SYS_init_module = 105; | |
| 116 | pub const SYS_delete_module = 106; | |
| 117 | pub const SYS_timer_create = 107; | |
| 118 | pub const SYS_timer_gettime = 108; | |
| 119 | pub const SYS_timer_getoverrun = 109; | |
| 120 | pub const SYS_timer_settime = 110; | |
| 121 | pub const SYS_timer_delete = 111; | |
| 122 | pub const SYS_clock_settime = 112; | |
| 123 | pub const SYS_clock_gettime = 113; | |
| 124 | pub const SYS_clock_getres = 114; | |
| 125 | pub const SYS_clock_nanosleep = 115; | |
| 126 | pub const SYS_syslog = 116; | |
| 127 | pub const SYS_ptrace = 117; | |
| 128 | pub const SYS_sched_setparam = 118; | |
| 129 | pub const SYS_sched_setscheduler = 119; | |
| 130 | pub const SYS_sched_getscheduler = 120; | |
| 131 | pub const SYS_sched_getparam = 121; | |
| 132 | pub const SYS_sched_setaffinity = 122; | |
| 133 | pub const SYS_sched_getaffinity = 123; | |
| 134 | pub const SYS_sched_yield = 124; | |
| 135 | pub const SYS_sched_get_priority_max = 125; | |
| 136 | pub const SYS_sched_get_priority_min = 126; | |
| 137 | pub const SYS_sched_rr_get_interval = 127; | |
| 138 | pub const SYS_restart_syscall = 128; | |
| 139 | pub const SYS_kill = 129; | |
| 140 | pub const SYS_tkill = 130; | |
| 141 | pub const SYS_tgkill = 131; | |
| 142 | pub const SYS_sigaltstack = 132; | |
| 143 | pub const SYS_rt_sigsuspend = 133; | |
| 144 | pub const SYS_rt_sigaction = 134; | |
| 145 | pub const SYS_rt_sigprocmask = 135; | |
| 146 | pub const SYS_rt_sigpending = 136; | |
| 147 | pub const SYS_rt_sigtimedwait = 137; | |
| 148 | pub const SYS_rt_sigqueueinfo = 138; | |
| 149 | pub const SYS_rt_sigreturn = 139; | |
| 150 | pub const SYS_setpriority = 140; | |
| 151 | pub const SYS_getpriority = 141; | |
| 152 | pub const SYS_reboot = 142; | |
| 153 | pub const SYS_setregid = 143; | |
| 154 | pub const SYS_setgid = 144; | |
| 155 | pub const SYS_setreuid = 145; | |
| 156 | pub const SYS_setuid = 146; | |
| 157 | pub const SYS_setresuid = 147; | |
| 158 | pub const SYS_getresuid = 148; | |
| 159 | pub const SYS_setresgid = 149; | |
| 160 | pub const SYS_getresgid = 150; | |
| 161 | pub const SYS_setfsuid = 151; | |
| 162 | pub const SYS_setfsgid = 152; | |
| 163 | pub const SYS_times = 153; | |
| 164 | pub const SYS_setpgid = 154; | |
| 165 | pub const SYS_getpgid = 155; | |
| 166 | pub const SYS_getsid = 156; | |
| 167 | pub const SYS_setsid = 157; | |
| 168 | pub const SYS_getgroups = 158; | |
| 169 | pub const SYS_setgroups = 159; | |
| 170 | pub const SYS_uname = 160; | |
| 171 | pub const SYS_sethostname = 161; | |
| 172 | pub const SYS_setdomainname = 162; | |
| 173 | pub const SYS_getrlimit = 163; | |
| 174 | pub const SYS_setrlimit = 164; | |
| 175 | pub const SYS_getrusage = 165; | |
| 176 | pub const SYS_umask = 166; | |
| 177 | pub const SYS_prctl = 167; | |
| 178 | pub const SYS_getcpu = 168; | |
| 179 | pub const SYS_gettimeofday = 169; | |
| 180 | pub const SYS_settimeofday = 170; | |
| 181 | pub const SYS_adjtimex = 171; | |
| 182 | pub const SYS_getpid = 172; | |
| 183 | pub const SYS_getppid = 173; | |
| 184 | pub const SYS_getuid = 174; | |
| 185 | pub const SYS_geteuid = 175; | |
| 186 | pub const SYS_getgid = 176; | |
| 187 | pub const SYS_getegid = 177; | |
| 188 | pub const SYS_gettid = 178; | |
| 189 | pub const SYS_sysinfo = 179; | |
| 190 | pub const SYS_mq_open = 180; | |
| 191 | pub const SYS_mq_unlink = 181; | |
| 192 | pub const SYS_mq_timedsend = 182; | |
| 193 | pub const SYS_mq_timedreceive = 183; | |
| 194 | pub const SYS_mq_notify = 184; | |
| 195 | pub const SYS_mq_getsetattr = 185; | |
| 196 | pub const SYS_msgget = 186; | |
| 197 | pub const SYS_msgctl = 187; | |
| 198 | pub const SYS_msgrcv = 188; | |
| 199 | pub const SYS_msgsnd = 189; | |
| 200 | pub const SYS_semget = 190; | |
| 201 | pub const SYS_semctl = 191; | |
| 202 | pub const SYS_semtimedop = 192; | |
| 203 | pub const SYS_semop = 193; | |
| 204 | pub const SYS_shmget = 194; | |
| 205 | pub const SYS_shmctl = 195; | |
| 206 | pub const SYS_shmat = 196; | |
| 207 | pub const SYS_shmdt = 197; | |
| 208 | pub const SYS_socket = 198; | |
| 209 | pub const SYS_socketpair = 199; | |
| 210 | pub const SYS_bind = 200; | |
| 211 | pub const SYS_listen = 201; | |
| 212 | pub const SYS_accept = 202; | |
| 213 | pub const SYS_connect = 203; | |
| 214 | pub const SYS_getsockname = 204; | |
| 215 | pub const SYS_getpeername = 205; | |
| 216 | pub const SYS_sendto = 206; | |
| 217 | pub const SYS_recvfrom = 207; | |
| 218 | pub const SYS_setsockopt = 208; | |
| 219 | pub const SYS_getsockopt = 209; | |
| 220 | pub const SYS_shutdown = 210; | |
| 221 | pub const SYS_sendmsg = 211; | |
| 222 | pub const SYS_recvmsg = 212; | |
| 223 | pub const SYS_readahead = 213; | |
| 224 | pub const SYS_brk = 214; | |
| 225 | pub const SYS_munmap = 215; | |
| 226 | pub const SYS_mremap = 216; | |
| 227 | pub const SYS_add_key = 217; | |
| 228 | pub const SYS_request_key = 218; | |
| 229 | pub const SYS_keyctl = 219; | |
| 230 | pub const SYS_clone = 220; | |
| 231 | pub const SYS_execve = 221; | |
| 232 | pub const SYS_mmap = 222; | |
| 233 | pub const SYS_fadvise64 = 223; | |
| 234 | pub const SYS_swapon = 224; | |
| 235 | pub const SYS_swapoff = 225; | |
| 236 | pub const SYS_mprotect = 226; | |
| 237 | pub const SYS_msync = 227; | |
| 238 | pub const SYS_mlock = 228; | |
| 239 | pub const SYS_munlock = 229; | |
| 240 | pub const SYS_mlockall = 230; | |
| 241 | pub const SYS_munlockall = 231; | |
| 242 | pub const SYS_mincore = 232; | |
| 243 | pub const SYS_madvise = 233; | |
| 244 | pub const SYS_remap_file_pages = 234; | |
| 245 | pub const SYS_mbind = 235; | |
| 246 | pub const SYS_get_mempolicy = 236; | |
| 247 | pub const SYS_set_mempolicy = 237; | |
| 248 | pub const SYS_migrate_pages = 238; | |
| 249 | pub const SYS_move_pages = 239; | |
| 250 | pub const SYS_rt_tgsigqueueinfo = 240; | |
| 251 | pub const SYS_perf_event_open = 241; | |
| 252 | pub const SYS_accept4 = 242; | |
| 253 | pub const SYS_recvmmsg = 243; | |
| 254 | pub const SYS_arch_specific_syscall = 244; | |
| 255 | pub const SYS_wait4 = 260; | |
| 256 | pub const SYS_prlimit64 = 261; | |
| 257 | pub const SYS_fanotify_init = 262; | |
| 258 | pub const SYS_fanotify_mark = 263; | |
| 259 | pub const SYS_clock_adjtime = 266; | |
| 260 | pub const SYS_syncfs = 267; | |
| 261 | pub const SYS_setns = 268; | |
| 262 | pub const SYS_sendmmsg = 269; | |
| 263 | pub const SYS_process_vm_readv = 270; | |
| 264 | pub const SYS_process_vm_writev = 271; | |
| 265 | pub const SYS_kcmp = 272; | |
| 266 | pub const SYS_finit_module = 273; | |
| 267 | pub const SYS_sched_setattr = 274; | |
| 268 | pub const SYS_sched_getattr = 275; | |
| 269 | pub const SYS_renameat2 = 276; | |
| 270 | pub const SYS_seccomp = 277; | |
| 271 | pub const SYS_getrandom = 278; | |
| 272 | pub const SYS_memfd_create = 279; | |
| 273 | pub const SYS_bpf = 280; | |
| 274 | pub const SYS_execveat = 281; | |
| 275 | pub const SYS_userfaultfd = 282; | |
| 276 | pub const SYS_membarrier = 283; | |
| 277 | pub const SYS_mlock2 = 284; | |
| 278 | pub const SYS_copy_file_range = 285; | |
| 279 | pub const SYS_preadv2 = 286; | |
| 280 | pub const SYS_pwritev2 = 287; | |
| 281 | pub const SYS_pkey_mprotect = 288; | |
| 282 | pub const SYS_pkey_alloc = 289; | |
| 283 | pub const SYS_pkey_free = 290; | |
| 284 | pub const SYS_statx = 291; | |
| 285 | pub const SYS_io_pgetevents = 292; | |
| 286 | pub const SYS_rseq = 293; | |
| 287 | pub const SYS_kexec_file_load = 294; | |
| 288 | pub const SYS_pidfd_send_signal = 424; | |
| 289 | pub const SYS_io_uring_setup = 425; | |
| 290 | pub const SYS_io_uring_enter = 426; | |
| 291 | pub const SYS_io_uring_register = 427; | |
| 292 | ||
| 293 | pub const O_CREAT = 0o100; | |
| 294 | pub const O_EXCL = 0o200; | |
| 295 | pub const O_NOCTTY = 0o400; | |
| 296 | pub const O_TRUNC = 0o1000; | |
| 297 | pub const O_APPEND = 0o2000; | |
| 298 | pub const O_NONBLOCK = 0o4000; | |
| 299 | pub const O_DSYNC = 0o10000; | |
| 300 | pub const O_SYNC = 0o4010000; | |
| 301 | pub const O_RSYNC = 0o4010000; | |
| 302 | pub const O_DIRECTORY = 0o200000; | |
| 303 | pub const O_NOFOLLOW = 0o400000; | |
| 304 | pub const O_CLOEXEC = 0o2000000; | |
| 305 | ||
| 306 | pub const O_ASYNC = 0o20000; | |
| 307 | pub const O_DIRECT = 0o40000; | |
| 308 | pub const O_LARGEFILE = 0; | |
| 309 | pub const O_NOATIME = 0o1000000; | |
| 310 | pub const O_PATH = 0o10000000; | |
| 311 | pub const O_TMPFILE = 0o20200000; | |
| 312 | pub const O_NDELAY = O_NONBLOCK; | |
| 313 | ||
| 314 | pub const F_DUPFD = 0; | |
| 315 | pub const F_GETFD = 1; | |
| 316 | pub const F_SETFD = 2; | |
| 317 | pub const F_GETFL = 3; | |
| 318 | pub const F_SETFL = 4; | |
| 319 | ||
| 320 | pub const F_SETOWN = 8; | |
| 321 | pub const F_GETOWN = 9; | |
| 322 | pub const F_SETSIG = 10; | |
| 323 | pub const F_GETSIG = 11; | |
| 324 | ||
| 325 | pub const F_GETLK = 5; | |
| 326 | pub const F_SETLK = 6; | |
| 327 | pub const F_SETLKW = 7; | |
| 328 | ||
| 329 | pub const F_SETOWN_EX = 15; | |
| 330 | pub const F_GETOWN_EX = 16; | |
| 331 | ||
| 332 | pub const F_GETOWNER_UIDS = 17; | |
| 333 | ||
| 334 | pub const AT_FDCWD = -100; | |
| 335 | pub const AT_SYMLINK_NOFOLLOW = 0x100; | |
| 336 | pub const AT_REMOVEDIR = 0x200; | |
| 337 | pub const AT_SYMLINK_FOLLOW = 0x400; | |
| 338 | pub const AT_NO_AUTOMOUNT = 0x800; | |
| 339 | pub const AT_EMPTY_PATH = 0x1000; | |
| 340 | ||
| 341 | pub const VDSO_USEFUL = true; | |
| 342 | pub const VDSO_CGT_SYM = "__kernel_clock_gettime"; | |
| 343 | pub const VDSO_CGT_VER = "LINUX_2.6.39"; | |
| 344 | ||
| 345 | pub const msghdr = extern struct { | |
| 346 | msg_name: ?*sockaddr, | |
| 347 | msg_namelen: socklen_t, | |
| 348 | msg_iov: [*]iovec, | |
| 349 | msg_iovlen: i32, | |
| 350 | __pad1: i32, | |
| 351 | msg_control: ?*c_void, | |
| 352 | msg_controllen: socklen_t, | |
| 353 | __pad2: socklen_t, | |
| 354 | msg_flags: i32, | |
| 355 | }; | |
| 356 | ||
| 357 | pub const msghdr_const = extern struct { | |
| 358 | msg_name: ?*const sockaddr, | |
| 359 | msg_namelen: socklen_t, | |
| 360 | msg_iov: [*]iovec_const, | |
| 361 | msg_iovlen: i32, | |
| 362 | __pad1: i32, | |
| 363 | msg_control: ?*c_void, | |
| 364 | msg_controllen: socklen_t, | |
| 365 | __pad2: socklen_t, | |
| 366 | msg_flags: i32, | |
| 367 | }; | |
| 368 | ||
| 369 | /// Renamed to Stat to not conflict with the stat function. | |
| 370 | pub const Stat = extern struct { | |
| 371 | dev: u64, | |
| 372 | ino: u64, | |
| 373 | nlink: usize, | |
| 374 | ||
| 375 | mode: u32, | |
| 376 | uid: u32, | |
| 377 | gid: u32, | |
| 378 | __pad0: u32, | |
| 379 | rdev: u64, | |
| 380 | size: i64, | |
| 381 | blksize: isize, | |
| 382 | blocks: i64, | |
| 383 | ||
| 384 | atim: timespec, | |
| 385 | mtim: timespec, | |
| 386 | ctim: timespec, | |
| 387 | __unused: [3]isize, | |
| 388 | }; | |
| 389 | ||
| 390 | pub const timespec = extern struct { | |
| 391 | tv_sec: isize, | |
| 392 | tv_nsec: isize, | |
| 393 | }; | |
| 394 | ||
| 395 | pub const timeval = extern struct { | |
| 396 | tv_sec: isize, | |
| 397 | tv_usec: isize, | |
| 398 | }; | |
| 399 | ||
| 400 | pub const timezone = extern struct { | |
| 401 | tz_minuteswest: i32, | |
| 402 | tz_dsttime: i32, | |
| 403 | }; | |
| 404 | ||
| 405 | pub const Elf_Symndx = u32; |
std/os/linux/posix/x86_64.zig deleted-470| ... | ... | @@ -1,470 +0,0 @@ |
| 1 | // x86-64-specific declarations that are intended to be imported into the POSIX namespace. | |
| 2 | const std = @import("../../../std.zig"); | |
| 3 | ||
| 4 | const linux = std.os.linux; | |
| 5 | const sockaddr = linux.sockaddr; | |
| 6 | const socklen_t = linux.socklen_t; | |
| 7 | const iovec = linux.iovec; | |
| 8 | const iovec_const = linux.iovec_const; | |
| 9 | ||
| 10 | pub const SYS_read = 0; | |
| 11 | pub const SYS_write = 1; | |
| 12 | pub const SYS_open = 2; | |
| 13 | pub const SYS_close = 3; | |
| 14 | pub const SYS_stat = 4; | |
| 15 | pub const SYS_fstat = 5; | |
| 16 | pub const SYS_lstat = 6; | |
| 17 | pub const SYS_poll = 7; | |
| 18 | pub const SYS_lseek = 8; | |
| 19 | pub const SYS_mmap = 9; | |
| 20 | pub const SYS_mprotect = 10; | |
| 21 | pub const SYS_munmap = 11; | |
| 22 | pub const SYS_brk = 12; | |
| 23 | pub const SYS_rt_sigaction = 13; | |
| 24 | pub const SYS_rt_sigprocmask = 14; | |
| 25 | pub const SYS_rt_sigreturn = 15; | |
| 26 | pub const SYS_ioctl = 16; | |
| 27 | pub const SYS_pread = 17; | |
| 28 | pub const SYS_pwrite = 18; | |
| 29 | pub const SYS_readv = 19; | |
| 30 | pub const SYS_writev = 20; | |
| 31 | pub const SYS_access = 21; | |
| 32 | pub const SYS_pipe = 22; | |
| 33 | pub const SYS_select = 23; | |
| 34 | pub const SYS_sched_yield = 24; | |
| 35 | pub const SYS_mremap = 25; | |
| 36 | pub const SYS_msync = 26; | |
| 37 | pub const SYS_mincore = 27; | |
| 38 | pub const SYS_madvise = 28; | |
| 39 | pub const SYS_shmget = 29; | |
| 40 | pub const SYS_shmat = 30; | |
| 41 | pub const SYS_shmctl = 31; | |
| 42 | pub const SYS_dup = 32; | |
| 43 | pub const SYS_dup2 = 33; | |
| 44 | pub const SYS_pause = 34; | |
| 45 | pub const SYS_nanosleep = 35; | |
| 46 | pub const SYS_getitimer = 36; | |
| 47 | pub const SYS_alarm = 37; | |
| 48 | pub const SYS_setitimer = 38; | |
| 49 | pub const SYS_getpid = 39; | |
| 50 | pub const SYS_sendfile = 40; | |
| 51 | pub const SYS_socket = 41; | |
| 52 | pub const SYS_connect = 42; | |
| 53 | pub const SYS_accept = 43; | |
| 54 | pub const SYS_sendto = 44; | |
| 55 | pub const SYS_recvfrom = 45; | |
| 56 | pub const SYS_sendmsg = 46; | |
| 57 | pub const SYS_recvmsg = 47; | |
| 58 | pub const SYS_shutdown = 48; | |
| 59 | pub const SYS_bind = 49; | |
| 60 | pub const SYS_listen = 50; | |
| 61 | pub const SYS_getsockname = 51; | |
| 62 | pub const SYS_getpeername = 52; | |
| 63 | pub const SYS_socketpair = 53; | |
| 64 | pub const SYS_setsockopt = 54; | |
| 65 | pub const SYS_getsockopt = 55; | |
| 66 | pub const SYS_clone = 56; | |
| 67 | pub const SYS_fork = 57; | |
| 68 | pub const SYS_vfork = 58; | |
| 69 | pub const SYS_execve = 59; | |
| 70 | pub const SYS_exit = 60; | |
| 71 | pub const SYS_wait4 = 61; | |
| 72 | pub const SYS_kill = 62; | |
| 73 | pub const SYS_uname = 63; | |
| 74 | pub const SYS_semget = 64; | |
| 75 | pub const SYS_semop = 65; | |
| 76 | pub const SYS_semctl = 66; | |
| 77 | pub const SYS_shmdt = 67; | |
| 78 | pub const SYS_msgget = 68; | |
| 79 | pub const SYS_msgsnd = 69; | |
| 80 | pub const SYS_msgrcv = 70; | |
| 81 | pub const SYS_msgctl = 71; | |
| 82 | pub const SYS_fcntl = 72; | |
| 83 | pub const SYS_flock = 73; | |
| 84 | pub const SYS_fsync = 74; | |
| 85 | pub const SYS_fdatasync = 75; | |
| 86 | pub const SYS_truncate = 76; | |
| 87 | pub const SYS_ftruncate = 77; | |
| 88 | pub const SYS_getdents = 78; | |
| 89 | pub const SYS_getcwd = 79; | |
| 90 | pub const SYS_chdir = 80; | |
| 91 | pub const SYS_fchdir = 81; | |
| 92 | pub const SYS_rename = 82; | |
| 93 | pub const SYS_mkdir = 83; | |
| 94 | pub const SYS_rmdir = 84; | |
| 95 | pub const SYS_creat = 85; | |
| 96 | pub const SYS_link = 86; | |
| 97 | pub const SYS_unlink = 87; | |
| 98 | pub const SYS_symlink = 88; | |
| 99 | pub const SYS_readlink = 89; | |
| 100 | pub const SYS_chmod = 90; | |
| 101 | pub const SYS_fchmod = 91; | |
| 102 | pub const SYS_chown = 92; | |
| 103 | pub const SYS_fchown = 93; | |
| 104 | pub const SYS_lchown = 94; | |
| 105 | pub const SYS_umask = 95; | |
| 106 | pub const SYS_gettimeofday = 96; | |
| 107 | pub const SYS_getrlimit = 97; | |
| 108 | pub const SYS_getrusage = 98; | |
| 109 | pub const SYS_sysinfo = 99; | |
| 110 | pub const SYS_times = 100; | |
| 111 | pub const SYS_ptrace = 101; | |
| 112 | pub const SYS_getuid = 102; | |
| 113 | pub const SYS_syslog = 103; | |
| 114 | pub const SYS_getgid = 104; | |
| 115 | pub const SYS_setuid = 105; | |
| 116 | pub const SYS_setgid = 106; | |
| 117 | pub const SYS_geteuid = 107; | |
| 118 | pub const SYS_getegid = 108; | |
| 119 | pub const SYS_setpgid = 109; | |
| 120 | pub const SYS_getppid = 110; | |
| 121 | pub const SYS_getpgrp = 111; | |
| 122 | pub const SYS_setsid = 112; | |
| 123 | pub const SYS_setreuid = 113; | |
| 124 | pub const SYS_setregid = 114; | |
| 125 | pub const SYS_getgroups = 115; | |
| 126 | pub const SYS_setgroups = 116; | |
| 127 | pub const SYS_setresuid = 117; | |
| 128 | pub const SYS_getresuid = 118; | |
| 129 | pub const SYS_setresgid = 119; | |
| 130 | pub const SYS_getresgid = 120; | |
| 131 | pub const SYS_getpgid = 121; | |
| 132 | pub const SYS_setfsuid = 122; | |
| 133 | pub const SYS_setfsgid = 123; | |
| 134 | pub const SYS_getsid = 124; | |
| 135 | pub const SYS_capget = 125; | |
| 136 | pub const SYS_capset = 126; | |
| 137 | pub const SYS_rt_sigpending = 127; | |
| 138 | pub const SYS_rt_sigtimedwait = 128; | |
| 139 | pub const SYS_rt_sigqueueinfo = 129; | |
| 140 | pub const SYS_rt_sigsuspend = 130; | |
| 141 | pub const SYS_sigaltstack = 131; | |
| 142 | pub const SYS_utime = 132; | |
| 143 | pub const SYS_mknod = 133; | |
| 144 | pub const SYS_uselib = 134; | |
| 145 | pub const SYS_personality = 135; | |
| 146 | pub const SYS_ustat = 136; | |
| 147 | pub const SYS_statfs = 137; | |
| 148 | pub const SYS_fstatfs = 138; | |
| 149 | pub const SYS_sysfs = 139; | |
| 150 | pub const SYS_getpriority = 140; | |
| 151 | pub const SYS_setpriority = 141; | |
| 152 | pub const SYS_sched_setparam = 142; | |
| 153 | pub const SYS_sched_getparam = 143; | |
| 154 | pub const SYS_sched_setscheduler = 144; | |
| 155 | pub const SYS_sched_getscheduler = 145; | |
| 156 | pub const SYS_sched_get_priority_max = 146; | |
| 157 | pub const SYS_sched_get_priority_min = 147; | |
| 158 | pub const SYS_sched_rr_get_interval = 148; | |
| 159 | pub const SYS_mlock = 149; | |
| 160 | pub const SYS_munlock = 150; | |
| 161 | pub const SYS_mlockall = 151; | |
| 162 | pub const SYS_munlockall = 152; | |
| 163 | pub const SYS_vhangup = 153; | |
| 164 | pub const SYS_modify_ldt = 154; | |
| 165 | pub const SYS_pivot_root = 155; | |
| 166 | pub const SYS__sysctl = 156; | |
| 167 | pub const SYS_prctl = 157; | |
| 168 | pub const SYS_arch_prctl = 158; | |
| 169 | pub const SYS_adjtimex = 159; | |
| 170 | pub const SYS_setrlimit = 160; | |
| 171 | pub const SYS_chroot = 161; | |
| 172 | pub const SYS_sync = 162; | |
| 173 | pub const SYS_acct = 163; | |
| 174 | pub const SYS_settimeofday = 164; | |
| 175 | pub const SYS_mount = 165; | |
| 176 | pub const SYS_umount2 = 166; | |
| 177 | pub const SYS_swapon = 167; | |
| 178 | pub const SYS_swapoff = 168; | |
| 179 | pub const SYS_reboot = 169; | |
| 180 | pub const SYS_sethostname = 170; | |
| 181 | pub const SYS_setdomainname = 171; | |
| 182 | pub const SYS_iopl = 172; | |
| 183 | pub const SYS_ioperm = 173; | |
| 184 | pub const SYS_create_module = 174; | |
| 185 | pub const SYS_init_module = 175; | |
| 186 | pub const SYS_delete_module = 176; | |
| 187 | pub const SYS_get_kernel_syms = 177; | |
| 188 | pub const SYS_query_module = 178; | |
| 189 | pub const SYS_quotactl = 179; | |
| 190 | pub const SYS_nfsservctl = 180; | |
| 191 | pub const SYS_getpmsg = 181; | |
| 192 | pub const SYS_putpmsg = 182; | |
| 193 | pub const SYS_afs_syscall = 183; | |
| 194 | pub const SYS_tuxcall = 184; | |
| 195 | pub const SYS_security = 185; | |
| 196 | pub const SYS_gettid = 186; | |
| 197 | pub const SYS_readahead = 187; | |
| 198 | pub const SYS_setxattr = 188; | |
| 199 | pub const SYS_lsetxattr = 189; | |
| 200 | pub const SYS_fsetxattr = 190; | |
| 201 | pub const SYS_getxattr = 191; | |
| 202 | pub const SYS_lgetxattr = 192; | |
| 203 | pub const SYS_fgetxattr = 193; | |
| 204 | pub const SYS_listxattr = 194; | |
| 205 | pub const SYS_llistxattr = 195; | |
| 206 | pub const SYS_flistxattr = 196; | |
| 207 | pub const SYS_removexattr = 197; | |
| 208 | pub const SYS_lremovexattr = 198; | |
| 209 | pub const SYS_fremovexattr = 199; | |
| 210 | pub const SYS_tkill = 200; | |
| 211 | pub const SYS_time = 201; | |
| 212 | pub const SYS_futex = 202; | |
| 213 | pub const SYS_sched_setaffinity = 203; | |
| 214 | pub const SYS_sched_getaffinity = 204; | |
| 215 | pub const SYS_set_thread_area = 205; | |
| 216 | pub const SYS_io_setup = 206; | |
| 217 | pub const SYS_io_destroy = 207; | |
| 218 | pub const SYS_io_getevents = 208; | |
| 219 | pub const SYS_io_submit = 209; | |
| 220 | pub const SYS_io_cancel = 210; | |
| 221 | pub const SYS_get_thread_area = 211; | |
| 222 | pub const SYS_lookup_dcookie = 212; | |
| 223 | pub const SYS_epoll_create = 213; | |
| 224 | pub const SYS_epoll_ctl_old = 214; | |
| 225 | pub const SYS_epoll_wait_old = 215; | |
| 226 | pub const SYS_remap_file_pages = 216; | |
| 227 | pub const SYS_getdents64 = 217; | |
| 228 | pub const SYS_set_tid_address = 218; | |
| 229 | pub const SYS_restart_syscall = 219; | |
| 230 | pub const SYS_semtimedop = 220; | |
| 231 | pub const SYS_fadvise64 = 221; | |
| 232 | pub const SYS_timer_create = 222; | |
| 233 | pub const SYS_timer_settime = 223; | |
| 234 | pub const SYS_timer_gettime = 224; | |
| 235 | pub const SYS_timer_getoverrun = 225; | |
| 236 | pub const SYS_timer_delete = 226; | |
| 237 | pub const SYS_clock_settime = 227; | |
| 238 | pub const SYS_clock_gettime = 228; | |
| 239 | pub const SYS_clock_getres = 229; | |
| 240 | pub const SYS_clock_nanosleep = 230; | |
| 241 | pub const SYS_exit_group = 231; | |
| 242 | pub const SYS_epoll_wait = 232; | |
| 243 | pub const SYS_epoll_ctl = 233; | |
| 244 | pub const SYS_tgkill = 234; | |
| 245 | pub const SYS_utimes = 235; | |
| 246 | pub const SYS_vserver = 236; | |
| 247 | pub const SYS_mbind = 237; | |
| 248 | pub const SYS_set_mempolicy = 238; | |
| 249 | pub const SYS_get_mempolicy = 239; | |
| 250 | pub const SYS_mq_open = 240; | |
| 251 | pub const SYS_mq_unlink = 241; | |
| 252 | pub const SYS_mq_timedsend = 242; | |
| 253 | pub const SYS_mq_timedreceive = 243; | |
| 254 | pub const SYS_mq_notify = 244; | |
| 255 | pub const SYS_mq_getsetattr = 245; | |
| 256 | pub const SYS_kexec_load = 246; | |
| 257 | pub const SYS_waitid = 247; | |
| 258 | pub const SYS_add_key = 248; | |
| 259 | pub const SYS_request_key = 249; | |
| 260 | pub const SYS_keyctl = 250; | |
| 261 | pub const SYS_ioprio_set = 251; | |
| 262 | pub const SYS_ioprio_get = 252; | |
| 263 | pub const SYS_inotify_init = 253; | |
| 264 | pub const SYS_inotify_add_watch = 254; | |
| 265 | pub const SYS_inotify_rm_watch = 255; | |
| 266 | pub const SYS_migrate_pages = 256; | |
| 267 | pub const SYS_openat = 257; | |
| 268 | pub const SYS_mkdirat = 258; | |
| 269 | pub const SYS_mknodat = 259; | |
| 270 | pub const SYS_fchownat = 260; | |
| 271 | pub const SYS_futimesat = 261; | |
| 272 | pub const SYS_newfstatat = 262; | |
| 273 | pub const SYS_fstatat = 262; | |
| 274 | pub const SYS_unlinkat = 263; | |
| 275 | pub const SYS_renameat = 264; | |
| 276 | pub const SYS_linkat = 265; | |
| 277 | pub const SYS_symlinkat = 266; | |
| 278 | pub const SYS_readlinkat = 267; | |
| 279 | pub const SYS_fchmodat = 268; | |
| 280 | pub const SYS_faccessat = 269; | |
| 281 | pub const SYS_pselect6 = 270; | |
| 282 | pub const SYS_ppoll = 271; | |
| 283 | pub const SYS_unshare = 272; | |
| 284 | pub const SYS_set_robust_list = 273; | |
| 285 | pub const SYS_get_robust_list = 274; | |
| 286 | pub const SYS_splice = 275; | |
| 287 | pub const SYS_tee = 276; | |
| 288 | pub const SYS_sync_file_range = 277; | |
| 289 | pub const SYS_vmsplice = 278; | |
| 290 | pub const SYS_move_pages = 279; | |
| 291 | pub const SYS_utimensat = 280; | |
| 292 | pub const SYS_epoll_pwait = 281; | |
| 293 | pub const SYS_signalfd = 282; | |
| 294 | pub const SYS_timerfd_create = 283; | |
| 295 | pub const SYS_eventfd = 284; | |
| 296 | pub const SYS_fallocate = 285; | |
| 297 | pub const SYS_timerfd_settime = 286; | |
| 298 | pub const SYS_timerfd_gettime = 287; | |
| 299 | pub const SYS_accept4 = 288; | |
| 300 | pub const SYS_signalfd4 = 289; | |
| 301 | pub const SYS_eventfd2 = 290; | |
| 302 | pub const SYS_epoll_create1 = 291; | |
| 303 | pub const SYS_dup3 = 292; | |
| 304 | pub const SYS_pipe2 = 293; | |
| 305 | pub const SYS_inotify_init1 = 294; | |
| 306 | pub const SYS_preadv = 295; | |
| 307 | pub const SYS_pwritev = 296; | |
| 308 | pub const SYS_rt_tgsigqueueinfo = 297; | |
| 309 | pub const SYS_perf_event_open = 298; | |
| 310 | pub const SYS_recvmmsg = 299; | |
| 311 | pub const SYS_fanotify_init = 300; | |
| 312 | pub const SYS_fanotify_mark = 301; | |
| 313 | pub const SYS_prlimit64 = 302; | |
| 314 | pub const SYS_name_to_handle_at = 303; | |
| 315 | pub const SYS_open_by_handle_at = 304; | |
| 316 | pub const SYS_clock_adjtime = 305; | |
| 317 | pub const SYS_syncfs = 306; | |
| 318 | pub const SYS_sendmmsg = 307; | |
| 319 | pub const SYS_setns = 308; | |
| 320 | pub const SYS_getcpu = 309; | |
| 321 | pub const SYS_process_vm_readv = 310; | |
| 322 | pub const SYS_process_vm_writev = 311; | |
| 323 | pub const SYS_kcmp = 312; | |
| 324 | pub const SYS_finit_module = 313; | |
| 325 | pub const SYS_sched_setattr = 314; | |
| 326 | pub const SYS_sched_getattr = 315; | |
| 327 | pub const SYS_renameat2 = 316; | |
| 328 | pub const SYS_seccomp = 317; | |
| 329 | pub const SYS_getrandom = 318; | |
| 330 | pub const SYS_memfd_create = 319; | |
| 331 | pub const SYS_kexec_file_load = 320; | |
| 332 | pub const SYS_bpf = 321; | |
| 333 | pub const SYS_execveat = 322; | |
| 334 | pub const SYS_userfaultfd = 323; | |
| 335 | pub const SYS_membarrier = 324; | |
| 336 | pub const SYS_mlock2 = 325; | |
| 337 | pub const SYS_copy_file_range = 326; | |
| 338 | pub const SYS_preadv2 = 327; | |
| 339 | pub const SYS_pwritev2 = 328; | |
| 340 | pub const SYS_pkey_mprotect = 329; | |
| 341 | pub const SYS_pkey_alloc = 330; | |
| 342 | pub const SYS_pkey_free = 331; | |
| 343 | pub const SYS_statx = 332; | |
| 344 | pub const SYS_io_pgetevents = 333; | |
| 345 | pub const SYS_rseq = 334; | |
| 346 | pub const SYS_pidfd_send_signal = 424; | |
| 347 | pub const SYS_io_uring_setup = 425; | |
| 348 | pub const SYS_io_uring_enter = 426; | |
| 349 | pub const SYS_io_uring_register = 427; | |
| 350 | ||
| 351 | pub const O_CREAT = 0o100; | |
| 352 | pub const O_EXCL = 0o200; | |
| 353 | pub const O_NOCTTY = 0o400; | |
| 354 | pub const O_TRUNC = 0o1000; | |
| 355 | pub const O_APPEND = 0o2000; | |
| 356 | pub const O_NONBLOCK = 0o4000; | |
| 357 | pub const O_DSYNC = 0o10000; | |
| 358 | pub const O_SYNC = 0o4010000; | |
| 359 | pub const O_RSYNC = 0o4010000; | |
| 360 | pub const O_DIRECTORY = 0o200000; | |
| 361 | pub const O_NOFOLLOW = 0o400000; | |
| 362 | pub const O_CLOEXEC = 0o2000000; | |
| 363 | ||
| 364 | pub const O_ASYNC = 0o20000; | |
| 365 | pub const O_DIRECT = 0o40000; | |
| 366 | pub const O_LARGEFILE = 0; | |
| 367 | pub const O_NOATIME = 0o1000000; | |
| 368 | pub const O_PATH = 0o10000000; | |
| 369 | pub const O_TMPFILE = 0o20200000; | |
| 370 | pub const O_NDELAY = O_NONBLOCK; | |
| 371 | ||
| 372 | pub const F_DUPFD = 0; | |
| 373 | pub const F_GETFD = 1; | |
| 374 | pub const F_SETFD = 2; | |
| 375 | pub const F_GETFL = 3; | |
| 376 | pub const F_SETFL = 4; | |
| 377 | ||
| 378 | pub const F_SETOWN = 8; | |
| 379 | pub const F_GETOWN = 9; | |
| 380 | pub const F_SETSIG = 10; | |
| 381 | pub const F_GETSIG = 11; | |
| 382 | ||
| 383 | pub const F_GETLK = 5; | |
| 384 | pub const F_SETLK = 6; | |
| 385 | pub const F_SETLKW = 7; | |
| 386 | ||
| 387 | pub const F_SETOWN_EX = 15; | |
| 388 | pub const F_GETOWN_EX = 16; | |
| 389 | ||
| 390 | pub const F_GETOWNER_UIDS = 17; | |
| 391 | ||
| 392 | pub const AT_FDCWD = -100; | |
| 393 | pub const AT_SYMLINK_NOFOLLOW = 0x100; | |
| 394 | pub const AT_REMOVEDIR = 0x200; | |
| 395 | pub const AT_SYMLINK_FOLLOW = 0x400; | |
| 396 | pub const AT_NO_AUTOMOUNT = 0x800; | |
| 397 | pub const AT_EMPTY_PATH = 0x1000; | |
| 398 | ||
| 399 | pub const VDSO_USEFUL = true; | |
| 400 | pub const VDSO_CGT_SYM = "__vdso_clock_gettime"; | |
| 401 | pub const VDSO_CGT_VER = "LINUX_2.6"; | |
| 402 | pub const VDSO_GETCPU_SYM = "__vdso_getcpu"; | |
| 403 | pub const VDSO_GETCPU_VER = "LINUX_2.6"; | |
| 404 | ||
| 405 | pub const ARCH_SET_GS = 0x1001; | |
| 406 | pub const ARCH_SET_FS = 0x1002; | |
| 407 | pub const ARCH_GET_FS = 0x1003; | |
| 408 | pub const ARCH_GET_GS = 0x1004; | |
| 409 | ||
| 410 | pub const msghdr = extern struct { | |
| 411 | msg_name: ?*sockaddr, | |
| 412 | msg_namelen: socklen_t, | |
| 413 | msg_iov: [*]iovec, | |
| 414 | msg_iovlen: i32, | |
| 415 | __pad1: i32, | |
| 416 | msg_control: ?*c_void, | |
| 417 | msg_controllen: socklen_t, | |
| 418 | __pad2: socklen_t, | |
| 419 | msg_flags: i32, | |
| 420 | }; | |
| 421 | ||
| 422 | pub const msghdr_const = extern struct { | |
| 423 | msg_name: ?*const sockaddr, | |
| 424 | msg_namelen: socklen_t, | |
| 425 | msg_iov: [*]iovec_const, | |
| 426 | msg_iovlen: i32, | |
| 427 | __pad1: i32, | |
| 428 | msg_control: ?*c_void, | |
| 429 | msg_controllen: socklen_t, | |
| 430 | __pad2: socklen_t, | |
| 431 | msg_flags: i32, | |
| 432 | }; | |
| 433 | ||
| 434 | /// Renamed to Stat to not conflict with the stat function. | |
| 435 | pub const Stat = extern struct { | |
| 436 | dev: u64, | |
| 437 | ino: u64, | |
| 438 | nlink: usize, | |
| 439 | ||
| 440 | mode: u32, | |
| 441 | uid: u32, | |
| 442 | gid: u32, | |
| 443 | __pad0: u32, | |
| 444 | rdev: u64, | |
| 445 | size: i64, | |
| 446 | blksize: isize, | |
| 447 | blocks: i64, | |
| 448 | ||
| 449 | atim: timespec, | |
| 450 | mtim: timespec, | |
| 451 | ctim: timespec, | |
| 452 | __unused: [3]isize, | |
| 453 | }; | |
| 454 | ||
| 455 | pub const timespec = extern struct { | |
| 456 | tv_sec: isize, | |
| 457 | tv_nsec: isize, | |
| 458 | }; | |
| 459 | ||
| 460 | pub const timeval = extern struct { | |
| 461 | tv_sec: isize, | |
| 462 | tv_usec: isize, | |
| 463 | }; | |
| 464 | ||
| 465 | pub const timezone = extern struct { | |
| 466 | tz_minuteswest: i32, | |
| 467 | tz_dsttime: i32, | |
| 468 | }; | |
| 469 | ||
| 470 | pub const Elf_Symndx = u32; |
std/os/linux/sys.zig+1-2| ... | ... | @@ -17,8 +17,7 @@ pub use switch (builtin.arch) { |
| 17 | 17 | .aarch64 => @import("arm64.zig"), |
| 18 | 18 | else => struct {}, |
| 19 | 19 | }; |
| 20 | pub const posix = @import("posix.zig"); | |
| 21 | pub use posix; | |
| 20 | pub use @import("../bits.zig"); | |
| 22 | 21 | |
| 23 | 22 | /// See `std.os.posix.getauxval`. |
| 24 | 23 | pub var elf_aux_maybe: ?[*]std.elf.Auxv = null; |
std/os/wasi.zig+3-3| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | // Based on https://github.com/CraneStation/wasi-sysroot/blob/wasi/libc-bottom-half/headers/public/wasi/core.h |
| 2 | 2 | // and https://github.com/WebAssembly/WASI/blob/master/design/WASI-core.md |
| 3 | const builtin = @import("builtin"); | |
| 3 | 4 | const std = @import("std"); |
| 4 | 5 | const assert = std.debug.assert; |
| 5 | 6 | |
| 6 | pub const is_the_target = @import("builtin").os == .wasi; | |
| 7 | pub const posix = @import("wasi/posix.zig"); | |
| 8 | pub use posix; | |
| 7 | pub const is_the_target = builtin.os == .wasi; | |
| 8 | pub use @import("bits/wasi.zig"); | |
| 9 | 9 | |
| 10 | 10 | comptime { |
| 11 | 11 | assert(@alignOf(i8) == 1); |
std/os/wasi/posix.zig deleted-320| ... | ... | @@ -1,320 +0,0 @@ |
| 1 | // Declarations that are intended to be imported into the POSIX namespace. | |
| 2 | // This includes WASI-only APIs. | |
| 3 | ||
| 4 | pub const STDIN_FILENO = 0; | |
| 5 | pub const STDOUT_FILENO = 1; | |
| 6 | pub const STDERR_FILENO = 2; | |
| 7 | ||
| 8 | pub const advice_t = u8; | |
| 9 | pub const ADVICE_NORMAL: advice_t = 0; | |
| 10 | pub const ADVICE_SEQUENTIAL: advice_t = 1; | |
| 11 | pub const ADVICE_RANDOM: advice_t = 2; | |
| 12 | pub const ADVICE_WILLNEED: advice_t = 3; | |
| 13 | pub const ADVICE_DONTNEED: advice_t = 4; | |
| 14 | pub const ADVICE_NOREUSE: advice_t = 5; | |
| 15 | ||
| 16 | pub const ciovec_t = extern struct { | |
| 17 | buf: [*]const u8, | |
| 18 | buf_len: usize, | |
| 19 | }; | |
| 20 | ||
| 21 | pub const clockid_t = u32; | |
| 22 | pub const CLOCK_REALTIME: clockid_t = 0; | |
| 23 | pub const CLOCK_MONOTONIC: clockid_t = 1; | |
| 24 | pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2; | |
| 25 | pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3; | |
| 26 | ||
| 27 | pub const device_t = u64; | |
| 28 | ||
| 29 | pub const dircookie_t = u64; | |
| 30 | pub const DIRCOOKIE_START: dircookie_t = 0; | |
| 31 | ||
| 32 | pub const dirent_t = extern struct { | |
| 33 | d_next: dircookie_t, | |
| 34 | d_ino: inode_t, | |
| 35 | d_namlen: u32, | |
| 36 | d_type: filetype_t, | |
| 37 | }; | |
| 38 | ||
| 39 | pub const errno_t = u16; | |
| 40 | pub const ESUCCESS: errno_t = 0; | |
| 41 | pub const E2BIG: errno_t = 1; | |
| 42 | pub const EACCES: errno_t = 2; | |
| 43 | pub const EADDRINUSE: errno_t = 3; | |
| 44 | pub const EADDRNOTAVAIL: errno_t = 4; | |
| 45 | pub const EAFNOSUPPORT: errno_t = 5; | |
| 46 | pub const EAGAIN: errno_t = 6; | |
| 47 | pub const EALREADY: errno_t = 7; | |
| 48 | pub const EBADF: errno_t = 8; | |
| 49 | pub const EBADMSG: errno_t = 9; | |
| 50 | pub const EBUSY: errno_t = 10; | |
| 51 | pub const ECANCELED: errno_t = 11; | |
| 52 | pub const ECHILD: errno_t = 12; | |
| 53 | pub const ECONNABORTED: errno_t = 13; | |
| 54 | pub const ECONNREFUSED: errno_t = 14; | |
| 55 | pub const ECONNRESET: errno_t = 15; | |
| 56 | pub const EDEADLK: errno_t = 16; | |
| 57 | pub const EDESTADDRREQ: errno_t = 17; | |
| 58 | pub const EDOM: errno_t = 18; | |
| 59 | pub const EDQUOT: errno_t = 19; | |
| 60 | pub const EEXIST: errno_t = 20; | |
| 61 | pub const EFAULT: errno_t = 21; | |
| 62 | pub const EFBIG: errno_t = 22; | |
| 63 | pub const EHOSTUNREACH: errno_t = 23; | |
| 64 | pub const EIDRM: errno_t = 24; | |
| 65 | pub const EILSEQ: errno_t = 25; | |
| 66 | pub const EINPROGRESS: errno_t = 26; | |
| 67 | pub const EINTR: errno_t = 27; | |
| 68 | pub const EINVAL: errno_t = 28; | |
| 69 | pub const EIO: errno_t = 29; | |
| 70 | pub const EISCONN: errno_t = 30; | |
| 71 | pub const EISDIR: errno_t = 31; | |
| 72 | pub const ELOOP: errno_t = 32; | |
| 73 | pub const EMFILE: errno_t = 33; | |
| 74 | pub const EMLINK: errno_t = 34; | |
| 75 | pub const EMSGSIZE: errno_t = 35; | |
| 76 | pub const EMULTIHOP: errno_t = 36; | |
| 77 | pub const ENAMETOOLONG: errno_t = 37; | |
| 78 | pub const ENETDOWN: errno_t = 38; | |
| 79 | pub const ENETRESET: errno_t = 39; | |
| 80 | pub const ENETUNREACH: errno_t = 40; | |
| 81 | pub const ENFILE: errno_t = 41; | |
| 82 | pub const ENOBUFS: errno_t = 42; | |
| 83 | pub const ENODEV: errno_t = 43; | |
| 84 | pub const ENOENT: errno_t = 44; | |
| 85 | pub const ENOEXEC: errno_t = 45; | |
| 86 | pub const ENOLCK: errno_t = 46; | |
| 87 | pub const ENOLINK: errno_t = 47; | |
| 88 | pub const ENOMEM: errno_t = 48; | |
| 89 | pub const ENOMSG: errno_t = 49; | |
| 90 | pub const ENOPROTOOPT: errno_t = 50; | |
| 91 | pub const ENOSPC: errno_t = 51; | |
| 92 | pub const ENOSYS: errno_t = 52; | |
| 93 | pub const ENOTCONN: errno_t = 53; | |
| 94 | pub const ENOTDIR: errno_t = 54; | |
| 95 | pub const ENOTEMPTY: errno_t = 55; | |
| 96 | pub const ENOTRECOVERABLE: errno_t = 56; | |
| 97 | pub const ENOTSOCK: errno_t = 57; | |
| 98 | pub const ENOTSUP: errno_t = 58; | |
| 99 | pub const ENOTTY: errno_t = 59; | |
| 100 | pub const ENXIO: errno_t = 60; | |
| 101 | pub const EOVERFLOW: errno_t = 61; | |
| 102 | pub const EOWNERDEAD: errno_t = 62; | |
| 103 | pub const EPERM: errno_t = 63; | |
| 104 | pub const EPIPE: errno_t = 64; | |
| 105 | pub const EPROTO: errno_t = 65; | |
| 106 | pub const EPROTONOSUPPORT: errno_t = 66; | |
| 107 | pub const EPROTOTYPE: errno_t = 67; | |
| 108 | pub const ERANGE: errno_t = 68; | |
| 109 | pub const EROFS: errno_t = 69; | |
| 110 | pub const ESPIPE: errno_t = 70; | |
| 111 | pub const ESRCH: errno_t = 71; | |
| 112 | pub const ESTALE: errno_t = 72; | |
| 113 | pub const ETIMEDOUT: errno_t = 73; | |
| 114 | pub const ETXTBSY: errno_t = 74; | |
| 115 | pub const EXDEV: errno_t = 75; | |
| 116 | pub const ENOTCAPABLE: errno_t = 76; | |
| 117 | ||
| 118 | pub const event_t = extern struct { | |
| 119 | userdata: userdata_t, | |
| 120 | @"error": errno_t, | |
| 121 | @"type": eventtype_t, | |
| 122 | u: extern union { | |
| 123 | fd_readwrite: extern struct { | |
| 124 | nbytes: filesize_t, | |
| 125 | flags: eventrwflags_t, | |
| 126 | }, | |
| 127 | }, | |
| 128 | }; | |
| 129 | ||
| 130 | pub const eventrwflags_t = u16; | |
| 131 | pub const EVENT_FD_READWRITE_HANGUP: eventrwflags_t = 0x0001; | |
| 132 | ||
| 133 | pub const eventtype_t = u8; | |
| 134 | pub const EVENTTYPE_CLOCK: eventtype_t = 0; | |
| 135 | pub const EVENTTYPE_FD_READ: eventtype_t = 1; | |
| 136 | pub const EVENTTYPE_FD_WRITE: eventtype_t = 2; | |
| 137 | ||
| 138 | pub const exitcode_t = u32; | |
| 139 | ||
| 140 | pub const fd_t = u32; | |
| 141 | ||
| 142 | pub const fdflags_t = u16; | |
| 143 | pub const FDFLAG_APPEND: fdflags_t = 0x0001; | |
| 144 | pub const FDFLAG_DSYNC: fdflags_t = 0x0002; | |
| 145 | pub const FDFLAG_NONBLOCK: fdflags_t = 0x0004; | |
| 146 | pub const FDFLAG_RSYNC: fdflags_t = 0x0008; | |
| 147 | pub const FDFLAG_SYNC: fdflags_t = 0x0010; | |
| 148 | ||
| 149 | const fdstat_t = extern struct { | |
| 150 | fs_filetype: filetype_t, | |
| 151 | fs_flags: fdflags_t, | |
| 152 | fs_rights_base: rights_t, | |
| 153 | fs_rights_inheriting: rights_t, | |
| 154 | }; | |
| 155 | ||
| 156 | pub const filedelta_t = i64; | |
| 157 | ||
| 158 | pub const filesize_t = u64; | |
| 159 | ||
| 160 | pub const filestat_t = extern struct { | |
| 161 | st_dev: device_t, | |
| 162 | st_ino: inode_t, | |
| 163 | st_filetype: filetype_t, | |
| 164 | st_nlink: linkcount_t, | |
| 165 | st_size: filesize_t, | |
| 166 | st_atim: timestamp_t, | |
| 167 | st_mtim: timestamp_t, | |
| 168 | st_ctim: timestamp_t, | |
| 169 | }; | |
| 170 | ||
| 171 | pub const filetype_t = u8; | |
| 172 | pub const FILETYPE_UNKNOWN: filetype_t = 0; | |
| 173 | pub const FILETYPE_BLOCK_DEVICE: filetype_t = 1; | |
| 174 | pub const FILETYPE_CHARACTER_DEVICE: filetype_t = 2; | |
| 175 | pub const FILETYPE_DIRECTORY: filetype_t = 3; | |
| 176 | pub const FILETYPE_REGULAR_FILE: filetype_t = 4; | |
| 177 | pub const FILETYPE_SOCKET_DGRAM: filetype_t = 5; | |
| 178 | pub const FILETYPE_SOCKET_STREAM: filetype_t = 6; | |
| 179 | pub const FILETYPE_SYMBOLIC_LINK: filetype_t = 7; | |
| 180 | ||
| 181 | pub const fstflags_t = u16; | |
| 182 | pub const FILESTAT_SET_ATIM: fstflags_t = 0x0001; | |
| 183 | pub const FILESTAT_SET_ATIM_NOW: fstflags_t = 0x0002; | |
| 184 | pub const FILESTAT_SET_MTIM: fstflags_t = 0x0004; | |
| 185 | pub const FILESTAT_SET_MTIM_NOW: fstflags_t = 0x0008; | |
| 186 | ||
| 187 | pub const inode_t = u64; | |
| 188 | ||
| 189 | pub const iovec_t = extern struct { | |
| 190 | buf: [*]u8, | |
| 191 | buf_len: usize, | |
| 192 | }; | |
| 193 | ||
| 194 | pub const linkcount_t = u32; | |
| 195 | ||
| 196 | pub const lookupflags_t = u32; | |
| 197 | pub const LOOKUP_SYMLINK_FOLLOW: lookupflags_t = 0x00000001; | |
| 198 | ||
| 199 | pub const oflags_t = u16; | |
| 200 | pub const O_CREAT: oflags_t = 0x0001; | |
| 201 | pub const O_DIRECTORY: oflags_t = 0x0002; | |
| 202 | pub const O_EXCL: oflags_t = 0x0004; | |
| 203 | pub const O_TRUNC: oflags_t = 0x0008; | |
| 204 | ||
| 205 | pub const preopentype_t = u8; | |
| 206 | pub const PREOPENTYPE_DIR: preopentype_t = 0; | |
| 207 | ||
| 208 | pub const prestat_t = extern struct { | |
| 209 | pr_type: preopentype_t, | |
| 210 | u: extern union { | |
| 211 | dir: extern struct { | |
| 212 | pr_name_len: usize, | |
| 213 | }, | |
| 214 | }, | |
| 215 | }; | |
| 216 | ||
| 217 | pub const riflags_t = u16; | |
| 218 | pub const SOCK_RECV_PEEK: riflags_t = 0x0001; | |
| 219 | pub const SOCK_RECV_WAITALL: riflags_t = 0x0002; | |
| 220 | ||
| 221 | pub const rights_t = u64; | |
| 222 | pub const RIGHT_FD_DATASYNC: rights_t = 0x0000000000000001; | |
| 223 | pub const RIGHT_FD_READ: rights_t = 0x0000000000000002; | |
| 224 | pub const RIGHT_FD_SEEK: rights_t = 0x0000000000000004; | |
| 225 | pub const RIGHT_FD_FDSTAT_SET_FLAGS: rights_t = 0x0000000000000008; | |
| 226 | pub const RIGHT_FD_SYNC: rights_t = 0x0000000000000010; | |
| 227 | pub const RIGHT_FD_TELL: rights_t = 0x0000000000000020; | |
| 228 | pub const RIGHT_FD_WRITE: rights_t = 0x0000000000000040; | |
| 229 | pub const RIGHT_FD_ADVISE: rights_t = 0x0000000000000080; | |
| 230 | pub const RIGHT_FD_ALLOCATE: rights_t = 0x0000000000000100; | |
| 231 | pub const RIGHT_PATH_CREATE_DIRECTORY: rights_t = 0x0000000000000200; | |
| 232 | pub const RIGHT_PATH_CREATE_FILE: rights_t = 0x0000000000000400; | |
| 233 | pub const RIGHT_PATH_LINK_SOURCE: rights_t = 0x0000000000000800; | |
| 234 | pub const RIGHT_PATH_LINK_TARGET: rights_t = 0x0000000000001000; | |
| 235 | pub const RIGHT_PATH_OPEN: rights_t = 0x0000000000002000; | |
| 236 | pub const RIGHT_FD_READDIR: rights_t = 0x0000000000004000; | |
| 237 | pub const RIGHT_PATH_READLINK: rights_t = 0x0000000000008000; | |
| 238 | pub const RIGHT_PATH_RENAME_SOURCE: rights_t = 0x0000000000010000; | |
| 239 | pub const RIGHT_PATH_RENAME_TARGET: rights_t = 0x0000000000020000; | |
| 240 | pub const RIGHT_PATH_FILESTAT_GET: rights_t = 0x0000000000040000; | |
| 241 | pub const RIGHT_PATH_FILESTAT_SET_SIZE: rights_t = 0x0000000000080000; | |
| 242 | pub const RIGHT_PATH_FILESTAT_SET_TIMES: rights_t = 0x0000000000100000; | |
| 243 | pub const RIGHT_FD_FILESTAT_GET: rights_t = 0x0000000000200000; | |
| 244 | pub const RIGHT_FD_FILESTAT_SET_SIZE: rights_t = 0x0000000000400000; | |
| 245 | pub const RIGHT_FD_FILESTAT_SET_TIMES: rights_t = 0x0000000000800000; | |
| 246 | pub const RIGHT_PATH_SYMLINK: rights_t = 0x0000000001000000; | |
| 247 | pub const RIGHT_PATH_REMOVE_DIRECTORY: rights_t = 0x0000000002000000; | |
| 248 | pub const RIGHT_PATH_UNLINK_FILE: rights_t = 0x0000000004000000; | |
| 249 | pub const RIGHT_POLL_FD_READWRITE: rights_t = 0x0000000008000000; | |
| 250 | pub const RIGHT_SOCK_SHUTDOWN: rights_t = 0x0000000010000000; | |
| 251 | ||
| 252 | pub const roflags_t = u16; | |
| 253 | pub const SOCK_RECV_DATA_TRUNCATED: roflags_t = 0x0001; | |
| 254 | ||
| 255 | pub const sdflags_t = u8; | |
| 256 | pub const SHUT_RD: sdflags_t = 0x01; | |
| 257 | pub const SHUT_WR: sdflags_t = 0x02; | |
| 258 | ||
| 259 | pub const siflags_t = u16; | |
| 260 | ||
| 261 | pub const signal_t = u8; | |
| 262 | pub const SIGHUP: signal_t = 1; | |
| 263 | pub const SIGINT: signal_t = 2; | |
| 264 | pub const SIGQUIT: signal_t = 3; | |
| 265 | pub const SIGILL: signal_t = 4; | |
| 266 | pub const SIGTRAP: signal_t = 5; | |
| 267 | pub const SIGABRT: signal_t = 6; | |
| 268 | pub const SIGBUS: signal_t = 7; | |
| 269 | pub const SIGFPE: signal_t = 8; | |
| 270 | pub const SIGKILL: signal_t = 9; | |
| 271 | pub const SIGUSR1: signal_t = 10; | |
| 272 | pub const SIGSEGV: signal_t = 11; | |
| 273 | pub const SIGUSR2: signal_t = 12; | |
| 274 | pub const SIGPIPE: signal_t = 13; | |
| 275 | pub const SIGALRM: signal_t = 14; | |
| 276 | pub const SIGTERM: signal_t = 15; | |
| 277 | pub const SIGCHLD: signal_t = 16; | |
| 278 | pub const SIGCONT: signal_t = 17; | |
| 279 | pub const SIGSTOP: signal_t = 18; | |
| 280 | pub const SIGTSTP: signal_t = 19; | |
| 281 | pub const SIGTTIN: signal_t = 20; | |
| 282 | pub const SIGTTOU: signal_t = 21; | |
| 283 | pub const SIGURG: signal_t = 22; | |
| 284 | pub const SIGXCPU: signal_t = 23; | |
| 285 | pub const SIGXFSZ: signal_t = 24; | |
| 286 | pub const SIGVTALRM: signal_t = 25; | |
| 287 | pub const SIGPROF: signal_t = 26; | |
| 288 | pub const SIGWINCH: signal_t = 27; | |
| 289 | pub const SIGPOLL: signal_t = 28; | |
| 290 | pub const SIGPWR: signal_t = 29; | |
| 291 | pub const SIGSYS: signal_t = 30; | |
| 292 | ||
| 293 | pub const subclockflags_t = u16; | |
| 294 | pub const SUBSCRIPTION_CLOCK_ABSTIME: subclockflags_t = 0x0001; | |
| 295 | ||
| 296 | pub const subscription_t = extern struct { | |
| 297 | userdata: userdata_t, | |
| 298 | @"type": eventtype_t, | |
| 299 | u: extern union { | |
| 300 | clock: extern struct { | |
| 301 | identifier: userdata_t, | |
| 302 | clock_id: clockid_t, | |
| 303 | timeout: timestamp_t, | |
| 304 | precision: timestamp_t, | |
| 305 | flags: subclockflags_t, | |
| 306 | }, | |
| 307 | fd_readwrite: extern struct { | |
| 308 | fd: fd_t, | |
| 309 | }, | |
| 310 | }, | |
| 311 | }; | |
| 312 | ||
| 313 | pub const timestamp_t = u64; | |
| 314 | ||
| 315 | pub const userdata_t = u64; | |
| 316 | ||
| 317 | pub const whence_t = u8; | |
| 318 | pub const WHENCE_CUR: whence_t = 0; | |
| 319 | pub const WHENCE_END: whence_t = 1; | |
| 320 | pub const WHENCE_SET: whence_t = 2; |
std/os/windows.zig+8-6| ... | ... | @@ -1,12 +1,14 @@ |
| 1 | // This file contains the types and constants of the Windows API, | |
| 2 | // as well as the Windows-equivalent of "Zig-flavored POSIX" API layer. | |
| 1 | // This file contains thin wrappers around Windows-specific APIs, with these | |
| 2 | // specific goals in mind: | |
| 3 | // * Convert "errno"-style error codes into Zig errors. | |
| 4 | // * When null-terminated or UTF16LE byte buffers are required, provide APIs which accept | |
| 5 | // slices as well as APIs which accept null-terminated UTF16LE byte buffers. | |
| 6 | ||
| 3 | 7 | const std = @import("../std.zig"); |
| 4 | 8 | const assert = std.debug.assert; |
| 5 | 9 | const maxInt = std.math.maxInt; |
| 6 | 10 | |
| 7 | 11 | pub const is_the_target = builtin.os == .windows; |
| 8 | pub const posix = if (builtin.link_libc) struct {} else @import("windows/posix.zig"); | |
| 9 | pub use posix; | |
| 10 | 12 | |
| 11 | 13 | pub const advapi32 = @import("windows/advapi32.zig"); |
| 12 | 14 | pub const kernel32 = @import("windows/kernel32.zig"); |
| ... | ... | @@ -565,7 +567,7 @@ pub fn CreateFile( |
| 565 | 567 | share_mode: DWORD, |
| 566 | 568 | creation_disposition: DWORD, |
| 567 | 569 | flags_and_attrs: DWORD, |
| 568 | ) CreateFileError!fd_t { | |
| 570 | ) CreateFileError!HANDLE { | |
| 569 | 571 | const file_path_w = try sliceToPrefixedFileW(file_path); |
| 570 | 572 | return CreateFileW(&file_path_w, desired_access, share_mode, creation_disposition, flags_and_attrs); |
| 571 | 573 | } |
| ... | ... | @@ -934,7 +936,7 @@ pub const GetStdHandleError = error{ |
| 934 | 936 | Unexpected, |
| 935 | 937 | }; |
| 936 | 938 | |
| 937 | pub fn GetStdHandle(handle_id: DWORD) GetStdHandleError!fd_t { | |
| 939 | pub fn GetStdHandle(handle_id: DWORD) GetStdHandleError!HANDLE { | |
| 938 | 940 | const handle = kernel32.GetStdHandle(handle_id) orelse return error.NoStandardHandleAttached; |
| 939 | 941 | if (handle == INVALID_HANDLE_VALUE) { |
| 940 | 942 | switch (kernel32.GetLastError()) { |
std/os/windows/posix.zig deleted-6| ... | ... | @@ -1,6 +0,0 @@ |
| 1 | // Declarations that are intended to be imported into the POSIX namespace, | |
| 2 | // when not linking libc. | |
| 3 | const std = @import("../../std.zig"); | |
| 4 | const builtin = @import("builtin"); | |
| 5 | ||
| 6 | pub const fd_t = std.os.windows.HANDLE; |
std/os/zen.zig+1-1| ... | ... | @@ -80,7 +80,7 @@ pub const STDOUT_FILENO = 1; |
| 80 | 80 | pub const STDERR_FILENO = 2; |
| 81 | 81 | |
| 82 | 82 | // FIXME: let's borrow Linux's error numbers for now. |
| 83 | use @import("linux/errno.zig"); | |
| 83 | use @import("../bits/linux/errno.zig"); | |
| 84 | 84 | // Get the errno from a syscall return value, or 0 for no error. |
| 85 | 85 | pub fn getErrno(r: usize) usize { |
| 86 | 86 | const signed_r = @bitCast(isize, r); |