| author | |
| committer | |
| log | c05a20fc8c36742dab8792d15e79716da1a55759 |
| tree | bb232f4e121d172ec66f68127f96dc15a28e0ef1 |
| parent | 7884d84315f4080bfe429d3e29f7ebedf9f3f623 |
The proposal #9629 is now accepted, usingnamespace stays but no longer
puts identifiers in scope.51 files changed, 2115 insertions(+), 2072 deletions(-)
CMakeLists.txt-1| ... | @@ -431,7 +431,6 @@ set(ZIG_STAGE2_SOURCES | ... | @@ -431,7 +431,6 @@ set(ZIG_STAGE2_SOURCES |
| 431 | "${CMAKE_SOURCE_DIR}/lib/std/os/linux/io_uring.zig" | 431 | "${CMAKE_SOURCE_DIR}/lib/std/os/linux/io_uring.zig" |
| 432 | "${CMAKE_SOURCE_DIR}/lib/std/os/linux/x86_64.zig" | 432 | "${CMAKE_SOURCE_DIR}/lib/std/os/linux/x86_64.zig" |
| 433 | "${CMAKE_SOURCE_DIR}/lib/std/os/windows.zig" | 433 | "${CMAKE_SOURCE_DIR}/lib/std/os/windows.zig" |
| 434 | "${CMAKE_SOURCE_DIR}/lib/std/os/windows/bits.zig" | ||
| 435 | "${CMAKE_SOURCE_DIR}/lib/std/os/windows/ntstatus.zig" | 434 | "${CMAKE_SOURCE_DIR}/lib/std/os/windows/ntstatus.zig" |
| 436 | "${CMAKE_SOURCE_DIR}/lib/std/os/windows/win32error.zig" | 435 | "${CMAKE_SOURCE_DIR}/lib/std/os/windows/win32error.zig" |
| 437 | "${CMAKE_SOURCE_DIR}/lib/std/Progress.zig" | 436 | "${CMAKE_SOURCE_DIR}/lib/std/Progress.zig" |
lib/std/builtin.zig+1-1| ... | @@ -27,7 +27,7 @@ pub const code_model = builtin.code_model; | ... | @@ -27,7 +27,7 @@ pub const code_model = builtin.code_model; |
| 27 | /// used rather than `explicit_subsystem`. | 27 | /// used rather than `explicit_subsystem`. |
| 28 | /// On non-Windows targets, this is `null`. | 28 | /// On non-Windows targets, this is `null`. |
| 29 | pub const subsystem: ?std.Target.SubSystem = blk: { | 29 | pub const subsystem: ?std.Target.SubSystem = blk: { |
| 30 | if (@hasDecl(builtin, "explicit_subsystem")) break :blk explicit_subsystem; | 30 | if (@hasDecl(builtin, "explicit_subsystem")) break :blk builtin.explicit_subsystem; |
| 31 | switch (os.tag) { | 31 | switch (os.tag) { |
| 32 | .windows => { | 32 | .windows => { |
| 33 | if (is_test) { | 33 | if (is_test) { |
lib/std/c.zig+211-287| ... | @@ -1,181 +1,17 @@ | ... | @@ -1,181 +1,17 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = std.builtin; | 2 | const builtin = std.builtin; |
| 3 | const c = @This(); | ||
| 3 | const page_size = std.mem.page_size; | 4 | const page_size = std.mem.page_size; |
| 4 | const iovec = std.os.iovec; | 5 | const iovec = std.os.iovec; |
| 5 | const iovec_const = std.os.iovec_const; | 6 | const iovec_const = std.os.iovec_const; |
| 6 | 7 | ||
| 7 | pub const tokenizer = @import("c/tokenizer.zig"); | ||
| 8 | pub const Token = tokenizer.Token; | ||
| 9 | pub const Tokenizer = tokenizer.Tokenizer; | ||
| 10 | |||
| 11 | test { | 8 | test { |
| 12 | _ = tokenizer; | 9 | _ = tokenizer; |
| 13 | } | 10 | } |
| 14 | 11 | ||
| 15 | const generic = @import("c/generic.zig"); | 12 | pub const tokenizer = @import("c/tokenizer.zig"); |
| 16 | const system = switch (builtin.os.tag) { | 13 | pub const Token = tokenizer.Token; |
| 17 | .linux => @import("c/linux.zig"), | 14 | pub const Tokenizer = tokenizer.Tokenizer; |
| 18 | .windows => @import("c/windows.zig"), | ||
| 19 | .macos, .ios, .tvos, .watchos => @import("c/darwin.zig"), | ||
| 20 | .freebsd, .kfreebsd => @import("c/freebsd.zig"), | ||
| 21 | .netbsd => @import("c/netbsd.zig"), | ||
| 22 | .dragonfly => @import("c/dragonfly.zig"), | ||
| 23 | .openbsd => @import("c/openbsd.zig"), | ||
| 24 | .haiku => @import("c/haiku.zig"), | ||
| 25 | .hermit => @import("c/hermit.zig"), | ||
| 26 | .solaris => @import("c/solaris.zig"), | ||
| 27 | .fuchsia => @import("c/fuchsia.zig"), | ||
| 28 | .minix => @import("c/minix.zig"), | ||
| 29 | .emscripten => @import("c/emscripten.zig"), | ||
| 30 | .wasi => @import("c/wasi.zig"), | ||
| 31 | else => struct {}, | ||
| 32 | }; | ||
| 33 | |||
| 34 | pub const _errno = system._errno; | ||
| 35 | pub const copy_file_range = system.copy_file_range; | ||
| 36 | pub const fallocate64 = system.fallocate64; | ||
| 37 | pub const fopen64 = system.fopen64; | ||
| 38 | pub const fstat64 = system.fstat64; | ||
| 39 | pub const fstatat64 = system.fstatat64; | ||
| 40 | pub const ftruncate64 = system.ftruncate64; | ||
| 41 | pub const getrlimit64 = system.getrlimit64; | ||
| 42 | pub const lseek64 = system.lseek64; | ||
| 43 | pub const mmap64 = system.mmap64; | ||
| 44 | pub const open64 = system.open64; | ||
| 45 | pub const openat64 = system.openat64; | ||
| 46 | pub const pread64 = system.pread64; | ||
| 47 | pub const preadv64 = system.preadv64; | ||
| 48 | pub const pwrite64 = system.pwrite64; | ||
| 49 | pub const pwritev64 = system.pwritev64; | ||
| 50 | pub const sendfile64 = system.sendfile64; | ||
| 51 | pub const setrlimit64 = system.setrlimit64; | ||
| 52 | |||
| 53 | pub const AF = system.AF; | ||
| 54 | pub const AI = system.AI; | ||
| 55 | pub const AT = system.AT; | ||
| 56 | pub const CLOCK = system.CLOCK; | ||
| 57 | pub const CPU_COUNT = system.CPU_COUNT; | ||
| 58 | pub const E = system.E; | ||
| 59 | pub const EAI = system.EAI; | ||
| 60 | pub const F = system.F; | ||
| 61 | pub const FD_CLOEXEC = system.FD_CLOEXEC; | ||
| 62 | pub const F_OK = system.F_OK; | ||
| 63 | pub const HOST_NAME_MAX = system.HOST_NAME_MAX; | ||
| 64 | pub const IFNAMESIZE = system.IFNAMESIZE; | ||
| 65 | pub const IOV_MAX = system.IOV_MAX; | ||
| 66 | pub const IPPROTO = system.IPPROTO; | ||
| 67 | pub const LOCK = system.LOCK; | ||
| 68 | pub const MADV = system.MADV; | ||
| 69 | pub const MAP = system.MAP; | ||
| 70 | pub const NAME_MAX = system.NAME_MAX; | ||
| 71 | pub const NI = system.NI; | ||
| 72 | pub const O = system.O; | ||
| 73 | pub const PATH_MAX = system.PATH_MAX; | ||
| 74 | pub const POLL = system.POLL; | ||
| 75 | pub const PROT = system.PROT; | ||
| 76 | pub const REG = system.REG; | ||
| 77 | pub const RLIM = system.RLIM; | ||
| 78 | pub const RTLD = system.RTLD; | ||
| 79 | pub const R_OK = system.R_OK; | ||
| 80 | pub const S = system.S; | ||
| 81 | pub const SA = system.SA; | ||
| 82 | pub const SEEK = system.SEEK; | ||
| 83 | pub const SHUT = system.SHUT; | ||
| 84 | pub const SIG = system.SIG; | ||
| 85 | pub const SIOCGIFINDEX = system.SIOCGIFINDEX; | ||
| 86 | pub const SO = system.SO; | ||
| 87 | pub const SOCK = system.SOCK; | ||
| 88 | pub const SOL = system.SOL; | ||
| 89 | pub const STDERR_FILENO = system.STDERR_FILENO; | ||
| 90 | pub const STDIN_FILENO = system.STDIN_FILENO; | ||
| 91 | pub const STDOUT_FILENO = system.STDOUT_FILENO; | ||
| 92 | pub const Sigaction = system.Sigaction; | ||
| 93 | pub const Stat = system.Stat; | ||
| 94 | pub const W = system.W; | ||
| 95 | pub const W_OK = system.W_OK; | ||
| 96 | pub const X_OK = system.X_OK; | ||
| 97 | pub const addrinfo = system.addrinfo; | ||
| 98 | pub const cpu_set_t = system.cpu_set_t; | ||
| 99 | pub const dl_iterate_phdr = system.dl_iterate_phdr; | ||
| 100 | pub const dl_iterate_phdr_callback = system.dl_iterate_phdr_callback; | ||
| 101 | pub const dl_phdr_info = system.dl_phdr_info; | ||
| 102 | pub const empty_sigset = system.empty_sigset; | ||
| 103 | pub const epoll_create1 = system.epoll_create1; | ||
| 104 | pub const epoll_ctl = system.epoll_ctl; | ||
| 105 | pub const epoll_pwait = system.epoll_pwait; | ||
| 106 | pub const epoll_wait = system.epoll_wait; | ||
| 107 | pub const eventfd = system.eventfd; | ||
| 108 | pub const fallocate = system.fallocate; | ||
| 109 | pub const fd_t = system.fd_t; | ||
| 110 | pub const getauxval = system.getauxval; | ||
| 111 | pub const getdents = system.getdents; | ||
| 112 | pub const getrandom = system.getrandom; | ||
| 113 | pub const gid_t = system.gid_t; | ||
| 114 | pub const ifreq = system.ifreq; | ||
| 115 | pub const ino_t = system.ino_t; | ||
| 116 | pub const inotify_add_watch = system.inotify_add_watch; | ||
| 117 | pub const inotify_init1 = system.inotify_init1; | ||
| 118 | pub const inotify_rm_watch = system.inotify_rm_watch; | ||
| 119 | pub const madvise = system.madvise; | ||
| 120 | pub const malloc_usable_size = system.malloc_usable_size; | ||
| 121 | pub const memfd_create = system.memfd_create; | ||
| 122 | pub const mode_t = system.mode_t; | ||
| 123 | pub const nfds_t = system.nfds_t; | ||
| 124 | pub const off_t = system.off_t; | ||
| 125 | pub const pid_t = system.pid_t; | ||
| 126 | pub const pipe2 = system.pipe2; | ||
| 127 | pub const pollfd = system.pollfd; | ||
| 128 | pub const posix_memalign = system.posix_memalign; | ||
| 129 | pub const prlimit = system.prlimit; | ||
| 130 | pub const pthread_attr_t = system.pthread_attr_t; | ||
| 131 | pub const pthread_cond_t = system.pthread_cond_t; | ||
| 132 | pub const pthread_getname_np = system.pthread_getname_np; | ||
| 133 | pub const pthread_mutex_t = system.pthread_mutex_t; | ||
| 134 | pub const pthread_rwlock_t = system.pthread_rwlock_t; | ||
| 135 | pub const pthread_setname_np = system.pthread_setname_np; | ||
| 136 | pub const rlim_t = system.rlim_t; | ||
| 137 | pub const rlimit = system.rlimit; | ||
| 138 | pub const rlimit_resource = system.rlimit_resource; | ||
| 139 | pub const sched_getaffinity = system.sched_getaffinity; | ||
| 140 | pub const sem_t = system.sem_t; | ||
| 141 | pub const sendfile = system.sendfile; | ||
| 142 | pub const sigaltstack = system.sigaltstack; | ||
| 143 | pub const siginfo_t = system.siginfo_t; | ||
| 144 | pub const signalfd = system.signalfd; | ||
| 145 | pub const sigset_t = system.sigset_t; | ||
| 146 | pub const sockaddr = system.sockaddr; | ||
| 147 | pub const socklen_t = system.socklen_t; | ||
| 148 | pub const stack_t = system.stack_t; | ||
| 149 | pub const timespec = system.timespec; | ||
| 150 | pub const timeval = system.timeval; | ||
| 151 | pub const ucontext_t = system.ucontext_t; | ||
| 152 | pub const uid_t = system.uid_t; | ||
| 153 | pub const utsname = system.utsname; | ||
| 154 | |||
| 155 | pub const alarm = if (@hasDecl(system, "alarm")) system.alarm else generic.alarm; | ||
| 156 | pub const clock_getres = if (@hasDecl(system, "clock_getres")) system.clock_getres else generic.clock_getres; | ||
| 157 | pub const clock_gettime = if (@hasDecl(system, "clock_gettime")) system.clock_gettime else generic.clock_gettime; | ||
| 158 | pub const fstat = if (@hasDecl(system, "fstat")) system.fstat else generic.fstat; | ||
| 159 | pub const fstatat = if (@hasDecl(system, "fstatat")) system.fstatat else generic.fstatat; | ||
| 160 | pub const getrusage = if (@hasDecl(system, "getrusage")) system.getrusage else generic.getrusage; | ||
| 161 | pub const gettimeofday = if (@hasDecl(system, "gettimeofday")) system.gettimeofday else generic.gettimeofday; | ||
| 162 | pub const nanosleep = if (@hasDecl(system, "nanosleep")) system.nanosleep else generic.nanosleep; | ||
| 163 | pub const realpath = if (@hasDecl(system, "realpath")) system.realpath else generic.realpath; | ||
| 164 | pub const sched_yield = if (@hasDecl(system, "sched_yield")) system.sched_yield else generic.sched_yield; | ||
| 165 | pub const sigaction = if (@hasDecl(system, "sigaction")) system.sigaction else generic.sigaction; | ||
| 166 | pub const sigfillset = if (@hasDecl(system, "sigfillset")) system.sigfillset else generic.sigfillset; | ||
| 167 | pub const sigprocmask = if (@hasDecl(system, "sigprocmask")) system.sigprocmask else generic.sigprocmask; | ||
| 168 | pub const sigwait = if (@hasDecl(system, "sigwait")) system.sigwait else generic.sigwait; | ||
| 169 | pub const socket = if (@hasDecl(system, "socket")) system.socket else generic.socket; | ||
| 170 | pub const stat = if (@hasDecl(system, "stat")) system.stat else generic.stat; | ||
| 171 | |||
| 172 | pub fn getErrno(rc: anytype) E { | ||
| 173 | if (rc == -1) { | ||
| 174 | return @intToEnum(E, _errno().*); | ||
| 175 | } else { | ||
| 176 | return .SUCCESS; | ||
| 177 | } | ||
| 178 | } | ||
| 179 | 15 | ||
| 180 | /// The return type is `type` to force comptime function call execution. | 16 | /// The return type is `type` to force comptime function call execution. |
| 181 | /// TODO: https://github.com/ziglang/zig/issues/425 | 17 | /// TODO: https://github.com/ziglang/zig/issues/425 |
| ... | @@ -203,6 +39,94 @@ pub fn versionCheck(glibc_version: builtin.Version) type { | ... | @@ -203,6 +39,94 @@ pub fn versionCheck(glibc_version: builtin.Version) type { |
| 203 | }; | 39 | }; |
| 204 | } | 40 | } |
| 205 | 41 | ||
| 42 | pub usingnamespace switch (builtin.os.tag) { | ||
| 43 | .linux => @import("c/linux.zig"), | ||
| 44 | .windows => @import("c/windows.zig"), | ||
| 45 | .macos, .ios, .tvos, .watchos => @import("c/darwin.zig"), | ||
| 46 | .freebsd, .kfreebsd => @import("c/freebsd.zig"), | ||
| 47 | .netbsd => @import("c/netbsd.zig"), | ||
| 48 | .dragonfly => @import("c/dragonfly.zig"), | ||
| 49 | .openbsd => @import("c/openbsd.zig"), | ||
| 50 | .haiku => @import("c/haiku.zig"), | ||
| 51 | .hermit => @import("c/hermit.zig"), | ||
| 52 | .solaris => @import("c/solaris.zig"), | ||
| 53 | .fuchsia => @import("c/fuchsia.zig"), | ||
| 54 | .minix => @import("c/minix.zig"), | ||
| 55 | .emscripten => @import("c/emscripten.zig"), | ||
| 56 | .wasi => @import("c/wasi.zig"), | ||
| 57 | else => struct {}, | ||
| 58 | }; | ||
| 59 | |||
| 60 | pub usingnamespace switch (builtin.os.tag) { | ||
| 61 | .netbsd => struct {}, | ||
| 62 | .macos, .ios, .watchos, .tvos => struct { | ||
| 63 | // XXX: close -> close$NOCANCEL | ||
| 64 | // XXX: getdirentries -> _getdirentries64 | ||
| 65 | pub extern "c" fn clock_getres(clk_id: c_int, tp: *c.timespec) c_int; | ||
| 66 | pub extern "c" fn clock_gettime(clk_id: c_int, tp: *c.timespec) c_int; | ||
| 67 | pub extern "c" fn getrusage(who: c_int, usage: *c.rusage) c_int; | ||
| 68 | pub extern "c" fn gettimeofday(noalias tv: ?*c.timeval, noalias tz: ?*c.timezone) c_int; | ||
| 69 | pub extern "c" fn nanosleep(rqtp: *const c.timespec, rmtp: ?*c.timespec) c_int; | ||
| 70 | pub extern "c" fn sched_yield() c_int; | ||
| 71 | pub extern "c" fn sigaction(sig: c_int, noalias act: ?*const c.Sigaction, noalias oact: ?*c.Sigaction) c_int; | ||
| 72 | pub extern "c" fn sigprocmask(how: c_int, noalias set: ?*const c.sigset_t, noalias oset: ?*c.sigset_t) c_int; | ||
| 73 | pub extern "c" fn socket(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int; | ||
| 74 | pub extern "c" fn stat(noalias path: [*:0]const u8, noalias buf: *c.Stat) c_int; | ||
| 75 | pub extern "c" fn sigfillset(set: ?*c.sigset_t) void; | ||
| 76 | pub extern "c" fn alarm(seconds: c_uint) c_uint; | ||
| 77 | pub extern "c" fn sigwait(set: ?*c.sigset_t, sig: ?*c_int) c_int; | ||
| 78 | }, | ||
| 79 | .windows => struct { | ||
| 80 | // TODO: copied the else case and removed the socket function (because its in ws2_32) | ||
| 81 | // need to verify which of these is actually supported on windows | ||
| 82 | pub extern "c" fn clock_getres(clk_id: c_int, tp: *c.timespec) c_int; | ||
| 83 | pub extern "c" fn clock_gettime(clk_id: c_int, tp: *c.timespec) c_int; | ||
| 84 | pub extern "c" fn fstat(fd: c.fd_t, buf: *c.Stat) c_int; | ||
| 85 | pub extern "c" fn getrusage(who: c_int, usage: *c.rusage) c_int; | ||
| 86 | pub extern "c" fn gettimeofday(noalias tv: ?*c.timeval, noalias tz: ?*c.timezone) c_int; | ||
| 87 | pub extern "c" fn nanosleep(rqtp: *const c.timespec, rmtp: ?*c.timespec) c_int; | ||
| 88 | pub extern "c" fn sched_yield() c_int; | ||
| 89 | pub extern "c" fn sigaction(sig: c_int, noalias act: ?*const c.Sigaction, noalias oact: ?*c.Sigaction) c_int; | ||
| 90 | pub extern "c" fn sigprocmask(how: c_int, noalias set: ?*const c.sigset_t, noalias oset: ?*c.sigset_t) c_int; | ||
| 91 | pub extern "c" fn stat(noalias path: [*:0]const u8, noalias buf: *c.Stat) c_int; | ||
| 92 | pub extern "c" fn sigfillset(set: ?*c.sigset_t) void; | ||
| 93 | pub extern "c" fn alarm(seconds: c_uint) c_uint; | ||
| 94 | pub extern "c" fn sigwait(set: ?*c.sigset_t, sig: ?*c_int) c_int; | ||
| 95 | }, | ||
| 96 | else => struct { | ||
| 97 | pub extern "c" fn clock_getres(clk_id: c_int, tp: *c.timespec) c_int; | ||
| 98 | pub extern "c" fn clock_gettime(clk_id: c_int, tp: *c.timespec) c_int; | ||
| 99 | pub extern "c" fn fstat(fd: c.fd_t, buf: *c.Stat) c_int; | ||
| 100 | pub extern "c" fn getrusage(who: c_int, usage: *c.rusage) c_int; | ||
| 101 | pub extern "c" fn gettimeofday(noalias tv: ?*c.timeval, noalias tz: ?*c.timezone) c_int; | ||
| 102 | pub extern "c" fn nanosleep(rqtp: *const c.timespec, rmtp: ?*c.timespec) c_int; | ||
| 103 | pub extern "c" fn sched_yield() c_int; | ||
| 104 | pub extern "c" fn sigaction(sig: c_int, noalias act: ?*const c.Sigaction, noalias oact: ?*c.Sigaction) c_int; | ||
| 105 | pub extern "c" fn sigprocmask(how: c_int, noalias set: ?*const c.sigset_t, noalias oset: ?*c.sigset_t) c_int; | ||
| 106 | pub extern "c" fn socket(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int; | ||
| 107 | pub extern "c" fn stat(noalias path: [*:0]const u8, noalias buf: *c.Stat) c_int; | ||
| 108 | pub extern "c" fn sigfillset(set: ?*c.sigset_t) void; | ||
| 109 | pub extern "c" fn alarm(seconds: c_uint) c_uint; | ||
| 110 | pub extern "c" fn sigwait(set: ?*c.sigset_t, sig: ?*c_int) c_int; | ||
| 111 | }, | ||
| 112 | }; | ||
| 113 | |||
| 114 | pub usingnamespace switch (builtin.os.tag) { | ||
| 115 | .macos, .ios, .watchos, .tvos => struct {}, | ||
| 116 | else => struct { | ||
| 117 | pub extern "c" fn realpath(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8; | ||
| 118 | pub extern "c" fn fstatat(dirfd: c.fd_t, path: [*:0]const u8, stat_buf: *c.Stat, flags: u32) c_int; | ||
| 119 | }, | ||
| 120 | }; | ||
| 121 | |||
| 122 | pub fn getErrno(rc: anytype) c.E { | ||
| 123 | if (rc == -1) { | ||
| 124 | return @intToEnum(c.E, c._errno().*); | ||
| 125 | } else { | ||
| 126 | return .SUCCESS; | ||
| 127 | } | ||
| 128 | } | ||
| 129 | |||
| 206 | pub extern "c" var environ: [*:null]?[*:0]u8; | 130 | pub extern "c" var environ: [*:null]?[*:0]u8; |
| 207 | 131 | ||
| 208 | pub extern "c" fn fopen(noalias filename: [*:0]const u8, noalias modes: [*:0]const u8) ?*FILE; | 132 | pub extern "c" fn fopen(noalias filename: [*:0]const u8, noalias modes: [*:0]const u8) ?*FILE; |
| ... | @@ -214,175 +138,175 @@ pub extern "c" fn printf(format: [*:0]const u8, ...) c_int; | ... | @@ -214,175 +138,175 @@ pub extern "c" fn printf(format: [*:0]const u8, ...) c_int; |
| 214 | pub extern "c" fn abort() noreturn; | 138 | pub extern "c" fn abort() noreturn; |
| 215 | pub extern "c" fn exit(code: c_int) noreturn; | 139 | pub extern "c" fn exit(code: c_int) noreturn; |
| 216 | pub extern "c" fn _exit(code: c_int) noreturn; | 140 | pub extern "c" fn _exit(code: c_int) noreturn; |
| 217 | pub extern "c" fn isatty(fd: fd_t) c_int; | 141 | pub extern "c" fn isatty(fd: c.fd_t) c_int; |
| 218 | pub extern "c" fn close(fd: fd_t) c_int; | 142 | pub extern "c" fn close(fd: c.fd_t) c_int; |
| 219 | pub extern "c" fn lseek(fd: fd_t, offset: off_t, whence: c_int) off_t; | 143 | pub extern "c" fn lseek(fd: c.fd_t, offset: c.off_t, whence: c_int) c.off_t; |
| 220 | pub extern "c" fn open(path: [*:0]const u8, oflag: c_uint, ...) c_int; | 144 | pub extern "c" fn open(path: [*:0]const u8, oflag: c_uint, ...) c_int; |
| 221 | pub extern "c" fn openat(fd: c_int, path: [*:0]const u8, oflag: c_uint, ...) c_int; | 145 | pub extern "c" fn openat(fd: c_int, path: [*:0]const u8, oflag: c_uint, ...) c_int; |
| 222 | pub extern "c" fn ftruncate(fd: c_int, length: off_t) c_int; | 146 | pub extern "c" fn ftruncate(fd: c_int, length: c.off_t) c_int; |
| 223 | pub extern "c" fn raise(sig: c_int) c_int; | 147 | pub extern "c" fn raise(sig: c_int) c_int; |
| 224 | pub extern "c" fn read(fd: fd_t, buf: [*]u8, nbyte: usize) isize; | 148 | pub extern "c" fn read(fd: c.fd_t, buf: [*]u8, nbyte: usize) isize; |
| 225 | pub extern "c" fn readv(fd: c_int, iov: [*]const iovec, iovcnt: c_uint) isize; | 149 | pub extern "c" fn readv(fd: c_int, iov: [*]const iovec, iovcnt: c_uint) isize; |
| 226 | pub extern "c" fn pread(fd: fd_t, buf: [*]u8, nbyte: usize, offset: off_t) isize; | 150 | pub extern "c" fn pread(fd: c.fd_t, buf: [*]u8, nbyte: usize, offset: c.off_t) isize; |
| 227 | pub extern "c" fn preadv(fd: c_int, iov: [*]const iovec, iovcnt: c_uint, offset: off_t) isize; | 151 | pub extern "c" fn preadv(fd: c_int, iov: [*]const iovec, iovcnt: c_uint, offset: c.off_t) isize; |
| 228 | pub extern "c" fn writev(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint) isize; | 152 | pub extern "c" fn writev(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint) isize; |
| 229 | pub extern "c" fn pwritev(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint, offset: off_t) isize; | 153 | pub extern "c" fn pwritev(fd: c_int, iov: [*]const iovec_const, iovcnt: c_uint, offset: c.off_t) isize; |
| 230 | pub extern "c" fn write(fd: fd_t, buf: [*]const u8, nbyte: usize) isize; | 154 | pub extern "c" fn write(fd: c.fd_t, buf: [*]const u8, nbyte: usize) isize; |
| 231 | pub extern "c" fn pwrite(fd: fd_t, buf: [*]const u8, nbyte: usize, offset: off_t) isize; | 155 | pub extern "c" fn pwrite(fd: c.fd_t, buf: [*]const u8, nbyte: usize, offset: c.off_t) isize; |
| 232 | pub extern "c" fn mmap(addr: ?*align(page_size) c_void, len: usize, prot: c_uint, flags: c_uint, fd: fd_t, offset: off_t) *c_void; | 156 | pub extern "c" fn mmap(addr: ?*align(page_size) c_void, len: usize, prot: c_uint, flags: c_uint, fd: c.fd_t, offset: c.off_t) *c_void; |
| 233 | pub extern "c" fn munmap(addr: *align(page_size) const c_void, len: usize) c_int; | 157 | pub extern "c" fn munmap(addr: *align(page_size) const c_void, len: usize) c_int; |
| 234 | pub extern "c" fn mprotect(addr: *align(page_size) c_void, len: usize, prot: c_uint) c_int; | 158 | pub extern "c" fn mprotect(addr: *align(page_size) c_void, len: usize, prot: c_uint) c_int; |
| 235 | pub extern "c" fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8, flags: c_int) c_int; | 159 | pub extern "c" fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8, flags: c_int) c_int; |
| 236 | pub extern "c" fn linkat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpath: [*:0]const u8, flags: c_int) c_int; | 160 | pub extern "c" fn linkat(oldfd: c.fd_t, oldpath: [*:0]const u8, newfd: c.fd_t, newpath: [*:0]const u8, flags: c_int) c_int; |
| 237 | pub extern "c" fn unlink(path: [*:0]const u8) c_int; | 161 | pub extern "c" fn unlink(path: [*:0]const u8) c_int; |
| 238 | pub extern "c" fn unlinkat(dirfd: fd_t, path: [*:0]const u8, flags: c_uint) c_int; | 162 | pub extern "c" fn unlinkat(dirfd: c.fd_t, path: [*:0]const u8, flags: c_uint) c_int; |
| 239 | pub extern "c" fn getcwd(buf: [*]u8, size: usize) ?[*]u8; | 163 | pub extern "c" fn getcwd(buf: [*]u8, size: usize) ?[*]u8; |
| 240 | pub extern "c" fn waitpid(pid: pid_t, stat_loc: ?*c_int, options: c_int) pid_t; | 164 | pub extern "c" fn waitpid(pid: c.pid_t, stat_loc: ?*c_int, options: c_int) c.pid_t; |
| 241 | pub extern "c" fn fork() c_int; | 165 | pub extern "c" fn fork() c_int; |
| 242 | pub extern "c" fn access(path: [*:0]const u8, mode: c_uint) c_int; | 166 | pub extern "c" fn access(path: [*:0]const u8, mode: c_uint) c_int; |
| 243 | pub extern "c" fn faccessat(dirfd: fd_t, path: [*:0]const u8, mode: c_uint, flags: c_uint) c_int; | 167 | pub extern "c" fn faccessat(dirfd: c.fd_t, path: [*:0]const u8, mode: c_uint, flags: c_uint) c_int; |
| 244 | pub extern "c" fn pipe(fds: *[2]fd_t) c_int; | 168 | pub extern "c" fn pipe(fds: *[2]c.fd_t) c_int; |
| 245 | pub extern "c" fn mkdir(path: [*:0]const u8, mode: c_uint) c_int; | 169 | pub extern "c" fn mkdir(path: [*:0]const u8, mode: c_uint) c_int; |
| 246 | pub extern "c" fn mkdirat(dirfd: fd_t, path: [*:0]const u8, mode: u32) c_int; | 170 | pub extern "c" fn mkdirat(dirfd: c.fd_t, path: [*:0]const u8, mode: u32) c_int; |
| 247 | pub extern "c" fn symlink(existing: [*:0]const u8, new: [*:0]const u8) c_int; | 171 | pub extern "c" fn symlink(existing: [*:0]const u8, new: [*:0]const u8) c_int; |
| 248 | pub extern "c" fn symlinkat(oldpath: [*:0]const u8, newdirfd: fd_t, newpath: [*:0]const u8) c_int; | 172 | pub extern "c" fn symlinkat(oldpath: [*:0]const u8, newdirfd: c.fd_t, newpath: [*:0]const u8) c_int; |
| 249 | pub extern "c" fn rename(old: [*:0]const u8, new: [*:0]const u8) c_int; | 173 | pub extern "c" fn rename(old: [*:0]const u8, new: [*:0]const u8) c_int; |
| 250 | pub extern "c" fn renameat(olddirfd: fd_t, old: [*:0]const u8, newdirfd: fd_t, new: [*:0]const u8) c_int; | 174 | pub extern "c" fn renameat(olddirfd: c.fd_t, old: [*:0]const u8, newdirfd: c.fd_t, new: [*:0]const u8) c_int; |
| 251 | pub extern "c" fn chdir(path: [*:0]const u8) c_int; | 175 | pub extern "c" fn chdir(path: [*:0]const u8) c_int; |
| 252 | pub extern "c" fn fchdir(fd: fd_t) c_int; | 176 | pub extern "c" fn fchdir(fd: c.fd_t) c_int; |
| 253 | pub extern "c" fn execve(path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8, envp: [*:null]const ?[*:0]const u8) c_int; | 177 | pub extern "c" fn execve(path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8, envp: [*:null]const ?[*:0]const u8) c_int; |
| 254 | pub extern "c" fn dup(fd: fd_t) c_int; | 178 | pub extern "c" fn dup(fd: c.fd_t) c_int; |
| 255 | pub extern "c" fn dup2(old_fd: fd_t, new_fd: fd_t) c_int; | 179 | pub extern "c" fn dup2(old_fd: c.fd_t, new_fd: c.fd_t) c_int; |
| 256 | pub extern "c" fn readlink(noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize; | 180 | pub extern "c" fn readlink(noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize; |
| 257 | pub extern "c" fn readlinkat(dirfd: fd_t, noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize; | 181 | pub extern "c" fn readlinkat(dirfd: c.fd_t, noalias path: [*:0]const u8, noalias buf: [*]u8, bufsize: usize) isize; |
| 258 | 182 | ||
| 259 | pub extern "c" fn rmdir(path: [*:0]const u8) c_int; | 183 | pub extern "c" fn rmdir(path: [*:0]const u8) c_int; |
| 260 | pub extern "c" fn getenv(name: [*:0]const u8) ?[*:0]u8; | 184 | pub extern "c" fn getenv(name: [*:0]const u8) ?[*:0]u8; |
| 261 | pub extern "c" fn sysctl(name: [*]const c_int, namelen: c_uint, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) c_int; | 185 | pub extern "c" fn sysctl(name: [*]const c_int, namelen: c_uint, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) c_int; |
| 262 | pub extern "c" fn sysctlbyname(name: [*:0]const u8, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) c_int; | 186 | pub extern "c" fn sysctlbyname(name: [*:0]const u8, oldp: ?*c_void, oldlenp: ?*usize, newp: ?*c_void, newlen: usize) c_int; |
| 263 | pub extern "c" fn sysctlnametomib(name: [*:0]const u8, mibp: ?*c_int, sizep: ?*usize) c_int; | 187 | pub extern "c" fn sysctlnametomib(name: [*:0]const u8, mibp: ?*c_int, sizep: ?*usize) c_int; |
| 264 | pub extern "c" fn tcgetattr(fd: fd_t, termios_p: *termios) c_int; | 188 | pub extern "c" fn tcgetattr(fd: c.fd_t, termios_p: *c.termios) c_int; |
| 265 | pub extern "c" fn tcsetattr(fd: fd_t, optional_action: TCSA, termios_p: *const termios) c_int; | 189 | pub extern "c" fn tcsetattr(fd: c.fd_t, optional_action: c.TCSA, termios_p: *const c.termios) c_int; |
| 266 | pub extern "c" fn fcntl(fd: fd_t, cmd: c_int, ...) c_int; | 190 | pub extern "c" fn fcntl(fd: c.fd_t, cmd: c_int, ...) c_int; |
| 267 | pub extern "c" fn flock(fd: fd_t, operation: c_int) c_int; | 191 | pub extern "c" fn flock(fd: c.fd_t, operation: c_int) c_int; |
| 268 | pub extern "c" fn ioctl(fd: fd_t, request: c_int, ...) c_int; | 192 | pub extern "c" fn ioctl(fd: c.fd_t, request: c_int, ...) c_int; |
| 269 | pub extern "c" fn uname(buf: *utsname) c_int; | 193 | pub extern "c" fn uname(buf: *c.utsname) c_int; |
| 270 | 194 | ||
| 271 | pub extern "c" fn gethostname(name: [*]u8, len: usize) c_int; | 195 | pub extern "c" fn gethostname(name: [*]u8, len: usize) c_int; |
| 272 | pub extern "c" fn shutdown(socket: fd_t, how: c_int) c_int; | 196 | pub extern "c" fn shutdown(socket: c.fd_t, how: c_int) c_int; |
| 273 | pub extern "c" fn bind(socket: fd_t, address: ?*const sockaddr, address_len: socklen_t) c_int; | 197 | pub extern "c" fn bind(socket: c.fd_t, address: ?*const c.sockaddr, address_len: c.socklen_t) c_int; |
| 274 | pub extern "c" fn socketpair(domain: c_uint, sock_type: c_uint, protocol: c_uint, sv: *[2]fd_t) c_int; | 198 | pub extern "c" fn socketpair(domain: c_uint, sock_type: c_uint, protocol: c_uint, sv: *[2]c.fd_t) c_int; |
| 275 | pub extern "c" fn listen(sockfd: fd_t, backlog: c_uint) c_int; | 199 | pub extern "c" fn listen(sockfd: c.fd_t, backlog: c_uint) c_int; |
| 276 | pub extern "c" fn getsockname(sockfd: fd_t, noalias addr: *sockaddr, noalias addrlen: *socklen_t) c_int; | 200 | pub extern "c" fn getsockname(sockfd: c.fd_t, noalias addr: *c.sockaddr, noalias addrlen: *c.socklen_t) c_int; |
| 277 | pub extern "c" fn getpeername(sockfd: fd_t, noalias addr: *sockaddr, noalias addrlen: *socklen_t) c_int; | 201 | pub extern "c" fn getpeername(sockfd: c.fd_t, noalias addr: *c.sockaddr, noalias addrlen: *c.socklen_t) c_int; |
| 278 | pub extern "c" fn connect(sockfd: fd_t, sock_addr: *const sockaddr, addrlen: socklen_t) c_int; | 202 | pub extern "c" fn connect(sockfd: c.fd_t, sock_addr: *const c.sockaddr, addrlen: c.socklen_t) c_int; |
| 279 | pub extern "c" fn accept(sockfd: fd_t, noalias addr: ?*sockaddr, noalias addrlen: ?*socklen_t) c_int; | 203 | pub extern "c" fn accept(sockfd: c.fd_t, noalias addr: ?*c.sockaddr, noalias addrlen: ?*c.socklen_t) c_int; |
| 280 | pub extern "c" fn accept4(sockfd: fd_t, noalias addr: ?*sockaddr, noalias addrlen: ?*socklen_t, flags: c_uint) c_int; | 204 | pub extern "c" fn accept4(sockfd: c.fd_t, noalias addr: ?*c.sockaddr, noalias addrlen: ?*c.socklen_t, flags: c_uint) c_int; |
| 281 | pub extern "c" fn getsockopt(sockfd: fd_t, level: u32, optname: u32, noalias optval: ?*c_void, noalias optlen: *socklen_t) c_int; | 205 | pub extern "c" fn getsockopt(sockfd: c.fd_t, level: u32, optname: u32, noalias optval: ?*c_void, noalias optlen: *c.socklen_t) c_int; |
| 282 | pub extern "c" fn setsockopt(sockfd: fd_t, level: u32, optname: u32, optval: ?*const c_void, optlen: socklen_t) c_int; | 206 | pub extern "c" fn setsockopt(sockfd: c.fd_t, level: u32, optname: u32, optval: ?*const c_void, optlen: c.socklen_t) c_int; |
| 283 | pub extern "c" fn send(sockfd: fd_t, buf: *const c_void, len: usize, flags: u32) isize; | 207 | pub extern "c" fn send(sockfd: c.fd_t, buf: *const c_void, len: usize, flags: u32) isize; |
| 284 | pub extern "c" fn sendto( | 208 | pub extern "c" fn sendto( |
| 285 | sockfd: fd_t, | 209 | sockfd: c.fd_t, |
| 286 | buf: *const c_void, | 210 | buf: *const c_void, |
| 287 | len: usize, | 211 | len: usize, |
| 288 | flags: u32, | 212 | flags: u32, |
| 289 | dest_addr: ?*const sockaddr, | 213 | dest_addr: ?*const c.sockaddr, |
| 290 | addrlen: socklen_t, | 214 | addrlen: c.socklen_t, |
| 291 | ) isize; | 215 | ) isize; |
| 292 | pub extern "c" fn sendmsg(sockfd: fd_t, msg: *const std.x.os.Socket.Message, flags: c_int) isize; | 216 | pub extern "c" fn sendmsg(sockfd: c.fd_t, msg: *const std.x.os.Socket.Message, flags: c_int) isize; |
| 293 | 217 | ||
| 294 | pub extern "c" fn recv(sockfd: fd_t, arg1: ?*c_void, arg2: usize, arg3: c_int) isize; | 218 | pub extern "c" fn recv(sockfd: c.fd_t, arg1: ?*c_void, arg2: usize, arg3: c_int) isize; |
| 295 | pub extern "c" fn recvfrom( | 219 | pub extern "c" fn recvfrom( |
| 296 | sockfd: fd_t, | 220 | sockfd: c.fd_t, |
| 297 | noalias buf: *c_void, | 221 | noalias buf: *c_void, |
| 298 | len: usize, | 222 | len: usize, |
| 299 | flags: u32, | 223 | flags: u32, |
| 300 | noalias src_addr: ?*sockaddr, | 224 | noalias src_addr: ?*c.sockaddr, |
| 301 | noalias addrlen: ?*socklen_t, | 225 | noalias addrlen: ?*c.socklen_t, |
| 302 | ) isize; | 226 | ) isize; |
| 303 | pub extern "c" fn recvmsg(sockfd: fd_t, msg: *std.x.os.Socket.Message, flags: c_int) isize; | 227 | pub extern "c" fn recvmsg(sockfd: c.fd_t, msg: *std.x.os.Socket.Message, flags: c_int) isize; |
| 304 | 228 | ||
| 305 | pub extern "c" fn kill(pid: pid_t, sig: c_int) c_int; | 229 | pub extern "c" fn kill(pid: c.pid_t, sig: c_int) c_int; |
| 306 | pub extern "c" fn getdirentries(fd: fd_t, buf_ptr: [*]u8, nbytes: usize, basep: *i64) isize; | 230 | pub extern "c" fn getdirentries(fd: c.fd_t, buf_ptr: [*]u8, nbytes: usize, basep: *i64) isize; |
| 307 | 231 | ||
| 308 | pub extern "c" fn setuid(uid: uid_t) c_int; | 232 | pub extern "c" fn setuid(uid: c.uid_t) c_int; |
| 309 | pub extern "c" fn setgid(gid: gid_t) c_int; | 233 | pub extern "c" fn setgid(gid: c.gid_t) c_int; |
| 310 | pub extern "c" fn seteuid(euid: uid_t) c_int; | 234 | pub extern "c" fn seteuid(euid: c.uid_t) c_int; |
| 311 | pub extern "c" fn setegid(egid: gid_t) c_int; | 235 | pub extern "c" fn setegid(egid: c.gid_t) c_int; |
| 312 | pub extern "c" fn setreuid(ruid: uid_t, euid: uid_t) c_int; | 236 | pub extern "c" fn setreuid(ruid: c.uid_t, euid: c.uid_t) c_int; |
| 313 | pub extern "c" fn setregid(rgid: gid_t, egid: gid_t) c_int; | 237 | pub extern "c" fn setregid(rgid: c.gid_t, egid: c.gid_t) c_int; |
| 314 | pub extern "c" fn setresuid(ruid: uid_t, euid: uid_t, suid: uid_t) c_int; | 238 | pub extern "c" fn setresuid(ruid: c.uid_t, euid: c.uid_t, suid: c.uid_t) c_int; |
| 315 | pub extern "c" fn setresgid(rgid: gid_t, egid: gid_t, sgid: gid_t) c_int; | 239 | pub extern "c" fn setresgid(rgid: c.gid_t, egid: c.gid_t, sgid: c.gid_t) c_int; |
| 316 | 240 | ||
| 317 | pub extern "c" fn malloc(usize) ?*c_void; | 241 | pub extern "c" fn malloc(usize) ?*c_void; |
| 318 | pub extern "c" fn realloc(?*c_void, usize) ?*c_void; | 242 | pub extern "c" fn realloc(?*c_void, usize) ?*c_void; |
| 319 | pub extern "c" fn free(?*c_void) void; | 243 | pub extern "c" fn free(?*c_void) void; |
| 320 | 244 | ||
| 321 | pub extern "c" fn futimes(fd: fd_t, times: *[2]timeval) c_int; | 245 | pub extern "c" fn futimes(fd: c.fd_t, times: *[2]c.timeval) c_int; |
| 322 | pub extern "c" fn utimes(path: [*:0]const u8, times: *[2]timeval) c_int; | 246 | pub extern "c" fn utimes(path: [*:0]const u8, times: *[2]c.timeval) c_int; |
| 323 | 247 | ||
| 324 | pub extern "c" fn utimensat(dirfd: fd_t, pathname: [*:0]const u8, times: *[2]timespec, flags: u32) c_int; | 248 | pub extern "c" fn utimensat(dirfd: c.fd_t, pathname: [*:0]const u8, times: *[2]c.timespec, flags: u32) c_int; |
| 325 | pub extern "c" fn futimens(fd: fd_t, times: *const [2]timespec) c_int; | 249 | pub extern "c" fn futimens(fd: c.fd_t, times: *const [2]c.timespec) c_int; |
| 326 | 250 | ||
| 327 | pub extern "c" fn pthread_create(noalias newthread: *pthread_t, noalias attr: ?*const pthread_attr_t, start_routine: fn (?*c_void) callconv(.C) ?*c_void, noalias arg: ?*c_void) E; | 251 | pub extern "c" fn pthread_create(noalias newthread: *pthread_t, noalias attr: ?*const c.pthread_attr_t, start_routine: fn (?*c_void) callconv(.C) ?*c_void, noalias arg: ?*c_void) c.E; |
| 328 | pub extern "c" fn pthread_attr_init(attr: *pthread_attr_t) E; | 252 | pub extern "c" fn pthread_attr_init(attr: *c.pthread_attr_t) c.E; |
| 329 | pub extern "c" fn pthread_attr_setstack(attr: *pthread_attr_t, stackaddr: *c_void, stacksize: usize) E; | 253 | pub extern "c" fn pthread_attr_setstack(attr: *c.pthread_attr_t, stackaddr: *c_void, stacksize: usize) c.E; |
| 330 | pub extern "c" fn pthread_attr_setstacksize(attr: *pthread_attr_t, stacksize: usize) E; | 254 | pub extern "c" fn pthread_attr_setstacksize(attr: *c.pthread_attr_t, stacksize: usize) c.E; |
| 331 | pub extern "c" fn pthread_attr_setguardsize(attr: *pthread_attr_t, guardsize: usize) E; | 255 | pub extern "c" fn pthread_attr_setguardsize(attr: *c.pthread_attr_t, guardsize: usize) c.E; |
| 332 | pub extern "c" fn pthread_attr_destroy(attr: *pthread_attr_t) E; | 256 | pub extern "c" fn pthread_attr_destroy(attr: *c.pthread_attr_t) c.E; |
| 333 | pub extern "c" fn pthread_self() pthread_t; | 257 | pub extern "c" fn pthread_self() pthread_t; |
| 334 | pub extern "c" fn pthread_join(thread: pthread_t, arg_return: ?*?*c_void) E; | 258 | pub extern "c" fn pthread_join(thread: pthread_t, arg_return: ?*?*c_void) c.E; |
| 335 | pub extern "c" fn pthread_detach(thread: pthread_t) E; | 259 | pub extern "c" fn pthread_detach(thread: pthread_t) c.E; |
| 336 | pub extern "c" fn pthread_atfork( | 260 | pub extern "c" fn pthread_atfork( |
| 337 | prepare: ?fn () callconv(.C) void, | 261 | prepare: ?fn () callconv(.C) void, |
| 338 | parent: ?fn () callconv(.C) void, | 262 | parent: ?fn () callconv(.C) void, |
| 339 | child: ?fn () callconv(.C) void, | 263 | child: ?fn () callconv(.C) void, |
| 340 | ) c_int; | 264 | ) c_int; |
| 341 | pub extern "c" fn pthread_key_create(key: *pthread_key_t, destructor: ?fn (value: *c_void) callconv(.C) void) E; | 265 | pub extern "c" fn pthread_key_create(key: *c.pthread_key_t, destructor: ?fn (value: *c_void) callconv(.C) void) c.E; |
| 342 | pub extern "c" fn pthread_key_delete(key: pthread_key_t) E; | 266 | pub extern "c" fn pthread_key_delete(key: c.pthread_key_t) c.E; |
| 343 | pub extern "c" fn pthread_getspecific(key: pthread_key_t) ?*c_void; | 267 | pub extern "c" fn pthread_getspecific(key: c.pthread_key_t) ?*c_void; |
| 344 | pub extern "c" fn pthread_setspecific(key: pthread_key_t, value: ?*c_void) c_int; | 268 | pub extern "c" fn pthread_setspecific(key: c.pthread_key_t, value: ?*c_void) c_int; |
| 345 | pub extern "c" fn sem_init(sem: *sem_t, pshared: c_int, value: c_uint) c_int; | 269 | pub extern "c" fn sem_init(sem: *c.sem_t, pshared: c_int, value: c_uint) c_int; |
| 346 | pub extern "c" fn sem_destroy(sem: *sem_t) c_int; | 270 | pub extern "c" fn sem_destroy(sem: *c.sem_t) c_int; |
| 347 | pub extern "c" fn sem_post(sem: *sem_t) c_int; | 271 | pub extern "c" fn sem_post(sem: *c.sem_t) c_int; |
| 348 | pub extern "c" fn sem_wait(sem: *sem_t) c_int; | 272 | pub extern "c" fn sem_wait(sem: *c.sem_t) c_int; |
| 349 | pub extern "c" fn sem_trywait(sem: *sem_t) c_int; | 273 | pub extern "c" fn sem_trywait(sem: *c.sem_t) c_int; |
| 350 | pub extern "c" fn sem_timedwait(sem: *sem_t, abs_timeout: *const timespec) c_int; | 274 | pub extern "c" fn sem_timedwait(sem: *c.sem_t, abs_timeout: *const c.timespec) c_int; |
| 351 | pub extern "c" fn sem_getvalue(sem: *sem_t, sval: *c_int) c_int; | 275 | pub extern "c" fn sem_getvalue(sem: *c.sem_t, sval: *c_int) c_int; |
| 352 | 276 | ||
| 353 | pub extern "c" fn kqueue() c_int; | 277 | pub extern "c" fn kqueue() c_int; |
| 354 | pub extern "c" fn kevent( | 278 | pub extern "c" fn kevent( |
| 355 | kq: c_int, | 279 | kq: c_int, |
| 356 | changelist: [*]const Kevent, | 280 | changelist: [*]const c.Kevent, |
| 357 | nchanges: c_int, | 281 | nchanges: c_int, |
| 358 | eventlist: [*]Kevent, | 282 | eventlist: [*]c.Kevent, |
| 359 | nevents: c_int, | 283 | nevents: c_int, |
| 360 | timeout: ?*const timespec, | 284 | timeout: ?*const c.timespec, |
| 361 | ) c_int; | 285 | ) c_int; |
| 362 | 286 | ||
| 363 | pub extern "c" fn getaddrinfo( | 287 | pub extern "c" fn getaddrinfo( |
| 364 | noalias node: ?[*:0]const u8, | 288 | noalias node: ?[*:0]const u8, |
| 365 | noalias service: ?[*:0]const u8, | 289 | noalias service: ?[*:0]const u8, |
| 366 | noalias hints: ?*const addrinfo, | 290 | noalias hints: ?*const c.addrinfo, |
| 367 | noalias res: **addrinfo, | 291 | noalias res: **c.addrinfo, |
| 368 | ) EAI; | 292 | ) c.EAI; |
| 369 | 293 | ||
| 370 | pub extern "c" fn freeaddrinfo(res: *addrinfo) void; | 294 | pub extern "c" fn freeaddrinfo(res: *c.addrinfo) void; |
| 371 | 295 | ||
| 372 | pub extern "c" fn getnameinfo( | 296 | pub extern "c" fn getnameinfo( |
| 373 | noalias addr: *const sockaddr, | 297 | noalias addr: *const c.sockaddr, |
| 374 | addrlen: socklen_t, | 298 | addrlen: c.socklen_t, |
| 375 | noalias host: [*]u8, | 299 | noalias host: [*]u8, |
| 376 | hostlen: socklen_t, | 300 | hostlen: c.socklen_t, |
| 377 | noalias serv: [*]u8, | 301 | noalias serv: [*]u8, |
| 378 | servlen: socklen_t, | 302 | servlen: c.socklen_t, |
| 379 | flags: u32, | 303 | flags: u32, |
| 380 | ) EAI; | 304 | ) c.EAI; |
| 381 | 305 | ||
| 382 | pub extern "c" fn gai_strerror(errcode: EAI) [*:0]const u8; | 306 | pub extern "c" fn gai_strerror(errcode: c.EAI) [*:0]const u8; |
| 383 | 307 | ||
| 384 | pub extern "c" fn poll(fds: [*]pollfd, nfds: nfds_t, timeout: c_int) c_int; | 308 | pub extern "c" fn poll(fds: [*]c.pollfd, nfds: c.nfds_t, timeout: c_int) c_int; |
| 385 | pub extern "c" fn ppoll(fds: [*]pollfd, nfds: nfds_t, timeout: ?*const timespec, sigmask: ?*const sigset_t) c_int; | 309 | pub extern "c" fn ppoll(fds: [*]c.pollfd, nfds: c.nfds_t, timeout: ?*const c.timespec, sigmask: ?*const c.sigset_t) c_int; |
| 386 | 310 | ||
| 387 | pub extern "c" fn dn_expand( | 311 | pub extern "c" fn dn_expand( |
| 388 | msg: [*:0]const u8, | 312 | msg: [*:0]const u8, |
| ... | @@ -392,25 +316,25 @@ pub extern "c" fn dn_expand( | ... | @@ -392,25 +316,25 @@ pub extern "c" fn dn_expand( |
| 392 | length: c_int, | 316 | length: c_int, |
| 393 | ) c_int; | 317 | ) c_int; |
| 394 | 318 | ||
| 395 | pub const PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t{}; | 319 | pub const PTHREAD_MUTEX_INITIALIZER = c.pthread_mutex_t{}; |
| 396 | pub extern "c" fn pthread_mutex_lock(mutex: *pthread_mutex_t) E; | 320 | pub extern "c" fn pthread_mutex_lock(mutex: *c.pthread_mutex_t) c.E; |
| 397 | pub extern "c" fn pthread_mutex_unlock(mutex: *pthread_mutex_t) E; | 321 | pub extern "c" fn pthread_mutex_unlock(mutex: *c.pthread_mutex_t) c.E; |
| 398 | pub extern "c" fn pthread_mutex_trylock(mutex: *pthread_mutex_t) E; | 322 | pub extern "c" fn pthread_mutex_trylock(mutex: *c.pthread_mutex_t) c.E; |
| 399 | pub extern "c" fn pthread_mutex_destroy(mutex: *pthread_mutex_t) E; | 323 | pub extern "c" fn pthread_mutex_destroy(mutex: *c.pthread_mutex_t) c.E; |
| 400 | 324 | ||
| 401 | pub const PTHREAD_COND_INITIALIZER = pthread_cond_t{}; | 325 | pub const PTHREAD_COND_INITIALIZER = c.pthread_cond_t{}; |
| 402 | pub extern "c" fn pthread_cond_wait(noalias cond: *pthread_cond_t, noalias mutex: *pthread_mutex_t) E; | 326 | pub extern "c" fn pthread_cond_wait(noalias cond: *c.pthread_cond_t, noalias mutex: *c.pthread_mutex_t) c.E; |
| 403 | pub extern "c" fn pthread_cond_timedwait(noalias cond: *pthread_cond_t, noalias mutex: *pthread_mutex_t, noalias abstime: *const timespec) E; | 327 | pub extern "c" fn pthread_cond_timedwait(noalias cond: *c.pthread_cond_t, noalias mutex: *c.pthread_mutex_t, noalias abstime: *const c.timespec) c.E; |
| 404 | pub extern "c" fn pthread_cond_signal(cond: *pthread_cond_t) E; | 328 | pub extern "c" fn pthread_cond_signal(cond: *c.pthread_cond_t) c.E; |
| 405 | pub extern "c" fn pthread_cond_broadcast(cond: *pthread_cond_t) E; | 329 | pub extern "c" fn pthread_cond_broadcast(cond: *c.pthread_cond_t) c.E; |
| 406 | pub extern "c" fn pthread_cond_destroy(cond: *pthread_cond_t) E; | 330 | pub extern "c" fn pthread_cond_destroy(cond: *c.pthread_cond_t) c.E; |
| 407 | 331 | ||
| 408 | pub extern "c" fn pthread_rwlock_destroy(rwl: *pthread_rwlock_t) callconv(.C) E; | 332 | pub extern "c" fn pthread_rwlock_destroy(rwl: *c.pthread_rwlock_t) callconv(.C) c.E; |
| 409 | pub extern "c" fn pthread_rwlock_rdlock(rwl: *pthread_rwlock_t) callconv(.C) E; | 333 | pub extern "c" fn pthread_rwlock_rdlock(rwl: *c.pthread_rwlock_t) callconv(.C) c.E; |
| 410 | pub extern "c" fn pthread_rwlock_wrlock(rwl: *pthread_rwlock_t) callconv(.C) E; | 334 | pub extern "c" fn pthread_rwlock_wrlock(rwl: *c.pthread_rwlock_t) callconv(.C) c.E; |
| 411 | pub extern "c" fn pthread_rwlock_tryrdlock(rwl: *pthread_rwlock_t) callconv(.C) E; | 335 | pub extern "c" fn pthread_rwlock_tryrdlock(rwl: *c.pthread_rwlock_t) callconv(.C) c.E; |
| 412 | pub extern "c" fn pthread_rwlock_trywrlock(rwl: *pthread_rwlock_t) callconv(.C) E; | 336 | pub extern "c" fn pthread_rwlock_trywrlock(rwl: *c.pthread_rwlock_t) callconv(.C) c.E; |
| 413 | pub extern "c" fn pthread_rwlock_unlock(rwl: *pthread_rwlock_t) callconv(.C) E; | 337 | pub extern "c" fn pthread_rwlock_unlock(rwl: *c.pthread_rwlock_t) callconv(.C) c.E; |
| 414 | 338 | ||
| 415 | pub const pthread_t = *opaque {}; | 339 | pub const pthread_t = *opaque {}; |
| 416 | pub const FILE = opaque {}; | 340 | pub const FILE = opaque {}; |
| ... | @@ -426,8 +350,8 @@ pub extern "c" fn fdatasync(fd: c_int) c_int; | ... | @@ -426,8 +350,8 @@ pub extern "c" fn fdatasync(fd: c_int) c_int; |
| 426 | 350 | ||
| 427 | pub extern "c" fn prctl(option: c_int, ...) c_int; | 351 | pub extern "c" fn prctl(option: c_int, ...) c_int; |
| 428 | 352 | ||
| 429 | pub extern "c" fn getrlimit(resource: rlimit_resource, rlim: *rlimit) c_int; | 353 | pub extern "c" fn getrlimit(resource: c.rlimit_resource, rlim: *c.rlimit) c_int; |
| 430 | pub extern "c" fn setrlimit(resource: rlimit_resource, rlim: *const rlimit) c_int; | 354 | pub extern "c" fn setrlimit(resource: c.rlimit_resource, rlim: *const c.rlimit) c_int; |
| 431 | 355 | ||
| 432 | pub extern "c" fn fmemopen(noalias buf: ?*c_void, size: usize, noalias mode: [*:0]const u8) ?*FILE; | 356 | pub extern "c" fn fmemopen(noalias buf: ?*c_void, size: usize, noalias mode: [*:0]const u8) ?*FILE; |
| 433 | 357 |
lib/std/c/darwin.zig+117-167| ... | @@ -4,6 +4,7 @@ const builtin = @import("builtin"); | ... | @@ -4,6 +4,7 @@ const builtin = @import("builtin"); |
| 4 | const macho = std.macho; | 4 | const macho = std.macho; |
| 5 | const native_arch = builtin.target.cpu.arch; | 5 | const native_arch = builtin.target.cpu.arch; |
| 6 | const maxInt = std.math.maxInt; | 6 | const maxInt = std.math.maxInt; |
| 7 | const iovec_const = std.os.iovec_const; | ||
| 7 | 8 | ||
| 8 | extern "c" fn __error() *c_int; | 9 | extern "c" fn __error() *c_int; |
| 9 | pub extern "c" fn NSVersionOfRunTimeLibrary(library_name: [*:0]const u8) u32; | 10 | pub extern "c" fn NSVersionOfRunTimeLibrary(library_name: [*:0]const u8) u32; |
| ... | @@ -84,8 +85,6 @@ pub const _errno = __error; | ... | @@ -84,8 +85,6 @@ pub const _errno = __error; |
| 84 | pub extern "c" fn @"close$NOCANCEL"(fd: fd_t) c_int; | 85 | pub extern "c" fn @"close$NOCANCEL"(fd: fd_t) c_int; |
| 85 | pub extern "c" fn mach_host_self() mach_port_t; | 86 | pub extern "c" fn mach_host_self() mach_port_t; |
| 86 | pub extern "c" fn clock_get_time(clock_serv: clock_serv_t, cur_time: *mach_timespec_t) kern_return_t; | 87 | pub extern "c" fn clock_get_time(clock_serv: clock_serv_t, cur_time: *mach_timespec_t) kern_return_t; |
| 87 | pub extern "c" fn host_get_clock_service(host: host_t, clock_id: clock_id_t, clock_serv: ?[*]clock_serv_t) kern_return_t; | ||
| 88 | pub extern "c" fn mach_port_deallocate(task: ipc_space_t, name: mach_port_name_t) kern_return_t; | ||
| 89 | 88 | ||
| 90 | pub const sf_hdtr = extern struct { | 89 | pub const sf_hdtr = extern struct { |
| 91 | headers: [*]const iovec_const, | 90 | headers: [*]const iovec_const, |
| ... | @@ -1550,19 +1549,17 @@ pub fn S_IWHT(m: u32) bool { | ... | @@ -1550,19 +1549,17 @@ pub fn S_IWHT(m: u32) bool { |
| 1550 | 1549 | ||
| 1551 | pub const HOST_NAME_MAX = 72; | 1550 | pub const HOST_NAME_MAX = 72; |
| 1552 | 1551 | ||
| 1553 | pub const AT_FDCWD = -2; | 1552 | pub const AT = struct { |
| 1554 | 1553 | pub const FDCWD = -2; | |
| 1555 | /// Use effective ids in access check | 1554 | /// Use effective ids in access check |
| 1556 | pub const AT_EACCESS = 0x0010; | 1555 | pub const EACCESS = 0x0010; |
| 1557 | 1556 | /// Act on the symlink itself not the target | |
| 1558 | /// Act on the symlink itself not the target | 1557 | pub const SYMLINK_NOFOLLOW = 0x0020; |
| 1559 | pub const AT_SYMLINK_NOFOLLOW = 0x0020; | 1558 | /// Act on target of symlink |
| 1560 | 1559 | pub const SYMLINK_FOLLOW = 0x0040; | |
| 1561 | /// Act on target of symlink | 1560 | /// Path refers to directory |
| 1562 | pub const AT_SYMLINK_FOLLOW = 0x0040; | 1561 | pub const REMOVEDIR = 0x0080; |
| 1563 | 1562 | }; | |
| 1564 | /// Path refers to directory | ||
| 1565 | pub const AT_REMOVEDIR = 0x0080; | ||
| 1566 | 1563 | ||
| 1567 | pub const addrinfo = extern struct { | 1564 | pub const addrinfo = extern struct { |
| 1568 | flags: i32, | 1565 | flags: i32, |
| ... | @@ -1590,164 +1587,117 @@ pub const RTLD = struct { | ... | @@ -1590,164 +1587,117 @@ pub const RTLD = struct { |
| 1590 | pub const MAIN_ONLY = @intToPtr(*c_void, @bitCast(usize, @as(isize, -5))); | 1587 | pub const MAIN_ONLY = @intToPtr(*c_void, @bitCast(usize, @as(isize, -5))); |
| 1591 | }; | 1588 | }; |
| 1592 | 1589 | ||
| 1593 | /// duplicate file descriptor | 1590 | pub const F = struct { |
| 1594 | pub const F_DUPFD = 0; | 1591 | /// duplicate file descriptor |
| 1595 | 1592 | pub const DUPFD = 0; | |
| 1596 | /// get file descriptor flags | 1593 | /// get file descriptor flags |
| 1597 | pub const F_GETFD = 1; | 1594 | pub const GETFD = 1; |
| 1598 | 1595 | /// set file descriptor flags | |
| 1599 | /// set file descriptor flags | 1596 | pub const SETFD = 2; |
| 1600 | pub const F_SETFD = 2; | 1597 | /// get file status flags |
| 1601 | 1598 | pub const GETFL = 3; | |
| 1602 | /// get file status flags | 1599 | /// set file status flags |
| 1603 | pub const F_GETFL = 3; | 1600 | pub const SETFL = 4; |
| 1604 | 1601 | /// get SIGIO/SIGURG proc/pgrp | |
| 1605 | /// set file status flags | 1602 | pub const GETOWN = 5; |
| 1606 | pub const F_SETFL = 4; | 1603 | /// set SIGIO/SIGURG proc/pgrp |
| 1607 | 1604 | pub const SETOWN = 6; | |
| 1608 | /// get SIGIO/SIGURG proc/pgrp | 1605 | /// get record locking information |
| 1609 | pub const F_GETOWN = 5; | 1606 | pub const GETLK = 7; |
| 1610 | 1607 | /// set record locking information | |
| 1611 | /// set SIGIO/SIGURG proc/pgrp | 1608 | pub const SETLK = 8; |
| 1612 | pub const F_SETOWN = 6; | 1609 | /// F.SETLK; wait if blocked |
| 1613 | 1610 | pub const SETLKW = 9; | |
| 1614 | /// get record locking information | 1611 | /// F.SETLK; wait if blocked, return on timeout |
| 1615 | pub const F_GETLK = 7; | 1612 | pub const SETLKWTIMEOUT = 10; |
| 1616 | 1613 | pub const FLUSH_DATA = 40; | |
| 1617 | /// set record locking information | 1614 | /// Used for regression test |
| 1618 | pub const F_SETLK = 8; | 1615 | pub const CHKCLEAN = 41; |
| 1619 | 1616 | /// Preallocate storage | |
| 1620 | /// F_SETLK; wait if blocked | 1617 | pub const PREALLOCATE = 42; |
| 1621 | pub const F_SETLKW = 9; | 1618 | /// Truncate a file without zeroing space |
| 1622 | 1619 | pub const SETSIZE = 43; | |
| 1623 | /// F_SETLK; wait if blocked, return on timeout | 1620 | /// Issue an advisory read async with no copy to user |
| 1624 | pub const F_SETLKWTIMEOUT = 10; | 1621 | pub const RDADVISE = 44; |
| 1625 | pub const F_FLUSH_DATA = 40; | 1622 | /// turn read ahead off/on for this fd |
| 1626 | 1623 | pub const RDAHEAD = 45; | |
| 1627 | /// Used for regression test | 1624 | /// turn data caching off/on for this fd |
| 1628 | pub const F_CHKCLEAN = 41; | 1625 | pub const NOCACHE = 48; |
| 1629 | 1626 | /// file offset to device offset | |
| 1630 | /// Preallocate storage | 1627 | pub const LOG2PHYS = 49; |
| 1631 | pub const F_PREALLOCATE = 42; | 1628 | /// return the full path of the fd |
| 1632 | 1629 | pub const GETPATH = 50; | |
| 1633 | /// Truncate a file without zeroing space | 1630 | /// fsync + ask the drive to flush to the media |
| 1634 | pub const F_SETSIZE = 43; | 1631 | pub const FULLFSYNC = 51; |
| 1635 | 1632 | /// find which component (if any) is a package | |
| 1636 | /// Issue an advisory read async with no copy to user | 1633 | pub const PATHPKG_CHECK = 52; |
| 1637 | pub const F_RDADVISE = 44; | 1634 | /// "freeze" all fs operations |
| 1638 | 1635 | pub const FREEZE_FS = 53; | |
| 1639 | /// turn read ahead off/on for this fd | 1636 | /// "thaw" all fs operations |
| 1640 | pub const F_RDAHEAD = 45; | 1637 | pub const THAW_FS = 54; |
| 1641 | 1638 | /// turn data caching off/on (globally) for this file | |
| 1642 | /// turn data caching off/on for this fd | 1639 | pub const GLOBAL_NOCACHE = 55; |
| 1643 | pub const F_NOCACHE = 48; | 1640 | /// add detached signatures |
| 1644 | 1641 | pub const ADDSIGS = 59; | |
| 1645 | /// file offset to device offset | 1642 | /// add signature from same file (used by dyld for shared libs) |
| 1646 | pub const F_LOG2PHYS = 49; | 1643 | pub const ADDFILESIGS = 61; |
| 1647 | 1644 | /// used in conjunction with F.NOCACHE to indicate that DIRECT, synchonous writes | |
| 1648 | /// return the full path of the fd | 1645 | /// should not be used (i.e. its ok to temporaily create cached pages) |
| 1649 | pub const F_GETPATH = 50; | 1646 | pub const NODIRECT = 62; |
| 1650 | 1647 | ///Get the protection class of a file from the EA, returns int | |
| 1651 | /// fsync + ask the drive to flush to the media | 1648 | pub const GETPROTECTIONCLASS = 63; |
| 1652 | pub const F_FULLFSYNC = 51; | 1649 | ///Set the protection class of a file for the EA, requires int |
| 1653 | 1650 | pub const SETPROTECTIONCLASS = 64; | |
| 1654 | /// find which component (if any) is a package | 1651 | ///file offset to device offset, extended |
| 1655 | pub const F_PATHPKG_CHECK = 52; | 1652 | pub const LOG2PHYS_EXT = 65; |
| 1656 | 1653 | ///get record locking information, per-process | |
| 1657 | /// "freeze" all fs operations | 1654 | pub const GETLKPID = 66; |
| 1658 | pub const F_FREEZE_FS = 53; | 1655 | ///Mark the file as being the backing store for another filesystem |
| 1659 | 1656 | pub const SETBACKINGSTORE = 70; | |
| 1660 | /// "thaw" all fs operations | 1657 | ///return the full path of the FD, but error in specific mtmd circumstances |
| 1661 | pub const F_THAW_FS = 54; | 1658 | pub const GETPATH_MTMINFO = 71; |
| 1662 | 1659 | ///Returns the code directory, with associated hashes, to the caller | |
| 1663 | /// turn data caching off/on (globally) for this file | 1660 | pub const GETCODEDIR = 72; |
| 1664 | pub const F_GLOBAL_NOCACHE = 55; | 1661 | ///No SIGPIPE generated on EPIPE |
| 1665 | 1662 | pub const SETNOSIGPIPE = 73; | |
| 1666 | /// add detached signatures | 1663 | ///Status of SIGPIPE for this fd |
| 1667 | pub const F_ADDSIGS = 59; | 1664 | pub const GETNOSIGPIPE = 74; |
| 1668 | 1665 | ///For some cases, we need to rewrap the key for AKS/MKB | |
| 1669 | /// add signature from same file (used by dyld for shared libs) | 1666 | pub const TRANSCODEKEY = 75; |
| 1670 | pub const F_ADDFILESIGS = 61; | 1667 | ///file being written to a by single writer... if throttling enabled, writes |
| 1671 | 1668 | ///may be broken into smaller chunks with throttling in between | |
| 1672 | /// used in conjunction with F_NOCACHE to indicate that DIRECT, synchonous writes | 1669 | pub const SINGLE_WRITER = 76; |
| 1673 | /// should not be used (i.e. its ok to temporaily create cached pages) | 1670 | ///Get the protection version number for this filesystem |
| 1674 | pub const F_NODIRECT = 62; | 1671 | pub const GETPROTECTIONLEVEL = 77; |
| 1675 | 1672 | ///Add detached code signatures (used by dyld for shared libs) | |
| 1676 | ///Get the protection class of a file from the EA, returns int | 1673 | pub const FINDSIGS = 78; |
| 1677 | pub const F_GETPROTECTIONCLASS = 63; | 1674 | ///Add signature from same file, only if it is signed by Apple (used by dyld for simulator) |
| 1678 | 1675 | pub const ADDFILESIGS_FOR_DYLD_SIM = 83; | |
| 1679 | ///Set the protection class of a file for the EA, requires int | 1676 | ///fsync + issue barrier to drive |
| 1680 | pub const F_SETPROTECTIONCLASS = 64; | 1677 | pub const BARRIERFSYNC = 85; |
| 1681 | 1678 | ///Add signature from same file, return end offset in structure on success | |
| 1682 | ///file offset to device offset, extended | 1679 | pub const ADDFILESIGS_RETURN = 97; |
| 1683 | pub const F_LOG2PHYS_EXT = 65; | 1680 | ///Check if Library Validation allows this Mach-O file to be mapped into the calling process |
| 1684 | 1681 | pub const CHECK_LV = 98; | |
| 1685 | ///get record locking information, per-process | 1682 | ///Deallocate a range of the file |
| 1686 | pub const F_GETLKPID = 66; | 1683 | pub const PUNCHHOLE = 99; |
| 1687 | 1684 | ///Trim an active file | |
| 1688 | ///Mark the file as being the backing store for another filesystem | 1685 | pub const TRIM_ACTIVE_FILE = 100; |
| 1689 | pub const F_SETBACKINGSTORE = 70; | 1686 | ///mark the dup with FD_CLOEXEC |
| 1690 | 1687 | pub const DUPFD_CLOEXEC = 67; | |
| 1691 | ///return the full path of the FD, but error in specific mtmd circumstances | 1688 | /// shared or read lock |
| 1692 | pub const F_GETPATH_MTMINFO = 71; | 1689 | pub const RDLCK = 1; |
| 1693 | 1690 | /// unlock | |
| 1694 | ///Returns the code directory, with associated hashes, to the caller | 1691 | pub const UNLCK = 2; |
| 1695 | pub const F_GETCODEDIR = 72; | 1692 | /// exclusive or write lock |
| 1696 | 1693 | pub const WRLCK = 3; | |
| 1697 | ///No SIGPIPE generated on EPIPE | 1694 | }; |
| 1698 | pub const F_SETNOSIGPIPE = 73; | ||
| 1699 | |||
| 1700 | ///Status of SIGPIPE for this fd | ||
| 1701 | pub const F_GETNOSIGPIPE = 74; | ||
| 1702 | |||
| 1703 | ///For some cases, we need to rewrap the key for AKS/MKB | ||
| 1704 | pub const F_TRANSCODEKEY = 75; | ||
| 1705 | |||
| 1706 | ///file being written to a by single writer... if throttling enabled, writes | ||
| 1707 | ///may be broken into smaller chunks with throttling in between | ||
| 1708 | pub const F_SINGLE_WRITER = 76; | ||
| 1709 | |||
| 1710 | ///Get the protection version number for this filesystem | ||
| 1711 | pub const F_GETPROTECTIONLEVEL = 77; | ||
| 1712 | |||
| 1713 | ///Add detached code signatures (used by dyld for shared libs) | ||
| 1714 | pub const F_FINDSIGS = 78; | ||
| 1715 | |||
| 1716 | ///Add signature from same file, only if it is signed by Apple (used by dyld for simulator) | ||
| 1717 | pub const F_ADDFILESIGS_FOR_DYLD_SIM = 83; | ||
| 1718 | |||
| 1719 | ///fsync + issue barrier to drive | ||
| 1720 | pub const F_BARRIERFSYNC = 85; | ||
| 1721 | |||
| 1722 | ///Add signature from same file, return end offset in structure on success | ||
| 1723 | pub const F_ADDFILESIGS_RETURN = 97; | ||
| 1724 | |||
| 1725 | ///Check if Library Validation allows this Mach-O file to be mapped into the calling process | ||
| 1726 | pub const F_CHECK_LV = 98; | ||
| 1727 | |||
| 1728 | ///Deallocate a range of the file | ||
| 1729 | pub const F_PUNCHHOLE = 99; | ||
| 1730 | |||
| 1731 | ///Trim an active file | ||
| 1732 | pub const F_TRIM_ACTIVE_FILE = 100; | ||
| 1733 | 1695 | ||
| 1734 | pub const FCNTL_FS_SPECIFIC_BASE = 0x00010000; | 1696 | pub const FCNTL_FS_SPECIFIC_BASE = 0x00010000; |
| 1735 | 1697 | ||
| 1736 | ///mark the dup with FD_CLOEXEC | ||
| 1737 | pub const F_DUPFD_CLOEXEC = 67; | ||
| 1738 | |||
| 1739 | ///close-on-exec flag | 1698 | ///close-on-exec flag |
| 1740 | pub const FD_CLOEXEC = 1; | 1699 | pub const FD_CLOEXEC = 1; |
| 1741 | 1700 | ||
| 1742 | /// shared or read lock | ||
| 1743 | pub const F_RDLCK = 1; | ||
| 1744 | |||
| 1745 | /// unlock | ||
| 1746 | pub const F_UNLCK = 2; | ||
| 1747 | |||
| 1748 | /// exclusive or write lock | ||
| 1749 | pub const F_WRLCK = 3; | ||
| 1750 | |||
| 1751 | pub const LOCK = struct { | 1701 | pub const LOCK = struct { |
| 1752 | pub const SH = 1; | 1702 | pub const SH = 1; |
| 1753 | pub const EX = 2; | 1703 | pub const EX = 2; |
lib/std/c/dragonfly.zig+32-27| ... | @@ -1,5 +1,6 @@ | ... | @@ -1,5 +1,6 @@ |
| 1 | const std = @import("../std.zig"); | 1 | const std = @import("../std.zig"); |
| 2 | const maxInt = std.math.maxInt; | 2 | const maxInt = std.math.maxInt; |
| 3 | const iovec = std.os.iovec; | ||
| 3 | 4 | ||
| 4 | extern "c" threadlocal var errno: c_int; | 5 | extern "c" threadlocal var errno: c_int; |
| 5 | pub fn _errno() *c_int { | 6 | pub fn _errno() *c_int { |
| ... | @@ -353,18 +354,39 @@ pub const SEEK_END = 2; | ... | @@ -353,18 +354,39 @@ pub const SEEK_END = 2; |
| 353 | pub const SEEK_DATA = 3; | 354 | pub const SEEK_DATA = 3; |
| 354 | pub const SEEK_HOLE = 4; | 355 | pub const SEEK_HOLE = 4; |
| 355 | 356 | ||
| 356 | pub const F_ULOCK = 0; | 357 | pub const F = struct { |
| 357 | pub const F_LOCK = 1; | 358 | pub const ULOCK = 0; |
| 358 | pub const F_TLOCK = 2; | 359 | pub const LOCK = 1; |
| 359 | pub const F_TEST = 3; | 360 | pub const TLOCK = 2; |
| 361 | pub const TEST = 3; | ||
| 362 | |||
| 363 | pub const DUPFD = 0; | ||
| 364 | pub const GETFD = 1; | ||
| 365 | pub const RDLCK = 1; | ||
| 366 | pub const SETFD = 2; | ||
| 367 | pub const UNLCK = 2; | ||
| 368 | pub const WRLCK = 3; | ||
| 369 | pub const GETFL = 3; | ||
| 370 | pub const SETFL = 4; | ||
| 371 | pub const GETOWN = 5; | ||
| 372 | pub const SETOWN = 6; | ||
| 373 | pub const GETLK = 7; | ||
| 374 | pub const SETLK = 8; | ||
| 375 | pub const SETLKW = 9; | ||
| 376 | pub const DUP2FD = 10; | ||
| 377 | pub const DUPFD_CLOEXEC = 17; | ||
| 378 | pub const DUP2FD_CLOEXEC = 18; | ||
| 379 | }; | ||
| 360 | 380 | ||
| 361 | pub const FD_CLOEXEC = 1; | 381 | pub const FD_CLOEXEC = 1; |
| 362 | 382 | ||
| 363 | pub const AT_FDCWD = -328243; | 383 | pub const AT = struct { |
| 364 | pub const AT_SYMLINK_NOFOLLOW = 1; | 384 | pub const FDCWD = -328243; |
| 365 | pub const AT_REMOVEDIR = 2; | 385 | pub const SYMLINK_NOFOLLOW = 1; |
| 366 | pub const AT_EACCESS = 4; | 386 | pub const REMOVEDIR = 2; |
| 367 | pub const AT_SYMLINK_FOLLOW = 8; | 387 | pub const EACCESS = 4; |
| 388 | pub const SYMLINK_FOLLOW = 8; | ||
| 389 | }; | ||
| 368 | 390 | ||
| 369 | pub fn WEXITSTATUS(s: u32) u8 { | 391 | pub fn WEXITSTATUS(s: u32) u8 { |
| 370 | return @intCast(u8, (s & 0xff00) >> 8); | 392 | return @intCast(u8, (s & 0xff00) >> 8); |
| ... | @@ -715,7 +737,7 @@ pub const PF = struct { | ... | @@ -715,7 +737,7 @@ pub const PF = struct { |
| 715 | pub const ISDN = AF.ISDN; | 737 | pub const ISDN = AF.ISDN; |
| 716 | pub const RTIP = AF.pseudo_RTIP; | 738 | pub const RTIP = AF.pseudo_RTIP; |
| 717 | pub const LAT = AF.LAT; | 739 | pub const LAT = AF.LAT; |
| 718 | pub const UNIX = PF_LOCAL; | 740 | pub const UNIX = PF.LOCAL; |
| 719 | pub const XTP = AF.pseudo_XTP; | 741 | pub const XTP = AF.pseudo_XTP; |
| 720 | pub const DECnet = AF.DECnet; | 742 | pub const DECnet = AF.DECnet; |
| 721 | }; | 743 | }; |
| ... | @@ -868,23 +890,6 @@ pub const MADV = struct { | ... | @@ -868,23 +890,6 @@ pub const MADV = struct { |
| 868 | pub const SETMAP = 11; | 890 | pub const SETMAP = 11; |
| 869 | }; | 891 | }; |
| 870 | 892 | ||
| 871 | pub const F_DUPFD = 0; | ||
| 872 | pub const F_GETFD = 1; | ||
| 873 | pub const F_RDLCK = 1; | ||
| 874 | pub const F_SETFD = 2; | ||
| 875 | pub const F_UNLCK = 2; | ||
| 876 | pub const F_WRLCK = 3; | ||
| 877 | pub const F_GETFL = 3; | ||
| 878 | pub const F_SETFL = 4; | ||
| 879 | pub const F_GETOWN = 5; | ||
| 880 | pub const F_SETOWN = 6; | ||
| 881 | pub const F_GETLK = 7; | ||
| 882 | pub const F_SETLK = 8; | ||
| 883 | pub const F_SETLKW = 9; | ||
| 884 | pub const F_DUP2FD = 10; | ||
| 885 | pub const F_DUPFD_CLOEXEC = 17; | ||
| 886 | pub const F_DUP2FD_CLOEXEC = 18; | ||
| 887 | |||
| 888 | pub const LOCK = struct { | 893 | pub const LOCK = struct { |
| 889 | pub const SH = 1; | 894 | pub const SH = 1; |
| 890 | pub const EX = 2; | 895 | pub const EX = 2; |
lib/std/c/freebsd.zig+134-129| ... | @@ -1,5 +1,8 @@ | ... | @@ -1,5 +1,8 @@ |
| 1 | const std = @import("../std.zig"); | 1 | const std = @import("../std.zig"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | const maxInt = std.math.maxInt; | 3 | const maxInt = std.math.maxInt; |
| 4 | const iovec = std.os.iovec; | ||
| 5 | const iovec_const = std.os.iovec_const; | ||
| 3 | 6 | ||
| 4 | extern "c" fn __error() *c_int; | 7 | extern "c" fn __error() *c_int; |
| 5 | pub const _errno = __error; | 8 | pub const _errno = __error; |
| ... | @@ -400,60 +403,100 @@ pub const MAP = struct { | ... | @@ -400,60 +403,100 @@ pub const MAP = struct { |
| 400 | pub const @"32BIT" = 0x00080000; | 403 | pub const @"32BIT" = 0x00080000; |
| 401 | }; | 404 | }; |
| 402 | 405 | ||
| 403 | pub const WNOHANG = 1; | 406 | pub const W = struct { |
| 404 | pub const WUNTRACED = 2; | 407 | pub const NOHANG = 1; |
| 405 | pub const WSTOPPED = WUNTRACED; | 408 | pub const UNTRACED = 2; |
| 406 | pub const WCONTINUED = 4; | 409 | pub const STOPPED = UNTRACED; |
| 407 | pub const WNOWAIT = 8; | 410 | pub const CONTINUED = 4; |
| 408 | pub const WEXITED = 16; | 411 | pub const NOWAIT = 8; |
| 409 | pub const WTRAPPED = 32; | 412 | pub const EXITED = 16; |
| 410 | 413 | pub const TRAPPED = 32; | |
| 411 | pub const SA_ONSTACK = 0x0001; | 414 | }; |
| 412 | pub const SA_RESTART = 0x0002; | 415 | |
| 413 | pub const SA_RESETHAND = 0x0004; | 416 | pub const SA = struct { |
| 414 | pub const SA_NOCLDSTOP = 0x0008; | 417 | pub const ONSTACK = 0x0001; |
| 415 | pub const SA_NODEFER = 0x0010; | 418 | pub const RESTART = 0x0002; |
| 416 | pub const SA_NOCLDWAIT = 0x0020; | 419 | pub const RESETHAND = 0x0004; |
| 417 | pub const SA_SIGINFO = 0x0040; | 420 | pub const NOCLDSTOP = 0x0008; |
| 418 | 421 | pub const NODEFER = 0x0010; | |
| 419 | pub const SIGHUP = 1; | 422 | pub const NOCLDWAIT = 0x0020; |
| 420 | pub const SIGINT = 2; | 423 | pub const SIGINFO = 0x0040; |
| 421 | pub const SIGQUIT = 3; | 424 | }; |
| 422 | pub const SIGILL = 4; | 425 | |
| 423 | pub const SIGTRAP = 5; | 426 | pub const SIG = struct { |
| 424 | pub const SIGABRT = 6; | 427 | pub const HUP = 1; |
| 425 | pub const SIGIOT = SIGABRT; | 428 | pub const INT = 2; |
| 426 | pub const SIGEMT = 7; | 429 | pub const QUIT = 3; |
| 427 | pub const SIGFPE = 8; | 430 | pub const ILL = 4; |
| 428 | pub const SIGKILL = 9; | 431 | pub const TRAP = 5; |
| 429 | pub const SIGBUS = 10; | 432 | pub const ABRT = 6; |
| 430 | pub const SIGSEGV = 11; | 433 | pub const IOT = ABRT; |
| 431 | pub const SIGSYS = 12; | 434 | pub const EMT = 7; |
| 432 | pub const SIGPIPE = 13; | 435 | pub const FPE = 8; |
| 433 | pub const SIGALRM = 14; | 436 | pub const KILL = 9; |
| 434 | pub const SIGTERM = 15; | 437 | pub const BUS = 10; |
| 435 | pub const SIGURG = 16; | 438 | pub const SEGV = 11; |
| 436 | pub const SIGSTOP = 17; | 439 | pub const SYS = 12; |
| 437 | pub const SIGTSTP = 18; | 440 | pub const PIPE = 13; |
| 438 | pub const SIGCONT = 19; | 441 | pub const ALRM = 14; |
| 439 | pub const SIGCHLD = 20; | 442 | pub const TERM = 15; |
| 440 | pub const SIGTTIN = 21; | 443 | pub const URG = 16; |
| 441 | pub const SIGTTOU = 22; | 444 | pub const STOP = 17; |
| 442 | pub const SIGIO = 23; | 445 | pub const TSTP = 18; |
| 443 | pub const SIGXCPU = 24; | 446 | pub const CONT = 19; |
| 444 | pub const SIGXFSZ = 25; | 447 | pub const CHLD = 20; |
| 445 | pub const SIGVTALRM = 26; | 448 | pub const TTIN = 21; |
| 446 | pub const SIGPROF = 27; | 449 | pub const TTOU = 22; |
| 447 | pub const SIGWINCH = 28; | 450 | pub const IO = 23; |
| 448 | pub const SIGINFO = 29; | 451 | pub const XCPU = 24; |
| 449 | pub const SIGUSR1 = 30; | 452 | pub const XFSZ = 25; |
| 450 | pub const SIGUSR2 = 31; | 453 | pub const VTALRM = 26; |
| 451 | pub const SIGTHR = 32; | 454 | pub const PROF = 27; |
| 452 | pub const SIGLWP = SIGTHR; | 455 | pub const WINCH = 28; |
| 453 | pub const SIGLIBRT = 33; | 456 | pub const INFO = 29; |
| 454 | 457 | pub const USR1 = 30; | |
| 455 | pub const SIGRTMIN = 65; | 458 | pub const USR2 = 31; |
| 456 | pub const SIGRTMAX = 126; | 459 | pub const THR = 32; |
| 460 | pub const LWP = THR; | ||
| 461 | pub const LIBRT = 33; | ||
| 462 | |||
| 463 | pub const RTMIN = 65; | ||
| 464 | pub const RTMAX = 126; | ||
| 465 | |||
| 466 | pub const BLOCK = 1; | ||
| 467 | pub const UNBLOCK = 2; | ||
| 468 | pub const SETMASK = 3; | ||
| 469 | |||
| 470 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | ||
| 471 | pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); | ||
| 472 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | ||
| 473 | |||
| 474 | pub const WORDS = 4; | ||
| 475 | pub const MAXSIG = 128; | ||
| 476 | |||
| 477 | pub inline fn IDX(sig: usize) usize { | ||
| 478 | return sig - 1; | ||
| 479 | } | ||
| 480 | pub inline fn WORD(sig: usize) usize { | ||
| 481 | return IDX(sig) >> 5; | ||
| 482 | } | ||
| 483 | pub inline fn BIT(sig: usize) usize { | ||
| 484 | return 1 << (IDX(sig) & 31); | ||
| 485 | } | ||
| 486 | pub inline fn VALID(sig: usize) usize { | ||
| 487 | return sig <= MAXSIG and sig > 0; | ||
| 488 | } | ||
| 489 | }; | ||
| 490 | pub const sigval = extern union { | ||
| 491 | int: c_int, | ||
| 492 | ptr: ?*c_void, | ||
| 493 | }; | ||
| 494 | |||
| 495 | pub const sigset_t = extern struct { | ||
| 496 | __bits: [SIG.WORDS]u32, | ||
| 497 | }; | ||
| 498 | |||
| 499 | pub const empty_sigset = sigset_t{ .__bits = [_]u32{0} ** SIG.WORDS }; | ||
| 457 | 500 | ||
| 458 | // access function | 501 | // access function |
| 459 | pub const F_OK = 0; // test for existence of file | 502 | pub const F_OK = 0; // test for existence of file |
| ... | @@ -489,22 +532,29 @@ pub const O_PATH = 0o10000000; | ... | @@ -489,22 +532,29 @@ pub const O_PATH = 0o10000000; |
| 489 | pub const O_TMPFILE = 0o20200000; | 532 | pub const O_TMPFILE = 0o20200000; |
| 490 | pub const O_NDELAY = O_NONBLOCK; | 533 | pub const O_NDELAY = O_NONBLOCK; |
| 491 | 534 | ||
| 492 | pub const F_DUPFD = 0; | 535 | pub const F = struct { |
| 493 | pub const F_GETFD = 1; | 536 | pub const DUPFD = 0; |
| 494 | pub const F_SETFD = 2; | 537 | pub const GETFD = 1; |
| 495 | pub const F_GETFL = 3; | 538 | pub const SETFD = 2; |
| 496 | pub const F_SETFL = 4; | 539 | pub const GETFL = 3; |
| 540 | pub const SETFL = 4; | ||
| 541 | |||
| 542 | pub const GETOWN = 5; | ||
| 543 | pub const SETOWN = 6; | ||
| 497 | 544 | ||
| 498 | pub const F_GETOWN = 5; | 545 | pub const GETLK = 11; |
| 499 | pub const F_SETOWN = 6; | 546 | pub const SETLK = 12; |
| 547 | pub const SETLKW = 13; | ||
| 500 | 548 | ||
| 501 | pub const F_GETLK = 11; | 549 | pub const RDLCK = 1; |
| 502 | pub const F_SETLK = 12; | 550 | pub const WRLCK = 3; |
| 503 | pub const F_SETLKW = 13; | 551 | pub const UNLCK = 2; |
| 504 | 552 | ||
| 505 | pub const F_RDLCK = 1; | 553 | pub const SETOWN_EX = 15; |
| 506 | pub const F_WRLCK = 3; | 554 | pub const GETOWN_EX = 16; |
| 507 | pub const F_UNLCK = 2; | 555 | |
| 556 | pub const GETOWNER_UIDS = 17; | ||
| 557 | }; | ||
| 508 | 558 | ||
| 509 | pub const LOCK = struct { | 559 | pub const LOCK = struct { |
| 510 | pub const SH = 1; | 560 | pub const SH = 1; |
| ... | @@ -513,21 +563,12 @@ pub const LOCK = struct { | ... | @@ -513,21 +563,12 @@ pub const LOCK = struct { |
| 513 | pub const NB = 4; | 563 | pub const NB = 4; |
| 514 | }; | 564 | }; |
| 515 | 565 | ||
| 516 | pub const F_SETOWN_EX = 15; | ||
| 517 | pub const F_GETOWN_EX = 16; | ||
| 518 | |||
| 519 | pub const F_GETOWNER_UIDS = 17; | ||
| 520 | |||
| 521 | pub const FD_CLOEXEC = 1; | 566 | pub const FD_CLOEXEC = 1; |
| 522 | 567 | ||
| 523 | pub const SEEK_SET = 0; | 568 | pub const SEEK_SET = 0; |
| 524 | pub const SEEK_CUR = 1; | 569 | pub const SEEK_CUR = 1; |
| 525 | pub const SEEK_END = 2; | 570 | pub const SEEK_END = 2; |
| 526 | 571 | ||
| 527 | pub const SIG_BLOCK = 1; | ||
| 528 | pub const SIG_UNBLOCK = 2; | ||
| 529 | pub const SIG_SETMASK = 3; | ||
| 530 | |||
| 531 | pub const SOCK = struct { | 572 | pub const SOCK = struct { |
| 532 | pub const STREAM = 1; | 573 | pub const STREAM = 1; |
| 533 | pub const DGRAM = 2; | 574 | pub const DGRAM = 2; |
| ... | @@ -890,10 +931,6 @@ pub const winsize = extern struct { | ... | @@ -890,10 +931,6 @@ pub const winsize = extern struct { |
| 890 | 931 | ||
| 891 | const NSIG = 32; | 932 | const NSIG = 32; |
| 892 | 933 | ||
| 893 | pub const SIG_DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | ||
| 894 | pub const SIG_IGN = @intToPtr(?Sigaction.sigaction_fn, 1); | ||
| 895 | pub const SIG_ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | ||
| 896 | |||
| 897 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. | 934 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. |
| 898 | pub const Sigaction = extern struct { | 935 | pub const Sigaction = extern struct { |
| 899 | pub const handler_fn = fn (c_int) callconv(.C) void; | 936 | pub const handler_fn = fn (c_int) callconv(.C) void; |
| ... | @@ -942,34 +979,7 @@ pub const siginfo_t = extern struct { | ... | @@ -942,34 +979,7 @@ pub const siginfo_t = extern struct { |
| 942 | }, | 979 | }, |
| 943 | }; | 980 | }; |
| 944 | 981 | ||
| 945 | pub const sigval = extern union { | 982 | pub usingnamespace switch (builtin.cpu.arch) { |
| 946 | int: c_int, | ||
| 947 | ptr: ?*c_void, | ||
| 948 | }; | ||
| 949 | |||
| 950 | pub const _SIG_WORDS = 4; | ||
| 951 | pub const _SIG_MAXSIG = 128; | ||
| 952 | |||
| 953 | pub inline fn _SIG_IDX(sig: usize) usize { | ||
| 954 | return sig - 1; | ||
| 955 | } | ||
| 956 | pub inline fn _SIG_WORD(sig: usize) usize { | ||
| 957 | return_SIG_IDX(sig) >> 5; | ||
| 958 | } | ||
| 959 | pub inline fn _SIG_BIT(sig: usize) usize { | ||
| 960 | return 1 << (_SIG_IDX(sig) & 31); | ||
| 961 | } | ||
| 962 | pub inline fn _SIG_VALID(sig: usize) usize { | ||
| 963 | return sig <= _SIG_MAXSIG and sig > 0; | ||
| 964 | } | ||
| 965 | |||
| 966 | pub const sigset_t = extern struct { | ||
| 967 | __bits: [_SIG_WORDS]u32, | ||
| 968 | }; | ||
| 969 | |||
| 970 | pub const empty_sigset = sigset_t{ .__bits = [_]u32{0} ** _SIG_WORDS }; | ||
| 971 | |||
| 972 | const arch_bits = switch (builtin.cpu.arch) { | ||
| 973 | .x86_64 => struct { | 983 | .x86_64 => struct { |
| 974 | pub const ucontext_t = extern struct { | 984 | pub const ucontext_t = extern struct { |
| 975 | sigmask: sigset_t, | 985 | sigmask: sigset_t, |
| ... | @@ -1015,8 +1025,6 @@ const arch_bits = switch (builtin.cpu.arch) { | ... | @@ -1015,8 +1025,6 @@ const arch_bits = switch (builtin.cpu.arch) { |
| 1015 | }, | 1025 | }, |
| 1016 | else => struct {}, | 1026 | else => struct {}, |
| 1017 | }; | 1027 | }; |
| 1018 | pub const ucontext_t = arch_bits.ucontext_t; | ||
| 1019 | pub const mcontext_t = arch_bits.mcontext_t; | ||
| 1020 | 1028 | ||
| 1021 | pub const E = enum(u16) { | 1029 | pub const E = enum(u16) { |
| 1022 | /// No error occurred. | 1030 | /// No error occurred. |
| ... | @@ -1224,22 +1232,22 @@ pub fn S_IWHT(m: u32) bool { | ... | @@ -1224,22 +1232,22 @@ pub fn S_IWHT(m: u32) bool { |
| 1224 | 1232 | ||
| 1225 | pub const HOST_NAME_MAX = 255; | 1233 | pub const HOST_NAME_MAX = 255; |
| 1226 | 1234 | ||
| 1227 | /// Magic value that specify the use of the current working directory | 1235 | pub const AT = struct { |
| 1228 | /// to determine the target of relative file paths in the openat() and | 1236 | /// Magic value that specify the use of the current working directory |
| 1229 | /// similar syscalls. | 1237 | /// to determine the target of relative file paths in the openat() and |
| 1230 | pub const AT_FDCWD = -100; | 1238 | /// similar syscalls. |
| 1231 | 1239 | pub const FDCWD = -100; | |
| 1232 | /// Check access using effective user and group ID | 1240 | /// Check access using effective user and group ID |
| 1233 | pub const AT_EACCESS = 0x0100; | 1241 | pub const EACCESS = 0x0100; |
| 1234 | 1242 | /// Do not follow symbolic links | |
| 1235 | /// Do not follow symbolic links | 1243 | pub const SYMLINK_NOFOLLOW = 0x0200; |
| 1236 | pub const AT_SYMLINK_NOFOLLOW = 0x0200; | 1244 | /// Follow symbolic link |
| 1237 | 1245 | pub const SYMLINK_FOLLOW = 0x0400; | |
| 1238 | /// Follow symbolic link | 1246 | /// Remove directory instead of file |
| 1239 | pub const AT_SYMLINK_FOLLOW = 0x0400; | 1247 | pub const REMOVEDIR = 0x0800; |
| 1240 | 1248 | /// Fail if not under dirfd | |
| 1241 | /// Remove directory instead of file | 1249 | pub const BENEATH = 0x1000; |
| 1242 | pub const AT_REMOVEDIR = 0x0800; | 1250 | }; |
| 1243 | 1251 | ||
| 1244 | pub const addrinfo = extern struct { | 1252 | pub const addrinfo = extern struct { |
| 1245 | flags: i32, | 1253 | flags: i32, |
| ... | @@ -1252,9 +1260,6 @@ pub const addrinfo = extern struct { | ... | @@ -1252,9 +1260,6 @@ pub const addrinfo = extern struct { |
| 1252 | next: ?*addrinfo, | 1260 | next: ?*addrinfo, |
| 1253 | }; | 1261 | }; |
| 1254 | 1262 | ||
| 1255 | /// Fail if not under dirfd | ||
| 1256 | pub const AT_BENEATH = 0x1000; | ||
| 1257 | |||
| 1258 | pub const IPPROTO = struct { | 1263 | pub const IPPROTO = struct { |
| 1259 | /// dummy for IP | 1264 | /// dummy for IP |
| 1260 | pub const IP = 0; | 1265 | pub const IP = 0; |
lib/std/c/generic.zig deleted-23| ... | @@ -1,23 +0,0 @@ | ||
| 1 | const std = @import("../std.zig"); | ||
| 2 | const Stat = std.c.Stat; | ||
| 3 | const timespec = std.c.timespec; | ||
| 4 | const Sigaction = std.c.Sigaction; | ||
| 5 | const sigset_t = std.c.sigset_t; | ||
| 6 | const rusage = std.c.rusage; | ||
| 7 | |||
| 8 | pub extern "c" fn realpath(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8; | ||
| 9 | pub extern "c" fn fstatat(dirfd: fd_t, path: [*:0]const u8, stat_buf: *Stat, flags: u32) c_int; | ||
| 10 | pub extern "c" fn clock_getres(clk_id: c_int, tp: *timespec) c_int; | ||
| 11 | pub extern "c" fn clock_gettime(clk_id: c_int, tp: *timespec) c_int; | ||
| 12 | pub extern "c" fn fstat(fd: fd_t, buf: *Stat) c_int; | ||
| 13 | pub extern "c" fn getrusage(who: c_int, usage: *rusage) c_int; | ||
| 14 | pub extern "c" fn gettimeofday(noalias tv: ?*timeval, noalias tz: ?*timezone) c_int; | ||
| 15 | pub extern "c" fn nanosleep(rqtp: *const timespec, rmtp: ?*timespec) c_int; | ||
| 16 | pub extern "c" fn sched_yield() c_int; | ||
| 17 | pub extern "c" fn sigaction(sig: c_int, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) c_int; | ||
| 18 | pub extern "c" fn sigprocmask(how: c_int, noalias set: ?*const sigset_t, noalias oset: ?*sigset_t) c_int; | ||
| 19 | pub extern "c" fn socket(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int; | ||
| 20 | pub extern "c" fn stat(noalias path: [*:0]const u8, noalias buf: *Stat) c_int; | ||
| 21 | pub extern "c" fn sigfillset(set: ?*sigset_t) void; | ||
| 22 | pub extern "c" fn alarm(seconds: c_uint) c_uint; | ||
| 23 | pub extern "c" fn sigwait(set: ?*sigset_t, sig: ?*c_int) c_int; | ||
lib/std/c/haiku.zig+99-96| ... | @@ -1,5 +1,8 @@ | ... | @@ -1,5 +1,8 @@ |
| 1 | const std = @import("../std.zig"); | 1 | const std = @import("../std.zig"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | const maxInt = std.math.maxInt; | 3 | const maxInt = std.math.maxInt; |
| 4 | const iovec = std.os.iovec; | ||
| 5 | const iovec_const = std.os.iovec_const; | ||
| 3 | 6 | ||
| 4 | extern "c" fn _errnop() *c_int; | 7 | extern "c" fn _errnop() *c_int; |
| 5 | 8 | ||
| ... | @@ -421,43 +424,64 @@ pub const SA_NOMASK = SA_NODEFER; | ... | @@ -421,43 +424,64 @@ pub const SA_NOMASK = SA_NODEFER; |
| 421 | pub const SA_STACK = SA_ONSTACK; | 424 | pub const SA_STACK = SA_ONSTACK; |
| 422 | pub const SA_ONESHOT = SA_RESETHAND; | 425 | pub const SA_ONESHOT = SA_RESETHAND; |
| 423 | 426 | ||
| 424 | pub const SIGHUP = 1; | 427 | pub const SIG = struct { |
| 425 | pub const SIGINT = 2; | 428 | pub const HUP = 1; |
| 426 | pub const SIGQUIT = 3; | 429 | pub const INT = 2; |
| 427 | pub const SIGILL = 4; | 430 | pub const QUIT = 3; |
| 428 | pub const SIGCHLD = 5; | 431 | pub const ILL = 4; |
| 429 | pub const SIGABRT = 6; | 432 | pub const CHLD = 5; |
| 430 | pub const SIGIOT = SIGABRT; | 433 | pub const ABRT = 6; |
| 431 | pub const SIGPIPE = 7; | 434 | pub const IOT = ABRT; |
| 432 | pub const SIGFPE = 8; | 435 | pub const PIPE = 7; |
| 433 | pub const SIGKILL = 9; | 436 | pub const FPE = 8; |
| 434 | pub const SIGSTOP = 10; | 437 | pub const KILL = 9; |
| 435 | pub const SIGSEGV = 11; | 438 | pub const STOP = 10; |
| 436 | pub const SIGCONT = 12; | 439 | pub const SEGV = 11; |
| 437 | pub const SIGTSTP = 13; | 440 | pub const CONT = 12; |
| 438 | pub const SIGALRM = 14; | 441 | pub const TSTP = 13; |
| 439 | pub const SIGTERM = 15; | 442 | pub const ALRM = 14; |
| 440 | pub const SIGTTIN = 16; | 443 | pub const TERM = 15; |
| 441 | pub const SIGTTOU = 17; | 444 | pub const TTIN = 16; |
| 442 | pub const SIGUSR1 = 18; | 445 | pub const TTOU = 17; |
| 443 | pub const SIGUSR2 = 19; | 446 | pub const USR1 = 18; |
| 444 | pub const SIGWINCH = 20; | 447 | pub const USR2 = 19; |
| 445 | pub const SIGKILLTHR = 21; | 448 | pub const WINCH = 20; |
| 446 | pub const SIGTRAP = 22; | 449 | pub const KILLTHR = 21; |
| 447 | pub const SIGPOLL = 23; | 450 | pub const TRAP = 22; |
| 448 | pub const SIGPROF = 24; | 451 | pub const POLL = 23; |
| 449 | pub const SIGSYS = 25; | 452 | pub const PROF = 24; |
| 450 | pub const SIGURG = 26; | 453 | pub const SYS = 25; |
| 451 | pub const SIGVTALRM = 27; | 454 | pub const URG = 26; |
| 452 | pub const SIGXCPU = 28; | 455 | pub const VTALRM = 27; |
| 453 | pub const SIGXFSZ = 29; | 456 | pub const XCPU = 28; |
| 454 | pub const SIGBUS = 30; | 457 | pub const XFSZ = 29; |
| 455 | pub const SIGRESERVED1 = 31; | 458 | pub const BUS = 30; |
| 456 | pub const SIGRESERVED2 = 32; | 459 | pub const RESERVED1 = 31; |
| 457 | 460 | pub const RESERVED2 = 32; | |
| 458 | // TODO: check | 461 | |
| 459 | pub const SIGRTMIN = 65; | 462 | // TODO: check |
| 460 | pub const SIGRTMAX = 126; | 463 | pub const RTMIN = 65; |
| 464 | pub const RTMAX = 126; | ||
| 465 | |||
| 466 | pub const BLOCK = 1; | ||
| 467 | pub const UNBLOCK = 2; | ||
| 468 | pub const SETMASK = 3; | ||
| 469 | |||
| 470 | pub const WORDS = 4; | ||
| 471 | pub const MAXSIG = 128; | ||
| 472 | pub inline fn IDX(sig: usize) usize { | ||
| 473 | return sig - 1; | ||
| 474 | } | ||
| 475 | pub inline fn WORD(sig: usize) usize { | ||
| 476 | return IDX(sig) >> 5; | ||
| 477 | } | ||
| 478 | pub inline fn BIT(sig: usize) usize { | ||
| 479 | return 1 << (IDX(sig) & 31); | ||
| 480 | } | ||
| 481 | pub inline fn VALID(sig: usize) usize { | ||
| 482 | return sig <= MAXSIG and sig > 0; | ||
| 483 | } | ||
| 484 | }; | ||
| 461 | 485 | ||
| 462 | // access function | 486 | // access function |
| 463 | pub const F_OK = 0; // test for existence of file | 487 | pub const F_OK = 0; // test for existence of file |
| ... | @@ -493,22 +517,29 @@ pub const O_PATH = 0o10000000; | ... | @@ -493,22 +517,29 @@ pub const O_PATH = 0o10000000; |
| 493 | pub const O_TMPFILE = 0o20200000; | 517 | pub const O_TMPFILE = 0o20200000; |
| 494 | pub const O_NDELAY = O_NONBLOCK; | 518 | pub const O_NDELAY = O_NONBLOCK; |
| 495 | 519 | ||
| 496 | pub const F_DUPFD = 0; | 520 | pub const F = struct { |
| 497 | pub const F_GETFD = 1; | 521 | pub const DUPFD = 0; |
| 498 | pub const F_SETFD = 2; | 522 | pub const GETFD = 1; |
| 499 | pub const F_GETFL = 3; | 523 | pub const SETFD = 2; |
| 500 | pub const F_SETFL = 4; | 524 | pub const GETFL = 3; |
| 525 | pub const SETFL = 4; | ||
| 526 | |||
| 527 | pub const GETOWN = 5; | ||
| 528 | pub const SETOWN = 6; | ||
| 501 | 529 | ||
| 502 | pub const F_GETOWN = 5; | 530 | pub const GETLK = 11; |
| 503 | pub const F_SETOWN = 6; | 531 | pub const SETLK = 12; |
| 532 | pub const SETLKW = 13; | ||
| 504 | 533 | ||
| 505 | pub const F_GETLK = 11; | 534 | pub const RDLCK = 1; |
| 506 | pub const F_SETLK = 12; | 535 | pub const WRLCK = 3; |
| 507 | pub const F_SETLKW = 13; | 536 | pub const UNLCK = 2; |
| 508 | 537 | ||
| 509 | pub const F_RDLCK = 1; | 538 | pub const SETOWN_EX = 15; |
| 510 | pub const F_WRLCK = 3; | 539 | pub const GETOWN_EX = 16; |
| 511 | pub const F_UNLCK = 2; | 540 | |
| 541 | pub const GETOWNER_UIDS = 17; | ||
| 542 | }; | ||
| 512 | 543 | ||
| 513 | pub const LOCK = struct { | 544 | pub const LOCK = struct { |
| 514 | pub const SH = 1; | 545 | pub const SH = 1; |
| ... | @@ -517,21 +548,12 @@ pub const LOCK = struct { | ... | @@ -517,21 +548,12 @@ pub const LOCK = struct { |
| 517 | pub const NB = 4; | 548 | pub const NB = 4; |
| 518 | }; | 549 | }; |
| 519 | 550 | ||
| 520 | pub const F_SETOWN_EX = 15; | ||
| 521 | pub const F_GETOWN_EX = 16; | ||
| 522 | |||
| 523 | pub const F_GETOWNER_UIDS = 17; | ||
| 524 | |||
| 525 | pub const FD_CLOEXEC = 1; | 551 | pub const FD_CLOEXEC = 1; |
| 526 | 552 | ||
| 527 | pub const SEEK_SET = 0; | 553 | pub const SEEK_SET = 0; |
| 528 | pub const SEEK_CUR = 1; | 554 | pub const SEEK_CUR = 1; |
| 529 | pub const SEEK_END = 2; | 555 | pub const SEEK_END = 2; |
| 530 | 556 | ||
| 531 | pub const SIG_BLOCK = 1; | ||
| 532 | pub const SIG_UNBLOCK = 2; | ||
| 533 | pub const SIG_SETMASK = 3; | ||
| 534 | |||
| 535 | pub const SOCK = struct { | 557 | pub const SOCK = struct { |
| 536 | pub const STREAM = 1; | 558 | pub const STREAM = 1; |
| 537 | pub const DGRAM = 2; | 559 | pub const DGRAM = 2; |
| ... | @@ -615,7 +637,7 @@ pub const PF = struct { | ... | @@ -615,7 +637,7 @@ pub const PF = struct { |
| 615 | pub const SIP = AF.SIP; | 637 | pub const SIP = AF.SIP; |
| 616 | pub const IPX = AF.IPX; | 638 | pub const IPX = AF.IPX; |
| 617 | pub const RTIP = AF.pseudo_RTIP; | 639 | pub const RTIP = AF.pseudo_RTIP; |
| 618 | pub const PIP = psuedo_AF.PIP; | 640 | pub const PIP = AF.pseudo_PIP; |
| 619 | pub const ISDN = AF.ISDN; | 641 | pub const ISDN = AF.ISDN; |
| 620 | pub const KEY = AF.pseudo_KEY; | 642 | pub const KEY = AF.pseudo_KEY; |
| 621 | pub const INET6 = AF.pseudo_INET6; | 643 | pub const INET6 = AF.pseudo_INET6; |
| ... | @@ -816,7 +838,6 @@ pub const Sigaction = extern struct { | ... | @@ -816,7 +838,6 @@ pub const Sigaction = extern struct { |
| 816 | /// signal handler | 838 | /// signal handler |
| 817 | __sigaction_u: extern union { | 839 | __sigaction_u: extern union { |
| 818 | __sa_handler: fn (i32) callconv(.C) void, | 840 | __sa_handler: fn (i32) callconv(.C) void, |
| 819 | __sa_sigaction: fn (i32, *__siginfo, usize) callconv(.C) void, | ||
| 820 | }, | 841 | }, |
| 821 | 842 | ||
| 822 | /// see signal options | 843 | /// see signal options |
| ... | @@ -826,23 +847,8 @@ pub const Sigaction = extern struct { | ... | @@ -826,23 +847,8 @@ pub const Sigaction = extern struct { |
| 826 | sa_mask: sigset_t, | 847 | sa_mask: sigset_t, |
| 827 | }; | 848 | }; |
| 828 | 849 | ||
| 829 | pub const _SIG_WORDS = 4; | ||
| 830 | pub const _SIG_MAXSIG = 128; | ||
| 831 | pub inline fn _SIG_IDX(sig: usize) usize { | ||
| 832 | return sig - 1; | ||
| 833 | } | ||
| 834 | pub inline fn _SIG_WORD(sig: usize) usize { | ||
| 835 | return_SIG_IDX(sig) >> 5; | ||
| 836 | } | ||
| 837 | pub inline fn _SIG_BIT(sig: usize) usize { | ||
| 838 | return 1 << (_SIG_IDX(sig) & 31); | ||
| 839 | } | ||
| 840 | pub inline fn _SIG_VALID(sig: usize) usize { | ||
| 841 | return sig <= _SIG_MAXSIG and sig > 0; | ||
| 842 | } | ||
| 843 | |||
| 844 | pub const sigset_t = extern struct { | 850 | pub const sigset_t = extern struct { |
| 845 | __bits: [_SIG_WORDS]u32, | 851 | __bits: [SIG.WORDS]u32, |
| 846 | }; | 852 | }; |
| 847 | 853 | ||
| 848 | pub const E = enum(i32) { | 854 | pub const E = enum(i32) { |
| ... | @@ -1047,22 +1053,22 @@ pub fn S_IWHT(m: u32) bool { | ... | @@ -1047,22 +1053,22 @@ pub fn S_IWHT(m: u32) bool { |
| 1047 | 1053 | ||
| 1048 | pub const HOST_NAME_MAX = 255; | 1054 | pub const HOST_NAME_MAX = 255; |
| 1049 | 1055 | ||
| 1050 | /// Magic value that specify the use of the current working directory | 1056 | pub const AT = struct { |
| 1051 | /// to determine the target of relative file paths in the openat() and | 1057 | /// Magic value that specify the use of the current working directory |
| 1052 | /// similar syscalls. | 1058 | /// to determine the target of relative file paths in the openat() and |
| 1053 | pub const AT_FDCWD = -100; | 1059 | /// similar syscalls. |
| 1054 | 1060 | pub const FDCWD = -100; | |
| 1055 | /// Check access using effective user and group ID | 1061 | /// Check access using effective user and group ID |
| 1056 | pub const AT_EACCESS = 0x0100; | 1062 | pub const EACCESS = 0x0100; |
| 1057 | 1063 | /// Do not follow symbolic links | |
| 1058 | /// Do not follow symbolic links | 1064 | pub const SYMLINK_NOFOLLOW = 0x0200; |
| 1059 | pub const AT_SYMLINK_NOFOLLOW = 0x0200; | 1065 | /// Follow symbolic link |
| 1060 | 1066 | pub const SYMLINK_FOLLOW = 0x0400; | |
| 1061 | /// Follow symbolic link | 1067 | /// Remove directory instead of file |
| 1062 | pub const AT_SYMLINK_FOLLOW = 0x0400; | 1068 | pub const REMOVEDIR = 0x0800; |
| 1063 | 1069 | /// Fail if not under dirfd | |
| 1064 | /// Remove directory instead of file | 1070 | pub const BENEATH = 0x1000; |
| 1065 | pub const AT_REMOVEDIR = 0x0800; | 1071 | }; |
| 1066 | 1072 | ||
| 1067 | pub const addrinfo = extern struct { | 1073 | pub const addrinfo = extern struct { |
| 1068 | flags: i32, | 1074 | flags: i32, |
| ... | @@ -1075,9 +1081,6 @@ pub const addrinfo = extern struct { | ... | @@ -1075,9 +1081,6 @@ pub const addrinfo = extern struct { |
| 1075 | next: ?*addrinfo, | 1081 | next: ?*addrinfo, |
| 1076 | }; | 1082 | }; |
| 1077 | 1083 | ||
| 1078 | /// Fail if not under dirfd | ||
| 1079 | pub const AT_BENEATH = 0x1000; | ||
| 1080 | |||
| 1081 | pub const IPPROTO = struct { | 1084 | pub const IPPROTO = struct { |
| 1082 | /// dummy for IP | 1085 | /// dummy for IP |
| 1083 | pub const IP = 0; | 1086 | pub const IP = 0; |
lib/std/c/hermit.zig+4-1| ... | @@ -1,3 +1,6 @@ | ... | @@ -1,3 +1,6 @@ |
| 1 | const std = @import("std"); | ||
| 2 | const maxInt = std.math.maxInt; | ||
| 3 | |||
| 1 | pub const pthread_mutex_t = extern struct { | 4 | pub const pthread_mutex_t = extern struct { |
| 2 | inner: usize = ~@as(usize, 0), | 5 | inner: usize = ~@as(usize, 0), |
| 3 | }; | 6 | }; |
| ... | @@ -5,5 +8,5 @@ pub const pthread_cond_t = extern struct { | ... | @@ -5,5 +8,5 @@ pub const pthread_cond_t = extern struct { |
| 5 | inner: usize = ~@as(usize, 0), | 8 | inner: usize = ~@as(usize, 0), |
| 6 | }; | 9 | }; |
| 7 | pub const pthread_rwlock_t = extern struct { | 10 | pub const pthread_rwlock_t = extern struct { |
| 8 | ptr: usize = std.math.maxInt(usize), | 11 | ptr: usize = maxInt(usize), |
| 9 | }; | 12 | }; |
lib/std/c/linux.zig+1| ... | @@ -6,6 +6,7 @@ const native_arch = builtin.cpu.arch; | ... | @@ -6,6 +6,7 @@ const native_arch = builtin.cpu.arch; |
| 6 | const linux = std.os.linux; | 6 | const linux = std.os.linux; |
| 7 | const iovec = std.os.iovec; | 7 | const iovec = std.os.iovec; |
| 8 | const iovec_const = std.os.iovec_const; | 8 | const iovec_const = std.os.iovec_const; |
| 9 | const FILE = std.c.FILE; | ||
| 9 | 10 | ||
| 10 | pub const AF = linux.AF; | 11 | pub const AF = linux.AF; |
| 11 | pub const ARCH = linux.ARCH; | 12 | pub const ARCH = linux.ARCH; |
lib/std/c/netbsd.zig+141-124| ... | @@ -1,6 +1,10 @@ | ... | @@ -1,6 +1,10 @@ |
| 1 | const std = @import("../std.zig"); | 1 | const std = @import("../std.zig"); |
| 2 | const builtin = @import("builtin"); | 2 | const builtin = @import("builtin"); |
| 3 | const maxInt = std.math.maxInt; | 3 | const maxInt = std.math.maxInt; |
| 4 | const iovec = std.os.iovec; | ||
| 5 | const iovec_const = std.os.iovec_const; | ||
| 6 | const timezone = std.c.timezone; | ||
| 7 | const rusage = std.c.rusage; | ||
| 4 | 8 | ||
| 5 | extern "c" fn __errno() *c_int; | 9 | extern "c" fn __errno() *c_int; |
| 6 | pub const _errno = __errno; | 10 | pub const _errno = __errno; |
| ... | @@ -12,56 +16,81 @@ pub extern "c" fn _lwp_self() lwpid_t; | ... | @@ -12,56 +16,81 @@ pub extern "c" fn _lwp_self() lwpid_t; |
| 12 | 16 | ||
| 13 | pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int; | 17 | pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int; |
| 14 | pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void; | 18 | pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void; |
| 19 | |||
| 15 | pub extern "c" fn __fstat50(fd: fd_t, buf: *Stat) c_int; | 20 | pub extern "c" fn __fstat50(fd: fd_t, buf: *Stat) c_int; |
| 21 | pub const fstat = __fstat50; | ||
| 22 | |||
| 16 | pub extern "c" fn __stat50(path: [*:0]const u8, buf: *Stat) c_int; | 23 | pub extern "c" fn __stat50(path: [*:0]const u8, buf: *Stat) c_int; |
| 24 | pub const stat = __stat50; | ||
| 25 | |||
| 17 | pub extern "c" fn __clock_gettime50(clk_id: c_int, tp: *timespec) c_int; | 26 | pub extern "c" fn __clock_gettime50(clk_id: c_int, tp: *timespec) c_int; |
| 27 | pub const clock_gettime = __clock_gettime50; | ||
| 28 | |||
| 18 | pub extern "c" fn __clock_getres50(clk_id: c_int, tp: *timespec) c_int; | 29 | pub extern "c" fn __clock_getres50(clk_id: c_int, tp: *timespec) c_int; |
| 30 | pub const clock_getres = __clock_getres50; | ||
| 31 | |||
| 19 | pub extern "c" fn __getdents30(fd: c_int, buf_ptr: [*]u8, nbytes: usize) c_int; | 32 | pub extern "c" fn __getdents30(fd: c_int, buf_ptr: [*]u8, nbytes: usize) c_int; |
| 33 | pub const getdents = __getdents30; | ||
| 34 | |||
| 20 | pub extern "c" fn __sigaltstack14(ss: ?*stack_t, old_ss: ?*stack_t) c_int; | 35 | pub extern "c" fn __sigaltstack14(ss: ?*stack_t, old_ss: ?*stack_t) c_int; |
| 36 | pub const sigaltstack = __sigaltstack14; | ||
| 37 | |||
| 21 | pub extern "c" fn __nanosleep50(rqtp: *const timespec, rmtp: ?*timespec) c_int; | 38 | pub extern "c" fn __nanosleep50(rqtp: *const timespec, rmtp: ?*timespec) c_int; |
| 39 | pub const nanosleep = __nanosleep50; | ||
| 40 | |||
| 22 | pub extern "c" fn __sigaction14(sig: c_int, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) c_int; | 41 | pub extern "c" fn __sigaction14(sig: c_int, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) c_int; |
| 42 | pub const sigaction = __sigaction14; | ||
| 43 | |||
| 23 | pub extern "c" fn __sigprocmask14(how: c_int, noalias set: ?*const sigset_t, noalias oset: ?*sigset_t) c_int; | 44 | pub extern "c" fn __sigprocmask14(how: c_int, noalias set: ?*const sigset_t, noalias oset: ?*sigset_t) c_int; |
| 45 | pub const sigprocmask = __sigaction14; | ||
| 46 | |||
| 24 | pub extern "c" fn __socket30(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int; | 47 | pub extern "c" fn __socket30(domain: c_uint, sock_type: c_uint, protocol: c_uint) c_int; |
| 48 | pub const socket = __socket30; | ||
| 49 | |||
| 25 | pub extern "c" fn __gettimeofday50(noalias tv: ?*timeval, noalias tz: ?*timezone) c_int; | 50 | pub extern "c" fn __gettimeofday50(noalias tv: ?*timeval, noalias tz: ?*timezone) c_int; |
| 51 | pub const gettimeofday = __gettimeofday50; | ||
| 52 | |||
| 26 | pub extern "c" fn __getrusage50(who: c_int, usage: *rusage) c_int; | 53 | pub extern "c" fn __getrusage50(who: c_int, usage: *rusage) c_int; |
| 27 | // libc aliases this as sched_yield | 54 | pub const getrusage = __getrusage50; |
| 55 | |||
| 28 | pub extern "c" fn __libc_thr_yield() c_int; | 56 | pub extern "c" fn __libc_thr_yield() c_int; |
| 57 | pub const sched_yield = __libc_thr_yield; | ||
| 29 | 58 | ||
| 30 | pub extern "c" fn posix_memalign(memptr: *?*c_void, alignment: usize, size: usize) c_int; | 59 | pub extern "c" fn posix_memalign(memptr: *?*c_void, alignment: usize, size: usize) c_int; |
| 31 | 60 | ||
| 32 | pub const pthread_mutex_t = extern struct { | 61 | pub const pthread_mutex_t = extern struct { |
| 33 | ptm_magic: u32 = 0x33330003, | 62 | magic: u32 = 0x33330003, |
| 34 | ptm_errorcheck: padded_pthread_spin_t = 0, | 63 | errorcheck: padded_pthread_spin_t = 0, |
| 35 | ptm_ceiling: padded_pthread_spin_t = 0, | 64 | ceiling: padded_pthread_spin_t = 0, |
| 36 | ptm_owner: usize = 0, | 65 | owner: usize = 0, |
| 37 | ptm_waiters: ?*u8 = null, | 66 | waiters: ?*u8 = null, |
| 38 | ptm_recursed: u32 = 0, | 67 | recursed: u32 = 0, |
| 39 | ptm_spare2: ?*c_void = null, | 68 | spare2: ?*c_void = null, |
| 40 | }; | 69 | }; |
| 41 | 70 | ||
| 42 | pub const pthread_cond_t = extern struct { | 71 | pub const pthread_cond_t = extern struct { |
| 43 | ptc_magic: u32 = 0x55550005, | 72 | magic: u32 = 0x55550005, |
| 44 | ptc_lock: pthread_spin_t = 0, | 73 | lock: pthread_spin_t = 0, |
| 45 | ptc_waiters_first: ?*u8 = null, | 74 | waiters_first: ?*u8 = null, |
| 46 | ptc_waiters_last: ?*u8 = null, | 75 | waiters_last: ?*u8 = null, |
| 47 | ptc_mutex: ?*pthread_mutex_t = null, | 76 | mutex: ?*pthread_mutex_t = null, |
| 48 | ptc_private: ?*c_void = null, | 77 | private: ?*c_void = null, |
| 49 | }; | 78 | }; |
| 50 | 79 | ||
| 51 | pub const pthread_rwlock_t = extern struct { | 80 | pub const pthread_rwlock_t = extern struct { |
| 52 | ptr_magic: c_uint = 0x99990009, | 81 | magic: c_uint = 0x99990009, |
| 53 | ptr_interlock: switch (builtin.cpu.arch) { | 82 | interlock: switch (builtin.cpu.arch) { |
| 54 | .aarch64, .sparc, .x86_64, .i386 => u8, | 83 | .aarch64, .sparc, .x86_64, .i386 => u8, |
| 55 | .arm, .powerpc => c_int, | 84 | .arm, .powerpc => c_int, |
| 56 | else => unreachable, | 85 | else => unreachable, |
| 57 | } = 0, | 86 | } = 0, |
| 58 | ptr_rblocked_first: ?*u8 = null, | 87 | rblocked_first: ?*u8 = null, |
| 59 | ptr_rblocked_last: ?*u8 = null, | 88 | rblocked_last: ?*u8 = null, |
| 60 | ptr_wblocked_first: ?*u8 = null, | 89 | wblocked_first: ?*u8 = null, |
| 61 | ptr_wblocked_last: ?*u8 = null, | 90 | wblocked_last: ?*u8 = null, |
| 62 | ptr_nreaders: c_uint = 0, | 91 | nreaders: c_uint = 0, |
| 63 | ptr_owner: std.c.pthread_t = null, | 92 | owner: std.c.pthread_t = null, |
| 64 | ptr_private: ?*c_void = null, | 93 | private: ?*c_void = null, |
| 65 | }; | 94 | }; |
| 66 | 95 | ||
| 67 | const pthread_spin_t = switch (builtin.cpu.arch) { | 96 | const pthread_spin_t = switch (builtin.cpu.arch) { |
| ... | @@ -92,20 +121,6 @@ pub const sem_t = ?*opaque {}; | ... | @@ -92,20 +121,6 @@ pub const sem_t = ?*opaque {}; |
| 92 | pub extern "c" fn pthread_setname_np(thread: std.c.pthread_t, name: [*:0]const u8, arg: ?*c_void) E; | 121 | pub extern "c" fn pthread_setname_np(thread: std.c.pthread_t, name: [*:0]const u8, arg: ?*c_void) E; |
| 93 | pub extern "c" fn pthread_getname_np(thread: std.c.pthread_t, name: [*:0]u8, len: usize) E; | 122 | pub extern "c" fn pthread_getname_np(thread: std.c.pthread_t, name: [*:0]u8, len: usize) E; |
| 94 | 123 | ||
| 95 | pub const clock_getres = __clock_getres50; | ||
| 96 | pub const clock_gettime = __clock_gettime50; | ||
| 97 | pub const fstat = __fstat50; | ||
| 98 | pub const getdents = __getdents30; | ||
| 99 | pub const getrusage = __getrusage50; | ||
| 100 | pub const gettimeofday = __gettimeofday50; | ||
| 101 | pub const nanosleep = __nanosleep50; | ||
| 102 | pub const sched_yield = __libc_thr_yield; | ||
| 103 | pub const sigaction = __sigaction14; | ||
| 104 | pub const sigaltstack = __sigaltstack14; | ||
| 105 | pub const sigprocmask = __sigprocmask14; | ||
| 106 | pub const socket = __socket30; | ||
| 107 | pub const stat = __stat50; | ||
| 108 | |||
| 109 | pub const blkcnt_t = i64; | 124 | pub const blkcnt_t = i64; |
| 110 | pub const blksize_t = i32; | 125 | pub const blksize_t = i32; |
| 111 | pub const clock_t = u32; | 126 | pub const clock_t = u32; |
| ... | @@ -568,43 +583,6 @@ pub const SA_NODEFER = 0x0010; | ... | @@ -568,43 +583,6 @@ pub const SA_NODEFER = 0x0010; |
| 568 | pub const SA_NOCLDWAIT = 0x0020; | 583 | pub const SA_NOCLDWAIT = 0x0020; |
| 569 | pub const SA_SIGINFO = 0x0040; | 584 | pub const SA_SIGINFO = 0x0040; |
| 570 | 585 | ||
| 571 | pub const SIGHUP = 1; | ||
| 572 | pub const SIGINT = 2; | ||
| 573 | pub const SIGQUIT = 3; | ||
| 574 | pub const SIGILL = 4; | ||
| 575 | pub const SIGTRAP = 5; | ||
| 576 | pub const SIGABRT = 6; | ||
| 577 | pub const SIGIOT = SIGABRT; | ||
| 578 | pub const SIGEMT = 7; | ||
| 579 | pub const SIGFPE = 8; | ||
| 580 | pub const SIGKILL = 9; | ||
| 581 | pub const SIGBUS = 10; | ||
| 582 | pub const SIGSEGV = 11; | ||
| 583 | pub const SIGSYS = 12; | ||
| 584 | pub const SIGPIPE = 13; | ||
| 585 | pub const SIGALRM = 14; | ||
| 586 | pub const SIGTERM = 15; | ||
| 587 | pub const SIGURG = 16; | ||
| 588 | pub const SIGSTOP = 17; | ||
| 589 | pub const SIGTSTP = 18; | ||
| 590 | pub const SIGCONT = 19; | ||
| 591 | pub const SIGCHLD = 20; | ||
| 592 | pub const SIGTTIN = 21; | ||
| 593 | pub const SIGTTOU = 22; | ||
| 594 | pub const SIGIO = 23; | ||
| 595 | pub const SIGXCPU = 24; | ||
| 596 | pub const SIGXFSZ = 25; | ||
| 597 | pub const SIGVTALRM = 26; | ||
| 598 | pub const SIGPROF = 27; | ||
| 599 | pub const SIGWINCH = 28; | ||
| 600 | pub const SIGINFO = 29; | ||
| 601 | pub const SIGUSR1 = 30; | ||
| 602 | pub const SIGUSR2 = 31; | ||
| 603 | pub const SIGPWR = 32; | ||
| 604 | |||
| 605 | pub const SIGRTMIN = 33; | ||
| 606 | pub const SIGRTMAX = 63; | ||
| 607 | |||
| 608 | // access function | 586 | // access function |
| 609 | pub const F_OK = 0; // test for existence of file | 587 | pub const F_OK = 0; // test for existence of file |
| 610 | pub const X_OK = 1; // test for execute or search permission | 588 | pub const X_OK = 1; // test for execute or search permission |
| ... | @@ -677,22 +655,24 @@ pub const O_CLOEXEC = 0x00400000; | ... | @@ -677,22 +655,24 @@ pub const O_CLOEXEC = 0x00400000; |
| 677 | /// skip search permission checks | 655 | /// skip search permission checks |
| 678 | pub const O_SEARCH = 0x00800000; | 656 | pub const O_SEARCH = 0x00800000; |
| 679 | 657 | ||
| 680 | pub const F_DUPFD = 0; | 658 | pub const F = struct { |
| 681 | pub const F_GETFD = 1; | 659 | pub const DUPFD = 0; |
| 682 | pub const F_SETFD = 2; | 660 | pub const GETFD = 1; |
| 683 | pub const F_GETFL = 3; | 661 | pub const SETFD = 2; |
| 684 | pub const F_SETFL = 4; | 662 | pub const GETFL = 3; |
| 663 | pub const SETFL = 4; | ||
| 685 | 664 | ||
| 686 | pub const F_GETOWN = 5; | 665 | pub const GETOWN = 5; |
| 687 | pub const F_SETOWN = 6; | 666 | pub const SETOWN = 6; |
| 688 | 667 | ||
| 689 | pub const F_GETLK = 7; | 668 | pub const GETLK = 7; |
| 690 | pub const F_SETLK = 8; | 669 | pub const SETLK = 8; |
| 691 | pub const F_SETLKW = 9; | 670 | pub const SETLKW = 9; |
| 692 | 671 | ||
| 693 | pub const F_RDLCK = 1; | 672 | pub const RDLCK = 1; |
| 694 | pub const F_WRLCK = 3; | 673 | pub const WRLCK = 3; |
| 695 | pub const F_UNLCK = 2; | 674 | pub const UNLCK = 2; |
| 675 | }; | ||
| 696 | 676 | ||
| 697 | pub const LOCK = struct { | 677 | pub const LOCK = struct { |
| 698 | pub const SH = 1; | 678 | pub const SH = 1; |
| ... | @@ -918,9 +898,64 @@ pub const winsize = extern struct { | ... | @@ -918,9 +898,64 @@ pub const winsize = extern struct { |
| 918 | 898 | ||
| 919 | const NSIG = 32; | 899 | const NSIG = 32; |
| 920 | 900 | ||
| 921 | pub const SIG_DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | 901 | pub const SIG = struct { |
| 922 | pub const SIG_IGN = @intToPtr(?Sigaction.sigaction_fn, 1); | 902 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); |
| 923 | pub const SIG_ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | 903 | pub const IGN = @intToPtr(?Sigaction.sigaction_fn, 1); |
| 904 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | ||
| 905 | |||
| 906 | pub const WORDS = 4; | ||
| 907 | pub const MAXSIG = 128; | ||
| 908 | |||
| 909 | pub const HUP = 1; | ||
| 910 | pub const INT = 2; | ||
| 911 | pub const QUIT = 3; | ||
| 912 | pub const ILL = 4; | ||
| 913 | pub const TRAP = 5; | ||
| 914 | pub const ABRT = 6; | ||
| 915 | pub const IOT = ABRT; | ||
| 916 | pub const EMT = 7; | ||
| 917 | pub const FPE = 8; | ||
| 918 | pub const KILL = 9; | ||
| 919 | pub const BUS = 10; | ||
| 920 | pub const SEGV = 11; | ||
| 921 | pub const SYS = 12; | ||
| 922 | pub const PIPE = 13; | ||
| 923 | pub const ALRM = 14; | ||
| 924 | pub const TERM = 15; | ||
| 925 | pub const URG = 16; | ||
| 926 | pub const STOP = 17; | ||
| 927 | pub const TSTP = 18; | ||
| 928 | pub const CONT = 19; | ||
| 929 | pub const CHLD = 20; | ||
| 930 | pub const TTIN = 21; | ||
| 931 | pub const TTOU = 22; | ||
| 932 | pub const IO = 23; | ||
| 933 | pub const XCPU = 24; | ||
| 934 | pub const XFSZ = 25; | ||
| 935 | pub const VTALRM = 26; | ||
| 936 | pub const PROF = 27; | ||
| 937 | pub const WINCH = 28; | ||
| 938 | pub const INFO = 29; | ||
| 939 | pub const USR1 = 30; | ||
| 940 | pub const USR2 = 31; | ||
| 941 | pub const PWR = 32; | ||
| 942 | |||
| 943 | pub const RTMIN = 33; | ||
| 944 | pub const RTMAX = 63; | ||
| 945 | |||
| 946 | pub inline fn IDX(sig: usize) usize { | ||
| 947 | return sig - 1; | ||
| 948 | } | ||
| 949 | pub inline fn WORD(sig: usize) usize { | ||
| 950 | return IDX(sig) >> 5; | ||
| 951 | } | ||
| 952 | pub inline fn BIT(sig: usize) usize { | ||
| 953 | return 1 << (IDX(sig) & 31); | ||
| 954 | } | ||
| 955 | pub inline fn VALID(sig: usize) usize { | ||
| 956 | return sig <= MAXSIG and sig > 0; | ||
| 957 | } | ||
| 958 | }; | ||
| 924 | 959 | ||
| 925 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. | 960 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. |
| 926 | pub const Sigaction = extern struct { | 961 | pub const Sigaction = extern struct { |
| ... | @@ -993,27 +1028,11 @@ pub const _ksiginfo = extern struct { | ... | @@ -993,27 +1028,11 @@ pub const _ksiginfo = extern struct { |
| 993 | } align(@sizeOf(usize)), | 1028 | } align(@sizeOf(usize)), |
| 994 | }; | 1029 | }; |
| 995 | 1030 | ||
| 996 | pub const _SIG_WORDS = 4; | ||
| 997 | pub const _SIG_MAXSIG = 128; | ||
| 998 | |||
| 999 | pub inline fn _SIG_IDX(sig: usize) usize { | ||
| 1000 | return sig - 1; | ||
| 1001 | } | ||
| 1002 | pub inline fn _SIG_WORD(sig: usize) usize { | ||
| 1003 | return_SIG_IDX(sig) >> 5; | ||
| 1004 | } | ||
| 1005 | pub inline fn _SIG_BIT(sig: usize) usize { | ||
| 1006 | return 1 << (_SIG_IDX(sig) & 31); | ||
| 1007 | } | ||
| 1008 | pub inline fn _SIG_VALID(sig: usize) usize { | ||
| 1009 | return sig <= _SIG_MAXSIG and sig > 0; | ||
| 1010 | } | ||
| 1011 | |||
| 1012 | pub const sigset_t = extern struct { | 1031 | pub const sigset_t = extern struct { |
| 1013 | __bits: [_SIG_WORDS]u32, | 1032 | __bits: [SIG.WORDS]u32, |
| 1014 | }; | 1033 | }; |
| 1015 | 1034 | ||
| 1016 | pub const empty_sigset = sigset_t{ .__bits = [_]u32{0} ** _SIG_WORDS }; | 1035 | pub const empty_sigset = sigset_t{ .__bits = [_]u32{0} ** SIG.WORDS }; |
| 1017 | 1036 | ||
| 1018 | // XXX x86_64 specific | 1037 | // XXX x86_64 specific |
| 1019 | pub const mcontext_t = extern struct { | 1038 | pub const mcontext_t = extern struct { |
| ... | @@ -1253,22 +1272,20 @@ pub fn S_IWHT(m: u32) bool { | ... | @@ -1253,22 +1272,20 @@ pub fn S_IWHT(m: u32) bool { |
| 1253 | return m & S_IFMT == S_IFWHT; | 1272 | return m & S_IFMT == S_IFWHT; |
| 1254 | } | 1273 | } |
| 1255 | 1274 | ||
| 1256 | /// Magic value that specify the use of the current working directory | 1275 | pub const AT = struct { |
| 1257 | /// to determine the target of relative file paths in the openat() and | 1276 | /// Magic value that specify the use of the current working directory |
| 1258 | /// similar syscalls. | 1277 | /// to determine the target of relative file paths in the openat() and |
| 1259 | pub const AT_FDCWD = -100; | 1278 | /// similar syscalls. |
| 1260 | 1279 | pub const FDCWD = -100; | |
| 1261 | /// Check access using effective user and group ID | 1280 | /// Check access using effective user and group ID |
| 1262 | pub const AT_EACCESS = 0x0100; | 1281 | pub const EACCESS = 0x0100; |
| 1263 | 1282 | /// Do not follow symbolic links | |
| 1264 | /// Do not follow symbolic links | 1283 | pub const SYMLINK_NOFOLLOW = 0x0200; |
| 1265 | pub const AT_SYMLINK_NOFOLLOW = 0x0200; | 1284 | /// Follow symbolic link |
| 1266 | 1285 | pub const SYMLINK_FOLLOW = 0x0400; | |
| 1267 | /// Follow symbolic link | 1286 | /// Remove directory instead of file |
| 1268 | pub const AT_SYMLINK_FOLLOW = 0x0400; | 1287 | pub const REMOVEDIR = 0x0800; |
| 1269 | 1288 | }; | |
| 1270 | /// Remove directory instead of file | ||
| 1271 | pub const AT_REMOVEDIR = 0x0800; | ||
| 1272 | 1289 | ||
| 1273 | pub const HOST_NAME_MAX = 255; | 1290 | pub const HOST_NAME_MAX = 255; |
| 1274 | 1291 |
lib/std/c/openbsd.zig+32-30| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | const std = @import("../std.zig"); | 1 | const std = @import("../std.zig"); |
| 2 | const maxInt = std.math.maxInt; | 2 | const maxInt = std.math.maxInt; |
| 3 | const builtin = @import("builtin"); | 3 | const builtin = @import("builtin"); |
| 4 | const iovec = std.os.iovec; | ||
| 5 | const iovec_const = std.os.iovec_const; | ||
| 4 | 6 | ||
| 5 | extern "c" fn __errno() *c_int; | 7 | extern "c" fn __errno() *c_int; |
| 6 | pub const _errno = __errno; | 8 | pub const _errno = __errno; |
| ... | @@ -466,22 +468,24 @@ pub const O_DIRECTORY = 0x20000; | ... | @@ -466,22 +468,24 @@ pub const O_DIRECTORY = 0x20000; |
| 466 | /// set close on exec | 468 | /// set close on exec |
| 467 | pub const O_CLOEXEC = 0x10000; | 469 | pub const O_CLOEXEC = 0x10000; |
| 468 | 470 | ||
| 469 | pub const F_DUPFD = 0; | 471 | pub const F = struct { |
| 470 | pub const F_GETFD = 1; | 472 | pub const DUPFD = 0; |
| 471 | pub const F_SETFD = 2; | 473 | pub const GETFD = 1; |
| 472 | pub const F_GETFL = 3; | 474 | pub const SETFD = 2; |
| 473 | pub const F_SETFL = 4; | 475 | pub const GETFL = 3; |
| 476 | pub const SETFL = 4; | ||
| 474 | 477 | ||
| 475 | pub const F_GETOWN = 5; | 478 | pub const GETOWN = 5; |
| 476 | pub const F_SETOWN = 6; | 479 | pub const SETOWN = 6; |
| 477 | 480 | ||
| 478 | pub const F_GETLK = 7; | 481 | pub const GETLK = 7; |
| 479 | pub const F_SETLK = 8; | 482 | pub const SETLK = 8; |
| 480 | pub const F_SETLKW = 9; | 483 | pub const SETLKW = 9; |
| 481 | 484 | ||
| 482 | pub const F_RDLCK = 1; | 485 | pub const RDLCK = 1; |
| 483 | pub const F_UNLCK = 2; | 486 | pub const UNLCK = 2; |
| 484 | pub const F_WRLCK = 3; | 487 | pub const WRLCK = 3; |
| 488 | }; | ||
| 485 | 489 | ||
| 486 | pub const LOCK = struct { | 490 | pub const LOCK = struct { |
| 487 | pub const SH = 0x01; | 491 | pub const SH = 0x01; |
| ... | @@ -840,7 +844,7 @@ const arch_bits = switch (builtin.cpu.arch) { | ... | @@ -840,7 +844,7 @@ const arch_bits = switch (builtin.cpu.arch) { |
| 840 | sc_rsp: c_long, | 844 | sc_rsp: c_long, |
| 841 | sc_ss: c_long, | 845 | sc_ss: c_long, |
| 842 | 846 | ||
| 843 | sc_fpstate: fxsave64, | 847 | sc_fpstate: arch_bits.fxsave64, |
| 844 | __sc_unused: c_int, | 848 | __sc_unused: c_int, |
| 845 | sc_mask: c_int, | 849 | sc_mask: c_int, |
| 846 | sc_cookie: c_long, | 850 | sc_cookie: c_long, |
| ... | @@ -1063,22 +1067,20 @@ pub fn S_ISSOCK(m: u32) bool { | ... | @@ -1063,22 +1067,20 @@ pub fn S_ISSOCK(m: u32) bool { |
| 1063 | return m & S_IFMT == S_IFSOCK; | 1067 | return m & S_IFMT == S_IFSOCK; |
| 1064 | } | 1068 | } |
| 1065 | 1069 | ||
| 1066 | /// Magic value that specify the use of the current working directory | 1070 | pub const AT = struct { |
| 1067 | /// to determine the target of relative file paths in the openat() and | 1071 | /// Magic value that specify the use of the current working directory |
| 1068 | /// similar syscalls. | 1072 | /// to determine the target of relative file paths in the openat() and |
| 1069 | pub const AT_FDCWD = -100; | 1073 | /// similar syscalls. |
| 1070 | 1074 | pub const FDCWD = -100; | |
| 1071 | /// Check access using effective user and group ID | 1075 | /// Check access using effective user and group ID |
| 1072 | pub const AT_EACCESS = 0x01; | 1076 | pub const EACCESS = 0x01; |
| 1073 | 1077 | /// Do not follow symbolic links | |
| 1074 | /// Do not follow symbolic links | 1078 | pub const SYMLINK_NOFOLLOW = 0x02; |
| 1075 | pub const AT_SYMLINK_NOFOLLOW = 0x02; | 1079 | /// Follow symbolic link |
| 1076 | 1080 | pub const SYMLINK_FOLLOW = 0x04; | |
| 1077 | /// Follow symbolic link | 1081 | /// Remove directory instead of file |
| 1078 | pub const AT_SYMLINK_FOLLOW = 0x04; | 1082 | pub const REMOVEDIR = 0x08; |
| 1079 | 1083 | }; | |
| 1080 | /// Remove directory instead of file | ||
| 1081 | pub const AT_REMOVEDIR = 0x08; | ||
| 1082 | 1084 | ||
| 1083 | pub const HOST_NAME_MAX = 255; | 1085 | pub const HOST_NAME_MAX = 255; |
| 1084 | 1086 |
lib/std/c/wasi.zig+19-5| ... | @@ -1,3 +1,7 @@ | ... | @@ -1,3 +1,7 @@ |
| 1 | const std = @import("../std.zig"); | ||
| 2 | const wasi = std.os.wasi; | ||
| 3 | const FDFLAG = wasi.FDFLAG; | ||
| 4 | |||
| 1 | extern threadlocal var errno: c_int; | 5 | extern threadlocal var errno: c_int; |
| 2 | 6 | ||
| 3 | pub fn _errno() *c_int { | 7 | pub fn _errno() *c_int { |
| ... | @@ -9,6 +13,10 @@ pub const pid_t = c_int; | ... | @@ -9,6 +13,10 @@ pub const pid_t = c_int; |
| 9 | pub const uid_t = u32; | 13 | pub const uid_t = u32; |
| 10 | pub const gid_t = u32; | 14 | pub const gid_t = u32; |
| 11 | pub const off_t = i64; | 15 | pub const off_t = i64; |
| 16 | pub const ino_t = wasi.ino_t; | ||
| 17 | pub const mode_t = wasi.mode_t; | ||
| 18 | pub const time_t = wasi.time_t; | ||
| 19 | pub const timespec = wasi.timespec; | ||
| 12 | 20 | ||
| 13 | pub const Stat = extern struct { | 21 | pub const Stat = extern struct { |
| 14 | dev: i32, | 22 | dev: i32, |
| ... | @@ -57,22 +65,28 @@ pub const Stat = extern struct { | ... | @@ -57,22 +65,28 @@ pub const Stat = extern struct { |
| 57 | /// https://github.com/WebAssembly/wasi-libc/blob/main/expected/wasm32-wasi/predefined-macros.txt | 65 | /// https://github.com/WebAssembly/wasi-libc/blob/main/expected/wasm32-wasi/predefined-macros.txt |
| 58 | pub const O = struct { | 66 | pub const O = struct { |
| 59 | pub const ACCMODE = (EXEC | RDWR | SEARCH); | 67 | pub const ACCMODE = (EXEC | RDWR | SEARCH); |
| 60 | pub const APPEND = FDFLAG_APPEND; | 68 | pub const APPEND = FDFLAG.APPEND; |
| 61 | pub const CLOEXEC = (0); | 69 | pub const CLOEXEC = (0); |
| 62 | pub const CREAT = ((1 << 0) << 12); // = __WASI_OFLAGS_CREAT << 12 | 70 | pub const CREAT = ((1 << 0) << 12); // = __WASI_OFLAGS_CREAT << 12 |
| 63 | pub const DIRECTORY = ((1 << 1) << 12); // = __WASI_OFLAGS_DIRECTORY << 12 | 71 | pub const DIRECTORY = ((1 << 1) << 12); // = __WASI_OFLAGS_DIRECTORY << 12 |
| 64 | pub const DSYNC = FDFLAG_DSYNC; | 72 | pub const DSYNC = FDFLAG.DSYNC; |
| 65 | pub const EXCL = ((1 << 2) << 12); // = __WASI_OFLAGS_EXCL << 12 | 73 | pub const EXCL = ((1 << 2) << 12); // = __WASI_OFLAGS_EXCL << 12 |
| 66 | pub const EXEC = (0x02000000); | 74 | pub const EXEC = (0x02000000); |
| 67 | pub const NOCTTY = (0); | 75 | pub const NOCTTY = (0); |
| 68 | pub const NOFOLLOW = (0x01000000); | 76 | pub const NOFOLLOW = (0x01000000); |
| 69 | pub const NONBLOCK = (1 << FDFLAG_NONBLOCK); | 77 | pub const NONBLOCK = (1 << FDFLAG.NONBLOCK); |
| 70 | pub const RDONLY = (0x04000000); | 78 | pub const RDONLY = (0x04000000); |
| 71 | pub const RDWR = (RDONLY | WRONLY); | 79 | pub const RDWR = (RDONLY | WRONLY); |
| 72 | pub const RSYNC = (1 << FDFLAG_RSYNC); | 80 | pub const RSYNC = (1 << FDFLAG.RSYNC); |
| 73 | pub const SEARCH = (0x08000000); | 81 | pub const SEARCH = (0x08000000); |
| 74 | pub const SYNC = (1 << FDFLAG_SYNC); | 82 | pub const SYNC = (1 << FDFLAG.SYNC); |
| 75 | pub const TRUNC = ((1 << 3) << 12); // = __WASI_OFLAGS_TRUNC << 12 | 83 | pub const TRUNC = ((1 << 3) << 12); // = __WASI_OFLAGS_TRUNC << 12 |
| 76 | pub const TTY_INIT = (0); | 84 | pub const TTY_INIT = (0); |
| 77 | pub const WRONLY = (0x10000000); | 85 | pub const WRONLY = (0x10000000); |
| 78 | }; | 86 | }; |
| 87 | |||
| 88 | pub const SEEK = struct { | ||
| 89 | pub const SET: wasi.whence_t = .SET; | ||
| 90 | pub const CUR: wasi.whence_t = .CUR; | ||
| 91 | pub const END: wasi.whence_t = .END; | ||
| 92 | }; |
lib/std/c/windows.zig+40-46| ... | @@ -1,7 +1,6 @@ | ... | @@ -1,7 +1,6 @@ |
| 1 | //! The reference for these types and values is Microsoft Windows's ucrt (Universal C RunTime). | 1 | //! The reference for these types and values is Microsoft Windows's ucrt (Universal C RunTime). |
| 2 | const std = @import("../std.zig"); | 2 | const std = @import("../std.zig"); |
| 3 | const ws2_32 = std.os.windows.ws2_32; | 3 | const ws2_32 = std.os.windows.ws2_32; |
| 4 | |||
| 5 | const windows = std.os.windows; | 4 | const windows = std.os.windows; |
| 6 | 5 | ||
| 7 | pub extern "c" fn _errno() *c_int; | 6 | pub extern "c" fn _errno() *c_int; |
| ... | @@ -43,56 +42,51 @@ pub const timeval = extern struct { | ... | @@ -43,56 +42,51 @@ pub const timeval = extern struct { |
| 43 | tv_usec: c_long, | 42 | tv_usec: c_long, |
| 44 | }; | 43 | }; |
| 45 | 44 | ||
| 45 | pub const Stat = @compileError("TODO windows Stat definition"); | ||
| 46 | |||
| 46 | pub const sig_atomic_t = c_int; | 47 | pub const sig_atomic_t = c_int; |
| 47 | 48 | ||
| 49 | pub const sigset_t = @compileError("TODO windows sigset_t definition"); | ||
| 50 | pub const Sigaction = @compileError("TODO windows Sigaction definition"); | ||
| 51 | pub const timezone = @compileError("TODO windows timezone definition"); | ||
| 52 | pub const rusage = @compileError("TODO windows rusage definition"); | ||
| 53 | |||
| 48 | /// maximum signal number + 1 | 54 | /// maximum signal number + 1 |
| 49 | pub const NSIG = 23; | 55 | pub const NSIG = 23; |
| 50 | 56 | ||
| 51 | // Signal types | 57 | /// Signal types |
| 52 | 58 | pub const SIG = struct { | |
| 53 | /// interrupt | 59 | /// interrupt |
| 54 | pub const SIGINT = 2; | 60 | pub const INT = 2; |
| 55 | 61 | /// illegal instruction - invalid function image | |
| 56 | /// illegal instruction - invalid function image | 62 | pub const ILL = 4; |
| 57 | pub const SIGILL = 4; | 63 | /// floating point exception |
| 58 | 64 | pub const FPE = 8; | |
| 59 | /// floating point exception | 65 | /// segment violation |
| 60 | pub const SIGFPE = 8; | 66 | pub const SEGV = 11; |
| 61 | 67 | /// Software termination signal from kill | |
| 62 | /// segment violation | 68 | pub const TERM = 15; |
| 63 | pub const SIGSEGV = 11; | 69 | /// Ctrl-Break sequence |
| 64 | 70 | pub const BREAK = 21; | |
| 65 | /// Software termination signal from kill | 71 | /// abnormal termination triggered by abort call |
| 66 | pub const SIGTERM = 15; | 72 | pub const ABRT = 22; |
| 67 | 73 | /// SIGABRT compatible with other platforms, same as SIGABRT | |
| 68 | /// Ctrl-Break sequence | 74 | pub const ABRT_COMPAT = 6; |
| 69 | pub const SIGBREAK = 21; | 75 | |
| 70 | 76 | // Signal action codes | |
| 71 | /// abnormal termination triggered by abort call | 77 | /// default signal action |
| 72 | pub const SIGABRT = 22; | 78 | pub const DFL = 0; |
| 73 | 79 | /// ignore signal | |
| 74 | /// SIGABRT compatible with other platforms, same as SIGABRT | 80 | pub const IGN = 1; |
| 75 | pub const SIGABRT_COMPAT = 6; | 81 | /// return current value |
| 76 | 82 | pub const GET = 2; | |
| 77 | // Signal action codes | 83 | /// signal gets error |
| 78 | 84 | pub const SGE = 3; | |
| 79 | /// default signal action | 85 | /// acknowledge |
| 80 | pub const SIG_DFL = 0; | 86 | pub const ACK = 4; |
| 81 | 87 | /// Signal error value (returned by signal call on error) | |
| 82 | /// ignore signal | 88 | pub const ERR = -1; |
| 83 | pub const SIG_IGN = 1; | 89 | }; |
| 84 | |||
| 85 | /// return current value | ||
| 86 | pub const SIG_GET = 2; | ||
| 87 | |||
| 88 | /// signal gets error | ||
| 89 | pub const SIG_SGE = 3; | ||
| 90 | |||
| 91 | /// acknowledge | ||
| 92 | pub const SIG_ACK = 4; | ||
| 93 | |||
| 94 | /// Signal error value (returned by signal call on error) | ||
| 95 | pub const SIG_ERR = -1; | ||
| 96 | 90 | ||
| 97 | pub const SEEK_SET = 0; | 91 | pub const SEEK_SET = 0; |
| 98 | pub const SEEK_CUR = 1; | 92 | pub const SEEK_CUR = 1; |
lib/std/crypto/25519/curve25519.zig+1-3| ... | @@ -40,9 +40,7 @@ pub const Curve25519 = struct { | ... | @@ -40,9 +40,7 @@ pub const Curve25519 = struct { |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | /// Multiply a point by the cofactor | 42 | /// Multiply a point by the cofactor |
| 43 | pub fn clearCofactor(p: Edwards25519) Edwards25519 { | 43 | pub const clearCofactor = @compileError("TODO what was this function supposed to do? it didn't compile successfully"); |
| 44 | return p.dbl().dbl().dbl(); | ||
| 45 | } | ||
| 46 | 44 | ||
| 47 | fn ladder(p: Curve25519, s: [32]u8, comptime bits: usize) IdentityElementError!Curve25519 { | 45 | fn ladder(p: Curve25519, s: [32]u8, comptime bits: usize) IdentityElementError!Curve25519 { |
| 48 | var x1 = p.x; | 46 | var x1 = p.x; |
lib/std/debug.zig+2-2| ... | @@ -1341,7 +1341,7 @@ pub const ModuleDebugInfo = switch (native_os) { | ... | @@ -1341,7 +1341,7 @@ pub const ModuleDebugInfo = switch (native_os) { |
| 1341 | if (o_file_di.findCompileUnit(relocated_address_o)) |compile_unit| { | 1341 | if (o_file_di.findCompileUnit(relocated_address_o)) |compile_unit| { |
| 1342 | return SymbolInfo{ | 1342 | return SymbolInfo{ |
| 1343 | .symbol_name = o_file_di.getSymbolName(relocated_address_o) orelse "???", | 1343 | .symbol_name = o_file_di.getSymbolName(relocated_address_o) orelse "???", |
| 1344 | .compile_unit_name = compile_unit.die.getAttrString(&o_file_di, DW.AT_name) catch |err| switch (err) { | 1344 | .compile_unit_name = compile_unit.die.getAttrString(&o_file_di, DW.AT.name) catch |err| switch (err) { |
| 1345 | error.MissingDebugInfo, error.InvalidDebugInfo => "???", | 1345 | error.MissingDebugInfo, error.InvalidDebugInfo => "???", |
| 1346 | else => return err, | 1346 | else => return err, |
| 1347 | }, | 1347 | }, |
| ... | @@ -1438,7 +1438,7 @@ fn getSymbolFromDwarf(address: u64, di: *DW.DwarfInfo) !SymbolInfo { | ... | @@ -1438,7 +1438,7 @@ fn getSymbolFromDwarf(address: u64, di: *DW.DwarfInfo) !SymbolInfo { |
| 1438 | if (nosuspend di.findCompileUnit(address)) |compile_unit| { | 1438 | if (nosuspend di.findCompileUnit(address)) |compile_unit| { |
| 1439 | return SymbolInfo{ | 1439 | return SymbolInfo{ |
| 1440 | .symbol_name = nosuspend di.getSymbolName(address) orelse "???", | 1440 | .symbol_name = nosuspend di.getSymbolName(address) orelse "???", |
| 1441 | .compile_unit_name = compile_unit.die.getAttrString(di, DW.AT_name) catch |err| switch (err) { | 1441 | .compile_unit_name = compile_unit.die.getAttrString(di, DW.AT.name) catch |err| switch (err) { |
| 1442 | error.MissingDebugInfo, error.InvalidDebugInfo => "???", | 1442 | error.MissingDebugInfo, error.InvalidDebugInfo => "???", |
| 1443 | else => return err, | 1443 | else => return err, |
| 1444 | }, | 1444 | }, |
lib/std/dwarf.zig+277-61| ... | @@ -9,7 +9,223 @@ const leb = @import("leb128.zig"); | ... | @@ -9,7 +9,223 @@ const leb = @import("leb128.zig"); |
| 9 | 9 | ||
| 10 | const ArrayList = std.ArrayList; | 10 | const ArrayList = std.ArrayList; |
| 11 | 11 | ||
| 12 | pub usingnamespace @import("dwarf_bits.zig"); | 12 | pub const TAG = @import("dwarf/TAG.zig"); |
| 13 | pub const AT = @import("dwarf/AT.zig"); | ||
| 14 | pub const OP = @import("dwarf/OP.zig"); | ||
| 15 | |||
| 16 | pub const FORM = struct { | ||
| 17 | pub const addr = 0x01; | ||
| 18 | pub const block2 = 0x03; | ||
| 19 | pub const block4 = 0x04; | ||
| 20 | pub const data2 = 0x05; | ||
| 21 | pub const data4 = 0x06; | ||
| 22 | pub const data8 = 0x07; | ||
| 23 | pub const string = 0x08; | ||
| 24 | pub const block = 0x09; | ||
| 25 | pub const block1 = 0x0a; | ||
| 26 | pub const data1 = 0x0b; | ||
| 27 | pub const flag = 0x0c; | ||
| 28 | pub const sdata = 0x0d; | ||
| 29 | pub const strp = 0x0e; | ||
| 30 | pub const udata = 0x0f; | ||
| 31 | pub const ref_addr = 0x10; | ||
| 32 | pub const ref1 = 0x11; | ||
| 33 | pub const ref2 = 0x12; | ||
| 34 | pub const ref4 = 0x13; | ||
| 35 | pub const ref8 = 0x14; | ||
| 36 | pub const ref_udata = 0x15; | ||
| 37 | pub const indirect = 0x16; | ||
| 38 | pub const sec_offset = 0x17; | ||
| 39 | pub const exprloc = 0x18; | ||
| 40 | pub const flag_present = 0x19; | ||
| 41 | pub const ref_sig8 = 0x20; | ||
| 42 | |||
| 43 | // Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFission. | ||
| 44 | pub const GNU_addr_index = 0x1f01; | ||
| 45 | pub const GNU_str_index = 0x1f02; | ||
| 46 | |||
| 47 | // Extensions for DWZ multifile. | ||
| 48 | // See http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open . | ||
| 49 | pub const GNU_ref_alt = 0x1f20; | ||
| 50 | pub const GNU_strp_alt = 0x1f21; | ||
| 51 | }; | ||
| 52 | |||
| 53 | pub const ATE = struct { | ||
| 54 | pub const @"void" = 0x0; | ||
| 55 | pub const address = 0x1; | ||
| 56 | pub const boolean = 0x2; | ||
| 57 | pub const complex_float = 0x3; | ||
| 58 | pub const float = 0x4; | ||
| 59 | pub const signed = 0x5; | ||
| 60 | pub const signed_char = 0x6; | ||
| 61 | pub const unsigned = 0x7; | ||
| 62 | pub const unsigned_char = 0x8; | ||
| 63 | |||
| 64 | // DWARF 3. | ||
| 65 | pub const imaginary_float = 0x9; | ||
| 66 | pub const packed_decimal = 0xa; | ||
| 67 | pub const numeric_string = 0xb; | ||
| 68 | pub const edited = 0xc; | ||
| 69 | pub const signed_fixed = 0xd; | ||
| 70 | pub const unsigned_fixed = 0xe; | ||
| 71 | pub const decimal_float = 0xf; | ||
| 72 | |||
| 73 | // DWARF 4. | ||
| 74 | pub const UTF = 0x10; | ||
| 75 | |||
| 76 | pub const lo_user = 0x80; | ||
| 77 | pub const hi_user = 0xff; | ||
| 78 | |||
| 79 | // HP extensions. | ||
| 80 | pub const HP_float80 = 0x80; // Floating-point (80 bit). | ||
| 81 | pub const HP_complex_float80 = 0x81; // Complex floating-point (80 bit). | ||
| 82 | pub const HP_float128 = 0x82; // Floating-point (128 bit). | ||
| 83 | pub const HP_complex_float128 = 0x83; // Complex fp (128 bit). | ||
| 84 | pub const HP_floathpintel = 0x84; // Floating-point (82 bit IA64). | ||
| 85 | pub const HP_imaginary_float80 = 0x85; | ||
| 86 | pub const HP_imaginary_float128 = 0x86; | ||
| 87 | pub const HP_VAX_float = 0x88; // F or G floating. | ||
| 88 | pub const HP_VAX_float_d = 0x89; // D floating. | ||
| 89 | pub const HP_packed_decimal = 0x8a; // Cobol. | ||
| 90 | pub const HP_zoned_decimal = 0x8b; // Cobol. | ||
| 91 | pub const HP_edited = 0x8c; // Cobol. | ||
| 92 | pub const HP_signed_fixed = 0x8d; // Cobol. | ||
| 93 | pub const HP_unsigned_fixed = 0x8e; // Cobol. | ||
| 94 | pub const HP_VAX_complex_float = 0x8f; // F or G floating complex. | ||
| 95 | pub const HP_VAX_complex_float_d = 0x90; // D floating complex. | ||
| 96 | }; | ||
| 97 | |||
| 98 | pub const CFA = struct { | ||
| 99 | pub const advance_loc = 0x40; | ||
| 100 | pub const offset = 0x80; | ||
| 101 | pub const restore = 0xc0; | ||
| 102 | pub const nop = 0x00; | ||
| 103 | pub const set_loc = 0x01; | ||
| 104 | pub const advance_loc1 = 0x02; | ||
| 105 | pub const advance_loc2 = 0x03; | ||
| 106 | pub const advance_loc4 = 0x04; | ||
| 107 | pub const offset_extended = 0x05; | ||
| 108 | pub const restore_extended = 0x06; | ||
| 109 | pub const @"undefined" = 0x07; | ||
| 110 | pub const same_value = 0x08; | ||
| 111 | pub const register = 0x09; | ||
| 112 | pub const remember_state = 0x0a; | ||
| 113 | pub const restore_state = 0x0b; | ||
| 114 | pub const def_cfa = 0x0c; | ||
| 115 | pub const def_cfa_register = 0x0d; | ||
| 116 | pub const def_cfa_offset = 0x0e; | ||
| 117 | |||
| 118 | // DWARF 3. | ||
| 119 | pub const def_cfa_expression = 0x0f; | ||
| 120 | pub const expression = 0x10; | ||
| 121 | pub const offset_extended_sf = 0x11; | ||
| 122 | pub const def_cfa_sf = 0x12; | ||
| 123 | pub const def_cfa_offset_sf = 0x13; | ||
| 124 | pub const val_offset = 0x14; | ||
| 125 | pub const val_offset_sf = 0x15; | ||
| 126 | pub const val_expression = 0x16; | ||
| 127 | |||
| 128 | pub const lo_user = 0x1c; | ||
| 129 | pub const hi_user = 0x3f; | ||
| 130 | |||
| 131 | // SGI/MIPS specific. | ||
| 132 | pub const MIPS_advance_loc8 = 0x1d; | ||
| 133 | |||
| 134 | // GNU extensions. | ||
| 135 | pub const GNU_window_save = 0x2d; | ||
| 136 | pub const GNU_args_size = 0x2e; | ||
| 137 | pub const GNU_negative_offset_extended = 0x2f; | ||
| 138 | }; | ||
| 139 | |||
| 140 | pub const CHILDREN = struct { | ||
| 141 | pub const no = 0x00; | ||
| 142 | pub const yes = 0x01; | ||
| 143 | }; | ||
| 144 | |||
| 145 | pub const LNS = struct { | ||
| 146 | pub const extended_op = 0x00; | ||
| 147 | pub const copy = 0x01; | ||
| 148 | pub const advance_pc = 0x02; | ||
| 149 | pub const advance_line = 0x03; | ||
| 150 | pub const set_file = 0x04; | ||
| 151 | pub const set_column = 0x05; | ||
| 152 | pub const negate_stmt = 0x06; | ||
| 153 | pub const set_basic_block = 0x07; | ||
| 154 | pub const const_add_pc = 0x08; | ||
| 155 | pub const fixed_advance_pc = 0x09; | ||
| 156 | pub const set_prologue_end = 0x0a; | ||
| 157 | pub const set_epilogue_begin = 0x0b; | ||
| 158 | pub const set_isa = 0x0c; | ||
| 159 | }; | ||
| 160 | |||
| 161 | pub const LNE = struct { | ||
| 162 | pub const end_sequence = 0x01; | ||
| 163 | pub const set_address = 0x02; | ||
| 164 | pub const define_file = 0x03; | ||
| 165 | pub const set_discriminator = 0x04; | ||
| 166 | pub const lo_user = 0x80; | ||
| 167 | pub const hi_user = 0xff; | ||
| 168 | }; | ||
| 169 | |||
| 170 | pub const LANG = struct { | ||
| 171 | pub const C89 = 0x0001; | ||
| 172 | pub const C = 0x0002; | ||
| 173 | pub const Ada83 = 0x0003; | ||
| 174 | pub const C_plus_plus = 0x0004; | ||
| 175 | pub const Cobol74 = 0x0005; | ||
| 176 | pub const Cobol85 = 0x0006; | ||
| 177 | pub const Fortran77 = 0x0007; | ||
| 178 | pub const Fortran90 = 0x0008; | ||
| 179 | pub const Pascal83 = 0x0009; | ||
| 180 | pub const Modula2 = 0x000a; | ||
| 181 | pub const Java = 0x000b; | ||
| 182 | pub const C99 = 0x000c; | ||
| 183 | pub const Ada95 = 0x000d; | ||
| 184 | pub const Fortran95 = 0x000e; | ||
| 185 | pub const PLI = 0x000f; | ||
| 186 | pub const ObjC = 0x0010; | ||
| 187 | pub const ObjC_plus_plus = 0x0011; | ||
| 188 | pub const UPC = 0x0012; | ||
| 189 | pub const D = 0x0013; | ||
| 190 | pub const Python = 0x0014; | ||
| 191 | pub const Go = 0x0016; | ||
| 192 | pub const C_plus_plus_11 = 0x001a; | ||
| 193 | pub const Rust = 0x001c; | ||
| 194 | pub const C11 = 0x001d; | ||
| 195 | pub const C_plus_plus_14 = 0x0021; | ||
| 196 | pub const Fortran03 = 0x0022; | ||
| 197 | pub const Fortran08 = 0x0023; | ||
| 198 | pub const lo_user = 0x8000; | ||
| 199 | pub const hi_user = 0xffff; | ||
| 200 | pub const Mips_Assembler = 0x8001; | ||
| 201 | pub const Upc = 0x8765; | ||
| 202 | pub const HP_Bliss = 0x8003; | ||
| 203 | pub const HP_Basic91 = 0x8004; | ||
| 204 | pub const HP_Pascal91 = 0x8005; | ||
| 205 | pub const HP_IMacro = 0x8006; | ||
| 206 | pub const HP_Assembler = 0x8007; | ||
| 207 | }; | ||
| 208 | |||
| 209 | pub const UT = struct { | ||
| 210 | pub const compile = 0x01; | ||
| 211 | pub const @"type" = 0x02; | ||
| 212 | pub const partial = 0x03; | ||
| 213 | pub const skeleton = 0x04; | ||
| 214 | pub const split_compile = 0x05; | ||
| 215 | pub const split_type = 0x06; | ||
| 216 | pub const lo_user = 0x80; | ||
| 217 | pub const hi_user = 0xff; | ||
| 218 | }; | ||
| 219 | |||
| 220 | pub const LNCT = struct { | ||
| 221 | pub const path = 0x1; | ||
| 222 | pub const directory_index = 0x2; | ||
| 223 | pub const timestamp = 0x3; | ||
| 224 | pub const size = 0x4; | ||
| 225 | pub const MD5 = 0x5; | ||
| 226 | pub const lo_user = 0x2000; | ||
| 227 | pub const hi_user = 0x3fff; | ||
| 228 | }; | ||
| 13 | 229 | ||
| 14 | const PcRange = struct { | 230 | const PcRange = struct { |
| 15 | start: u64, | 231 | start: u64, |
| ... | @@ -322,43 +538,43 @@ fn parseFormValueRef(allocator: *mem.Allocator, in_stream: anytype, endian: buil | ... | @@ -322,43 +538,43 @@ fn parseFormValueRef(allocator: *mem.Allocator, in_stream: anytype, endian: buil |
| 322 | // TODO the nosuspends here are workarounds | 538 | // TODO the nosuspends here are workarounds |
| 323 | fn parseFormValue(allocator: *mem.Allocator, in_stream: anytype, form_id: u64, endian: builtin.Endian, is_64: bool) anyerror!FormValue { | 539 | fn parseFormValue(allocator: *mem.Allocator, in_stream: anytype, form_id: u64, endian: builtin.Endian, is_64: bool) anyerror!FormValue { |
| 324 | return switch (form_id) { | 540 | return switch (form_id) { |
| 325 | FORM_addr => FormValue{ .Address = try readAddress(in_stream, endian, @sizeOf(usize) == 8) }, | 541 | FORM.addr => FormValue{ .Address = try readAddress(in_stream, endian, @sizeOf(usize) == 8) }, |
| 326 | FORM_block1 => parseFormValueBlock(allocator, in_stream, endian, 1), | 542 | FORM.block1 => parseFormValueBlock(allocator, in_stream, endian, 1), |
| 327 | FORM_block2 => parseFormValueBlock(allocator, in_stream, endian, 2), | 543 | FORM.block2 => parseFormValueBlock(allocator, in_stream, endian, 2), |
| 328 | FORM_block4 => parseFormValueBlock(allocator, in_stream, endian, 4), | 544 | FORM.block4 => parseFormValueBlock(allocator, in_stream, endian, 4), |
| 329 | FORM_block => { | 545 | FORM.block => { |
| 330 | const block_len = try nosuspend leb.readULEB128(usize, in_stream); | 546 | const block_len = try nosuspend leb.readULEB128(usize, in_stream); |
| 331 | return parseFormValueBlockLen(allocator, in_stream, block_len); | 547 | return parseFormValueBlockLen(allocator, in_stream, block_len); |
| 332 | }, | 548 | }, |
| 333 | FORM_data1 => parseFormValueConstant(allocator, in_stream, false, endian, 1), | 549 | FORM.data1 => parseFormValueConstant(allocator, in_stream, false, endian, 1), |
| 334 | FORM_data2 => parseFormValueConstant(allocator, in_stream, false, endian, 2), | 550 | FORM.data2 => parseFormValueConstant(allocator, in_stream, false, endian, 2), |
| 335 | FORM_data4 => parseFormValueConstant(allocator, in_stream, false, endian, 4), | 551 | FORM.data4 => parseFormValueConstant(allocator, in_stream, false, endian, 4), |
| 336 | FORM_data8 => parseFormValueConstant(allocator, in_stream, false, endian, 8), | 552 | FORM.data8 => parseFormValueConstant(allocator, in_stream, false, endian, 8), |
| 337 | FORM_udata, FORM_sdata => { | 553 | FORM.udata, FORM.sdata => { |
| 338 | const signed = form_id == FORM_sdata; | 554 | const signed = form_id == FORM.sdata; |
| 339 | return parseFormValueConstant(allocator, in_stream, signed, endian, -1); | 555 | return parseFormValueConstant(allocator, in_stream, signed, endian, -1); |
| 340 | }, | 556 | }, |
| 341 | FORM_exprloc => { | 557 | FORM.exprloc => { |
| 342 | const size = try nosuspend leb.readULEB128(usize, in_stream); | 558 | const size = try nosuspend leb.readULEB128(usize, in_stream); |
| 343 | const buf = try readAllocBytes(allocator, in_stream, size); | 559 | const buf = try readAllocBytes(allocator, in_stream, size); |
| 344 | return FormValue{ .ExprLoc = buf }; | 560 | return FormValue{ .ExprLoc = buf }; |
| 345 | }, | 561 | }, |
| 346 | FORM_flag => FormValue{ .Flag = (try nosuspend in_stream.readByte()) != 0 }, | 562 | FORM.flag => FormValue{ .Flag = (try nosuspend in_stream.readByte()) != 0 }, |
| 347 | FORM_flag_present => FormValue{ .Flag = true }, | 563 | FORM.flag_present => FormValue{ .Flag = true }, |
| 348 | FORM_sec_offset => FormValue{ .SecOffset = try readAddress(in_stream, endian, is_64) }, | 564 | FORM.sec_offset => FormValue{ .SecOffset = try readAddress(in_stream, endian, is_64) }, |
| 349 | 565 | ||
| 350 | FORM_ref1 => parseFormValueRef(allocator, in_stream, endian, 1), | 566 | FORM.ref1 => parseFormValueRef(allocator, in_stream, endian, 1), |
| 351 | FORM_ref2 => parseFormValueRef(allocator, in_stream, endian, 2), | 567 | FORM.ref2 => parseFormValueRef(allocator, in_stream, endian, 2), |
| 352 | FORM_ref4 => parseFormValueRef(allocator, in_stream, endian, 4), | 568 | FORM.ref4 => parseFormValueRef(allocator, in_stream, endian, 4), |
| 353 | FORM_ref8 => parseFormValueRef(allocator, in_stream, endian, 8), | 569 | FORM.ref8 => parseFormValueRef(allocator, in_stream, endian, 8), |
| 354 | FORM_ref_udata => parseFormValueRef(allocator, in_stream, endian, -1), | 570 | FORM.ref_udata => parseFormValueRef(allocator, in_stream, endian, -1), |
| 355 | 571 | ||
| 356 | FORM_ref_addr => FormValue{ .RefAddr = try readAddress(in_stream, endian, is_64) }, | 572 | FORM.ref_addr => FormValue{ .RefAddr = try readAddress(in_stream, endian, is_64) }, |
| 357 | FORM_ref_sig8 => FormValue{ .Ref = try nosuspend in_stream.readInt(u64, endian) }, | 573 | FORM.ref_sig8 => FormValue{ .Ref = try nosuspend in_stream.readInt(u64, endian) }, |
| 358 | 574 | ||
| 359 | FORM_string => FormValue{ .String = try in_stream.readUntilDelimiterAlloc(allocator, 0, math.maxInt(usize)) }, | 575 | FORM.string => FormValue{ .String = try in_stream.readUntilDelimiterAlloc(allocator, 0, math.maxInt(usize)) }, |
| 360 | FORM_strp => FormValue{ .StrPtr = try readAddress(in_stream, endian, is_64) }, | 576 | FORM.strp => FormValue{ .StrPtr = try readAddress(in_stream, endian, is_64) }, |
| 361 | FORM_indirect => { | 577 | FORM.indirect => { |
| 362 | const child_form_id = try nosuspend leb.readULEB128(u64, in_stream); | 578 | const child_form_id = try nosuspend leb.readULEB128(u64, in_stream); |
| 363 | const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64)); | 579 | const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64)); |
| 364 | var frame = try allocator.create(F); | 580 | var frame = try allocator.create(F); |
| ... | @@ -441,24 +657,24 @@ pub const DwarfInfo = struct { | ... | @@ -441,24 +657,24 @@ pub const DwarfInfo = struct { |
| 441 | const after_die_offset = try seekable.getPos(); | 657 | const after_die_offset = try seekable.getPos(); |
| 442 | 658 | ||
| 443 | switch (die_obj.tag_id) { | 659 | switch (die_obj.tag_id) { |
| 444 | TAG_subprogram, TAG_inlined_subroutine, TAG_subroutine, TAG_entry_point => { | 660 | TAG.subprogram, TAG.inlined_subroutine, TAG.subroutine, TAG.entry_point => { |
| 445 | const fn_name = x: { | 661 | const fn_name = x: { |
| 446 | var depth: i32 = 3; | 662 | var depth: i32 = 3; |
| 447 | var this_die_obj = die_obj; | 663 | var this_die_obj = die_obj; |
| 448 | // Prenvent endless loops | 664 | // Prenvent endless loops |
| 449 | while (depth > 0) : (depth -= 1) { | 665 | while (depth > 0) : (depth -= 1) { |
| 450 | if (this_die_obj.getAttr(AT_name)) |_| { | 666 | if (this_die_obj.getAttr(AT.name)) |_| { |
| 451 | const name = try this_die_obj.getAttrString(di, AT_name); | 667 | const name = try this_die_obj.getAttrString(di, AT.name); |
| 452 | break :x name; | 668 | break :x name; |
| 453 | } else if (this_die_obj.getAttr(AT_abstract_origin)) |_| { | 669 | } else if (this_die_obj.getAttr(AT.abstract_origin)) |_| { |
| 454 | // Follow the DIE it points to and repeat | 670 | // Follow the DIE it points to and repeat |
| 455 | const ref_offset = try this_die_obj.getAttrRef(AT_abstract_origin); | 671 | const ref_offset = try this_die_obj.getAttrRef(AT.abstract_origin); |
| 456 | if (ref_offset > next_offset) return error.InvalidDebugInfo; | 672 | if (ref_offset > next_offset) return error.InvalidDebugInfo; |
| 457 | try seekable.seekTo(this_unit_offset + ref_offset); | 673 | try seekable.seekTo(this_unit_offset + ref_offset); |
| 458 | this_die_obj = (try di.parseDie(in, abbrev_table, is_64)) orelse return error.InvalidDebugInfo; | 674 | this_die_obj = (try di.parseDie(in, abbrev_table, is_64)) orelse return error.InvalidDebugInfo; |
| 459 | } else if (this_die_obj.getAttr(AT_specification)) |_| { | 675 | } else if (this_die_obj.getAttr(AT.specification)) |_| { |
| 460 | // Follow the DIE it points to and repeat | 676 | // Follow the DIE it points to and repeat |
| 461 | const ref_offset = try this_die_obj.getAttrRef(AT_specification); | 677 | const ref_offset = try this_die_obj.getAttrRef(AT.specification); |
| 462 | if (ref_offset > next_offset) return error.InvalidDebugInfo; | 678 | if (ref_offset > next_offset) return error.InvalidDebugInfo; |
| 463 | try seekable.seekTo(this_unit_offset + ref_offset); | 679 | try seekable.seekTo(this_unit_offset + ref_offset); |
| 464 | this_die_obj = (try di.parseDie(in, abbrev_table, is_64)) orelse return error.InvalidDebugInfo; | 680 | this_die_obj = (try di.parseDie(in, abbrev_table, is_64)) orelse return error.InvalidDebugInfo; |
| ... | @@ -471,8 +687,8 @@ pub const DwarfInfo = struct { | ... | @@ -471,8 +687,8 @@ pub const DwarfInfo = struct { |
| 471 | }; | 687 | }; |
| 472 | 688 | ||
| 473 | const pc_range = x: { | 689 | const pc_range = x: { |
| 474 | if (die_obj.getAttrAddr(AT_low_pc)) |low_pc| { | 690 | if (die_obj.getAttrAddr(AT.low_pc)) |low_pc| { |
| 475 | if (die_obj.getAttr(AT_high_pc)) |high_pc_value| { | 691 | if (die_obj.getAttr(AT.high_pc)) |high_pc_value| { |
| 476 | const pc_end = switch (high_pc_value.*) { | 692 | const pc_end = switch (high_pc_value.*) { |
| 477 | FormValue.Address => |value| value, | 693 | FormValue.Address => |value| value, |
| 478 | FormValue.Const => |value| b: { | 694 | FormValue.Const => |value| b: { |
| ... | @@ -539,11 +755,11 @@ pub const DwarfInfo = struct { | ... | @@ -539,11 +755,11 @@ pub const DwarfInfo = struct { |
| 539 | const compile_unit_die = try di.allocator().create(Die); | 755 | const compile_unit_die = try di.allocator().create(Die); |
| 540 | compile_unit_die.* = (try di.parseDie(in, abbrev_table, is_64)) orelse return error.InvalidDebugInfo; | 756 | compile_unit_die.* = (try di.parseDie(in, abbrev_table, is_64)) orelse return error.InvalidDebugInfo; |
| 541 | 757 | ||
| 542 | if (compile_unit_die.tag_id != TAG_compile_unit) return error.InvalidDebugInfo; | 758 | if (compile_unit_die.tag_id != TAG.compile_unit) return error.InvalidDebugInfo; |
| 543 | 759 | ||
| 544 | const pc_range = x: { | 760 | const pc_range = x: { |
| 545 | if (compile_unit_die.getAttrAddr(AT_low_pc)) |low_pc| { | 761 | if (compile_unit_die.getAttrAddr(AT.low_pc)) |low_pc| { |
| 546 | if (compile_unit_die.getAttr(AT_high_pc)) |high_pc_value| { | 762 | if (compile_unit_die.getAttr(AT.high_pc)) |high_pc_value| { |
| 547 | const pc_end = switch (high_pc_value.*) { | 763 | const pc_end = switch (high_pc_value.*) { |
| 548 | FormValue.Address => |value| value, | 764 | FormValue.Address => |value| value, |
| 549 | FormValue.Const => |value| b: { | 765 | FormValue.Const => |value| b: { |
| ... | @@ -582,16 +798,16 @@ pub const DwarfInfo = struct { | ... | @@ -582,16 +798,16 @@ pub const DwarfInfo = struct { |
| 582 | if (target_address >= range.start and target_address < range.end) return compile_unit; | 798 | if (target_address >= range.start and target_address < range.end) return compile_unit; |
| 583 | } | 799 | } |
| 584 | if (di.debug_ranges) |debug_ranges| { | 800 | if (di.debug_ranges) |debug_ranges| { |
| 585 | if (compile_unit.die.getAttrSecOffset(AT_ranges)) |ranges_offset| { | 801 | if (compile_unit.die.getAttrSecOffset(AT.ranges)) |ranges_offset| { |
| 586 | var stream = io.fixedBufferStream(debug_ranges); | 802 | var stream = io.fixedBufferStream(debug_ranges); |
| 587 | const in = &stream.reader(); | 803 | const in = &stream.reader(); |
| 588 | const seekable = &stream.seekableStream(); | 804 | const seekable = &stream.seekableStream(); |
| 589 | 805 | ||
| 590 | // All the addresses in the list are relative to the value | 806 | // All the addresses in the list are relative to the value |
| 591 | // specified by DW_AT_low_pc or to some other value encoded | 807 | // specified by DW_AT.low_pc or to some other value encoded |
| 592 | // in the list itself. | 808 | // in the list itself. |
| 593 | // If no starting value is specified use zero. | 809 | // If no starting value is specified use zero. |
| 594 | var base_address = compile_unit.die.getAttrAddr(AT_low_pc) catch |err| switch (err) { | 810 | var base_address = compile_unit.die.getAttrAddr(AT.low_pc) catch |err| switch (err) { |
| 595 | error.MissingDebugInfo => 0, | 811 | error.MissingDebugInfo => 0, |
| 596 | else => return err, | 812 | else => return err, |
| 597 | }; | 813 | }; |
| ... | @@ -651,7 +867,7 @@ pub const DwarfInfo = struct { | ... | @@ -651,7 +867,7 @@ pub const DwarfInfo = struct { |
| 651 | try result.append(AbbrevTableEntry{ | 867 | try result.append(AbbrevTableEntry{ |
| 652 | .abbrev_code = abbrev_code, | 868 | .abbrev_code = abbrev_code, |
| 653 | .tag_id = try leb.readULEB128(u64, in), | 869 | .tag_id = try leb.readULEB128(u64, in), |
| 654 | .has_children = (try in.readByte()) == CHILDREN_yes, | 870 | .has_children = (try in.readByte()) == CHILDREN.yes, |
| 655 | .attrs = ArrayList(AbbrevAttr).init(di.allocator()), | 871 | .attrs = ArrayList(AbbrevAttr).init(di.allocator()), |
| 656 | }); | 872 | }); |
| 657 | const attrs = &result.items[result.items.len - 1].attrs; | 873 | const attrs = &result.items[result.items.len - 1].attrs; |
| ... | @@ -693,8 +909,8 @@ pub const DwarfInfo = struct { | ... | @@ -693,8 +909,8 @@ pub const DwarfInfo = struct { |
| 693 | const in = &stream.reader(); | 909 | const in = &stream.reader(); |
| 694 | const seekable = &stream.seekableStream(); | 910 | const seekable = &stream.seekableStream(); |
| 695 | 911 | ||
| 696 | const compile_unit_cwd = try compile_unit.die.getAttrString(di, AT_comp_dir); | 912 | const compile_unit_cwd = try compile_unit.die.getAttrString(di, AT.comp_dir); |
| 697 | const line_info_offset = try compile_unit.die.getAttrSecOffset(AT_stmt_list); | 913 | const line_info_offset = try compile_unit.die.getAttrSecOffset(AT.stmt_list); |
| 698 | 914 | ||
| 699 | try seekable.seekTo(line_info_offset); | 915 | try seekable.seekTo(line_info_offset); |
| 700 | 916 | ||
| ... | @@ -769,21 +985,21 @@ pub const DwarfInfo = struct { | ... | @@ -769,21 +985,21 @@ pub const DwarfInfo = struct { |
| 769 | while ((try seekable.getPos()) < next_unit_pos) { | 985 | while ((try seekable.getPos()) < next_unit_pos) { |
| 770 | const opcode = try in.readByte(); | 986 | const opcode = try in.readByte(); |
| 771 | 987 | ||
| 772 | if (opcode == LNS_extended_op) { | 988 | if (opcode == LNS.extended_op) { |
| 773 | const op_size = try leb.readULEB128(u64, in); | 989 | const op_size = try leb.readULEB128(u64, in); |
| 774 | if (op_size < 1) return error.InvalidDebugInfo; | 990 | if (op_size < 1) return error.InvalidDebugInfo; |
| 775 | var sub_op = try in.readByte(); | 991 | var sub_op = try in.readByte(); |
| 776 | switch (sub_op) { | 992 | switch (sub_op) { |
| 777 | LNE_end_sequence => { | 993 | LNE.end_sequence => { |
| 778 | prog.end_sequence = true; | 994 | prog.end_sequence = true; |
| 779 | if (try prog.checkLineMatch()) |info| return info; | 995 | if (try prog.checkLineMatch()) |info| return info; |
| 780 | prog.reset(); | 996 | prog.reset(); |
| 781 | }, | 997 | }, |
| 782 | LNE_set_address => { | 998 | LNE.set_address => { |
| 783 | const addr = try in.readInt(usize, di.endian); | 999 | const addr = try in.readInt(usize, di.endian); |
| 784 | prog.address = addr; | 1000 | prog.address = addr; |
| 785 | }, | 1001 | }, |
| 786 | LNE_define_file => { | 1002 | LNE.define_file => { |
| 787 | const file_name = try in.readUntilDelimiterAlloc(di.allocator(), 0, math.maxInt(usize)); | 1003 | const file_name = try in.readUntilDelimiterAlloc(di.allocator(), 0, math.maxInt(usize)); |
| 788 | const dir_index = try leb.readULEB128(usize, in); | 1004 | const dir_index = try leb.readULEB128(usize, in); |
| 789 | const mtime = try leb.readULEB128(usize, in); | 1005 | const mtime = try leb.readULEB128(usize, in); |
| ... | @@ -811,41 +1027,41 @@ pub const DwarfInfo = struct { | ... | @@ -811,41 +1027,41 @@ pub const DwarfInfo = struct { |
| 811 | prog.basic_block = false; | 1027 | prog.basic_block = false; |
| 812 | } else { | 1028 | } else { |
| 813 | switch (opcode) { | 1029 | switch (opcode) { |
| 814 | LNS_copy => { | 1030 | LNS.copy => { |
| 815 | if (try prog.checkLineMatch()) |info| return info; | 1031 | if (try prog.checkLineMatch()) |info| return info; |
| 816 | prog.basic_block = false; | 1032 | prog.basic_block = false; |
| 817 | }, | 1033 | }, |
| 818 | LNS_advance_pc => { | 1034 | LNS.advance_pc => { |
| 819 | const arg = try leb.readULEB128(usize, in); | 1035 | const arg = try leb.readULEB128(usize, in); |
| 820 | prog.address += arg * minimum_instruction_length; | 1036 | prog.address += arg * minimum_instruction_length; |
| 821 | }, | 1037 | }, |
| 822 | LNS_advance_line => { | 1038 | LNS.advance_line => { |
| 823 | const arg = try leb.readILEB128(i64, in); | 1039 | const arg = try leb.readILEB128(i64, in); |
| 824 | prog.line += arg; | 1040 | prog.line += arg; |
| 825 | }, | 1041 | }, |
| 826 | LNS_set_file => { | 1042 | LNS.set_file => { |
| 827 | const arg = try leb.readULEB128(usize, in); | 1043 | const arg = try leb.readULEB128(usize, in); |
| 828 | prog.file = arg; | 1044 | prog.file = arg; |
| 829 | }, | 1045 | }, |
| 830 | LNS_set_column => { | 1046 | LNS.set_column => { |
| 831 | const arg = try leb.readULEB128(u64, in); | 1047 | const arg = try leb.readULEB128(u64, in); |
| 832 | prog.column = arg; | 1048 | prog.column = arg; |
| 833 | }, | 1049 | }, |
| 834 | LNS_negate_stmt => { | 1050 | LNS.negate_stmt => { |
| 835 | prog.is_stmt = !prog.is_stmt; | 1051 | prog.is_stmt = !prog.is_stmt; |
| 836 | }, | 1052 | }, |
| 837 | LNS_set_basic_block => { | 1053 | LNS.set_basic_block => { |
| 838 | prog.basic_block = true; | 1054 | prog.basic_block = true; |
| 839 | }, | 1055 | }, |
| 840 | LNS_const_add_pc => { | 1056 | LNS.const_add_pc => { |
| 841 | const inc_addr = minimum_instruction_length * ((255 - opcode_base) / line_range); | 1057 | const inc_addr = minimum_instruction_length * ((255 - opcode_base) / line_range); |
| 842 | prog.address += inc_addr; | 1058 | prog.address += inc_addr; |
| 843 | }, | 1059 | }, |
| 844 | LNS_fixed_advance_pc => { | 1060 | LNS.fixed_advance_pc => { |
| 845 | const arg = try in.readInt(u16, di.endian); | 1061 | const arg = try in.readInt(u16, di.endian); |
| 846 | prog.address += arg; | 1062 | prog.address += arg; |
| 847 | }, | 1063 | }, |
| 848 | LNS_set_prologue_end => {}, | 1064 | LNS.set_prologue_end => {}, |
| 849 | else => { | 1065 | else => { |
| 850 | if (opcode - 1 >= standard_opcode_lengths.len) return error.InvalidDebugInfo; | 1066 | if (opcode - 1 >= standard_opcode_lengths.len) return error.InvalidDebugInfo; |
| 851 | const len_bytes = standard_opcode_lengths[opcode - 1]; | 1067 | const len_bytes = standard_opcode_lengths[opcode - 1]; |
lib/std/dwarf/AT.zig created+198| ... | @@ -0,0 +1,198 @@ | ||
| 1 | pub const sibling = 0x01; | ||
| 2 | pub const location = 0x02; | ||
| 3 | pub const name = 0x03; | ||
| 4 | pub const ordering = 0x09; | ||
| 5 | pub const subscr_data = 0x0a; | ||
| 6 | pub const byte_size = 0x0b; | ||
| 7 | pub const bit_offset = 0x0c; | ||
| 8 | pub const bit_size = 0x0d; | ||
| 9 | pub const element_list = 0x0f; | ||
| 10 | pub const stmt_list = 0x10; | ||
| 11 | pub const low_pc = 0x11; | ||
| 12 | pub const high_pc = 0x12; | ||
| 13 | pub const language = 0x13; | ||
| 14 | pub const member = 0x14; | ||
| 15 | pub const discr = 0x15; | ||
| 16 | pub const discr_value = 0x16; | ||
| 17 | pub const visibility = 0x17; | ||
| 18 | pub const import = 0x18; | ||
| 19 | pub const string_length = 0x19; | ||
| 20 | pub const common_reference = 0x1a; | ||
| 21 | pub const comp_dir = 0x1b; | ||
| 22 | pub const const_value = 0x1c; | ||
| 23 | pub const containing_type = 0x1d; | ||
| 24 | pub const default_value = 0x1e; | ||
| 25 | pub const @"inline" = 0x20; | ||
| 26 | pub const is_optional = 0x21; | ||
| 27 | pub const lower_bound = 0x22; | ||
| 28 | pub const producer = 0x25; | ||
| 29 | pub const prototyped = 0x27; | ||
| 30 | pub const return_addr = 0x2a; | ||
| 31 | pub const start_scope = 0x2c; | ||
| 32 | pub const bit_stride = 0x2e; | ||
| 33 | pub const upper_bound = 0x2f; | ||
| 34 | pub const abstract_origin = 0x31; | ||
| 35 | pub const accessibility = 0x32; | ||
| 36 | pub const address_class = 0x33; | ||
| 37 | pub const artificial = 0x34; | ||
| 38 | pub const base_types = 0x35; | ||
| 39 | pub const calling_convention = 0x36; | ||
| 40 | pub const count = 0x37; | ||
| 41 | pub const data_member_location = 0x38; | ||
| 42 | pub const decl_column = 0x39; | ||
| 43 | pub const decl_file = 0x3a; | ||
| 44 | pub const decl_line = 0x3b; | ||
| 45 | pub const declaration = 0x3c; | ||
| 46 | pub const discr_list = 0x3d; | ||
| 47 | pub const encoding = 0x3e; | ||
| 48 | pub const external = 0x3f; | ||
| 49 | pub const frame_base = 0x40; | ||
| 50 | pub const friend = 0x41; | ||
| 51 | pub const identifier_case = 0x42; | ||
| 52 | pub const macro_info = 0x43; | ||
| 53 | pub const namelist_items = 0x44; | ||
| 54 | pub const priority = 0x45; | ||
| 55 | pub const segment = 0x46; | ||
| 56 | pub const specification = 0x47; | ||
| 57 | pub const static_link = 0x48; | ||
| 58 | pub const @"type" = 0x49; | ||
| 59 | pub const use_location = 0x4a; | ||
| 60 | pub const variable_parameter = 0x4b; | ||
| 61 | pub const virtuality = 0x4c; | ||
| 62 | pub const vtable_elem_location = 0x4d; | ||
| 63 | |||
| 64 | // DWARF 3 values. | ||
| 65 | pub const allocated = 0x4e; | ||
| 66 | pub const associated = 0x4f; | ||
| 67 | pub const data_location = 0x50; | ||
| 68 | pub const byte_stride = 0x51; | ||
| 69 | pub const entry_pc = 0x52; | ||
| 70 | pub const use_UTF8 = 0x53; | ||
| 71 | pub const extension = 0x54; | ||
| 72 | pub const ranges = 0x55; | ||
| 73 | pub const trampoline = 0x56; | ||
| 74 | pub const call_column = 0x57; | ||
| 75 | pub const call_file = 0x58; | ||
| 76 | pub const call_line = 0x59; | ||
| 77 | pub const description = 0x5a; | ||
| 78 | pub const binary_scale = 0x5b; | ||
| 79 | pub const decimal_scale = 0x5c; | ||
| 80 | pub const small = 0x5d; | ||
| 81 | pub const decimal_sign = 0x5e; | ||
| 82 | pub const digit_count = 0x5f; | ||
| 83 | pub const picture_string = 0x60; | ||
| 84 | pub const mutable = 0x61; | ||
| 85 | pub const threads_scaled = 0x62; | ||
| 86 | pub const explicit = 0x63; | ||
| 87 | pub const object_pointer = 0x64; | ||
| 88 | pub const endianity = 0x65; | ||
| 89 | pub const elemental = 0x66; | ||
| 90 | pub const pure = 0x67; | ||
| 91 | pub const recursive = 0x68; | ||
| 92 | |||
| 93 | // DWARF 4. | ||
| 94 | pub const signature = 0x69; | ||
| 95 | pub const main_subprogram = 0x6a; | ||
| 96 | pub const data_bit_offset = 0x6b; | ||
| 97 | pub const const_expr = 0x6c; | ||
| 98 | pub const enum_class = 0x6d; | ||
| 99 | pub const linkage_name = 0x6e; | ||
| 100 | |||
| 101 | // DWARF 5 | ||
| 102 | pub const alignment = 0x88; | ||
| 103 | |||
| 104 | pub const lo_user = 0x2000; // Implementation-defined range start. | ||
| 105 | pub const hi_user = 0x3fff; // Implementation-defined range end. | ||
| 106 | |||
| 107 | // SGI/MIPS extensions. | ||
| 108 | pub const MIPS_fde = 0x2001; | ||
| 109 | pub const MIPS_loop_begin = 0x2002; | ||
| 110 | pub const MIPS_tail_loop_begin = 0x2003; | ||
| 111 | pub const MIPS_epilog_begin = 0x2004; | ||
| 112 | pub const MIPS_loop_unroll_factor = 0x2005; | ||
| 113 | pub const MIPS_software_pipeline_depth = 0x2006; | ||
| 114 | pub const MIPS_linkage_name = 0x2007; | ||
| 115 | pub const MIPS_stride = 0x2008; | ||
| 116 | pub const MIPS_abstract_name = 0x2009; | ||
| 117 | pub const MIPS_clone_origin = 0x200a; | ||
| 118 | pub const MIPS_has_inlines = 0x200b; | ||
| 119 | |||
| 120 | // HP extensions. | ||
| 121 | pub const HP_block_index = 0x2000; | ||
| 122 | pub const HP_unmodifiable = 0x2001; // Same as AT.MIPS_fde. | ||
| 123 | pub const HP_prologue = 0x2005; // Same as AT.MIPS_loop_unroll. | ||
| 124 | pub const HP_epilogue = 0x2008; // Same as AT.MIPS_stride. | ||
| 125 | pub const HP_actuals_stmt_list = 0x2010; | ||
| 126 | pub const HP_proc_per_section = 0x2011; | ||
| 127 | pub const HP_raw_data_ptr = 0x2012; | ||
| 128 | pub const HP_pass_by_reference = 0x2013; | ||
| 129 | pub const HP_opt_level = 0x2014; | ||
| 130 | pub const HP_prof_version_id = 0x2015; | ||
| 131 | pub const HP_opt_flags = 0x2016; | ||
| 132 | pub const HP_cold_region_low_pc = 0x2017; | ||
| 133 | pub const HP_cold_region_high_pc = 0x2018; | ||
| 134 | pub const HP_all_variables_modifiable = 0x2019; | ||
| 135 | pub const HP_linkage_name = 0x201a; | ||
| 136 | pub const HP_prof_flags = 0x201b; // In comp unit of procs_info for -g. | ||
| 137 | pub const HP_unit_name = 0x201f; | ||
| 138 | pub const HP_unit_size = 0x2020; | ||
| 139 | pub const HP_widened_byte_size = 0x2021; | ||
| 140 | pub const HP_definition_points = 0x2022; | ||
| 141 | pub const HP_default_location = 0x2023; | ||
| 142 | pub const HP_is_result_param = 0x2029; | ||
| 143 | |||
| 144 | // GNU extensions. | ||
| 145 | pub const sf_names = 0x2101; | ||
| 146 | pub const src_info = 0x2102; | ||
| 147 | pub const mac_info = 0x2103; | ||
| 148 | pub const src_coords = 0x2104; | ||
| 149 | pub const body_begin = 0x2105; | ||
| 150 | pub const body_end = 0x2106; | ||
| 151 | pub const GNU_vector = 0x2107; | ||
| 152 | // Thread-safety annotations. | ||
| 153 | // See http://gcc.gnu.org/wiki/ThreadSafetyAnnotation . | ||
| 154 | pub const GNU_guarded_by = 0x2108; | ||
| 155 | pub const GNU_pt_guarded_by = 0x2109; | ||
| 156 | pub const GNU_guarded = 0x210a; | ||
| 157 | pub const GNU_pt_guarded = 0x210b; | ||
| 158 | pub const GNU_locks_excluded = 0x210c; | ||
| 159 | pub const GNU_exclusive_locks_required = 0x210d; | ||
| 160 | pub const GNU_shared_locks_required = 0x210e; | ||
| 161 | // One-definition rule violation detection. | ||
| 162 | // See http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo . | ||
| 163 | pub const GNU_odr_signature = 0x210f; | ||
| 164 | // Template template argument name. | ||
| 165 | // See http://gcc.gnu.org/wiki/TemplateParmsDwarf . | ||
| 166 | pub const GNU_template_name = 0x2110; | ||
| 167 | // The GNU call site extension. | ||
| 168 | // See http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open . | ||
| 169 | pub const GNU_call_site_value = 0x2111; | ||
| 170 | pub const GNU_call_site_data_value = 0x2112; | ||
| 171 | pub const GNU_call_site_target = 0x2113; | ||
| 172 | pub const GNU_call_site_target_clobbered = 0x2114; | ||
| 173 | pub const GNU_tail_call = 0x2115; | ||
| 174 | pub const GNU_all_tail_call_sites = 0x2116; | ||
| 175 | pub const GNU_all_call_sites = 0x2117; | ||
| 176 | pub const GNU_all_source_call_sites = 0x2118; | ||
| 177 | // Section offset into .debug_macro section. | ||
| 178 | pub const GNU_macros = 0x2119; | ||
| 179 | // Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFission. | ||
| 180 | pub const GNU_dwo_name = 0x2130; | ||
| 181 | pub const GNU_dwo_id = 0x2131; | ||
| 182 | pub const GNU_ranges_base = 0x2132; | ||
| 183 | pub const GNU_addr_base = 0x2133; | ||
| 184 | pub const GNU_pubnames = 0x2134; | ||
| 185 | pub const GNU_pubtypes = 0x2135; | ||
| 186 | // VMS extensions. | ||
| 187 | pub const VMS_rtnbeg_pd_address = 0x2201; | ||
| 188 | // GNAT extensions. | ||
| 189 | // GNAT descriptive type. | ||
| 190 | // See http://gcc.gnu.org/wiki/DW_AT_GNAT_descriptive_type . | ||
| 191 | pub const use_GNAT_descriptive_type = 0x2301; | ||
| 192 | pub const GNAT_descriptive_type = 0x2302; | ||
| 193 | // UPC extension. | ||
| 194 | pub const upc_threads_scaled = 0x3210; | ||
| 195 | // PGI (STMicroelectronics) extensions. | ||
| 196 | pub const PGI_lbase = 0x3a00; | ||
| 197 | pub const PGI_soffset = 0x3a01; | ||
| 198 | pub const PGI_lstride = 0x3a02; | ||
lib/std/dwarf/OP.zig created+195| ... | @@ -0,0 +1,195 @@ | ||
| 1 | pub const addr = 0x03; | ||
| 2 | pub const deref = 0x06; | ||
| 3 | pub const const1u = 0x08; | ||
| 4 | pub const const1s = 0x09; | ||
| 5 | pub const const2u = 0x0a; | ||
| 6 | pub const const2s = 0x0b; | ||
| 7 | pub const const4u = 0x0c; | ||
| 8 | pub const const4s = 0x0d; | ||
| 9 | pub const const8u = 0x0e; | ||
| 10 | pub const const8s = 0x0f; | ||
| 11 | pub const constu = 0x10; | ||
| 12 | pub const consts = 0x11; | ||
| 13 | pub const dup = 0x12; | ||
| 14 | pub const drop = 0x13; | ||
| 15 | pub const over = 0x14; | ||
| 16 | pub const pick = 0x15; | ||
| 17 | pub const swap = 0x16; | ||
| 18 | pub const rot = 0x17; | ||
| 19 | pub const xderef = 0x18; | ||
| 20 | pub const abs = 0x19; | ||
| 21 | pub const @"and" = 0x1a; | ||
| 22 | pub const div = 0x1b; | ||
| 23 | pub const minus = 0x1c; | ||
| 24 | pub const mod = 0x1d; | ||
| 25 | pub const mul = 0x1e; | ||
| 26 | pub const neg = 0x1f; | ||
| 27 | pub const not = 0x20; | ||
| 28 | pub const @"or" = 0x21; | ||
| 29 | pub const plus = 0x22; | ||
| 30 | pub const plus_uconst = 0x23; | ||
| 31 | pub const shl = 0x24; | ||
| 32 | pub const shr = 0x25; | ||
| 33 | pub const shra = 0x26; | ||
| 34 | pub const xor = 0x27; | ||
| 35 | pub const bra = 0x28; | ||
| 36 | pub const eq = 0x29; | ||
| 37 | pub const ge = 0x2a; | ||
| 38 | pub const gt = 0x2b; | ||
| 39 | pub const le = 0x2c; | ||
| 40 | pub const lt = 0x2d; | ||
| 41 | pub const ne = 0x2e; | ||
| 42 | pub const skip = 0x2f; | ||
| 43 | pub const lit0 = 0x30; | ||
| 44 | pub const lit1 = 0x31; | ||
| 45 | pub const lit2 = 0x32; | ||
| 46 | pub const lit3 = 0x33; | ||
| 47 | pub const lit4 = 0x34; | ||
| 48 | pub const lit5 = 0x35; | ||
| 49 | pub const lit6 = 0x36; | ||
| 50 | pub const lit7 = 0x37; | ||
| 51 | pub const lit8 = 0x38; | ||
| 52 | pub const lit9 = 0x39; | ||
| 53 | pub const lit10 = 0x3a; | ||
| 54 | pub const lit11 = 0x3b; | ||
| 55 | pub const lit12 = 0x3c; | ||
| 56 | pub const lit13 = 0x3d; | ||
| 57 | pub const lit14 = 0x3e; | ||
| 58 | pub const lit15 = 0x3f; | ||
| 59 | pub const lit16 = 0x40; | ||
| 60 | pub const lit17 = 0x41; | ||
| 61 | pub const lit18 = 0x42; | ||
| 62 | pub const lit19 = 0x43; | ||
| 63 | pub const lit20 = 0x44; | ||
| 64 | pub const lit21 = 0x45; | ||
| 65 | pub const lit22 = 0x46; | ||
| 66 | pub const lit23 = 0x47; | ||
| 67 | pub const lit24 = 0x48; | ||
| 68 | pub const lit25 = 0x49; | ||
| 69 | pub const lit26 = 0x4a; | ||
| 70 | pub const lit27 = 0x4b; | ||
| 71 | pub const lit28 = 0x4c; | ||
| 72 | pub const lit29 = 0x4d; | ||
| 73 | pub const lit30 = 0x4e; | ||
| 74 | pub const lit31 = 0x4f; | ||
| 75 | pub const reg0 = 0x50; | ||
| 76 | pub const reg1 = 0x51; | ||
| 77 | pub const reg2 = 0x52; | ||
| 78 | pub const reg3 = 0x53; | ||
| 79 | pub const reg4 = 0x54; | ||
| 80 | pub const reg5 = 0x55; | ||
| 81 | pub const reg6 = 0x56; | ||
| 82 | pub const reg7 = 0x57; | ||
| 83 | pub const reg8 = 0x58; | ||
| 84 | pub const reg9 = 0x59; | ||
| 85 | pub const reg10 = 0x5a; | ||
| 86 | pub const reg11 = 0x5b; | ||
| 87 | pub const reg12 = 0x5c; | ||
| 88 | pub const reg13 = 0x5d; | ||
| 89 | pub const reg14 = 0x5e; | ||
| 90 | pub const reg15 = 0x5f; | ||
| 91 | pub const reg16 = 0x60; | ||
| 92 | pub const reg17 = 0x61; | ||
| 93 | pub const reg18 = 0x62; | ||
| 94 | pub const reg19 = 0x63; | ||
| 95 | pub const reg20 = 0x64; | ||
| 96 | pub const reg21 = 0x65; | ||
| 97 | pub const reg22 = 0x66; | ||
| 98 | pub const reg23 = 0x67; | ||
| 99 | pub const reg24 = 0x68; | ||
| 100 | pub const reg25 = 0x69; | ||
| 101 | pub const reg26 = 0x6a; | ||
| 102 | pub const reg27 = 0x6b; | ||
| 103 | pub const reg28 = 0x6c; | ||
| 104 | pub const reg29 = 0x6d; | ||
| 105 | pub const reg30 = 0x6e; | ||
| 106 | pub const reg31 = 0x6f; | ||
| 107 | pub const breg0 = 0x70; | ||
| 108 | pub const breg1 = 0x71; | ||
| 109 | pub const breg2 = 0x72; | ||
| 110 | pub const breg3 = 0x73; | ||
| 111 | pub const breg4 = 0x74; | ||
| 112 | pub const breg5 = 0x75; | ||
| 113 | pub const breg6 = 0x76; | ||
| 114 | pub const breg7 = 0x77; | ||
| 115 | pub const breg8 = 0x78; | ||
| 116 | pub const breg9 = 0x79; | ||
| 117 | pub const breg10 = 0x7a; | ||
| 118 | pub const breg11 = 0x7b; | ||
| 119 | pub const breg12 = 0x7c; | ||
| 120 | pub const breg13 = 0x7d; | ||
| 121 | pub const breg14 = 0x7e; | ||
| 122 | pub const breg15 = 0x7f; | ||
| 123 | pub const breg16 = 0x80; | ||
| 124 | pub const breg17 = 0x81; | ||
| 125 | pub const breg18 = 0x82; | ||
| 126 | pub const breg19 = 0x83; | ||
| 127 | pub const breg20 = 0x84; | ||
| 128 | pub const breg21 = 0x85; | ||
| 129 | pub const breg22 = 0x86; | ||
| 130 | pub const breg23 = 0x87; | ||
| 131 | pub const breg24 = 0x88; | ||
| 132 | pub const breg25 = 0x89; | ||
| 133 | pub const breg26 = 0x8a; | ||
| 134 | pub const breg27 = 0x8b; | ||
| 135 | pub const breg28 = 0x8c; | ||
| 136 | pub const breg29 = 0x8d; | ||
| 137 | pub const breg30 = 0x8e; | ||
| 138 | pub const breg31 = 0x8f; | ||
| 139 | pub const regx = 0x90; | ||
| 140 | pub const fbreg = 0x91; | ||
| 141 | pub const bregx = 0x92; | ||
| 142 | pub const piece = 0x93; | ||
| 143 | pub const deref_size = 0x94; | ||
| 144 | pub const xderef_size = 0x95; | ||
| 145 | pub const nop = 0x96; | ||
| 146 | |||
| 147 | // DWARF 3 extensions. | ||
| 148 | pub const push_object_address = 0x97; | ||
| 149 | pub const call2 = 0x98; | ||
| 150 | pub const call4 = 0x99; | ||
| 151 | pub const call_ref = 0x9a; | ||
| 152 | pub const form_tls_address = 0x9b; | ||
| 153 | pub const call_frame_cfa = 0x9c; | ||
| 154 | pub const bit_piece = 0x9d; | ||
| 155 | |||
| 156 | // DWARF 4 extensions. | ||
| 157 | pub const implicit_value = 0x9e; | ||
| 158 | pub const stack_value = 0x9f; | ||
| 159 | |||
| 160 | pub const lo_user = 0xe0; // Implementation-defined range start. | ||
| 161 | pub const hi_user = 0xff; // Implementation-defined range end. | ||
| 162 | |||
| 163 | // GNU extensions. | ||
| 164 | pub const GNU_push_tls_address = 0xe0; | ||
| 165 | // The following is for marking variables that are uninitialized. | ||
| 166 | pub const GNU_uninit = 0xf0; | ||
| 167 | pub const GNU_encoded_addr = 0xf1; | ||
| 168 | // The GNU implicit pointer extension. | ||
| 169 | // See http://www.dwarfstd.org/ShowIssue.php?issue=100831.1&type=open . | ||
| 170 | pub const GNU_implicit_pointer = 0xf2; | ||
| 171 | // The GNU entry value extension. | ||
| 172 | // See http://www.dwarfstd.org/ShowIssue.php?issue=100909.1&type=open . | ||
| 173 | pub const GNU_entry_value = 0xf3; | ||
| 174 | // The GNU typed stack extension. | ||
| 175 | // See http://www.dwarfstd.org/doc/040408.1.html . | ||
| 176 | pub const GNU_const_type = 0xf4; | ||
| 177 | pub const GNU_regval_type = 0xf5; | ||
| 178 | pub const GNU_deref_type = 0xf6; | ||
| 179 | pub const GNU_convert = 0xf7; | ||
| 180 | pub const GNU_reinterpret = 0xf9; | ||
| 181 | // The GNU parameter ref extension. | ||
| 182 | pub const GNU_parameter_ref = 0xfa; | ||
| 183 | // Extension for Fission. See http://gcc.gnu.org/wiki/DebugFission. | ||
| 184 | pub const GNU_addr_index = 0xfb; | ||
| 185 | pub const GNU_const_index = 0xfc; | ||
| 186 | // HP extensions. | ||
| 187 | pub const HP_unknown = 0xe0; // Ouch, the same as GNU_push_tls_address. | ||
| 188 | pub const HP_is_value = 0xe1; | ||
| 189 | pub const HP_fltconst4 = 0xe2; | ||
| 190 | pub const HP_fltconst8 = 0xe3; | ||
| 191 | pub const HP_mod_range = 0xe4; | ||
| 192 | pub const HP_unmod_range = 0xe5; | ||
| 193 | pub const HP_tls = 0xe6; | ||
| 194 | // PGI (STMicroelectronics) extensions. | ||
| 195 | pub const PGI_omp_thread_num = 0xf8; | ||
lib/std/dwarf/TAG.zig created+108| ... | @@ -0,0 +1,108 @@ | ||
| 1 | pub const padding = 0x00; | ||
| 2 | pub const array_type = 0x01; | ||
| 3 | pub const class_type = 0x02; | ||
| 4 | pub const entry_point = 0x03; | ||
| 5 | pub const enumeration_type = 0x04; | ||
| 6 | pub const formal_parameter = 0x05; | ||
| 7 | pub const imported_declaration = 0x08; | ||
| 8 | pub const label = 0x0a; | ||
| 9 | pub const lexical_block = 0x0b; | ||
| 10 | pub const member = 0x0d; | ||
| 11 | pub const pointer_type = 0x0f; | ||
| 12 | pub const reference_type = 0x10; | ||
| 13 | pub const compile_unit = 0x11; | ||
| 14 | pub const string_type = 0x12; | ||
| 15 | pub const structure_type = 0x13; | ||
| 16 | pub const subroutine = 0x14; | ||
| 17 | pub const subroutine_type = 0x15; | ||
| 18 | pub const typedef = 0x16; | ||
| 19 | pub const union_type = 0x17; | ||
| 20 | pub const unspecified_parameters = 0x18; | ||
| 21 | pub const variant = 0x19; | ||
| 22 | pub const common_block = 0x1a; | ||
| 23 | pub const common_inclusion = 0x1b; | ||
| 24 | pub const inheritance = 0x1c; | ||
| 25 | pub const inlined_subroutine = 0x1d; | ||
| 26 | pub const module = 0x1e; | ||
| 27 | pub const ptr_to_member_type = 0x1f; | ||
| 28 | pub const set_type = 0x20; | ||
| 29 | pub const subrange_type = 0x21; | ||
| 30 | pub const with_stmt = 0x22; | ||
| 31 | pub const access_declaration = 0x23; | ||
| 32 | pub const base_type = 0x24; | ||
| 33 | pub const catch_block = 0x25; | ||
| 34 | pub const const_type = 0x26; | ||
| 35 | pub const constant = 0x27; | ||
| 36 | pub const enumerator = 0x28; | ||
| 37 | pub const file_type = 0x29; | ||
| 38 | pub const friend = 0x2a; | ||
| 39 | pub const namelist = 0x2b; | ||
| 40 | pub const namelist_item = 0x2c; | ||
| 41 | pub const packed_type = 0x2d; | ||
| 42 | pub const subprogram = 0x2e; | ||
| 43 | pub const template_type_param = 0x2f; | ||
| 44 | pub const template_value_param = 0x30; | ||
| 45 | pub const thrown_type = 0x31; | ||
| 46 | pub const try_block = 0x32; | ||
| 47 | pub const variant_part = 0x33; | ||
| 48 | pub const variable = 0x34; | ||
| 49 | pub const volatile_type = 0x35; | ||
| 50 | |||
| 51 | // DWARF 3 | ||
| 52 | pub const dwarf_procedure = 0x36; | ||
| 53 | pub const restrict_type = 0x37; | ||
| 54 | pub const interface_type = 0x38; | ||
| 55 | pub const namespace = 0x39; | ||
| 56 | pub const imported_module = 0x3a; | ||
| 57 | pub const unspecified_type = 0x3b; | ||
| 58 | pub const partial_unit = 0x3c; | ||
| 59 | pub const imported_unit = 0x3d; | ||
| 60 | pub const condition = 0x3f; | ||
| 61 | pub const shared_type = 0x40; | ||
| 62 | |||
| 63 | // DWARF 4 | ||
| 64 | pub const type_unit = 0x41; | ||
| 65 | pub const rvalue_reference_type = 0x42; | ||
| 66 | pub const template_alias = 0x43; | ||
| 67 | |||
| 68 | pub const lo_user = 0x4080; | ||
| 69 | pub const hi_user = 0xffff; | ||
| 70 | |||
| 71 | // SGI/MIPS Extensions. | ||
| 72 | pub const MIPS_loop = 0x4081; | ||
| 73 | |||
| 74 | // HP extensions. See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz . | ||
| 75 | pub const HP_array_descriptor = 0x4090; | ||
| 76 | pub const HP_Bliss_field = 0x4091; | ||
| 77 | pub const HP_Bliss_field_set = 0x4092; | ||
| 78 | |||
| 79 | // GNU extensions. | ||
| 80 | pub const format_label = 0x4101; // For FORTRAN 77 and Fortran 90. | ||
| 81 | pub const function_template = 0x4102; // For C++. | ||
| 82 | pub const class_template = 0x4103; //For C++. | ||
| 83 | pub const GNU_BINCL = 0x4104; | ||
| 84 | pub const GNU_EINCL = 0x4105; | ||
| 85 | |||
| 86 | // Template template parameter. | ||
| 87 | // See http://gcc.gnu.org/wiki/TemplateParmsDwarf . | ||
| 88 | pub const GNU_template_template_param = 0x4106; | ||
| 89 | |||
| 90 | // Template parameter pack extension = specified at | ||
| 91 | // http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates | ||
| 92 | // The values of these two TAGS are in the DW_TAG_GNU_* space until the tags | ||
| 93 | // are properly part of DWARF 5. | ||
| 94 | pub const GNU_template_parameter_pack = 0x4107; | ||
| 95 | pub const GNU_formal_parameter_pack = 0x4108; | ||
| 96 | // The GNU call site extension = specified at | ||
| 97 | // http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open . | ||
| 98 | // The values of these two TAGS are in the DW_TAG_GNU_* space until the tags | ||
| 99 | // are properly part of DWARF 5. | ||
| 100 | pub const GNU_call_site = 0x4109; | ||
| 101 | pub const GNU_call_site_parameter = 0x410a; | ||
| 102 | // Extensions for UPC. See: http://dwarfstd.org/doc/DWARF4.pdf. | ||
| 103 | pub const upc_shared_type = 0x8765; | ||
| 104 | pub const upc_strict_type = 0x8766; | ||
| 105 | pub const upc_relaxed_type = 0x8767; | ||
| 106 | // PGI (STMicroelectronics; extensions. No documentation available. | ||
| 107 | pub const PGI_kanji_type = 0xA000; | ||
| 108 | pub const PGI_interface_block = 0xA020; | ||
lib/std/dwarf_bits.zig deleted-699| ... | @@ -1,699 +0,0 @@ | ||
| 1 | pub const TAG_padding = 0x00; | ||
| 2 | pub const TAG_array_type = 0x01; | ||
| 3 | pub const TAG_class_type = 0x02; | ||
| 4 | pub const TAG_entry_point = 0x03; | ||
| 5 | pub const TAG_enumeration_type = 0x04; | ||
| 6 | pub const TAG_formal_parameter = 0x05; | ||
| 7 | pub const TAG_imported_declaration = 0x08; | ||
| 8 | pub const TAG_label = 0x0a; | ||
| 9 | pub const TAG_lexical_block = 0x0b; | ||
| 10 | pub const TAG_member = 0x0d; | ||
| 11 | pub const TAG_pointer_type = 0x0f; | ||
| 12 | pub const TAG_reference_type = 0x10; | ||
| 13 | pub const TAG_compile_unit = 0x11; | ||
| 14 | pub const TAG_string_type = 0x12; | ||
| 15 | pub const TAG_structure_type = 0x13; | ||
| 16 | pub const TAG_subroutine = 0x14; | ||
| 17 | pub const TAG_subroutine_type = 0x15; | ||
| 18 | pub const TAG_typedef = 0x16; | ||
| 19 | pub const TAG_union_type = 0x17; | ||
| 20 | pub const TAG_unspecified_parameters = 0x18; | ||
| 21 | pub const TAG_variant = 0x19; | ||
| 22 | pub const TAG_common_block = 0x1a; | ||
| 23 | pub const TAG_common_inclusion = 0x1b; | ||
| 24 | pub const TAG_inheritance = 0x1c; | ||
| 25 | pub const TAG_inlined_subroutine = 0x1d; | ||
| 26 | pub const TAG_module = 0x1e; | ||
| 27 | pub const TAG_ptr_to_member_type = 0x1f; | ||
| 28 | pub const TAG_set_type = 0x20; | ||
| 29 | pub const TAG_subrange_type = 0x21; | ||
| 30 | pub const TAG_with_stmt = 0x22; | ||
| 31 | pub const TAG_access_declaration = 0x23; | ||
| 32 | pub const TAG_base_type = 0x24; | ||
| 33 | pub const TAG_catch_block = 0x25; | ||
| 34 | pub const TAG_const_type = 0x26; | ||
| 35 | pub const TAG_constant = 0x27; | ||
| 36 | pub const TAG_enumerator = 0x28; | ||
| 37 | pub const TAG_file_type = 0x29; | ||
| 38 | pub const TAG_friend = 0x2a; | ||
| 39 | pub const TAG_namelist = 0x2b; | ||
| 40 | pub const TAG_namelist_item = 0x2c; | ||
| 41 | pub const TAG_packed_type = 0x2d; | ||
| 42 | pub const TAG_subprogram = 0x2e; | ||
| 43 | pub const TAG_template_type_param = 0x2f; | ||
| 44 | pub const TAG_template_value_param = 0x30; | ||
| 45 | pub const TAG_thrown_type = 0x31; | ||
| 46 | pub const TAG_try_block = 0x32; | ||
| 47 | pub const TAG_variant_part = 0x33; | ||
| 48 | pub const TAG_variable = 0x34; | ||
| 49 | pub const TAG_volatile_type = 0x35; | ||
| 50 | |||
| 51 | // DWARF 3 | ||
| 52 | pub const TAG_dwarf_procedure = 0x36; | ||
| 53 | pub const TAG_restrict_type = 0x37; | ||
| 54 | pub const TAG_interface_type = 0x38; | ||
| 55 | pub const TAG_namespace = 0x39; | ||
| 56 | pub const TAG_imported_module = 0x3a; | ||
| 57 | pub const TAG_unspecified_type = 0x3b; | ||
| 58 | pub const TAG_partial_unit = 0x3c; | ||
| 59 | pub const TAG_imported_unit = 0x3d; | ||
| 60 | pub const TAG_condition = 0x3f; | ||
| 61 | pub const TAG_shared_type = 0x40; | ||
| 62 | |||
| 63 | // DWARF 4 | ||
| 64 | pub const TAG_type_unit = 0x41; | ||
| 65 | pub const TAG_rvalue_reference_type = 0x42; | ||
| 66 | pub const TAG_template_alias = 0x43; | ||
| 67 | |||
| 68 | pub const TAG_lo_user = 0x4080; | ||
| 69 | pub const TAG_hi_user = 0xffff; | ||
| 70 | |||
| 71 | // SGI/MIPS Extensions. | ||
| 72 | pub const TAG_MIPS_loop = 0x4081; | ||
| 73 | |||
| 74 | // HP extensions. See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz . | ||
| 75 | pub const TAG_HP_array_descriptor = 0x4090; | ||
| 76 | pub const TAG_HP_Bliss_field = 0x4091; | ||
| 77 | pub const TAG_HP_Bliss_field_set = 0x4092; | ||
| 78 | |||
| 79 | // GNU extensions. | ||
| 80 | pub const TAG_format_label = 0x4101; // For FORTRAN 77 and Fortran 90. | ||
| 81 | pub const TAG_function_template = 0x4102; // For C++. | ||
| 82 | pub const TAG_class_template = 0x4103; //For C++. | ||
| 83 | pub const TAG_GNU_BINCL = 0x4104; | ||
| 84 | pub const TAG_GNU_EINCL = 0x4105; | ||
| 85 | |||
| 86 | // Template template parameter. | ||
| 87 | // See http://gcc.gnu.org/wiki/TemplateParmsDwarf . | ||
| 88 | pub const TAG_GNU_template_template_param = 0x4106; | ||
| 89 | |||
| 90 | // Template parameter pack extension = specified at | ||
| 91 | // http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates | ||
| 92 | // The values of these two TAGS are in the DW_TAG_GNU_* space until the tags | ||
| 93 | // are properly part of DWARF 5. | ||
| 94 | pub const TAG_GNU_template_parameter_pack = 0x4107; | ||
| 95 | pub const TAG_GNU_formal_parameter_pack = 0x4108; | ||
| 96 | // The GNU call site extension = specified at | ||
| 97 | // http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open . | ||
| 98 | // The values of these two TAGS are in the DW_TAG_GNU_* space until the tags | ||
| 99 | // are properly part of DWARF 5. | ||
| 100 | pub const TAG_GNU_call_site = 0x4109; | ||
| 101 | pub const TAG_GNU_call_site_parameter = 0x410a; | ||
| 102 | // Extensions for UPC. See: http://dwarfstd.org/doc/DWARF4.pdf. | ||
| 103 | pub const TAG_upc_shared_type = 0x8765; | ||
| 104 | pub const TAG_upc_strict_type = 0x8766; | ||
| 105 | pub const TAG_upc_relaxed_type = 0x8767; | ||
| 106 | // PGI (STMicroelectronics; extensions. No documentation available. | ||
| 107 | pub const TAG_PGI_kanji_type = 0xA000; | ||
| 108 | pub const TAG_PGI_interface_block = 0xA020; | ||
| 109 | |||
| 110 | pub const FORM_addr = 0x01; | ||
| 111 | pub const FORM_block2 = 0x03; | ||
| 112 | pub const FORM_block4 = 0x04; | ||
| 113 | pub const FORM_data2 = 0x05; | ||
| 114 | pub const FORM_data4 = 0x06; | ||
| 115 | pub const FORM_data8 = 0x07; | ||
| 116 | pub const FORM_string = 0x08; | ||
| 117 | pub const FORM_block = 0x09; | ||
| 118 | pub const FORM_block1 = 0x0a; | ||
| 119 | pub const FORM_data1 = 0x0b; | ||
| 120 | pub const FORM_flag = 0x0c; | ||
| 121 | pub const FORM_sdata = 0x0d; | ||
| 122 | pub const FORM_strp = 0x0e; | ||
| 123 | pub const FORM_udata = 0x0f; | ||
| 124 | pub const FORM_ref_addr = 0x10; | ||
| 125 | pub const FORM_ref1 = 0x11; | ||
| 126 | pub const FORM_ref2 = 0x12; | ||
| 127 | pub const FORM_ref4 = 0x13; | ||
| 128 | pub const FORM_ref8 = 0x14; | ||
| 129 | pub const FORM_ref_udata = 0x15; | ||
| 130 | pub const FORM_indirect = 0x16; | ||
| 131 | pub const FORM_sec_offset = 0x17; | ||
| 132 | pub const FORM_exprloc = 0x18; | ||
| 133 | pub const FORM_flag_present = 0x19; | ||
| 134 | pub const FORM_ref_sig8 = 0x20; | ||
| 135 | |||
| 136 | // Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFission. | ||
| 137 | pub const FORM_GNU_addr_index = 0x1f01; | ||
| 138 | pub const FORM_GNU_str_index = 0x1f02; | ||
| 139 | |||
| 140 | // Extensions for DWZ multifile. | ||
| 141 | // See http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open . | ||
| 142 | pub const FORM_GNU_ref_alt = 0x1f20; | ||
| 143 | pub const FORM_GNU_strp_alt = 0x1f21; | ||
| 144 | |||
| 145 | pub const AT_sibling = 0x01; | ||
| 146 | pub const AT_location = 0x02; | ||
| 147 | pub const AT_name = 0x03; | ||
| 148 | pub const AT_ordering = 0x09; | ||
| 149 | pub const AT_subscr_data = 0x0a; | ||
| 150 | pub const AT_byte_size = 0x0b; | ||
| 151 | pub const AT_bit_offset = 0x0c; | ||
| 152 | pub const AT_bit_size = 0x0d; | ||
| 153 | pub const AT_element_list = 0x0f; | ||
| 154 | pub const AT_stmt_list = 0x10; | ||
| 155 | pub const AT_low_pc = 0x11; | ||
| 156 | pub const AT_high_pc = 0x12; | ||
| 157 | pub const AT_language = 0x13; | ||
| 158 | pub const AT_member = 0x14; | ||
| 159 | pub const AT_discr = 0x15; | ||
| 160 | pub const AT_discr_value = 0x16; | ||
| 161 | pub const AT_visibility = 0x17; | ||
| 162 | pub const AT_import = 0x18; | ||
| 163 | pub const AT_string_length = 0x19; | ||
| 164 | pub const AT_common_reference = 0x1a; | ||
| 165 | pub const AT_comp_dir = 0x1b; | ||
| 166 | pub const AT_const_value = 0x1c; | ||
| 167 | pub const AT_containing_type = 0x1d; | ||
| 168 | pub const AT_default_value = 0x1e; | ||
| 169 | pub const AT_inline = 0x20; | ||
| 170 | pub const AT_is_optional = 0x21; | ||
| 171 | pub const AT_lower_bound = 0x22; | ||
| 172 | pub const AT_producer = 0x25; | ||
| 173 | pub const AT_prototyped = 0x27; | ||
| 174 | pub const AT_return_addr = 0x2a; | ||
| 175 | pub const AT_start_scope = 0x2c; | ||
| 176 | pub const AT_bit_stride = 0x2e; | ||
| 177 | pub const AT_upper_bound = 0x2f; | ||
| 178 | pub const AT_abstract_origin = 0x31; | ||
| 179 | pub const AT_accessibility = 0x32; | ||
| 180 | pub const AT_address_class = 0x33; | ||
| 181 | pub const AT_artificial = 0x34; | ||
| 182 | pub const AT_base_types = 0x35; | ||
| 183 | pub const AT_calling_convention = 0x36; | ||
| 184 | pub const AT_count = 0x37; | ||
| 185 | pub const AT_data_member_location = 0x38; | ||
| 186 | pub const AT_decl_column = 0x39; | ||
| 187 | pub const AT_decl_file = 0x3a; | ||
| 188 | pub const AT_decl_line = 0x3b; | ||
| 189 | pub const AT_declaration = 0x3c; | ||
| 190 | pub const AT_discr_list = 0x3d; | ||
| 191 | pub const AT_encoding = 0x3e; | ||
| 192 | pub const AT_external = 0x3f; | ||
| 193 | pub const AT_frame_base = 0x40; | ||
| 194 | pub const AT_friend = 0x41; | ||
| 195 | pub const AT_identifier_case = 0x42; | ||
| 196 | pub const AT_macro_info = 0x43; | ||
| 197 | pub const AT_namelist_items = 0x44; | ||
| 198 | pub const AT_priority = 0x45; | ||
| 199 | pub const AT_segment = 0x46; | ||
| 200 | pub const AT_specification = 0x47; | ||
| 201 | pub const AT_static_link = 0x48; | ||
| 202 | pub const AT_type = 0x49; | ||
| 203 | pub const AT_use_location = 0x4a; | ||
| 204 | pub const AT_variable_parameter = 0x4b; | ||
| 205 | pub const AT_virtuality = 0x4c; | ||
| 206 | pub const AT_vtable_elem_location = 0x4d; | ||
| 207 | |||
| 208 | // DWARF 3 values. | ||
| 209 | pub const AT_allocated = 0x4e; | ||
| 210 | pub const AT_associated = 0x4f; | ||
| 211 | pub const AT_data_location = 0x50; | ||
| 212 | pub const AT_byte_stride = 0x51; | ||
| 213 | pub const AT_entry_pc = 0x52; | ||
| 214 | pub const AT_use_UTF8 = 0x53; | ||
| 215 | pub const AT_extension = 0x54; | ||
| 216 | pub const AT_ranges = 0x55; | ||
| 217 | pub const AT_trampoline = 0x56; | ||
| 218 | pub const AT_call_column = 0x57; | ||
| 219 | pub const AT_call_file = 0x58; | ||
| 220 | pub const AT_call_line = 0x59; | ||
| 221 | pub const AT_description = 0x5a; | ||
| 222 | pub const AT_binary_scale = 0x5b; | ||
| 223 | pub const AT_decimal_scale = 0x5c; | ||
| 224 | pub const AT_small = 0x5d; | ||
| 225 | pub const AT_decimal_sign = 0x5e; | ||
| 226 | pub const AT_digit_count = 0x5f; | ||
| 227 | pub const AT_picture_string = 0x60; | ||
| 228 | pub const AT_mutable = 0x61; | ||
| 229 | pub const AT_threads_scaled = 0x62; | ||
| 230 | pub const AT_explicit = 0x63; | ||
| 231 | pub const AT_object_pointer = 0x64; | ||
| 232 | pub const AT_endianity = 0x65; | ||
| 233 | pub const AT_elemental = 0x66; | ||
| 234 | pub const AT_pure = 0x67; | ||
| 235 | pub const AT_recursive = 0x68; | ||
| 236 | |||
| 237 | // DWARF 4. | ||
| 238 | pub const AT_signature = 0x69; | ||
| 239 | pub const AT_main_subprogram = 0x6a; | ||
| 240 | pub const AT_data_bit_offset = 0x6b; | ||
| 241 | pub const AT_const_expr = 0x6c; | ||
| 242 | pub const AT_enum_class = 0x6d; | ||
| 243 | pub const AT_linkage_name = 0x6e; | ||
| 244 | |||
| 245 | // DWARF 5 | ||
| 246 | pub const AT_alignment = 0x88; | ||
| 247 | |||
| 248 | pub const AT_lo_user = 0x2000; // Implementation-defined range start. | ||
| 249 | pub const AT_hi_user = 0x3fff; // Implementation-defined range end. | ||
| 250 | |||
| 251 | // SGI/MIPS extensions. | ||
| 252 | pub const AT_MIPS_fde = 0x2001; | ||
| 253 | pub const AT_MIPS_loop_begin = 0x2002; | ||
| 254 | pub const AT_MIPS_tail_loop_begin = 0x2003; | ||
| 255 | pub const AT_MIPS_epilog_begin = 0x2004; | ||
| 256 | pub const AT_MIPS_loop_unroll_factor = 0x2005; | ||
| 257 | pub const AT_MIPS_software_pipeline_depth = 0x2006; | ||
| 258 | pub const AT_MIPS_linkage_name = 0x2007; | ||
| 259 | pub const AT_MIPS_stride = 0x2008; | ||
| 260 | pub const AT_MIPS_abstract_name = 0x2009; | ||
| 261 | pub const AT_MIPS_clone_origin = 0x200a; | ||
| 262 | pub const AT_MIPS_has_inlines = 0x200b; | ||
| 263 | |||
| 264 | // HP extensions. | ||
| 265 | pub const AT_HP_block_index = 0x2000; | ||
| 266 | pub const AT_HP_unmodifiable = 0x2001; // Same as AT_MIPS_fde. | ||
| 267 | pub const AT_HP_prologue = 0x2005; // Same as AT_MIPS_loop_unroll. | ||
| 268 | pub const AT_HP_epilogue = 0x2008; // Same as AT_MIPS_stride. | ||
| 269 | pub const AT_HP_actuals_stmt_list = 0x2010; | ||
| 270 | pub const AT_HP_proc_per_section = 0x2011; | ||
| 271 | pub const AT_HP_raw_data_ptr = 0x2012; | ||
| 272 | pub const AT_HP_pass_by_reference = 0x2013; | ||
| 273 | pub const AT_HP_opt_level = 0x2014; | ||
| 274 | pub const AT_HP_prof_version_id = 0x2015; | ||
| 275 | pub const AT_HP_opt_flags = 0x2016; | ||
| 276 | pub const AT_HP_cold_region_low_pc = 0x2017; | ||
| 277 | pub const AT_HP_cold_region_high_pc = 0x2018; | ||
| 278 | pub const AT_HP_all_variables_modifiable = 0x2019; | ||
| 279 | pub const AT_HP_linkage_name = 0x201a; | ||
| 280 | pub const AT_HP_prof_flags = 0x201b; // In comp unit of procs_info for -g. | ||
| 281 | pub const AT_HP_unit_name = 0x201f; | ||
| 282 | pub const AT_HP_unit_size = 0x2020; | ||
| 283 | pub const AT_HP_widened_byte_size = 0x2021; | ||
| 284 | pub const AT_HP_definition_points = 0x2022; | ||
| 285 | pub const AT_HP_default_location = 0x2023; | ||
| 286 | pub const AT_HP_is_result_param = 0x2029; | ||
| 287 | |||
| 288 | // GNU extensions. | ||
| 289 | pub const AT_sf_names = 0x2101; | ||
| 290 | pub const AT_src_info = 0x2102; | ||
| 291 | pub const AT_mac_info = 0x2103; | ||
| 292 | pub const AT_src_coords = 0x2104; | ||
| 293 | pub const AT_body_begin = 0x2105; | ||
| 294 | pub const AT_body_end = 0x2106; | ||
| 295 | pub const AT_GNU_vector = 0x2107; | ||
| 296 | // Thread-safety annotations. | ||
| 297 | // See http://gcc.gnu.org/wiki/ThreadSafetyAnnotation . | ||
| 298 | pub const AT_GNU_guarded_by = 0x2108; | ||
| 299 | pub const AT_GNU_pt_guarded_by = 0x2109; | ||
| 300 | pub const AT_GNU_guarded = 0x210a; | ||
| 301 | pub const AT_GNU_pt_guarded = 0x210b; | ||
| 302 | pub const AT_GNU_locks_excluded = 0x210c; | ||
| 303 | pub const AT_GNU_exclusive_locks_required = 0x210d; | ||
| 304 | pub const AT_GNU_shared_locks_required = 0x210e; | ||
| 305 | // One-definition rule violation detection. | ||
| 306 | // See http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo . | ||
| 307 | pub const AT_GNU_odr_signature = 0x210f; | ||
| 308 | // Template template argument name. | ||
| 309 | // See http://gcc.gnu.org/wiki/TemplateParmsDwarf . | ||
| 310 | pub const AT_GNU_template_name = 0x2110; | ||
| 311 | // The GNU call site extension. | ||
| 312 | // See http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open . | ||
| 313 | pub const AT_GNU_call_site_value = 0x2111; | ||
| 314 | pub const AT_GNU_call_site_data_value = 0x2112; | ||
| 315 | pub const AT_GNU_call_site_target = 0x2113; | ||
| 316 | pub const AT_GNU_call_site_target_clobbered = 0x2114; | ||
| 317 | pub const AT_GNU_tail_call = 0x2115; | ||
| 318 | pub const AT_GNU_all_tail_call_sites = 0x2116; | ||
| 319 | pub const AT_GNU_all_call_sites = 0x2117; | ||
| 320 | pub const AT_GNU_all_source_call_sites = 0x2118; | ||
| 321 | // Section offset into .debug_macro section. | ||
| 322 | pub const AT_GNU_macros = 0x2119; | ||
| 323 | // Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFission. | ||
| 324 | pub const AT_GNU_dwo_name = 0x2130; | ||
| 325 | pub const AT_GNU_dwo_id = 0x2131; | ||
| 326 | pub const AT_GNU_ranges_base = 0x2132; | ||
| 327 | pub const AT_GNU_addr_base = 0x2133; | ||
| 328 | pub const AT_GNU_pubnames = 0x2134; | ||
| 329 | pub const AT_GNU_pubtypes = 0x2135; | ||
| 330 | // VMS extensions. | ||
| 331 | pub const AT_VMS_rtnbeg_pd_address = 0x2201; | ||
| 332 | // GNAT extensions. | ||
| 333 | // GNAT descriptive type. | ||
| 334 | // See http://gcc.gnu.org/wiki/DW_AT_GNAT_descriptive_type . | ||
| 335 | pub const AT_use_GNAT_descriptive_type = 0x2301; | ||
| 336 | pub const AT_GNAT_descriptive_type = 0x2302; | ||
| 337 | // UPC extension. | ||
| 338 | pub const AT_upc_threads_scaled = 0x3210; | ||
| 339 | // PGI (STMicroelectronics) extensions. | ||
| 340 | pub const AT_PGI_lbase = 0x3a00; | ||
| 341 | pub const AT_PGI_soffset = 0x3a01; | ||
| 342 | pub const AT_PGI_lstride = 0x3a02; | ||
| 343 | |||
| 344 | pub const OP_addr = 0x03; | ||
| 345 | pub const OP_deref = 0x06; | ||
| 346 | pub const OP_const1u = 0x08; | ||
| 347 | pub const OP_const1s = 0x09; | ||
| 348 | pub const OP_const2u = 0x0a; | ||
| 349 | pub const OP_const2s = 0x0b; | ||
| 350 | pub const OP_const4u = 0x0c; | ||
| 351 | pub const OP_const4s = 0x0d; | ||
| 352 | pub const OP_const8u = 0x0e; | ||
| 353 | pub const OP_const8s = 0x0f; | ||
| 354 | pub const OP_constu = 0x10; | ||
| 355 | pub const OP_consts = 0x11; | ||
| 356 | pub const OP_dup = 0x12; | ||
| 357 | pub const OP_drop = 0x13; | ||
| 358 | pub const OP_over = 0x14; | ||
| 359 | pub const OP_pick = 0x15; | ||
| 360 | pub const OP_swap = 0x16; | ||
| 361 | pub const OP_rot = 0x17; | ||
| 362 | pub const OP_xderef = 0x18; | ||
| 363 | pub const OP_abs = 0x19; | ||
| 364 | pub const OP_and = 0x1a; | ||
| 365 | pub const OP_div = 0x1b; | ||
| 366 | pub const OP_minus = 0x1c; | ||
| 367 | pub const OP_mod = 0x1d; | ||
| 368 | pub const OP_mul = 0x1e; | ||
| 369 | pub const OP_neg = 0x1f; | ||
| 370 | pub const OP_not = 0x20; | ||
| 371 | pub const OP_or = 0x21; | ||
| 372 | pub const OP_plus = 0x22; | ||
| 373 | pub const OP_plus_uconst = 0x23; | ||
| 374 | pub const OP_shl = 0x24; | ||
| 375 | pub const OP_shr = 0x25; | ||
| 376 | pub const OP_shra = 0x26; | ||
| 377 | pub const OP_xor = 0x27; | ||
| 378 | pub const OP_bra = 0x28; | ||
| 379 | pub const OP_eq = 0x29; | ||
| 380 | pub const OP_ge = 0x2a; | ||
| 381 | pub const OP_gt = 0x2b; | ||
| 382 | pub const OP_le = 0x2c; | ||
| 383 | pub const OP_lt = 0x2d; | ||
| 384 | pub const OP_ne = 0x2e; | ||
| 385 | pub const OP_skip = 0x2f; | ||
| 386 | pub const OP_lit0 = 0x30; | ||
| 387 | pub const OP_lit1 = 0x31; | ||
| 388 | pub const OP_lit2 = 0x32; | ||
| 389 | pub const OP_lit3 = 0x33; | ||
| 390 | pub const OP_lit4 = 0x34; | ||
| 391 | pub const OP_lit5 = 0x35; | ||
| 392 | pub const OP_lit6 = 0x36; | ||
| 393 | pub const OP_lit7 = 0x37; | ||
| 394 | pub const OP_lit8 = 0x38; | ||
| 395 | pub const OP_lit9 = 0x39; | ||
| 396 | pub const OP_lit10 = 0x3a; | ||
| 397 | pub const OP_lit11 = 0x3b; | ||
| 398 | pub const OP_lit12 = 0x3c; | ||
| 399 | pub const OP_lit13 = 0x3d; | ||
| 400 | pub const OP_lit14 = 0x3e; | ||
| 401 | pub const OP_lit15 = 0x3f; | ||
| 402 | pub const OP_lit16 = 0x40; | ||
| 403 | pub const OP_lit17 = 0x41; | ||
| 404 | pub const OP_lit18 = 0x42; | ||
| 405 | pub const OP_lit19 = 0x43; | ||
| 406 | pub const OP_lit20 = 0x44; | ||
| 407 | pub const OP_lit21 = 0x45; | ||
| 408 | pub const OP_lit22 = 0x46; | ||
| 409 | pub const OP_lit23 = 0x47; | ||
| 410 | pub const OP_lit24 = 0x48; | ||
| 411 | pub const OP_lit25 = 0x49; | ||
| 412 | pub const OP_lit26 = 0x4a; | ||
| 413 | pub const OP_lit27 = 0x4b; | ||
| 414 | pub const OP_lit28 = 0x4c; | ||
| 415 | pub const OP_lit29 = 0x4d; | ||
| 416 | pub const OP_lit30 = 0x4e; | ||
| 417 | pub const OP_lit31 = 0x4f; | ||
| 418 | pub const OP_reg0 = 0x50; | ||
| 419 | pub const OP_reg1 = 0x51; | ||
| 420 | pub const OP_reg2 = 0x52; | ||
| 421 | pub const OP_reg3 = 0x53; | ||
| 422 | pub const OP_reg4 = 0x54; | ||
| 423 | pub const OP_reg5 = 0x55; | ||
| 424 | pub const OP_reg6 = 0x56; | ||
| 425 | pub const OP_reg7 = 0x57; | ||
| 426 | pub const OP_reg8 = 0x58; | ||
| 427 | pub const OP_reg9 = 0x59; | ||
| 428 | pub const OP_reg10 = 0x5a; | ||
| 429 | pub const OP_reg11 = 0x5b; | ||
| 430 | pub const OP_reg12 = 0x5c; | ||
| 431 | pub const OP_reg13 = 0x5d; | ||
| 432 | pub const OP_reg14 = 0x5e; | ||
| 433 | pub const OP_reg15 = 0x5f; | ||
| 434 | pub const OP_reg16 = 0x60; | ||
| 435 | pub const OP_reg17 = 0x61; | ||
| 436 | pub const OP_reg18 = 0x62; | ||
| 437 | pub const OP_reg19 = 0x63; | ||
| 438 | pub const OP_reg20 = 0x64; | ||
| 439 | pub const OP_reg21 = 0x65; | ||
| 440 | pub const OP_reg22 = 0x66; | ||
| 441 | pub const OP_reg23 = 0x67; | ||
| 442 | pub const OP_reg24 = 0x68; | ||
| 443 | pub const OP_reg25 = 0x69; | ||
| 444 | pub const OP_reg26 = 0x6a; | ||
| 445 | pub const OP_reg27 = 0x6b; | ||
| 446 | pub const OP_reg28 = 0x6c; | ||
| 447 | pub const OP_reg29 = 0x6d; | ||
| 448 | pub const OP_reg30 = 0x6e; | ||
| 449 | pub const OP_reg31 = 0x6f; | ||
| 450 | pub const OP_breg0 = 0x70; | ||
| 451 | pub const OP_breg1 = 0x71; | ||
| 452 | pub const OP_breg2 = 0x72; | ||
| 453 | pub const OP_breg3 = 0x73; | ||
| 454 | pub const OP_breg4 = 0x74; | ||
| 455 | pub const OP_breg5 = 0x75; | ||
| 456 | pub const OP_breg6 = 0x76; | ||
| 457 | pub const OP_breg7 = 0x77; | ||
| 458 | pub const OP_breg8 = 0x78; | ||
| 459 | pub const OP_breg9 = 0x79; | ||
| 460 | pub const OP_breg10 = 0x7a; | ||
| 461 | pub const OP_breg11 = 0x7b; | ||
| 462 | pub const OP_breg12 = 0x7c; | ||
| 463 | pub const OP_breg13 = 0x7d; | ||
| 464 | pub const OP_breg14 = 0x7e; | ||
| 465 | pub const OP_breg15 = 0x7f; | ||
| 466 | pub const OP_breg16 = 0x80; | ||
| 467 | pub const OP_breg17 = 0x81; | ||
| 468 | pub const OP_breg18 = 0x82; | ||
| 469 | pub const OP_breg19 = 0x83; | ||
| 470 | pub const OP_breg20 = 0x84; | ||
| 471 | pub const OP_breg21 = 0x85; | ||
| 472 | pub const OP_breg22 = 0x86; | ||
| 473 | pub const OP_breg23 = 0x87; | ||
| 474 | pub const OP_breg24 = 0x88; | ||
| 475 | pub const OP_breg25 = 0x89; | ||
| 476 | pub const OP_breg26 = 0x8a; | ||
| 477 | pub const OP_breg27 = 0x8b; | ||
| 478 | pub const OP_breg28 = 0x8c; | ||
| 479 | pub const OP_breg29 = 0x8d; | ||
| 480 | pub const OP_breg30 = 0x8e; | ||
| 481 | pub const OP_breg31 = 0x8f; | ||
| 482 | pub const OP_regx = 0x90; | ||
| 483 | pub const OP_fbreg = 0x91; | ||
| 484 | pub const OP_bregx = 0x92; | ||
| 485 | pub const OP_piece = 0x93; | ||
| 486 | pub const OP_deref_size = 0x94; | ||
| 487 | pub const OP_xderef_size = 0x95; | ||
| 488 | pub const OP_nop = 0x96; | ||
| 489 | |||
| 490 | // DWARF 3 extensions. | ||
| 491 | pub const OP_push_object_address = 0x97; | ||
| 492 | pub const OP_call2 = 0x98; | ||
| 493 | pub const OP_call4 = 0x99; | ||
| 494 | pub const OP_call_ref = 0x9a; | ||
| 495 | pub const OP_form_tls_address = 0x9b; | ||
| 496 | pub const OP_call_frame_cfa = 0x9c; | ||
| 497 | pub const OP_bit_piece = 0x9d; | ||
| 498 | |||
| 499 | // DWARF 4 extensions. | ||
| 500 | pub const OP_implicit_value = 0x9e; | ||
| 501 | pub const OP_stack_value = 0x9f; | ||
| 502 | |||
| 503 | pub const OP_lo_user = 0xe0; // Implementation-defined range start. | ||
| 504 | pub const OP_hi_user = 0xff; // Implementation-defined range end. | ||
| 505 | |||
| 506 | // GNU extensions. | ||
| 507 | pub const OP_GNU_push_tls_address = 0xe0; | ||
| 508 | // The following is for marking variables that are uninitialized. | ||
| 509 | pub const OP_GNU_uninit = 0xf0; | ||
| 510 | pub const OP_GNU_encoded_addr = 0xf1; | ||
| 511 | // The GNU implicit pointer extension. | ||
| 512 | // See http://www.dwarfstd.org/ShowIssue.php?issue=100831.1&type=open . | ||
| 513 | pub const OP_GNU_implicit_pointer = 0xf2; | ||
| 514 | // The GNU entry value extension. | ||
| 515 | // See http://www.dwarfstd.org/ShowIssue.php?issue=100909.1&type=open . | ||
| 516 | pub const OP_GNU_entry_value = 0xf3; | ||
| 517 | // The GNU typed stack extension. | ||
| 518 | // See http://www.dwarfstd.org/doc/040408.1.html . | ||
| 519 | pub const OP_GNU_const_type = 0xf4; | ||
| 520 | pub const OP_GNU_regval_type = 0xf5; | ||
| 521 | pub const OP_GNU_deref_type = 0xf6; | ||
| 522 | pub const OP_GNU_convert = 0xf7; | ||
| 523 | pub const OP_GNU_reinterpret = 0xf9; | ||
| 524 | // The GNU parameter ref extension. | ||
| 525 | pub const OP_GNU_parameter_ref = 0xfa; | ||
| 526 | // Extension for Fission. See http://gcc.gnu.org/wiki/DebugFission. | ||
| 527 | pub const OP_GNU_addr_index = 0xfb; | ||
| 528 | pub const OP_GNU_const_index = 0xfc; | ||
| 529 | // HP extensions. | ||
| 530 | pub const OP_HP_unknown = 0xe0; // Ouch, the same as GNU_push_tls_address. | ||
| 531 | pub const OP_HP_is_value = 0xe1; | ||
| 532 | pub const OP_HP_fltconst4 = 0xe2; | ||
| 533 | pub const OP_HP_fltconst8 = 0xe3; | ||
| 534 | pub const OP_HP_mod_range = 0xe4; | ||
| 535 | pub const OP_HP_unmod_range = 0xe5; | ||
| 536 | pub const OP_HP_tls = 0xe6; | ||
| 537 | // PGI (STMicroelectronics) extensions. | ||
| 538 | pub const OP_PGI_omp_thread_num = 0xf8; | ||
| 539 | |||
| 540 | pub const ATE_void = 0x0; | ||
| 541 | pub const ATE_address = 0x1; | ||
| 542 | pub const ATE_boolean = 0x2; | ||
| 543 | pub const ATE_complex_float = 0x3; | ||
| 544 | pub const ATE_float = 0x4; | ||
| 545 | pub const ATE_signed = 0x5; | ||
| 546 | pub const ATE_signed_char = 0x6; | ||
| 547 | pub const ATE_unsigned = 0x7; | ||
| 548 | pub const ATE_unsigned_char = 0x8; | ||
| 549 | |||
| 550 | // DWARF 3. | ||
| 551 | pub const ATE_imaginary_float = 0x9; | ||
| 552 | pub const ATE_packed_decimal = 0xa; | ||
| 553 | pub const ATE_numeric_string = 0xb; | ||
| 554 | pub const ATE_edited = 0xc; | ||
| 555 | pub const ATE_signed_fixed = 0xd; | ||
| 556 | pub const ATE_unsigned_fixed = 0xe; | ||
| 557 | pub const ATE_decimal_float = 0xf; | ||
| 558 | |||
| 559 | // DWARF 4. | ||
| 560 | pub const ATE_UTF = 0x10; | ||
| 561 | |||
| 562 | pub const ATE_lo_user = 0x80; | ||
| 563 | pub const ATE_hi_user = 0xff; | ||
| 564 | |||
| 565 | // HP extensions. | ||
| 566 | pub const ATE_HP_float80 = 0x80; // Floating-point (80 bit). | ||
| 567 | pub const ATE_HP_complex_float80 = 0x81; // Complex floating-point (80 bit). | ||
| 568 | pub const ATE_HP_float128 = 0x82; // Floating-point (128 bit). | ||
| 569 | pub const ATE_HP_complex_float128 = 0x83; // Complex fp (128 bit). | ||
| 570 | pub const ATE_HP_floathpintel = 0x84; // Floating-point (82 bit IA64). | ||
| 571 | pub const ATE_HP_imaginary_float80 = 0x85; | ||
| 572 | pub const ATE_HP_imaginary_float128 = 0x86; | ||
| 573 | pub const ATE_HP_VAX_float = 0x88; // F or G floating. | ||
| 574 | pub const ATE_HP_VAX_float_d = 0x89; // D floating. | ||
| 575 | pub const ATE_HP_packed_decimal = 0x8a; // Cobol. | ||
| 576 | pub const ATE_HP_zoned_decimal = 0x8b; // Cobol. | ||
| 577 | pub const ATE_HP_edited = 0x8c; // Cobol. | ||
| 578 | pub const ATE_HP_signed_fixed = 0x8d; // Cobol. | ||
| 579 | pub const ATE_HP_unsigned_fixed = 0x8e; // Cobol. | ||
| 580 | pub const ATE_HP_VAX_complex_float = 0x8f; // F or G floating complex. | ||
| 581 | pub const ATE_HP_VAX_complex_float_d = 0x90; // D floating complex. | ||
| 582 | |||
| 583 | pub const CFA_advance_loc = 0x40; | ||
| 584 | pub const CFA_offset = 0x80; | ||
| 585 | pub const CFA_restore = 0xc0; | ||
| 586 | pub const CFA_nop = 0x00; | ||
| 587 | pub const CFA_set_loc = 0x01; | ||
| 588 | pub const CFA_advance_loc1 = 0x02; | ||
| 589 | pub const CFA_advance_loc2 = 0x03; | ||
| 590 | pub const CFA_advance_loc4 = 0x04; | ||
| 591 | pub const CFA_offset_extended = 0x05; | ||
| 592 | pub const CFA_restore_extended = 0x06; | ||
| 593 | pub const CFA_undefined = 0x07; | ||
| 594 | pub const CFA_same_value = 0x08; | ||
| 595 | pub const CFA_register = 0x09; | ||
| 596 | pub const CFA_remember_state = 0x0a; | ||
| 597 | pub const CFA_restore_state = 0x0b; | ||
| 598 | pub const CFA_def_cfa = 0x0c; | ||
| 599 | pub const CFA_def_cfa_register = 0x0d; | ||
| 600 | pub const CFA_def_cfa_offset = 0x0e; | ||
| 601 | |||
| 602 | // DWARF 3. | ||
| 603 | pub const CFA_def_cfa_expression = 0x0f; | ||
| 604 | pub const CFA_expression = 0x10; | ||
| 605 | pub const CFA_offset_extended_sf = 0x11; | ||
| 606 | pub const CFA_def_cfa_sf = 0x12; | ||
| 607 | pub const CFA_def_cfa_offset_sf = 0x13; | ||
| 608 | pub const CFA_val_offset = 0x14; | ||
| 609 | pub const CFA_val_offset_sf = 0x15; | ||
| 610 | pub const CFA_val_expression = 0x16; | ||
| 611 | |||
| 612 | pub const CFA_lo_user = 0x1c; | ||
| 613 | pub const CFA_hi_user = 0x3f; | ||
| 614 | |||
| 615 | // SGI/MIPS specific. | ||
| 616 | pub const CFA_MIPS_advance_loc8 = 0x1d; | ||
| 617 | |||
| 618 | // GNU extensions. | ||
| 619 | pub const CFA_GNU_window_save = 0x2d; | ||
| 620 | pub const CFA_GNU_args_size = 0x2e; | ||
| 621 | pub const CFA_GNU_negative_offset_extended = 0x2f; | ||
| 622 | |||
| 623 | pub const CHILDREN_no = 0x00; | ||
| 624 | pub const CHILDREN_yes = 0x01; | ||
| 625 | |||
| 626 | pub const LNS_extended_op = 0x00; | ||
| 627 | pub const LNS_copy = 0x01; | ||
| 628 | pub const LNS_advance_pc = 0x02; | ||
| 629 | pub const LNS_advance_line = 0x03; | ||
| 630 | pub const LNS_set_file = 0x04; | ||
| 631 | pub const LNS_set_column = 0x05; | ||
| 632 | pub const LNS_negate_stmt = 0x06; | ||
| 633 | pub const LNS_set_basic_block = 0x07; | ||
| 634 | pub const LNS_const_add_pc = 0x08; | ||
| 635 | pub const LNS_fixed_advance_pc = 0x09; | ||
| 636 | pub const LNS_set_prologue_end = 0x0a; | ||
| 637 | pub const LNS_set_epilogue_begin = 0x0b; | ||
| 638 | pub const LNS_set_isa = 0x0c; | ||
| 639 | |||
| 640 | pub const LNE_end_sequence = 0x01; | ||
| 641 | pub const LNE_set_address = 0x02; | ||
| 642 | pub const LNE_define_file = 0x03; | ||
| 643 | pub const LNE_set_discriminator = 0x04; | ||
| 644 | pub const LNE_lo_user = 0x80; | ||
| 645 | pub const LNE_hi_user = 0xff; | ||
| 646 | |||
| 647 | pub const LANG_C89 = 0x0001; | ||
| 648 | pub const LANG_C = 0x0002; | ||
| 649 | pub const LANG_Ada83 = 0x0003; | ||
| 650 | pub const LANG_C_plus_plus = 0x0004; | ||
| 651 | pub const LANG_Cobol74 = 0x0005; | ||
| 652 | pub const LANG_Cobol85 = 0x0006; | ||
| 653 | pub const LANG_Fortran77 = 0x0007; | ||
| 654 | pub const LANG_Fortran90 = 0x0008; | ||
| 655 | pub const LANG_Pascal83 = 0x0009; | ||
| 656 | pub const LANG_Modula2 = 0x000a; | ||
| 657 | pub const LANG_Java = 0x000b; | ||
| 658 | pub const LANG_C99 = 0x000c; | ||
| 659 | pub const LANG_Ada95 = 0x000d; | ||
| 660 | pub const LANG_Fortran95 = 0x000e; | ||
| 661 | pub const LANG_PLI = 0x000f; | ||
| 662 | pub const LANG_ObjC = 0x0010; | ||
| 663 | pub const LANG_ObjC_plus_plus = 0x0011; | ||
| 664 | pub const LANG_UPC = 0x0012; | ||
| 665 | pub const LANG_D = 0x0013; | ||
| 666 | pub const LANG_Python = 0x0014; | ||
| 667 | pub const LANG_Go = 0x0016; | ||
| 668 | pub const LANG_C_plus_plus_11 = 0x001a; | ||
| 669 | pub const LANG_Rust = 0x001c; | ||
| 670 | pub const LANG_C11 = 0x001d; | ||
| 671 | pub const LANG_C_plus_plus_14 = 0x0021; | ||
| 672 | pub const LANG_Fortran03 = 0x0022; | ||
| 673 | pub const LANG_Fortran08 = 0x0023; | ||
| 674 | pub const LANG_lo_user = 0x8000; | ||
| 675 | pub const LANG_hi_user = 0xffff; | ||
| 676 | pub const LANG_Mips_Assembler = 0x8001; | ||
| 677 | pub const LANG_Upc = 0x8765; | ||
| 678 | pub const LANG_HP_Bliss = 0x8003; | ||
| 679 | pub const LANG_HP_Basic91 = 0x8004; | ||
| 680 | pub const LANG_HP_Pascal91 = 0x8005; | ||
| 681 | pub const LANG_HP_IMacro = 0x8006; | ||
| 682 | pub const LANG_HP_Assembler = 0x8007; | ||
| 683 | |||
| 684 | pub const UT_compile = 0x01; | ||
| 685 | pub const UT_type = 0x02; | ||
| 686 | pub const UT_partial = 0x03; | ||
| 687 | pub const UT_skeleton = 0x04; | ||
| 688 | pub const UT_split_compile = 0x05; | ||
| 689 | pub const UT_split_type = 0x06; | ||
| 690 | pub const UT_lo_user = 0x80; | ||
| 691 | pub const UT_hi_user = 0xff; | ||
| 692 | |||
| 693 | pub const LNCT_path = 0x1; | ||
| 694 | pub const LNCT_directory_index = 0x2; | ||
| 695 | pub const LNCT_timestamp = 0x3; | ||
| 696 | pub const LNCT_size = 0x4; | ||
| 697 | pub const LNCT_MD5 = 0x5; | ||
| 698 | pub const LNCT_lo_user = 0x2000; | ||
| 699 | pub const LNCT_hi_user = 0x3fff; | ||
lib/std/event/rwlock.zig+1| ... | @@ -4,6 +4,7 @@ const assert = std.debug.assert; | ... | @@ -4,6 +4,7 @@ const assert = std.debug.assert; |
| 4 | const testing = std.testing; | 4 | const testing = std.testing; |
| 5 | const mem = std.mem; | 5 | const mem = std.mem; |
| 6 | const Loop = std.event.Loop; | 6 | const Loop = std.event.Loop; |
| 7 | const Allocator = std.mem.Allocator; | ||
| 7 | 8 | ||
| 8 | /// Thread-safe async/await lock. | 9 | /// Thread-safe async/await lock. |
| 9 | /// Functions which are waiting for the lock are suspended, and | 10 | /// Functions which are waiting for the lock are suspended, and |
lib/std/fmt.zig+1-1| ... | @@ -902,7 +902,7 @@ pub fn formatText( | ... | @@ -902,7 +902,7 @@ pub fn formatText( |
| 902 | } else if (comptime std.mem.eql(u8, fmt, "Z")) { | 902 | } else if (comptime std.mem.eql(u8, fmt, "Z")) { |
| 903 | @compileError("specifier 'Z' has been deprecated, wrap your argument in std.zig.fmtEscapes instead"); | 903 | @compileError("specifier 'Z' has been deprecated, wrap your argument in std.zig.fmtEscapes instead"); |
| 904 | } else { | 904 | } else { |
| 905 | @compileError("Unsupported format string '" ++ fmt ++ "' for type '" ++ @typeName(@TypeOf(value)) ++ "'"); | 905 | @compileError("Unsupported format string '" ++ fmt ++ "' when formatting text"); |
| 906 | } | 906 | } |
| 907 | } | 907 | } |
| 908 | 908 |
lib/std/fs.zig+45-45| ... | @@ -880,20 +880,20 @@ pub const Dir = struct { | ... | @@ -880,20 +880,20 @@ pub const Dir = struct { |
| 880 | var fdflags: w.fdflags_t = 0x0; | 880 | var fdflags: w.fdflags_t = 0x0; |
| 881 | var base: w.rights_t = 0x0; | 881 | var base: w.rights_t = 0x0; |
| 882 | if (flags.read) { | 882 | if (flags.read) { |
| 883 | base |= w.RIGHT_FD_READ | w.RIGHT_FD_TELL | w.RIGHT_FD_SEEK | w.RIGHT_FD_FILESTAT_GET; | 883 | base |= w.RIGHT.FD_READ | w.RIGHT.FD_TELL | w.RIGHT.FD_SEEK | w.RIGHT.FD_FILESTAT_GET; |
| 884 | } | 884 | } |
| 885 | if (flags.write) { | 885 | if (flags.write) { |
| 886 | fdflags |= w.FDFLAG_APPEND; | 886 | fdflags |= w.FDFLAG.APPEND; |
| 887 | base |= w.RIGHT_FD_WRITE | | 887 | base |= w.RIGHT.FD_WRITE | |
| 888 | w.RIGHT_FD_TELL | | 888 | w.RIGHT.FD_TELL | |
| 889 | w.RIGHT_FD_SEEK | | 889 | w.RIGHT.FD_SEEK | |
| 890 | w.RIGHT_FD_DATASYNC | | 890 | w.RIGHT.FD_DATASYNC | |
| 891 | w.RIGHT_FD_FDSTAT_SET_FLAGS | | 891 | w.RIGHT.FD_FDSTAT_SET_FLAGS | |
| 892 | w.RIGHT_FD_SYNC | | 892 | w.RIGHT.FD_SYNC | |
| 893 | w.RIGHT_FD_ALLOCATE | | 893 | w.RIGHT.FD_ALLOCATE | |
| 894 | w.RIGHT_FD_ADVISE | | 894 | w.RIGHT.FD_ADVISE | |
| 895 | w.RIGHT_FD_FILESTAT_SET_TIMES | | 895 | w.RIGHT.FD_FILESTAT_SET_TIMES | |
| 896 | w.RIGHT_FD_FILESTAT_SET_SIZE; | 896 | w.RIGHT.FD_FILESTAT_SET_SIZE; |
| 897 | } | 897 | } |
| 898 | const fd = try os.openatWasi(self.fd, sub_path, 0x0, 0x0, fdflags, base, 0x0); | 898 | const fd = try os.openatWasi(self.fd, sub_path, 0x0, 0x0, fdflags, base, 0x0); |
| 899 | return File{ .handle = fd }; | 899 | return File{ .handle = fd }; |
| ... | @@ -958,14 +958,14 @@ pub const Dir = struct { | ... | @@ -958,14 +958,14 @@ pub const Dir = struct { |
| 958 | } | 958 | } |
| 959 | 959 | ||
| 960 | if (has_flock_open_flags and flags.lock_nonblocking) { | 960 | if (has_flock_open_flags and flags.lock_nonblocking) { |
| 961 | var fl_flags = os.fcntl(fd, os.F_GETFL, 0) catch |err| switch (err) { | 961 | var fl_flags = os.fcntl(fd, os.F.GETFL, 0) catch |err| switch (err) { |
| 962 | error.FileBusy => unreachable, | 962 | error.FileBusy => unreachable, |
| 963 | error.Locked => unreachable, | 963 | error.Locked => unreachable, |
| 964 | error.PermissionDenied => unreachable, | 964 | error.PermissionDenied => unreachable, |
| 965 | else => |e| return e, | 965 | else => |e| return e, |
| 966 | }; | 966 | }; |
| 967 | fl_flags &= ~@as(usize, os.O.NONBLOCK); | 967 | fl_flags &= ~@as(usize, os.O.NONBLOCK); |
| 968 | _ = os.fcntl(fd, os.F_SETFL, fl_flags) catch |err| switch (err) { | 968 | _ = os.fcntl(fd, os.F.SETFL, fl_flags) catch |err| switch (err) { |
| 969 | error.FileBusy => unreachable, | 969 | error.FileBusy => unreachable, |
| 970 | error.Locked => unreachable, | 970 | error.Locked => unreachable, |
| 971 | error.PermissionDenied => unreachable, | 971 | error.PermissionDenied => unreachable, |
| ... | @@ -1040,19 +1040,19 @@ pub const Dir = struct { | ... | @@ -1040,19 +1040,19 @@ pub const Dir = struct { |
| 1040 | pub fn createFileWasi(self: Dir, sub_path: []const u8, flags: File.CreateFlags) File.OpenError!File { | 1040 | pub fn createFileWasi(self: Dir, sub_path: []const u8, flags: File.CreateFlags) File.OpenError!File { |
| 1041 | const w = os.wasi; | 1041 | const w = os.wasi; |
| 1042 | var oflags = w.O.CREAT; | 1042 | var oflags = w.O.CREAT; |
| 1043 | var base: w.rights_t = w.RIGHT_FD_WRITE | | 1043 | var base: w.rights_t = w.RIGHT.FD_WRITE | |
| 1044 | w.RIGHT_FD_DATASYNC | | 1044 | w.RIGHT.FD_DATASYNC | |
| 1045 | w.RIGHT_FD_SEEK | | 1045 | w.RIGHT.FD_SEEK | |
| 1046 | w.RIGHT_FD_TELL | | 1046 | w.RIGHT.FD_TELL | |
| 1047 | w.RIGHT_FD_FDSTAT_SET_FLAGS | | 1047 | w.RIGHT.FD_FDSTAT_SET_FLAGS | |
| 1048 | w.RIGHT_FD_SYNC | | 1048 | w.RIGHT.FD_SYNC | |
| 1049 | w.RIGHT_FD_ALLOCATE | | 1049 | w.RIGHT.FD_ALLOCATE | |
| 1050 | w.RIGHT_FD_ADVISE | | 1050 | w.RIGHT.FD_ADVISE | |
| 1051 | w.RIGHT_FD_FILESTAT_SET_TIMES | | 1051 | w.RIGHT.FD_FILESTAT_SET_TIMES | |
| 1052 | w.RIGHT_FD_FILESTAT_SET_SIZE | | 1052 | w.RIGHT.FD_FILESTAT_SET_SIZE | |
| 1053 | w.RIGHT_FD_FILESTAT_GET; | 1053 | w.RIGHT.FD_FILESTAT_GET; |
| 1054 | if (flags.read) { | 1054 | if (flags.read) { |
| 1055 | base |= w.RIGHT_FD_READ; | 1055 | base |= w.RIGHT.FD_READ; |
| 1056 | } | 1056 | } |
| 1057 | if (flags.truncate) { | 1057 | if (flags.truncate) { |
| 1058 | oflags |= w.O.TRUNC; | 1058 | oflags |= w.O.TRUNC; |
| ... | @@ -1112,14 +1112,14 @@ pub const Dir = struct { | ... | @@ -1112,14 +1112,14 @@ pub const Dir = struct { |
| 1112 | } | 1112 | } |
| 1113 | 1113 | ||
| 1114 | if (has_flock_open_flags and flags.lock_nonblocking) { | 1114 | if (has_flock_open_flags and flags.lock_nonblocking) { |
| 1115 | var fl_flags = os.fcntl(fd, os.F_GETFL, 0) catch |err| switch (err) { | 1115 | var fl_flags = os.fcntl(fd, os.F.GETFL, 0) catch |err| switch (err) { |
| 1116 | error.FileBusy => unreachable, | 1116 | error.FileBusy => unreachable, |
| 1117 | error.Locked => unreachable, | 1117 | error.Locked => unreachable, |
| 1118 | error.PermissionDenied => unreachable, | 1118 | error.PermissionDenied => unreachable, |
| 1119 | else => |e| return e, | 1119 | else => |e| return e, |
| 1120 | }; | 1120 | }; |
| 1121 | fl_flags &= ~@as(usize, os.O.NONBLOCK); | 1121 | fl_flags &= ~@as(usize, os.O.NONBLOCK); |
| 1122 | _ = os.fcntl(fd, os.F_SETFL, fl_flags) catch |err| switch (err) { | 1122 | _ = os.fcntl(fd, os.F.SETFL, fl_flags) catch |err| switch (err) { |
| 1123 | error.FileBusy => unreachable, | 1123 | error.FileBusy => unreachable, |
| 1124 | error.Locked => unreachable, | 1124 | error.Locked => unreachable, |
| 1125 | error.PermissionDenied => unreachable, | 1125 | error.PermissionDenied => unreachable, |
| ... | @@ -1402,27 +1402,27 @@ pub const Dir = struct { | ... | @@ -1402,27 +1402,27 @@ pub const Dir = struct { |
| 1402 | /// Same as `openDir` except only WASI. | 1402 | /// Same as `openDir` except only WASI. |
| 1403 | pub fn openDirWasi(self: Dir, sub_path: []const u8, args: OpenDirOptions) OpenError!Dir { | 1403 | pub fn openDirWasi(self: Dir, sub_path: []const u8, args: OpenDirOptions) OpenError!Dir { |
| 1404 | const w = os.wasi; | 1404 | const w = os.wasi; |
| 1405 | var base: w.rights_t = w.RIGHT_FD_FILESTAT_GET | w.RIGHT_FD_FDSTAT_SET_FLAGS | w.RIGHT_FD_FILESTAT_SET_TIMES; | 1405 | var base: w.rights_t = w.RIGHT.FD_FILESTAT_GET | w.RIGHT.FD_FDSTAT_SET_FLAGS | w.RIGHT.FD_FILESTAT_SET_TIMES; |
| 1406 | if (args.access_sub_paths) { | 1406 | if (args.access_sub_paths) { |
| 1407 | base |= w.RIGHT_FD_READDIR | | 1407 | base |= w.RIGHT.FD_READDIR | |
| 1408 | w.RIGHT_PATH_CREATE_DIRECTORY | | 1408 | w.RIGHT.PATH_CREATE_DIRECTORY | |
| 1409 | w.RIGHT_PATH_CREATE_FILE | | 1409 | w.RIGHT.PATH_CREATE_FILE | |
| 1410 | w.RIGHT_PATH_LINK_SOURCE | | 1410 | w.RIGHT.PATH_LINK_SOURCE | |
| 1411 | w.RIGHT_PATH_LINK_TARGET | | 1411 | w.RIGHT.PATH_LINK_TARGET | |
| 1412 | w.RIGHT_PATH_OPEN | | 1412 | w.RIGHT.PATH_OPEN | |
| 1413 | w.RIGHT_PATH_READLINK | | 1413 | w.RIGHT.PATH_READLINK | |
| 1414 | w.RIGHT_PATH_RENAME_SOURCE | | 1414 | w.RIGHT.PATH_RENAME_SOURCE | |
| 1415 | w.RIGHT_PATH_RENAME_TARGET | | 1415 | w.RIGHT.PATH_RENAME_TARGET | |
| 1416 | w.RIGHT_PATH_FILESTAT_GET | | 1416 | w.RIGHT.PATH_FILESTAT_GET | |
| 1417 | w.RIGHT_PATH_FILESTAT_SET_SIZE | | 1417 | w.RIGHT.PATH_FILESTAT_SET_SIZE | |
| 1418 | w.RIGHT_PATH_FILESTAT_SET_TIMES | | 1418 | w.RIGHT.PATH_FILESTAT_SET_TIMES | |
| 1419 | w.RIGHT_PATH_SYMLINK | | 1419 | w.RIGHT.PATH_SYMLINK | |
| 1420 | w.RIGHT_PATH_REMOVE_DIRECTORY | | 1420 | w.RIGHT.PATH_REMOVE_DIRECTORY | |
| 1421 | w.RIGHT_PATH_UNLINK_FILE; | 1421 | w.RIGHT.PATH_UNLINK_FILE; |
| 1422 | } | 1422 | } |
| 1423 | const symlink_flags: w.lookupflags_t = if (args.no_follow) 0x0 else w.LOOKUP_SYMLINK_FOLLOW; | 1423 | const symlink_flags: w.lookupflags_t = if (args.no_follow) 0x0 else w.LOOKUP_SYMLINK_FOLLOW; |
| 1424 | // TODO do we really need all the rights here? | 1424 | // TODO do we really need all the rights here? |
| 1425 | const inheriting: w.rights_t = w.RIGHT_ALL ^ w.RIGHT_SOCK_SHUTDOWN; | 1425 | const inheriting: w.rights_t = w.RIGHT.ALL ^ w.RIGHT.SOCK_SHUTDOWN; |
| 1426 | 1426 | ||
| 1427 | const result = os.openatWasi(self.fd, sub_path, symlink_flags, w.O.DIRECTORY, 0x0, base, inheriting); | 1427 | const result = os.openatWasi(self.fd, sub_path, symlink_flags, w.O.DIRECTORY, 0x0, base, inheriting); |
| 1428 | const fd = result catch |err| switch (err) { | 1428 | const fd = result catch |err| switch (err) { |
lib/std/fs/wasi.zig+4-2| ... | @@ -4,6 +4,8 @@ const mem = std.mem; | ... | @@ -4,6 +4,8 @@ const mem = std.mem; |
| 4 | const math = std.math; | 4 | const math = std.math; |
| 5 | const Allocator = mem.Allocator; | 5 | const Allocator = mem.Allocator; |
| 6 | const wasi = std.os.wasi; | 6 | const wasi = std.os.wasi; |
| 7 | const fd_t = wasi.fd_t; | ||
| 8 | const prestat_t = wasi.prestat_t; | ||
| 7 | 9 | ||
| 8 | /// Type-tag of WASI preopen. | 10 | /// Type-tag of WASI preopen. |
| 9 | /// | 11 | /// |
| ... | @@ -114,7 +116,7 @@ pub const PreopenList = struct { | ... | @@ -114,7 +116,7 @@ pub const PreopenList = struct { |
| 114 | 116 | ||
| 115 | while (true) { | 117 | while (true) { |
| 116 | var buf: prestat_t = undefined; | 118 | var buf: prestat_t = undefined; |
| 117 | switch (fd_prestat_get(fd, &buf)) { | 119 | switch (wasi.fd_prestat_get(fd, &buf)) { |
| 118 | .SUCCESS => {}, | 120 | .SUCCESS => {}, |
| 119 | .OPNOTSUPP => { | 121 | .OPNOTSUPP => { |
| 120 | // not a preopen, so keep going | 122 | // not a preopen, so keep going |
| ... | @@ -130,7 +132,7 @@ pub const PreopenList = struct { | ... | @@ -130,7 +132,7 @@ pub const PreopenList = struct { |
| 130 | const preopen_len = buf.u.dir.pr_name_len; | 132 | const preopen_len = buf.u.dir.pr_name_len; |
| 131 | const path_buf = try self.buffer.allocator.alloc(u8, preopen_len); | 133 | const path_buf = try self.buffer.allocator.alloc(u8, preopen_len); |
| 132 | mem.set(u8, path_buf, 0); | 134 | mem.set(u8, path_buf, 0); |
| 133 | switch (fd_prestat_dir_name(fd, path_buf.ptr, preopen_len)) { | 135 | switch (wasi.fd_prestat_dir_name(fd, path_buf.ptr, preopen_len)) { |
| 134 | .SUCCESS => {}, | 136 | .SUCCESS => {}, |
| 135 | else => |err| return os.unexpectedErrno(err), | 137 | else => |err| return os.unexpectedErrno(err), |
| 136 | } | 138 | } |
lib/std/hash_map.zig+6-2| ... | @@ -622,8 +622,12 @@ pub fn HashMap( | ... | @@ -622,8 +622,12 @@ pub fn HashMap( |
| 622 | return other.promoteContext(self.allocator, new_ctx); | 622 | return other.promoteContext(self.allocator, new_ctx); |
| 623 | } | 623 | } |
| 624 | 624 | ||
| 625 | /// Creates a copy of this map, using a specified allocator and context | 625 | /// Creates a copy of this map, using a specified allocator and context. |
| 626 | pub fn cloneWithAllocatorAndContext(new_allocator: *Allocator, new_ctx: anytype) !HashMap(K, V, @TypeOf(new_ctx), max_load_percentage) { | 626 | pub fn cloneWithAllocatorAndContext( |
| 627 | self: Self, | ||
| 628 | new_allocator: *Allocator, | ||
| 629 | new_ctx: anytype, | ||
| 630 | ) !HashMap(K, V, @TypeOf(new_ctx), max_load_percentage) { | ||
| 627 | var other = try self.unmanaged.cloneContext(new_allocator, new_ctx); | 631 | var other = try self.unmanaged.cloneContext(new_allocator, new_ctx); |
| 628 | return other.promoteContext(new_allocator, new_ctx); | 632 | return other.promoteContext(new_allocator, new_ctx); |
| 629 | } | 633 | } |
lib/std/heap.zig+4-4| ... | @@ -88,12 +88,12 @@ const CAllocator = struct { | ... | @@ -88,12 +88,12 @@ const CAllocator = struct { |
| 88 | 88 | ||
| 89 | fn alignedAllocSize(ptr: [*]u8) usize { | 89 | fn alignedAllocSize(ptr: [*]u8) usize { |
| 90 | if (supports_posix_memalign) { | 90 | if (supports_posix_memalign) { |
| 91 | return malloc_size(ptr); | 91 | return CAllocator.malloc_size(ptr); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | const unaligned_ptr = getHeader(ptr).*; | 94 | const unaligned_ptr = getHeader(ptr).*; |
| 95 | const delta = @ptrToInt(ptr) - @ptrToInt(unaligned_ptr); | 95 | const delta = @ptrToInt(ptr) - @ptrToInt(unaligned_ptr); |
| 96 | return malloc_size(unaligned_ptr) - delta; | 96 | return CAllocator.malloc_size(unaligned_ptr) - delta; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | fn alloc( | 99 | fn alloc( |
| ... | @@ -113,7 +113,7 @@ const CAllocator = struct { | ... | @@ -113,7 +113,7 @@ const CAllocator = struct { |
| 113 | return ptr[0..len]; | 113 | return ptr[0..len]; |
| 114 | } | 114 | } |
| 115 | const full_len = init: { | 115 | const full_len = init: { |
| 116 | if (supports_malloc_size) { | 116 | if (CAllocator.supports_malloc_size) { |
| 117 | const s = alignedAllocSize(ptr); | 117 | const s = alignedAllocSize(ptr); |
| 118 | assert(s >= len); | 118 | assert(s >= len); |
| 119 | break :init s; | 119 | break :init s; |
| ... | @@ -141,7 +141,7 @@ const CAllocator = struct { | ... | @@ -141,7 +141,7 @@ const CAllocator = struct { |
| 141 | if (new_len <= buf.len) { | 141 | if (new_len <= buf.len) { |
| 142 | return mem.alignAllocLen(buf.len, new_len, len_align); | 142 | return mem.alignAllocLen(buf.len, new_len, len_align); |
| 143 | } | 143 | } |
| 144 | if (supports_malloc_size) { | 144 | if (CAllocator.supports_malloc_size) { |
| 145 | const full_len = alignedAllocSize(buf.ptr); | 145 | const full_len = alignedAllocSize(buf.ptr); |
| 146 | if (new_len <= full_len) { | 146 | if (new_len <= full_len) { |
| 147 | return mem.alignAllocLen(full_len, new_len, len_align); | 147 | return mem.alignAllocLen(full_len, new_len, len_align); |
lib/std/io/c_writer.zig+1| ... | @@ -2,6 +2,7 @@ const std = @import("../std.zig"); | ... | @@ -2,6 +2,7 @@ const std = @import("../std.zig"); |
| 2 | const builtin = std.builtin; | 2 | const builtin = std.builtin; |
| 3 | const io = std.io; | 3 | const io = std.io; |
| 4 | const testing = std.testing; | 4 | const testing = std.testing; |
| 5 | const os = std.os; | ||
| 5 | 6 | ||
| 6 | pub const CWriter = io.Writer(*std.c.FILE, std.fs.File.WriteError, cWriterWrite); | 7 | pub const CWriter = io.Writer(*std.c.FILE, std.fs.File.WriteError, cWriterWrite); |
| 7 | 8 |
lib/std/json.zig+1-1| ... | @@ -1405,7 +1405,7 @@ fn parsedEqual(a: anytype, b: @TypeOf(a)) bool { | ... | @@ -1405,7 +1405,7 @@ fn parsedEqual(a: anytype, b: @TypeOf(a)) bool { |
| 1405 | if (a == null or b == null) return false; | 1405 | if (a == null or b == null) return false; |
| 1406 | return parsedEqual(a.?, b.?); | 1406 | return parsedEqual(a.?, b.?); |
| 1407 | }, | 1407 | }, |
| 1408 | .Union => { | 1408 | .Union => |info| { |
| 1409 | if (info.tag_type) |UnionTag| { | 1409 | if (info.tag_type) |UnionTag| { |
| 1410 | const tag_a = std.meta.activeTag(a); | 1410 | const tag_a = std.meta.activeTag(a); |
| 1411 | const tag_b = std.meta.activeTag(b); | 1411 | const tag_b = std.meta.activeTag(b); |
lib/std/math/big/int.zig+1-2| ... | @@ -672,10 +672,9 @@ pub const Mutable = struct { | ... | @@ -672,10 +672,9 @@ pub const Mutable = struct { |
| 672 | /// | 672 | /// |
| 673 | /// `limbs_buffer` is used for temporary storage during the operation. | 673 | /// `limbs_buffer` is used for temporary storage during the operation. |
| 674 | pub fn gcdNoAlias(rma: *Mutable, x: Const, y: Const, limbs_buffer: *std.ArrayList(Limb)) !void { | 674 | pub fn gcdNoAlias(rma: *Mutable, x: Const, y: Const, limbs_buffer: *std.ArrayList(Limb)) !void { |
| 675 | _ = limbs_buffer; | ||
| 676 | assert(rma.limbs.ptr != x.limbs.ptr); // illegal aliasing | 675 | assert(rma.limbs.ptr != x.limbs.ptr); // illegal aliasing |
| 677 | assert(rma.limbs.ptr != y.limbs.ptr); // illegal aliasing | 676 | assert(rma.limbs.ptr != y.limbs.ptr); // illegal aliasing |
| 678 | return gcdLehmer(rma, x, y, allocator); | 677 | return gcdLehmer(rma, x, y, limbs_buffer); |
| 679 | } | 678 | } |
| 680 | 679 | ||
| 681 | fn gcdLehmer(result: *Mutable, xa: Const, ya: Const, limbs_buffer: *std.ArrayList(Limb)) !void { | 680 | fn gcdLehmer(result: *Mutable, xa: Const, ya: Const, limbs_buffer: *std.ArrayList(Limb)) !void { |
lib/std/os.zig+26-14| ... | @@ -78,6 +78,7 @@ pub const HOST_NAME_MAX = system.HOST_NAME_MAX; | ... | @@ -78,6 +78,7 @@ pub const HOST_NAME_MAX = system.HOST_NAME_MAX; |
| 78 | pub const IFNAMESIZE = system.IFNAMESIZE; | 78 | pub const IFNAMESIZE = system.IFNAMESIZE; |
| 79 | pub const IOV_MAX = system.IOV_MAX; | 79 | pub const IOV_MAX = system.IOV_MAX; |
| 80 | pub const IPPROTO = system.IPPROTO; | 80 | pub const IPPROTO = system.IPPROTO; |
| 81 | pub const Kevent = system.Kevent; | ||
| 81 | pub const LOCK = system.LOCK; | 82 | pub const LOCK = system.LOCK; |
| 82 | pub const MADV = system.MADV; | 83 | pub const MADV = system.MADV; |
| 83 | pub const MAP = system.MAP; | 84 | pub const MAP = system.MAP; |
| ... | @@ -89,8 +90,10 @@ pub const O = system.O; | ... | @@ -89,8 +90,10 @@ pub const O = system.O; |
| 89 | pub const PATH_MAX = system.PATH_MAX; | 90 | pub const PATH_MAX = system.PATH_MAX; |
| 90 | pub const POLL = system.POLL; | 91 | pub const POLL = system.POLL; |
| 91 | pub const POSIX_FADV = system.POSIX_FADV; | 92 | pub const POSIX_FADV = system.POSIX_FADV; |
| 93 | pub const PR = system.PR; | ||
| 92 | pub const PROT = system.PROT; | 94 | pub const PROT = system.PROT; |
| 93 | pub const REG = system.REG; | 95 | pub const REG = system.REG; |
| 96 | pub const RIGHT = system.RIGHT; | ||
| 94 | pub const RLIM = system.RLIM; | 97 | pub const RLIM = system.RLIM; |
| 95 | pub const RR = system.RR; | 98 | pub const RR = system.RR; |
| 96 | pub const R_OK = system.R_OK; | 99 | pub const R_OK = system.R_OK; |
| ... | @@ -110,6 +113,7 @@ pub const STDOUT_FILENO = system.STDOUT_FILENO; | ... | @@ -110,6 +113,7 @@ pub const STDOUT_FILENO = system.STDOUT_FILENO; |
| 110 | pub const SYS = system.SYS; | 113 | pub const SYS = system.SYS; |
| 111 | pub const Sigaction = system.Sigaction; | 114 | pub const Sigaction = system.Sigaction; |
| 112 | pub const Stat = system.Stat; | 115 | pub const Stat = system.Stat; |
| 116 | pub const TCSA = system.TCSA; | ||
| 113 | pub const VDSO = system.VDSO; | 117 | pub const VDSO = system.VDSO; |
| 114 | pub const W = system.W; | 118 | pub const W = system.W; |
| 115 | pub const W_OK = system.W_OK; | 119 | pub const W_OK = system.W_OK; |
| ... | @@ -123,9 +127,12 @@ pub const dev_t = system.dev_t; | ... | @@ -123,9 +127,12 @@ pub const dev_t = system.dev_t; |
| 123 | pub const dl_phdr_info = system.dl_phdr_info; | 127 | pub const dl_phdr_info = system.dl_phdr_info; |
| 124 | pub const empty_sigset = system.empty_sigset; | 128 | pub const empty_sigset = system.empty_sigset; |
| 125 | pub const fd_t = system.fd_t; | 129 | pub const fd_t = system.fd_t; |
| 130 | pub const fdflags_t = system.fdflags_t; | ||
| 131 | pub const fdstat_t = system.fdstat_t; | ||
| 126 | pub const gid_t = system.gid_t; | 132 | pub const gid_t = system.gid_t; |
| 127 | pub const ifreq = system.ifreq; | 133 | pub const ifreq = system.ifreq; |
| 128 | pub const ino_t = system.ino_t; | 134 | pub const ino_t = system.ino_t; |
| 135 | pub const lookupflags_t = system.lookupflags_t; | ||
| 129 | pub const mcontext_t = system.mcontext_t; | 136 | pub const mcontext_t = system.mcontext_t; |
| 130 | pub const mode_t = system.mode_t; | 137 | pub const mode_t = system.mode_t; |
| 131 | pub const msghdr = system.msghdr; | 138 | pub const msghdr = system.msghdr; |
| ... | @@ -133,19 +140,24 @@ pub const msghdr_const = system.msghdr_const; | ... | @@ -133,19 +140,24 @@ pub const msghdr_const = system.msghdr_const; |
| 133 | pub const nfds_t = system.nfds_t; | 140 | pub const nfds_t = system.nfds_t; |
| 134 | pub const nlink_t = system.nlink_t; | 141 | pub const nlink_t = system.nlink_t; |
| 135 | pub const off_t = system.off_t; | 142 | pub const off_t = system.off_t; |
| 143 | pub const oflags_t = system.oflags_t; | ||
| 136 | pub const pid_t = system.pid_t; | 144 | pub const pid_t = system.pid_t; |
| 137 | pub const pollfd = system.pollfd; | 145 | pub const pollfd = system.pollfd; |
| 146 | pub const rights_t = system.rights_t; | ||
| 138 | pub const rlim_t = system.rlim_t; | 147 | pub const rlim_t = system.rlim_t; |
| 139 | pub const rlimit = system.rlimit; | 148 | pub const rlimit = system.rlimit; |
| 140 | pub const rlimit_resource = system.rlimit_resource; | 149 | pub const rlimit_resource = system.rlimit_resource; |
| 150 | pub const rusage = system.rusage; | ||
| 141 | pub const sa_family_t = system.sa_family_t; | 151 | pub const sa_family_t = system.sa_family_t; |
| 142 | pub const siginfo_t = system.siginfo_t; | 152 | pub const siginfo_t = system.siginfo_t; |
| 143 | pub const sigset_t = system.sigset_t; | 153 | pub const sigset_t = system.sigset_t; |
| 144 | pub const sockaddr = system.sockaddr; | 154 | pub const sockaddr = system.sockaddr; |
| 145 | pub const socklen_t = system.socklen_t; | 155 | pub const socklen_t = system.socklen_t; |
| 146 | pub const stack_t = system.stack_t; | 156 | pub const stack_t = system.stack_t; |
| 157 | pub const termios = system.termios; | ||
| 147 | pub const time_t = system.time_t; | 158 | pub const time_t = system.time_t; |
| 148 | pub const timespec = system.timespec; | 159 | pub const timespec = system.timespec; |
| 160 | pub const timestamp_t = system.timestamp_t; | ||
| 149 | pub const timeval = system.timeval; | 161 | pub const timeval = system.timeval; |
| 150 | pub const timezone = system.timezone; | 162 | pub const timezone = system.timezone; |
| 151 | pub const ucontext_t = system.ucontext_t; | 163 | pub const ucontext_t = system.ucontext_t; |
| ... | @@ -2770,8 +2782,8 @@ pub fn isatty(handle: fd_t) bool { | ... | @@ -2770,8 +2782,8 @@ pub fn isatty(handle: fd_t) bool { |
| 2770 | } | 2782 | } |
| 2771 | 2783 | ||
| 2772 | // A tty is a character device that we can't seek or tell on. | 2784 | // A tty is a character device that we can't seek or tell on. |
| 2773 | if (statbuf.fs_filetype != FILETYPE_CHARACTER_DEVICE or | 2785 | if (statbuf.fs_filetype != .CHARACTER_DEVICE or |
| 2774 | (statbuf.fs_rights_base & (RIGHT_FD_SEEK | RIGHT_FD_TELL)) != 0) | 2786 | (statbuf.fs_rights_base & (RIGHT.FD_SEEK | RIGHT.FD_TELL)) != 0) |
| 2775 | { | 2787 | { |
| 2776 | // errno = ENOTTY; | 2788 | // errno = ENOTTY; |
| 2777 | return false; | 2789 | return false; |
| ... | @@ -3933,7 +3945,7 @@ pub const AccessError = error{ | ... | @@ -3933,7 +3945,7 @@ pub const AccessError = error{ |
| 3933 | } || UnexpectedError; | 3945 | } || UnexpectedError; |
| 3934 | 3946 | ||
| 3935 | /// check user's permissions for a file | 3947 | /// check user's permissions for a file |
| 3936 | /// TODO currently this assumes `mode` is `F_OK` on Windows. | 3948 | /// TODO currently this assumes `mode` is `F.OK` on Windows. |
| 3937 | pub fn access(path: []const u8, mode: u32) AccessError!void { | 3949 | pub fn access(path: []const u8, mode: u32) AccessError!void { |
| 3938 | if (builtin.os.tag == .windows) { | 3950 | if (builtin.os.tag == .windows) { |
| 3939 | const path_w = try windows.sliceToPrefixedFileW(path); | 3951 | const path_w = try windows.sliceToPrefixedFileW(path); |
| ... | @@ -4104,10 +4116,10 @@ pub fn pipe2(flags: u32) PipeError![2]fd_t { | ... | @@ -4104,10 +4116,10 @@ pub fn pipe2(flags: u32) PipeError![2]fd_t { |
| 4104 | return fds; | 4116 | return fds; |
| 4105 | 4117 | ||
| 4106 | // O.CLOEXEC is special, it's a file descriptor flag and must be set using | 4118 | // O.CLOEXEC is special, it's a file descriptor flag and must be set using |
| 4107 | // F_SETFD. | 4119 | // F.SETFD. |
| 4108 | if (flags & O.CLOEXEC != 0) { | 4120 | if (flags & O.CLOEXEC != 0) { |
| 4109 | for (fds) |fd| { | 4121 | for (fds) |fd| { |
| 4110 | switch (errno(system.fcntl(fd, F_SETFD, @as(u32, FD_CLOEXEC)))) { | 4122 | switch (errno(system.fcntl(fd, F.SETFD, @as(u32, FD_CLOEXEC)))) { |
| 4111 | .SUCCESS => {}, | 4123 | .SUCCESS => {}, |
| 4112 | .INVAL => unreachable, // Invalid flags | 4124 | .INVAL => unreachable, // Invalid flags |
| 4113 | .BADF => unreachable, // Always a race condition | 4125 | .BADF => unreachable, // Always a race condition |
| ... | @@ -4117,10 +4129,10 @@ pub fn pipe2(flags: u32) PipeError![2]fd_t { | ... | @@ -4117,10 +4129,10 @@ pub fn pipe2(flags: u32) PipeError![2]fd_t { |
| 4117 | } | 4129 | } |
| 4118 | 4130 | ||
| 4119 | const new_flags = flags & ~@as(u32, O.CLOEXEC); | 4131 | const new_flags = flags & ~@as(u32, O.CLOEXEC); |
| 4120 | // Set every other flag affecting the file status using F_SETFL. | 4132 | // Set every other flag affecting the file status using F.SETFL. |
| 4121 | if (new_flags != 0) { | 4133 | if (new_flags != 0) { |
| 4122 | for (fds) |fd| { | 4134 | for (fds) |fd| { |
| 4123 | switch (errno(system.fcntl(fd, F_SETFL, new_flags))) { | 4135 | switch (errno(system.fcntl(fd, F.SETFL, new_flags))) { |
| 4124 | .SUCCESS => {}, | 4136 | .SUCCESS => {}, |
| 4125 | .INVAL => unreachable, // Invalid flags | 4137 | .INVAL => unreachable, // Invalid flags |
| 4126 | .BADF => unreachable, // Always a race condition | 4138 | .BADF => unreachable, // Always a race condition |
| ... | @@ -4425,14 +4437,14 @@ fn setSockFlags(sock: socket_t, flags: u32) !void { | ... | @@ -4425,14 +4437,14 @@ fn setSockFlags(sock: socket_t, flags: u32) !void { |
| 4425 | if (builtin.os.tag == .windows) { | 4437 | if (builtin.os.tag == .windows) { |
| 4426 | // TODO: Find out if this is supported for sockets | 4438 | // TODO: Find out if this is supported for sockets |
| 4427 | } else { | 4439 | } else { |
| 4428 | var fd_flags = fcntl(sock, F_GETFD, 0) catch |err| switch (err) { | 4440 | var fd_flags = fcntl(sock, F.GETFD, 0) catch |err| switch (err) { |
| 4429 | error.FileBusy => unreachable, | 4441 | error.FileBusy => unreachable, |
| 4430 | error.Locked => unreachable, | 4442 | error.Locked => unreachable, |
| 4431 | error.PermissionDenied => unreachable, | 4443 | error.PermissionDenied => unreachable, |
| 4432 | else => |e| return e, | 4444 | else => |e| return e, |
| 4433 | }; | 4445 | }; |
| 4434 | fd_flags |= FD_CLOEXEC; | 4446 | fd_flags |= FD_CLOEXEC; |
| 4435 | _ = fcntl(sock, F_SETFD, fd_flags) catch |err| switch (err) { | 4447 | _ = fcntl(sock, F.SETFD, fd_flags) catch |err| switch (err) { |
| 4436 | error.FileBusy => unreachable, | 4448 | error.FileBusy => unreachable, |
| 4437 | error.Locked => unreachable, | 4449 | error.Locked => unreachable, |
| 4438 | error.PermissionDenied => unreachable, | 4450 | error.PermissionDenied => unreachable, |
| ... | @@ -4453,14 +4465,14 @@ fn setSockFlags(sock: socket_t, flags: u32) !void { | ... | @@ -4453,14 +4465,14 @@ fn setSockFlags(sock: socket_t, flags: u32) !void { |
| 4453 | } | 4465 | } |
| 4454 | } | 4466 | } |
| 4455 | } else { | 4467 | } else { |
| 4456 | var fl_flags = fcntl(sock, F_GETFL, 0) catch |err| switch (err) { | 4468 | var fl_flags = fcntl(sock, F.GETFL, 0) catch |err| switch (err) { |
| 4457 | error.FileBusy => unreachable, | 4469 | error.FileBusy => unreachable, |
| 4458 | error.Locked => unreachable, | 4470 | error.Locked => unreachable, |
| 4459 | error.PermissionDenied => unreachable, | 4471 | error.PermissionDenied => unreachable, |
| 4460 | else => |e| return e, | 4472 | else => |e| return e, |
| 4461 | }; | 4473 | }; |
| 4462 | fl_flags |= O.NONBLOCK; | 4474 | fl_flags |= O.NONBLOCK; |
| 4463 | _ = fcntl(sock, F_SETFL, fl_flags) catch |err| switch (err) { | 4475 | _ = fcntl(sock, F.SETFL, fl_flags) catch |err| switch (err) { |
| 4464 | error.FileBusy => unreachable, | 4476 | error.FileBusy => unreachable, |
| 4465 | error.Locked => unreachable, | 4477 | error.Locked => unreachable, |
| 4466 | error.PermissionDenied => unreachable, | 4478 | error.PermissionDenied => unreachable, |
| ... | @@ -4625,14 +4637,14 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 { | ... | @@ -4625,14 +4637,14 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 { |
| 4625 | return out_buffer[0..end_index]; | 4637 | return out_buffer[0..end_index]; |
| 4626 | }, | 4638 | }, |
| 4627 | .macos, .ios, .watchos, .tvos => { | 4639 | .macos, .ios, .watchos, .tvos => { |
| 4628 | // On macOS, we can use F_GETPATH fcntl command to query the OS for | 4640 | // On macOS, we can use F.GETPATH fcntl command to query the OS for |
| 4629 | // the path to the file descriptor. | 4641 | // the path to the file descriptor. |
| 4630 | @memset(out_buffer, 0, MAX_PATH_BYTES); | 4642 | @memset(out_buffer, 0, MAX_PATH_BYTES); |
| 4631 | switch (errno(system.fcntl(fd, F_GETPATH, out_buffer))) { | 4643 | switch (errno(system.fcntl(fd, F.GETPATH, out_buffer))) { |
| 4632 | .SUCCESS => {}, | 4644 | .SUCCESS => {}, |
| 4633 | .BADF => return error.FileNotFound, | 4645 | .BADF => return error.FileNotFound, |
| 4634 | // TODO man pages for fcntl on macOS don't really tell you what | 4646 | // TODO man pages for fcntl on macOS don't really tell you what |
| 4635 | // errno values to expect when command is F_GETPATH... | 4647 | // errno values to expect when command is F.GETPATH... |
| 4636 | else => |err| return unexpectedErrno(err), | 4648 | else => |err| return unexpectedErrno(err), |
| 4637 | } | 4649 | } |
| 4638 | const len = mem.indexOfScalar(u8, out_buffer[0..], @as(u8, 0)) orelse MAX_PATH_BYTES; | 4650 | const len = mem.indexOfScalar(u8, out_buffer[0..], @as(u8, 0)) orelse MAX_PATH_BYTES; |
lib/std/os/linux.zig+36-32| ... | @@ -50,8 +50,12 @@ pub const syscall3 = syscall_bits.syscall3; | ... | @@ -50,8 +50,12 @@ pub const syscall3 = syscall_bits.syscall3; |
| 50 | pub const syscall4 = syscall_bits.syscall4; | 50 | pub const syscall4 = syscall_bits.syscall4; |
| 51 | pub const syscall5 = syscall_bits.syscall5; | 51 | pub const syscall5 = syscall_bits.syscall5; |
| 52 | pub const syscall6 = syscall_bits.syscall6; | 52 | pub const syscall6 = syscall_bits.syscall6; |
| 53 | pub const syscall7 = syscall_bits.syscall7; | ||
| 53 | pub const restore = syscall_bits.restore; | 54 | pub const restore = syscall_bits.restore; |
| 54 | pub const restore_rt = syscall_bits.restore_rt; | 55 | pub const restore_rt = syscall_bits.restore_rt; |
| 56 | pub const socketcall = syscall_bits.socketcall; | ||
| 57 | pub const syscall_pipe = syscall_bits.syscall_pipe; | ||
| 58 | pub const syscall_fork = syscall_bits.syscall_fork; | ||
| 55 | 59 | ||
| 56 | pub const clone = arch_bits.clone; | 60 | pub const clone = arch_bits.clone; |
| 57 | pub const ARCH = arch_bits.ARCH; | 61 | pub const ARCH = arch_bits.ARCH; |
| ... | @@ -181,7 +185,7 @@ pub fn dup2(old: i32, new: i32) usize { | ... | @@ -181,7 +185,7 @@ pub fn dup2(old: i32, new: i32) usize { |
| 181 | } else { | 185 | } else { |
| 182 | if (old == new) { | 186 | if (old == new) { |
| 183 | if (std.debug.runtime_safety) { | 187 | if (std.debug.runtime_safety) { |
| 184 | const rc = syscall2(.fcntl, @bitCast(usize, @as(isize, old)), F_GETFD); | 188 | const rc = syscall2(.fcntl, @bitCast(usize, @as(isize, old)), F.GETFD); |
| 185 | if (@bitCast(isize, rc) < 0) return rc; | 189 | if (@bitCast(isize, rc) < 0) return rc; |
| 186 | } | 190 | } |
| 187 | return @intCast(usize, old); | 191 | return @intCast(usize, old); |
| ... | @@ -217,7 +221,7 @@ pub fn fork() usize { | ... | @@ -217,7 +221,7 @@ pub fn fork() usize { |
| 217 | } else if (@hasField(SYS, "fork")) { | 221 | } else if (@hasField(SYS, "fork")) { |
| 218 | return syscall0(.fork); | 222 | return syscall0(.fork); |
| 219 | } else { | 223 | } else { |
| 220 | return syscall2(.clone, SIGCHLD, 0); | 224 | return syscall2(.clone, SIG.CHLD, 0); |
| 221 | } | 225 | } |
| 222 | } | 226 | } |
| 223 | 227 | ||
| ... | @@ -821,7 +825,7 @@ var vdso_clock_gettime = @ptrCast(?*const c_void, init_vdso_clock_gettime); | ... | @@ -821,7 +825,7 @@ var vdso_clock_gettime = @ptrCast(?*const c_void, init_vdso_clock_gettime); |
| 821 | const vdso_clock_gettime_ty = fn (i32, *timespec) callconv(.C) usize; | 825 | const vdso_clock_gettime_ty = fn (i32, *timespec) callconv(.C) usize; |
| 822 | 826 | ||
| 823 | pub fn clock_gettime(clk_id: i32, tp: *timespec) usize { | 827 | pub fn clock_gettime(clk_id: i32, tp: *timespec) usize { |
| 824 | if (@hasDecl(@This(), "VDSO_CGT_SYM")) { | 828 | if (@hasDecl(VDSO, "CGT_SYM")) { |
| 825 | const ptr = @atomicLoad(?*const c_void, &vdso_clock_gettime, .Unordered); | 829 | const ptr = @atomicLoad(?*const c_void, &vdso_clock_gettime, .Unordered); |
| 826 | if (ptr) |fn_ptr| { | 830 | if (ptr) |fn_ptr| { |
| 827 | const f = @ptrCast(vdso_clock_gettime_ty, fn_ptr); | 831 | const f = @ptrCast(vdso_clock_gettime_ty, fn_ptr); |
| ... | @@ -836,7 +840,7 @@ pub fn clock_gettime(clk_id: i32, tp: *timespec) usize { | ... | @@ -836,7 +840,7 @@ pub fn clock_gettime(clk_id: i32, tp: *timespec) usize { |
| 836 | } | 840 | } |
| 837 | 841 | ||
| 838 | fn init_vdso_clock_gettime(clk: i32, ts: *timespec) callconv(.C) usize { | 842 | fn init_vdso_clock_gettime(clk: i32, ts: *timespec) callconv(.C) usize { |
| 839 | const ptr = @intToPtr(?*const c_void, vdso.lookup(VDSO_CGT_VER, VDSO_CGT_SYM)); | 843 | const ptr = @intToPtr(?*const c_void, vdso.lookup(VDSO.CGT_VER, VDSO.CGT_SYM)); |
| 840 | // Note that we may not have a VDSO at all, update the stub address anyway | 844 | // Note that we may not have a VDSO at all, update the stub address anyway |
| 841 | // so that clock_gettime will fall back on the good old (and slow) syscall | 845 | // so that clock_gettime will fall back on the good old (and slow) syscall |
| 842 | @atomicStore(?*const c_void, &vdso_clock_gettime, ptr, .Monotonic); | 846 | @atomicStore(?*const c_void, &vdso_clock_gettime, ptr, .Monotonic); |
| ... | @@ -1070,42 +1074,42 @@ pub fn sigismember(set: *const sigset_t, sig: u6) bool { | ... | @@ -1070,42 +1074,42 @@ pub fn sigismember(set: *const sigset_t, sig: u6) bool { |
| 1070 | 1074 | ||
| 1071 | pub fn getsockname(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { | 1075 | pub fn getsockname(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { |
| 1072 | if (native_arch == .i386) { | 1076 | if (native_arch == .i386) { |
| 1073 | return socketcall(SC_getsockname, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) }); | 1077 | return socketcall(SC.getsockname, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) }); |
| 1074 | } | 1078 | } |
| 1075 | return syscall3(.getsockname, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len)); | 1079 | return syscall3(.getsockname, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len)); |
| 1076 | } | 1080 | } |
| 1077 | 1081 | ||
| 1078 | pub fn getpeername(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { | 1082 | pub fn getpeername(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { |
| 1079 | if (native_arch == .i386) { | 1083 | if (native_arch == .i386) { |
| 1080 | return socketcall(SC_getpeername, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) }); | 1084 | return socketcall(SC.getpeername, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) }); |
| 1081 | } | 1085 | } |
| 1082 | return syscall3(.getpeername, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len)); | 1086 | return syscall3(.getpeername, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len)); |
| 1083 | } | 1087 | } |
| 1084 | 1088 | ||
| 1085 | pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize { | 1089 | pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize { |
| 1086 | if (native_arch == .i386) { | 1090 | if (native_arch == .i386) { |
| 1087 | return socketcall(SC_socket, &[3]usize{ domain, socket_type, protocol }); | 1091 | return socketcall(SC.socket, &[3]usize{ domain, socket_type, protocol }); |
| 1088 | } | 1092 | } |
| 1089 | return syscall3(.socket, domain, socket_type, protocol); | 1093 | return syscall3(.socket, domain, socket_type, protocol); |
| 1090 | } | 1094 | } |
| 1091 | 1095 | ||
| 1092 | pub fn setsockopt(fd: i32, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize { | 1096 | pub fn setsockopt(fd: i32, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize { |
| 1093 | if (native_arch == .i386) { | 1097 | if (native_arch == .i386) { |
| 1094 | return socketcall(SC_setsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen) }); | 1098 | return socketcall(SC.setsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen) }); |
| 1095 | } | 1099 | } |
| 1096 | return syscall5(.setsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen)); | 1100 | return syscall5(.setsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen)); |
| 1097 | } | 1101 | } |
| 1098 | 1102 | ||
| 1099 | pub fn getsockopt(fd: i32, level: u32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize { | 1103 | pub fn getsockopt(fd: i32, level: u32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize { |
| 1100 | if (native_arch == .i386) { | 1104 | if (native_arch == .i386) { |
| 1101 | return socketcall(SC_getsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen) }); | 1105 | return socketcall(SC.getsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen) }); |
| 1102 | } | 1106 | } |
| 1103 | return syscall5(.getsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen)); | 1107 | return syscall5(.getsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen)); |
| 1104 | } | 1108 | } |
| 1105 | 1109 | ||
| 1106 | pub fn sendmsg(fd: i32, msg: *const std.x.os.Socket.Message, flags: c_int) usize { | 1110 | pub fn sendmsg(fd: i32, msg: *const std.x.os.Socket.Message, flags: c_int) usize { |
| 1107 | if (native_arch == .i386) { | 1111 | if (native_arch == .i386) { |
| 1108 | return socketcall(SC_sendmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)) }); | 1112 | return socketcall(SC.sendmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)) }); |
| 1109 | } | 1113 | } |
| 1110 | return syscall3(.sendmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags))); | 1114 | return syscall3(.sendmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags))); |
| 1111 | } | 1115 | } |
| ... | @@ -1152,49 +1156,49 @@ pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize | ... | @@ -1152,49 +1156,49 @@ pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize |
| 1152 | 1156 | ||
| 1153 | pub fn connect(fd: i32, addr: *const c_void, len: socklen_t) usize { | 1157 | pub fn connect(fd: i32, addr: *const c_void, len: socklen_t) usize { |
| 1154 | if (native_arch == .i386) { | 1158 | if (native_arch == .i386) { |
| 1155 | return socketcall(SC_connect, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), len }); | 1159 | return socketcall(SC.connect, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), len }); |
| 1156 | } | 1160 | } |
| 1157 | return syscall3(.connect, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), len); | 1161 | return syscall3(.connect, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), len); |
| 1158 | } | 1162 | } |
| 1159 | 1163 | ||
| 1160 | pub fn recvmsg(fd: i32, msg: *std.x.os.Socket.Message, flags: c_int) usize { | 1164 | pub fn recvmsg(fd: i32, msg: *std.x.os.Socket.Message, flags: c_int) usize { |
| 1161 | if (native_arch == .i386) { | 1165 | if (native_arch == .i386) { |
| 1162 | return socketcall(SC_recvmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)) }); | 1166 | return socketcall(SC.recvmsg, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags)) }); |
| 1163 | } | 1167 | } |
| 1164 | return syscall3(.recvmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags))); | 1168 | return syscall3(.recvmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msg), @bitCast(usize, @as(isize, flags))); |
| 1165 | } | 1169 | } |
| 1166 | 1170 | ||
| 1167 | pub fn recvfrom(fd: i32, noalias buf: [*]u8, len: usize, flags: u32, noalias addr: ?*sockaddr, noalias alen: ?*socklen_t) usize { | 1171 | pub fn recvfrom(fd: i32, noalias buf: [*]u8, len: usize, flags: u32, noalias addr: ?*sockaddr, noalias alen: ?*socklen_t) usize { |
| 1168 | if (native_arch == .i386) { | 1172 | if (native_arch == .i386) { |
| 1169 | return socketcall(SC_recvfrom, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen) }); | 1173 | return socketcall(SC.recvfrom, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen) }); |
| 1170 | } | 1174 | } |
| 1171 | return syscall6(.recvfrom, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen)); | 1175 | return syscall6(.recvfrom, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @ptrToInt(alen)); |
| 1172 | } | 1176 | } |
| 1173 | 1177 | ||
| 1174 | pub fn shutdown(fd: i32, how: i32) usize { | 1178 | pub fn shutdown(fd: i32, how: i32) usize { |
| 1175 | if (native_arch == .i386) { | 1179 | if (native_arch == .i386) { |
| 1176 | return socketcall(SC_shutdown, &[2]usize{ @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, how)) }); | 1180 | return socketcall(SC.shutdown, &[2]usize{ @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, how)) }); |
| 1177 | } | 1181 | } |
| 1178 | return syscall2(.shutdown, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, how))); | 1182 | return syscall2(.shutdown, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, how))); |
| 1179 | } | 1183 | } |
| 1180 | 1184 | ||
| 1181 | pub fn bind(fd: i32, addr: *const sockaddr, len: socklen_t) usize { | 1185 | pub fn bind(fd: i32, addr: *const sockaddr, len: socklen_t) usize { |
| 1182 | if (native_arch == .i386) { | 1186 | if (native_arch == .i386) { |
| 1183 | return socketcall(SC_bind, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len) }); | 1187 | return socketcall(SC.bind, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len) }); |
| 1184 | } | 1188 | } |
| 1185 | return syscall3(.bind, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len)); | 1189 | return syscall3(.bind, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len)); |
| 1186 | } | 1190 | } |
| 1187 | 1191 | ||
| 1188 | pub fn listen(fd: i32, backlog: u32) usize { | 1192 | pub fn listen(fd: i32, backlog: u32) usize { |
| 1189 | if (native_arch == .i386) { | 1193 | if (native_arch == .i386) { |
| 1190 | return socketcall(SC_listen, &[2]usize{ @bitCast(usize, @as(isize, fd)), backlog }); | 1194 | return socketcall(SC.listen, &[2]usize{ @bitCast(usize, @as(isize, fd)), backlog }); |
| 1191 | } | 1195 | } |
| 1192 | return syscall2(.listen, @bitCast(usize, @as(isize, fd)), backlog); | 1196 | return syscall2(.listen, @bitCast(usize, @as(isize, fd)), backlog); |
| 1193 | } | 1197 | } |
| 1194 | 1198 | ||
| 1195 | pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const sockaddr, alen: socklen_t) usize { | 1199 | pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const sockaddr, alen: socklen_t) usize { |
| 1196 | if (native_arch == .i386) { | 1200 | if (native_arch == .i386) { |
| 1197 | return socketcall(SC_sendto, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen) }); | 1201 | return socketcall(SC.sendto, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen) }); |
| 1198 | } | 1202 | } |
| 1199 | return syscall6(.sendto, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen)); | 1203 | return syscall6(.sendto, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen)); |
| 1200 | } | 1204 | } |
| ... | @@ -1221,21 +1225,21 @@ pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize { | ... | @@ -1221,21 +1225,21 @@ pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize { |
| 1221 | 1225 | ||
| 1222 | pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: [2]i32) usize { | 1226 | pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: [2]i32) usize { |
| 1223 | if (native_arch == .i386) { | 1227 | if (native_arch == .i386) { |
| 1224 | return socketcall(SC_socketpair, &[4]usize{ @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(&fd[0]) }); | 1228 | return socketcall(SC.socketpair, &[4]usize{ @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(&fd[0]) }); |
| 1225 | } | 1229 | } |
| 1226 | return syscall4(.socketpair, @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(&fd[0])); | 1230 | return syscall4(.socketpair, @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(&fd[0])); |
| 1227 | } | 1231 | } |
| 1228 | 1232 | ||
| 1229 | pub fn accept(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize { | 1233 | pub fn accept(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize { |
| 1230 | if (native_arch == .i386) { | 1234 | if (native_arch == .i386) { |
| 1231 | return socketcall(SC_accept, &[4]usize{ fd, addr, len, 0 }); | 1235 | return socketcall(SC.accept, &[4]usize{ fd, addr, len, 0 }); |
| 1232 | } | 1236 | } |
| 1233 | return accept4(fd, addr, len, 0); | 1237 | return accept4(fd, addr, len, 0); |
| 1234 | } | 1238 | } |
| 1235 | 1239 | ||
| 1236 | pub fn accept4(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t, flags: u32) usize { | 1240 | pub fn accept4(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t, flags: u32) usize { |
| 1237 | if (native_arch == .i386) { | 1241 | if (native_arch == .i386) { |
| 1238 | return socketcall(SC_accept4, &[4]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len), flags }); | 1242 | return socketcall(SC.accept4, &[4]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len), flags }); |
| 1239 | } | 1243 | } |
| 1240 | return syscall4(.accept4, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len), flags); | 1244 | return syscall4(.accept4, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len), flags); |
| 1241 | } | 1245 | } |
| ... | @@ -1435,11 +1439,11 @@ pub fn getrusage(who: i32, usage: *rusage) usize { | ... | @@ -1435,11 +1439,11 @@ pub fn getrusage(who: i32, usage: *rusage) usize { |
| 1435 | } | 1439 | } |
| 1436 | 1440 | ||
| 1437 | pub fn tcgetattr(fd: fd_t, termios_p: *termios) usize { | 1441 | pub fn tcgetattr(fd: fd_t, termios_p: *termios) usize { |
| 1438 | return syscall3(.ioctl, @bitCast(usize, @as(isize, fd)), TCGETS, @ptrToInt(termios_p)); | 1442 | return syscall3(.ioctl, @bitCast(usize, @as(isize, fd)), T.CGETS, @ptrToInt(termios_p)); |
| 1439 | } | 1443 | } |
| 1440 | 1444 | ||
| 1441 | pub fn tcsetattr(fd: fd_t, optional_action: TCSA, termios_p: *const termios) usize { | 1445 | pub fn tcsetattr(fd: fd_t, optional_action: TCSA, termios_p: *const termios) usize { |
| 1442 | return syscall3(.ioctl, @bitCast(usize, @as(isize, fd)), TCSETS + @enumToInt(optional_action), @ptrToInt(termios_p)); | 1446 | return syscall3(.ioctl, @bitCast(usize, @as(isize, fd)), T.CSETS + @enumToInt(optional_action), @ptrToInt(termios_p)); |
| 1443 | } | 1447 | } |
| 1444 | 1448 | ||
| 1445 | pub fn ioctl(fd: fd_t, request: u32, arg: usize) usize { | 1449 | pub fn ioctl(fd: fd_t, request: u32, arg: usize) usize { |
| ... | @@ -1900,7 +1904,7 @@ pub const SIG = if (is_mips) struct { | ... | @@ -1900,7 +1904,7 @@ pub const SIG = if (is_mips) struct { |
| 1900 | pub const IOT = ABRT; | 1904 | pub const IOT = ABRT; |
| 1901 | pub const CLD = CHLD; | 1905 | pub const CLD = CHLD; |
| 1902 | pub const PWR = LOST; | 1906 | pub const PWR = LOST; |
| 1903 | pub const IO = POLL; | 1907 | pub const IO = SIG.POLL; |
| 1904 | 1908 | ||
| 1905 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | 1909 | pub const ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); |
| 1906 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); | 1910 | pub const DFL = @intToPtr(?Sigaction.sigaction_fn, 0); |
| ... | @@ -1996,8 +2000,8 @@ pub const SOCK = struct { | ... | @@ -1996,8 +2000,8 @@ pub const SOCK = struct { |
| 1996 | pub const PF = struct { | 2000 | pub const PF = struct { |
| 1997 | pub const UNSPEC = 0; | 2001 | pub const UNSPEC = 0; |
| 1998 | pub const LOCAL = 1; | 2002 | pub const LOCAL = 1; |
| 1999 | pub const UNIX = PF_LOCAL; | 2003 | pub const UNIX = LOCAL; |
| 2000 | pub const FILE = PF_LOCAL; | 2004 | pub const FILE = LOCAL; |
| 2001 | pub const INET = 2; | 2005 | pub const INET = 2; |
| 2002 | pub const AX25 = 3; | 2006 | pub const AX25 = 3; |
| 2003 | pub const IPX = 4; | 2007 | pub const IPX = 4; |
| ... | @@ -2013,7 +2017,7 @@ pub const PF = struct { | ... | @@ -2013,7 +2017,7 @@ pub const PF = struct { |
| 2013 | pub const SECURITY = 14; | 2017 | pub const SECURITY = 14; |
| 2014 | pub const KEY = 15; | 2018 | pub const KEY = 15; |
| 2015 | pub const NETLINK = 16; | 2019 | pub const NETLINK = 16; |
| 2016 | pub const ROUTE = PF_NETLINK; | 2020 | pub const ROUTE = PF.NETLINK; |
| 2017 | pub const PACKET = 17; | 2021 | pub const PACKET = 17; |
| 2018 | pub const ASH = 18; | 2022 | pub const ASH = 18; |
| 2019 | pub const ECONET = 19; | 2023 | pub const ECONET = 19; |
| ... | @@ -2357,7 +2361,7 @@ pub const IP = struct { | ... | @@ -2357,7 +2361,7 @@ pub const IP = struct { |
| 2357 | pub const PASSSEC = 18; | 2361 | pub const PASSSEC = 18; |
| 2358 | pub const TRANSPARENT = 19; | 2362 | pub const TRANSPARENT = 19; |
| 2359 | pub const ORIGDSTADDR = 20; | 2363 | pub const ORIGDSTADDR = 20; |
| 2360 | pub const RECVORIGDSTADDR = IP_ORIGDSTADDR; | 2364 | pub const RECVORIGDSTADDR = IP.ORIGDSTADDR; |
| 2361 | pub const MINTTL = 21; | 2365 | pub const MINTTL = 21; |
| 2362 | pub const NODEFRAG = 22; | 2366 | pub const NODEFRAG = 22; |
| 2363 | pub const CHECKSUM = 23; | 2367 | pub const CHECKSUM = 23; |
| ... | @@ -2376,7 +2380,7 @@ pub const IP = struct { | ... | @@ -2376,7 +2380,7 @@ pub const IP = struct { |
| 2376 | pub const MULTICAST_ALL = 49; | 2380 | pub const MULTICAST_ALL = 49; |
| 2377 | pub const UNICAST_IF = 50; | 2381 | pub const UNICAST_IF = 50; |
| 2378 | 2382 | ||
| 2379 | pub const RECVRETOPTS = IP_RETOPTS; | 2383 | pub const RECVRETOPTS = IP.RETOPTS; |
| 2380 | 2384 | ||
| 2381 | pub const PMTUDISC_DONT = 0; | 2385 | pub const PMTUDISC_DONT = 0; |
| 2382 | pub const PMTUDISC_WANT = 1; | 2386 | pub const PMTUDISC_WANT = 1; |
| ... | @@ -2418,7 +2422,7 @@ pub const IPV6 = struct { | ... | @@ -2418,7 +2422,7 @@ pub const IPV6 = struct { |
| 2418 | pub const JOIN_ANYCAST = 27; | 2422 | pub const JOIN_ANYCAST = 27; |
| 2419 | pub const LEAVE_ANYCAST = 28; | 2423 | pub const LEAVE_ANYCAST = 28; |
| 2420 | 2424 | ||
| 2421 | // IPV6_MTU_DISCOVER values | 2425 | // IPV6.MTU_DISCOVER values |
| 2422 | pub const PMTUDISC_DONT = 0; | 2426 | pub const PMTUDISC_DONT = 0; |
| 2423 | pub const PMTUDISC_WANT = 1; | 2427 | pub const PMTUDISC_WANT = 1; |
| 2424 | pub const PMTUDISC_DO = 2; | 2428 | pub const PMTUDISC_DO = 2; |
| ... | @@ -2470,7 +2474,7 @@ pub const IPV6 = struct { | ... | @@ -2470,7 +2474,7 @@ pub const IPV6 = struct { |
| 2470 | pub const MINHOPCOUNT = 73; | 2474 | pub const MINHOPCOUNT = 73; |
| 2471 | 2475 | ||
| 2472 | pub const ORIGDSTADDR = 74; | 2476 | pub const ORIGDSTADDR = 74; |
| 2473 | pub const RECVORIGDSTADDR = IPV6_ORIGDSTADDR; | 2477 | pub const RECVORIGDSTADDR = IPV6.ORIGDSTADDR; |
| 2474 | pub const TRANSPARENT = 75; | 2478 | pub const TRANSPARENT = 75; |
| 2475 | pub const UNICAST_IF = 76; | 2479 | pub const UNICAST_IF = 76; |
| 2476 | pub const RECVFRAGSIZE = 77; | 2480 | pub const RECVFRAGSIZE = 77; |
| ... | @@ -3924,8 +3928,8 @@ pub const V = switch (native_arch) { | ... | @@ -3924,8 +3928,8 @@ pub const V = switch (native_arch) { |
| 3924 | pub const DISCARD = 13; | 3928 | pub const DISCARD = 13; |
| 3925 | pub const WERASE = 14; | 3929 | pub const WERASE = 14; |
| 3926 | pub const LNEXT = 15; | 3930 | pub const LNEXT = 15; |
| 3927 | pub const MIN = VEOF; | 3931 | pub const MIN = EOF; |
| 3928 | pub const TIME = VEOL; | 3932 | pub const TIME = EOL; |
| 3929 | }, | 3933 | }, |
| 3930 | .mips, .mipsel, .mips64, .mips64el => struct { | 3934 | .mips, .mipsel, .mips64, .mips64el => struct { |
| 3931 | pub const INTR = 0; | 3935 | pub const INTR = 0; |
lib/std/os/linux/arm-eabi.zig+25-23| ... | @@ -551,29 +551,31 @@ pub const O_PATH = 0o10000000; | ... | @@ -551,29 +551,31 @@ pub const O_PATH = 0o10000000; |
| 551 | pub const O_TMPFILE = 0o20040000; | 551 | pub const O_TMPFILE = 0o20040000; |
| 552 | pub const O_NDELAY = O_NONBLOCK; | 552 | pub const O_NDELAY = O_NONBLOCK; |
| 553 | 553 | ||
| 554 | pub const F_DUPFD = 0; | 554 | pub const F = struct { |
| 555 | pub const F_GETFD = 1; | 555 | pub const DUPFD = 0; |
| 556 | pub const F_SETFD = 2; | 556 | pub const GETFD = 1; |
| 557 | pub const F_GETFL = 3; | 557 | pub const SETFD = 2; |
| 558 | pub const F_SETFL = 4; | 558 | pub const GETFL = 3; |
| 559 | 559 | pub const SETFL = 4; | |
| 560 | pub const F_SETOWN = 8; | 560 | |
| 561 | pub const F_GETOWN = 9; | 561 | pub const SETOWN = 8; |
| 562 | pub const F_SETSIG = 10; | 562 | pub const GETOWN = 9; |
| 563 | pub const F_GETSIG = 11; | 563 | pub const SETSIG = 10; |
| 564 | 564 | pub const GETSIG = 11; | |
| 565 | pub const F_GETLK = 12; | 565 | |
| 566 | pub const F_SETLK = 13; | 566 | pub const GETLK = 12; |
| 567 | pub const F_SETLKW = 14; | 567 | pub const SETLK = 13; |
| 568 | 568 | pub const SETLKW = 14; | |
| 569 | pub const F_RDLCK = 0; | 569 | |
| 570 | pub const F_WRLCK = 1; | 570 | pub const RDLCK = 0; |
| 571 | pub const F_UNLCK = 2; | 571 | pub const WRLCK = 1; |
| 572 | 572 | pub const UNLCK = 2; | |
| 573 | pub const F_SETOWN_EX = 15; | 573 | |
| 574 | pub const F_GETOWN_EX = 16; | 574 | pub const SETOWN_EX = 15; |
| 575 | 575 | pub const GETOWN_EX = 16; | |
| 576 | pub const F_GETOWNER_UIDS = 17; | 576 | |
| 577 | pub const GETOWNER_UIDS = 17; | ||
| 578 | }; | ||
| 577 | 579 | ||
| 578 | pub const LOCK = struct { | 580 | pub const LOCK = struct { |
| 579 | pub const SH = 1; | 581 | pub const SH = 1; |
lib/std/os/linux/arm64.zig+25-23| ... | @@ -430,24 +430,31 @@ pub const O_PATH = 0o10000000; | ... | @@ -430,24 +430,31 @@ pub const O_PATH = 0o10000000; |
| 430 | pub const O_TMPFILE = 0o20040000; | 430 | pub const O_TMPFILE = 0o20040000; |
| 431 | pub const O_NDELAY = O_NONBLOCK; | 431 | pub const O_NDELAY = O_NONBLOCK; |
| 432 | 432 | ||
| 433 | pub const F_DUPFD = 0; | 433 | pub const F = struct { |
| 434 | pub const F_GETFD = 1; | 434 | pub const DUPFD = 0; |
| 435 | pub const F_SETFD = 2; | 435 | pub const GETFD = 1; |
| 436 | pub const F_GETFL = 3; | 436 | pub const SETFD = 2; |
| 437 | pub const F_SETFL = 4; | 437 | pub const GETFL = 3; |
| 438 | 438 | pub const SETFL = 4; | |
| 439 | pub const F_SETOWN = 8; | 439 | |
| 440 | pub const F_GETOWN = 9; | 440 | pub const SETOWN = 8; |
| 441 | pub const F_SETSIG = 10; | 441 | pub const GETOWN = 9; |
| 442 | pub const F_GETSIG = 11; | 442 | pub const SETSIG = 10; |
| 443 | 443 | pub const GETSIG = 11; | |
| 444 | pub const F_GETLK = 5; | 444 | |
| 445 | pub const F_SETLK = 6; | 445 | pub const GETLK = 5; |
| 446 | pub const F_SETLKW = 7; | 446 | pub const SETLK = 6; |
| 447 | 447 | pub const SETLKW = 7; | |
| 448 | pub const F_RDLCK = 0; | 448 | |
| 449 | pub const F_WRLCK = 1; | 449 | pub const RDLCK = 0; |
| 450 | pub const F_UNLCK = 2; | 450 | pub const WRLCK = 1; |
| 451 | pub const UNLCK = 2; | ||
| 452 | |||
| 453 | pub const SETOWN_EX = 15; | ||
| 454 | pub const GETOWN_EX = 16; | ||
| 455 | |||
| 456 | pub const GETOWNER_UIDS = 17; | ||
| 457 | }; | ||
| 451 | 458 | ||
| 452 | pub const LOCK = struct { | 459 | pub const LOCK = struct { |
| 453 | pub const SH = 1; | 460 | pub const SH = 1; |
| ... | @@ -456,11 +463,6 @@ pub const LOCK = struct { | ... | @@ -456,11 +463,6 @@ pub const LOCK = struct { |
| 456 | pub const NB = 4; | 463 | pub const NB = 4; |
| 457 | }; | 464 | }; |
| 458 | 465 | ||
| 459 | pub const F_SETOWN_EX = 15; | ||
| 460 | pub const F_GETOWN_EX = 16; | ||
| 461 | |||
| 462 | pub const F_GETOWNER_UIDS = 17; | ||
| 463 | |||
| 464 | pub const MAP = struct { | 466 | pub const MAP = struct { |
| 465 | /// stack-like segment | 467 | /// stack-like segment |
| 466 | pub const GROWSDOWN = 0x0100; | 468 | pub const GROWSDOWN = 0x0100; |
lib/std/os/linux/io_uring.zig+3-3| ... | @@ -1297,12 +1297,12 @@ test "openat" { | ... | @@ -1297,12 +1297,12 @@ test "openat" { |
| 1297 | 1297 | ||
| 1298 | const flags: u32 = os.O_CLOEXEC | os.O_RDWR | os.O_CREAT; | 1298 | const flags: u32 = os.O_CLOEXEC | os.O_RDWR | os.O_CREAT; |
| 1299 | const mode: os.mode_t = 0o666; | 1299 | const mode: os.mode_t = 0o666; |
| 1300 | const sqe_openat = try ring.openat(0x33333333, linux.AT_FDCWD, path, flags, mode); | 1300 | const sqe_openat = try ring.openat(0x33333333, linux.AT.FDCWD, path, flags, mode); |
| 1301 | try testing.expectEqual(io_uring_sqe{ | 1301 | try testing.expectEqual(io_uring_sqe{ |
| 1302 | .opcode = .OPENAT, | 1302 | .opcode = .OPENAT, |
| 1303 | .flags = 0, | 1303 | .flags = 0, |
| 1304 | .ioprio = 0, | 1304 | .ioprio = 0, |
| 1305 | .fd = linux.AT_FDCWD, | 1305 | .fd = linux.AT.FDCWD, |
| 1306 | .off = 0, | 1306 | .off = 0, |
| 1307 | .addr = @ptrToInt(path), | 1307 | .addr = @ptrToInt(path), |
| 1308 | .len = mode, | 1308 | .len = mode, |
| ... | @@ -1318,7 +1318,7 @@ test "openat" { | ... | @@ -1318,7 +1318,7 @@ test "openat" { |
| 1318 | const cqe_openat = try ring.copy_cqe(); | 1318 | const cqe_openat = try ring.copy_cqe(); |
| 1319 | try testing.expectEqual(@as(u64, 0x33333333), cqe_openat.user_data); | 1319 | try testing.expectEqual(@as(u64, 0x33333333), cqe_openat.user_data); |
| 1320 | if (cqe_openat.err() == .INVAL) return error.SkipZigTest; | 1320 | if (cqe_openat.err() == .INVAL) return error.SkipZigTest; |
| 1321 | // AT_FDCWD is not fully supported before kernel 5.6: | 1321 | // AT.FDCWD is not fully supported before kernel 5.6: |
| 1322 | // See https://lore.kernel.org/io-uring/20200207155039.12819-1-axboe@kernel.dk/T/ | 1322 | // See https://lore.kernel.org/io-uring/20200207155039.12819-1-axboe@kernel.dk/T/ |
| 1323 | // We use IORING_FEAT_RW_CUR_POS to know if we are pre-5.6 since that feature was added in 5.6. | 1323 | // We use IORING_FEAT_RW_CUR_POS to know if we are pre-5.6 since that feature was added in 5.6. |
| 1324 | if (cqe_openat.err() == .BADF and (ring.features & linux.IORING_FEAT_RW_CUR_POS) == 0) { | 1324 | if (cqe_openat.err() == .BADF and (ring.features & linux.IORING_FEAT_RW_CUR_POS) == 0) { |
lib/std/os/linux/mips.zig+25-23| ... | @@ -649,24 +649,31 @@ pub const O_PATH = 0o010000000; | ... | @@ -649,24 +649,31 @@ pub const O_PATH = 0o010000000; |
| 649 | pub const O_TMPFILE = 0o020200000; | 649 | pub const O_TMPFILE = 0o020200000; |
| 650 | pub const O_NDELAY = O_NONBLOCK; | 650 | pub const O_NDELAY = O_NONBLOCK; |
| 651 | 651 | ||
| 652 | pub const F_DUPFD = 0; | 652 | pub const F = struct { |
| 653 | pub const F_GETFD = 1; | 653 | pub const DUPFD = 0; |
| 654 | pub const F_SETFD = 2; | 654 | pub const GETFD = 1; |
| 655 | pub const F_GETFL = 3; | 655 | pub const SETFD = 2; |
| 656 | pub const F_SETFL = 4; | 656 | pub const GETFL = 3; |
| 657 | 657 | pub const SETFL = 4; | |
| 658 | pub const F_SETOWN = 24; | 658 | |
| 659 | pub const F_GETOWN = 23; | 659 | pub const SETOWN = 24; |
| 660 | pub const F_SETSIG = 10; | 660 | pub const GETOWN = 23; |
| 661 | pub const F_GETSIG = 11; | 661 | pub const SETSIG = 10; |
| 662 | 662 | pub const GETSIG = 11; | |
| 663 | pub const F_GETLK = 33; | 663 | |
| 664 | pub const F_SETLK = 34; | 664 | pub const GETLK = 33; |
| 665 | pub const F_SETLKW = 35; | 665 | pub const SETLK = 34; |
| 666 | 666 | pub const SETLKW = 35; | |
| 667 | pub const F_RDLCK = 0; | 667 | |
| 668 | pub const F_WRLCK = 1; | 668 | pub const RDLCK = 0; |
| 669 | pub const F_UNLCK = 2; | 669 | pub const WRLCK = 1; |
| 670 | pub const UNLCK = 2; | ||
| 671 | |||
| 672 | pub const SETOWN_EX = 15; | ||
| 673 | pub const GETOWN_EX = 16; | ||
| 674 | |||
| 675 | pub const GETOWNER_UIDS = 17; | ||
| 676 | }; | ||
| 670 | 677 | ||
| 671 | pub const LOCK = struct { | 678 | pub const LOCK = struct { |
| 672 | pub const SH = 1; | 679 | pub const SH = 1; |
| ... | @@ -675,11 +682,6 @@ pub const LOCK = struct { | ... | @@ -675,11 +682,6 @@ pub const LOCK = struct { |
| 675 | pub const NB = 4; | 682 | pub const NB = 4; |
| 676 | }; | 683 | }; |
| 677 | 684 | ||
| 678 | pub const F_SETOWN_EX = 15; | ||
| 679 | pub const F_GETOWN_EX = 16; | ||
| 680 | |||
| 681 | pub const F_GETOWNER_UIDS = 17; | ||
| 682 | |||
| 683 | pub const MMAP2_UNIT = 4096; | 685 | pub const MMAP2_UNIT = 4096; |
| 684 | 686 | ||
| 685 | pub const MAP = struct { | 687 | pub const MAP = struct { |
lib/std/os/linux/powerpc.zig+25-23| ... | @@ -581,29 +581,31 @@ pub const O_PATH = 0o10000000; | ... | @@ -581,29 +581,31 @@ pub const O_PATH = 0o10000000; |
| 581 | pub const O_TMPFILE = 0o20040000; | 581 | pub const O_TMPFILE = 0o20040000; |
| 582 | pub const O_NDELAY = O_NONBLOCK; | 582 | pub const O_NDELAY = O_NONBLOCK; |
| 583 | 583 | ||
| 584 | pub const F_DUPFD = 0; | 584 | pub const F = struct { |
| 585 | pub const F_GETFD = 1; | 585 | pub const DUPFD = 0; |
| 586 | pub const F_SETFD = 2; | 586 | pub const GETFD = 1; |
| 587 | pub const F_GETFL = 3; | 587 | pub const SETFD = 2; |
| 588 | pub const F_SETFL = 4; | 588 | pub const GETFL = 3; |
| 589 | 589 | pub const SETFL = 4; | |
| 590 | pub const F_SETOWN = 8; | 590 | |
| 591 | pub const F_GETOWN = 9; | 591 | pub const SETOWN = 8; |
| 592 | pub const F_SETSIG = 10; | 592 | pub const GETOWN = 9; |
| 593 | pub const F_GETSIG = 11; | 593 | pub const SETSIG = 10; |
| 594 | 594 | pub const GETSIG = 11; | |
| 595 | pub const F_GETLK = 12; | 595 | |
| 596 | pub const F_SETLK = 13; | 596 | pub const GETLK = 12; |
| 597 | pub const F_SETLKW = 14; | 597 | pub const SETLK = 13; |
| 598 | 598 | pub const SETLKW = 14; | |
| 599 | pub const F_SETOWN_EX = 15; | 599 | |
| 600 | pub const F_GETOWN_EX = 16; | 600 | pub const SETOWN_EX = 15; |
| 601 | 601 | pub const GETOWN_EX = 16; | |
| 602 | pub const F_GETOWNER_UIDS = 17; | 602 | |
| 603 | 603 | pub const GETOWNER_UIDS = 17; | |
| 604 | pub const F_RDLCK = 0; | 604 | |
| 605 | pub const F_WRLCK = 1; | 605 | pub const RDLCK = 0; |
| 606 | pub const F_UNLCK = 2; | 606 | pub const WRLCK = 1; |
| 607 | pub const UNLCK = 2; | ||
| 608 | }; | ||
| 607 | 609 | ||
| 608 | pub const LOCK = struct { | 610 | pub const LOCK = struct { |
| 609 | pub const SH = 1; | 611 | pub const SH = 1; |
lib/std/os/linux/powerpc64.zig+25-23| ... | @@ -556,24 +556,31 @@ pub const O_PATH = 0o10000000; | ... | @@ -556,24 +556,31 @@ pub const O_PATH = 0o10000000; |
| 556 | pub const O_TMPFILE = 0o20200000; | 556 | pub const O_TMPFILE = 0o20200000; |
| 557 | pub const O_NDELAY = O_NONBLOCK; | 557 | pub const O_NDELAY = O_NONBLOCK; |
| 558 | 558 | ||
| 559 | pub const F_DUPFD = 0; | 559 | pub const F = struct { |
| 560 | pub const F_GETFD = 1; | 560 | pub const DUPFD = 0; |
| 561 | pub const F_SETFD = 2; | 561 | pub const GETFD = 1; |
| 562 | pub const F_GETFL = 3; | 562 | pub const SETFD = 2; |
| 563 | pub const F_SETFL = 4; | 563 | pub const GETFL = 3; |
| 564 | 564 | pub const SETFL = 4; | |
| 565 | pub const F_SETOWN = 8; | 565 | |
| 566 | pub const F_GETOWN = 9; | 566 | pub const SETOWN = 8; |
| 567 | pub const F_SETSIG = 10; | 567 | pub const GETOWN = 9; |
| 568 | pub const F_GETSIG = 11; | 568 | pub const SETSIG = 10; |
| 569 | 569 | pub const GETSIG = 11; | |
| 570 | pub const F_GETLK = 5; | 570 | |
| 571 | pub const F_SETLK = 6; | 571 | pub const GETLK = 5; |
| 572 | pub const F_SETLKW = 7; | 572 | pub const SETLK = 6; |
| 573 | 573 | pub const SETLKW = 7; | |
| 574 | pub const F_RDLCK = 0; | 574 | |
| 575 | pub const F_WRLCK = 1; | 575 | pub const RDLCK = 0; |
| 576 | pub const F_UNLCK = 2; | 576 | pub const WRLCK = 1; |
| 577 | pub const UNLCK = 2; | ||
| 578 | |||
| 579 | pub const SETOWN_EX = 15; | ||
| 580 | pub const GETOWN_EX = 16; | ||
| 581 | |||
| 582 | pub const GETOWNER_UIDS = 17; | ||
| 583 | }; | ||
| 577 | 584 | ||
| 578 | pub const LOCK = struct { | 585 | pub const LOCK = struct { |
| 579 | pub const SH = 1; | 586 | pub const SH = 1; |
| ... | @@ -582,11 +589,6 @@ pub const LOCK = struct { | ... | @@ -582,11 +589,6 @@ pub const LOCK = struct { |
| 582 | pub const NB = 4; | 589 | pub const NB = 4; |
| 583 | }; | 590 | }; |
| 584 | 591 | ||
| 585 | pub const F_SETOWN_EX = 15; | ||
| 586 | pub const F_GETOWN_EX = 16; | ||
| 587 | |||
| 588 | pub const F_GETOWNER_UIDS = 17; | ||
| 589 | |||
| 590 | pub const MAP = struct { | 592 | pub const MAP = struct { |
| 591 | /// stack-like segment | 593 | /// stack-like segment |
| 592 | pub const GROWSDOWN = 0x0100; | 594 | pub const GROWSDOWN = 0x0100; |
lib/std/os/linux/riscv64.zig+22-20| ... | @@ -427,22 +427,29 @@ pub const O_PATH = 0o10000000; | ... | @@ -427,22 +427,29 @@ pub const O_PATH = 0o10000000; |
| 427 | pub const O_TMPFILE = 0o20200000; | 427 | pub const O_TMPFILE = 0o20200000; |
| 428 | pub const O_NDELAY = O_NONBLOCK; | 428 | pub const O_NDELAY = O_NONBLOCK; |
| 429 | 429 | ||
| 430 | pub const F_DUPFD = 0; | 430 | pub const F = struct { |
| 431 | pub const F_GETFD = 1; | 431 | pub const DUPFD = 0; |
| 432 | pub const F_SETFD = 2; | 432 | pub const GETFD = 1; |
| 433 | pub const F_GETFL = 3; | 433 | pub const SETFD = 2; |
| 434 | pub const F_SETFL = 4; | 434 | pub const GETFL = 3; |
| 435 | pub const F_GETLK = 5; | 435 | pub const SETFL = 4; |
| 436 | pub const F_SETLK = 6; | 436 | pub const GETLK = 5; |
| 437 | pub const F_SETLKW = 7; | 437 | pub const SETLK = 6; |
| 438 | pub const F_SETOWN = 8; | 438 | pub const SETLKW = 7; |
| 439 | pub const F_GETOWN = 9; | 439 | pub const SETOWN = 8; |
| 440 | pub const F_SETSIG = 10; | 440 | pub const GETOWN = 9; |
| 441 | pub const F_GETSIG = 11; | 441 | pub const SETSIG = 10; |
| 442 | pub const GETSIG = 11; | ||
| 442 | 443 | ||
| 443 | pub const F_RDLCK = 0; | 444 | pub const RDLCK = 0; |
| 444 | pub const F_WRLCK = 1; | 445 | pub const WRLCK = 1; |
| 445 | pub const F_UNLCK = 2; | 446 | pub const UNLCK = 2; |
| 447 | |||
| 448 | pub const SETOWN_EX = 15; | ||
| 449 | pub const GETOWN_EX = 16; | ||
| 450 | |||
| 451 | pub const GETOWNER_UIDS = 17; | ||
| 452 | }; | ||
| 446 | 453 | ||
| 447 | pub const LOCK = struct { | 454 | pub const LOCK = struct { |
| 448 | pub const SH = 1; | 455 | pub const SH = 1; |
| ... | @@ -451,11 +458,6 @@ pub const LOCK = struct { | ... | @@ -451,11 +458,6 @@ pub const LOCK = struct { |
| 451 | pub const NB = 4; | 458 | pub const NB = 4; |
| 452 | }; | 459 | }; |
| 453 | 460 | ||
| 454 | pub const F_SETOWN_EX = 15; | ||
| 455 | pub const F_GETOWN_EX = 16; | ||
| 456 | |||
| 457 | pub const F_GETOWNER_UIDS = 17; | ||
| 458 | |||
| 459 | pub const blksize_t = i32; | 461 | pub const blksize_t = i32; |
| 460 | pub const nlink_t = u32; | 462 | pub const nlink_t = u32; |
| 461 | pub const time_t = isize; | 463 | pub const time_t = isize; |
lib/std/os/linux/sparc64.zig+22-20| ... | @@ -591,26 +591,28 @@ pub const O_PATH = 0x1000000; | ... | @@ -591,26 +591,28 @@ pub const O_PATH = 0x1000000; |
| 591 | pub const O_TMPFILE = 0x2010000; | 591 | pub const O_TMPFILE = 0x2010000; |
| 592 | pub const O_NDELAY = O_NONBLOCK | 0x4; | 592 | pub const O_NDELAY = O_NONBLOCK | 0x4; |
| 593 | 593 | ||
| 594 | pub const F_DUPFD = 0; | 594 | pub const F = struct { |
| 595 | pub const F_GETFD = 1; | 595 | pub const DUPFD = 0; |
| 596 | pub const F_SETFD = 2; | 596 | pub const GETFD = 1; |
| 597 | pub const F_GETFL = 3; | 597 | pub const SETFD = 2; |
| 598 | pub const F_SETFL = 4; | 598 | pub const GETFL = 3; |
| 599 | 599 | pub const SETFL = 4; | |
| 600 | pub const F_SETOWN = 5; | 600 | |
| 601 | pub const F_GETOWN = 6; | 601 | pub const SETOWN = 5; |
| 602 | pub const F_GETLK = 7; | 602 | pub const GETOWN = 6; |
| 603 | pub const F_SETLK = 8; | 603 | pub const GETLK = 7; |
| 604 | pub const F_SETLKW = 9; | 604 | pub const SETLK = 8; |
| 605 | 605 | pub const SETLKW = 9; | |
| 606 | pub const F_RDLCK = 1; | 606 | |
| 607 | pub const F_WRLCK = 2; | 607 | pub const RDLCK = 1; |
| 608 | pub const F_UNLCK = 3; | 608 | pub const WRLCK = 2; |
| 609 | 609 | pub const UNLCK = 3; | |
| 610 | pub const F_SETOWN_EX = 15; | 610 | |
| 611 | pub const F_GETOWN_EX = 16; | 611 | pub const SETOWN_EX = 15; |
| 612 | 612 | pub const GETOWN_EX = 16; | |
| 613 | pub const F_GETOWNER_UIDS = 17; | 613 | |
| 614 | pub const GETOWNER_UIDS = 17; | ||
| 615 | }; | ||
| 614 | 616 | ||
| 615 | pub const LOCK = struct { | 617 | pub const LOCK = struct { |
| 616 | pub const SH = 1; | 618 | pub const SH = 1; |
lib/std/os/linux/thumb.zig+3| ... | @@ -3,6 +3,9 @@ | ... | @@ -3,6 +3,9 @@ |
| 3 | //! reserved for the frame pointer. | 3 | //! reserved for the frame pointer. |
| 4 | //! Save and restore r7 around the syscall without touching the stack pointer not | 4 | //! Save and restore r7 around the syscall without touching the stack pointer not |
| 5 | //! to break the frame chain. | 5 | //! to break the frame chain. |
| 6 | const std = @import("../../std.zig"); | ||
| 7 | const linux = std.os.linux; | ||
| 8 | const SYS = linux.SYS; | ||
| 6 | 9 | ||
| 7 | pub fn syscall0(number: SYS) usize { | 10 | pub fn syscall0(number: SYS) usize { |
| 8 | @setRuntimeSafety(false); | 11 | @setRuntimeSafety(false); |
lib/std/os/wasi.zig+96-93| ... | @@ -149,8 +149,10 @@ pub const Stat = struct { | ... | @@ -149,8 +149,10 @@ pub const Stat = struct { |
| 149 | 149 | ||
| 150 | pub const IOV_MAX = 1024; | 150 | pub const IOV_MAX = 1024; |
| 151 | 151 | ||
| 152 | pub const AT_REMOVEDIR: u32 = 0x4; | 152 | pub const AT = struct { |
| 153 | pub const AT_FDCWD: fd_t = -2; | 153 | pub const REMOVEDIR: u32 = 0x4; |
| 154 | pub const FDCWD: fd_t = -2; | ||
| 155 | }; | ||
| 154 | 156 | ||
| 155 | // As defined in the wasi_snapshot_preview1 spec file: | 157 | // As defined in the wasi_snapshot_preview1 spec file: |
| 156 | // https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/witx/typenames.witx | 158 | // https://github.com/WebAssembly/WASI/blob/master/phases/snapshot/witx/typenames.witx |
| ... | @@ -293,11 +295,13 @@ pub const exitcode_t = u32; | ... | @@ -293,11 +295,13 @@ pub const exitcode_t = u32; |
| 293 | pub const fd_t = u32; | 295 | pub const fd_t = u32; |
| 294 | 296 | ||
| 295 | pub const fdflags_t = u16; | 297 | pub const fdflags_t = u16; |
| 296 | pub const FDFLAG_APPEND: fdflags_t = 0x0001; | 298 | pub const FDFLAG = struct { |
| 297 | pub const FDFLAG_DSYNC: fdflags_t = 0x0002; | 299 | pub const APPEND: fdflags_t = 0x0001; |
| 298 | pub const FDFLAG_NONBLOCK: fdflags_t = 0x0004; | 300 | pub const DSYNC: fdflags_t = 0x0002; |
| 299 | pub const FDFLAG_RSYNC: fdflags_t = 0x0008; | 301 | pub const NONBLOCK: fdflags_t = 0x0004; |
| 300 | pub const FDFLAG_SYNC: fdflags_t = 0x0010; | 302 | pub const RSYNC: fdflags_t = 0x0008; |
| 303 | pub const SYNC: fdflags_t = 0x0010; | ||
| 304 | }; | ||
| 301 | 305 | ||
| 302 | pub const fdstat_t = extern struct { | 306 | pub const fdstat_t = extern struct { |
| 303 | fs_filetype: filetype_t, | 307 | fs_filetype: filetype_t, |
| ... | @@ -333,15 +337,17 @@ pub const filestat_t = extern struct { | ... | @@ -333,15 +337,17 @@ pub const filestat_t = extern struct { |
| 333 | } | 337 | } |
| 334 | }; | 338 | }; |
| 335 | 339 | ||
| 336 | pub const filetype_t = u8; | 340 | pub const filetype_t = enum(u8) { |
| 337 | pub const FILETYPE_UNKNOWN: filetype_t = 0; | 341 | UNKNOWN, |
| 338 | pub const FILETYPE_BLOCK_DEVICE: filetype_t = 1; | 342 | BLOCK_DEVICE, |
| 339 | pub const FILETYPE_CHARACTER_DEVICE: filetype_t = 2; | 343 | CHARACTER_DEVICE, |
| 340 | pub const FILETYPE_DIRECTORY: filetype_t = 3; | 344 | DIRECTORY, |
| 341 | pub const FILETYPE_REGULAR_FILE: filetype_t = 4; | 345 | REGULAR_FILE, |
| 342 | pub const FILETYPE_SOCKET_DGRAM: filetype_t = 5; | 346 | SOCKET_DGRAM, |
| 343 | pub const FILETYPE_SOCKET_STREAM: filetype_t = 6; | 347 | SOCKET_STREAM, |
| 344 | pub const FILETYPE_SYMBOLIC_LINK: filetype_t = 7; | 348 | SYMBOLIC_LINK, |
| 349 | _, | ||
| 350 | }; | ||
| 345 | 351 | ||
| 346 | pub const fstflags_t = u16; | 352 | pub const fstflags_t = u16; |
| 347 | pub const FILESTAT_SET_ATIM: fstflags_t = 0x0001; | 353 | pub const FILESTAT_SET_ATIM: fstflags_t = 0x0001; |
| ... | @@ -392,64 +398,66 @@ pub const SOCK = struct { | ... | @@ -392,64 +398,66 @@ pub const SOCK = struct { |
| 392 | }; | 398 | }; |
| 393 | 399 | ||
| 394 | pub const rights_t = u64; | 400 | pub const rights_t = u64; |
| 395 | pub const RIGHT_FD_DATASYNC: rights_t = 0x0000000000000001; | 401 | pub const RIGHT = struct { |
| 396 | pub const RIGHT_FD_READ: rights_t = 0x0000000000000002; | 402 | pub const FD_DATASYNC: rights_t = 0x0000000000000001; |
| 397 | pub const RIGHT_FD_SEEK: rights_t = 0x0000000000000004; | 403 | pub const FD_READ: rights_t = 0x0000000000000002; |
| 398 | pub const RIGHT_FD_FDSTAT_SET_FLAGS: rights_t = 0x0000000000000008; | 404 | pub const FD_SEEK: rights_t = 0x0000000000000004; |
| 399 | pub const RIGHT_FD_SYNC: rights_t = 0x0000000000000010; | 405 | pub const FD_FDSTAT_SET_FLAGS: rights_t = 0x0000000000000008; |
| 400 | pub const RIGHT_FD_TELL: rights_t = 0x0000000000000020; | 406 | pub const FD_SYNC: rights_t = 0x0000000000000010; |
| 401 | pub const RIGHT_FD_WRITE: rights_t = 0x0000000000000040; | 407 | pub const FD_TELL: rights_t = 0x0000000000000020; |
| 402 | pub const RIGHT_FD_ADVISE: rights_t = 0x0000000000000080; | 408 | pub const FD_WRITE: rights_t = 0x0000000000000040; |
| 403 | pub const RIGHT_FD_ALLOCATE: rights_t = 0x0000000000000100; | 409 | pub const FD_ADVISE: rights_t = 0x0000000000000080; |
| 404 | pub const RIGHT_PATH_CREATE_DIRECTORY: rights_t = 0x0000000000000200; | 410 | pub const FD_ALLOCATE: rights_t = 0x0000000000000100; |
| 405 | pub const RIGHT_PATH_CREATE_FILE: rights_t = 0x0000000000000400; | 411 | pub const PATH_CREATE_DIRECTORY: rights_t = 0x0000000000000200; |
| 406 | pub const RIGHT_PATH_LINK_SOURCE: rights_t = 0x0000000000000800; | 412 | pub const PATH_CREATE_FILE: rights_t = 0x0000000000000400; |
| 407 | pub const RIGHT_PATH_LINK_TARGET: rights_t = 0x0000000000001000; | 413 | pub const PATH_LINK_SOURCE: rights_t = 0x0000000000000800; |
| 408 | pub const RIGHT_PATH_OPEN: rights_t = 0x0000000000002000; | 414 | pub const PATH_LINK_TARGET: rights_t = 0x0000000000001000; |
| 409 | pub const RIGHT_FD_READDIR: rights_t = 0x0000000000004000; | 415 | pub const PATH_OPEN: rights_t = 0x0000000000002000; |
| 410 | pub const RIGHT_PATH_READLINK: rights_t = 0x0000000000008000; | 416 | pub const FD_READDIR: rights_t = 0x0000000000004000; |
| 411 | pub const RIGHT_PATH_RENAME_SOURCE: rights_t = 0x0000000000010000; | 417 | pub const PATH_READLINK: rights_t = 0x0000000000008000; |
| 412 | pub const RIGHT_PATH_RENAME_TARGET: rights_t = 0x0000000000020000; | 418 | pub const PATH_RENAME_SOURCE: rights_t = 0x0000000000010000; |
| 413 | pub const RIGHT_PATH_FILESTAT_GET: rights_t = 0x0000000000040000; | 419 | pub const PATH_RENAME_TARGET: rights_t = 0x0000000000020000; |
| 414 | pub const RIGHT_PATH_FILESTAT_SET_SIZE: rights_t = 0x0000000000080000; | 420 | pub const PATH_FILESTAT_GET: rights_t = 0x0000000000040000; |
| 415 | pub const RIGHT_PATH_FILESTAT_SET_TIMES: rights_t = 0x0000000000100000; | 421 | pub const PATH_FILESTAT_SET_SIZE: rights_t = 0x0000000000080000; |
| 416 | pub const RIGHT_FD_FILESTAT_GET: rights_t = 0x0000000000200000; | 422 | pub const PATH_FILESTAT_SET_TIMES: rights_t = 0x0000000000100000; |
| 417 | pub const RIGHT_FD_FILESTAT_SET_SIZE: rights_t = 0x0000000000400000; | 423 | pub const FD_FILESTAT_GET: rights_t = 0x0000000000200000; |
| 418 | pub const RIGHT_FD_FILESTAT_SET_TIMES: rights_t = 0x0000000000800000; | 424 | pub const FD_FILESTAT_SET_SIZE: rights_t = 0x0000000000400000; |
| 419 | pub const RIGHT_PATH_SYMLINK: rights_t = 0x0000000001000000; | 425 | pub const FD_FILESTAT_SET_TIMES: rights_t = 0x0000000000800000; |
| 420 | pub const RIGHT_PATH_REMOVE_DIRECTORY: rights_t = 0x0000000002000000; | 426 | pub const PATH_SYMLINK: rights_t = 0x0000000001000000; |
| 421 | pub const RIGHT_PATH_UNLINK_FILE: rights_t = 0x0000000004000000; | 427 | pub const PATH_REMOVE_DIRECTORY: rights_t = 0x0000000002000000; |
| 422 | pub const RIGHT_POLL_FD_READWRITE: rights_t = 0x0000000008000000; | 428 | pub const PATH_UNLINK_FILE: rights_t = 0x0000000004000000; |
| 423 | pub const RIGHT_SOCK_SHUTDOWN: rights_t = 0x0000000010000000; | 429 | pub const POLL_FD_READWRITE: rights_t = 0x0000000008000000; |
| 424 | pub const RIGHT_ALL: rights_t = RIGHT_FD_DATASYNC | | 430 | pub const SOCK_SHUTDOWN: rights_t = 0x0000000010000000; |
| 425 | RIGHT_FD_READ | | 431 | pub const ALL: rights_t = FD_DATASYNC | |
| 426 | RIGHT_FD_SEEK | | 432 | FD_READ | |
| 427 | RIGHT_FD_FDSTAT_SET_FLAGS | | 433 | FD_SEEK | |
| 428 | RIGHT_FD_SYNC | | 434 | FD_FDSTAT_SET_FLAGS | |
| 429 | RIGHT_FD_TELL | | 435 | FD_SYNC | |
| 430 | RIGHT_FD_WRITE | | 436 | FD_TELL | |
| 431 | RIGHT_FD_ADVISE | | 437 | FD_WRITE | |
| 432 | RIGHT_FD_ALLOCATE | | 438 | FD_ADVISE | |
| 433 | RIGHT_PATH_CREATE_DIRECTORY | | 439 | FD_ALLOCATE | |
| 434 | RIGHT_PATH_CREATE_FILE | | 440 | PATH_CREATE_DIRECTORY | |
| 435 | RIGHT_PATH_LINK_SOURCE | | 441 | PATH_CREATE_FILE | |
| 436 | RIGHT_PATH_LINK_TARGET | | 442 | PATH_LINK_SOURCE | |
| 437 | RIGHT_PATH_OPEN | | 443 | PATH_LINK_TARGET | |
| 438 | RIGHT_FD_READDIR | | 444 | PATH_OPEN | |
| 439 | RIGHT_PATH_READLINK | | 445 | FD_READDIR | |
| 440 | RIGHT_PATH_RENAME_SOURCE | | 446 | PATH_READLINK | |
| 441 | RIGHT_PATH_RENAME_TARGET | | 447 | PATH_RENAME_SOURCE | |
| 442 | RIGHT_PATH_FILESTAT_GET | | 448 | PATH_RENAME_TARGET | |
| 443 | RIGHT_PATH_FILESTAT_SET_SIZE | | 449 | PATH_FILESTAT_GET | |
| 444 | RIGHT_PATH_FILESTAT_SET_TIMES | | 450 | PATH_FILESTAT_SET_SIZE | |
| 445 | RIGHT_FD_FILESTAT_GET | | 451 | PATH_FILESTAT_SET_TIMES | |
| 446 | RIGHT_FD_FILESTAT_SET_SIZE | | 452 | FD_FILESTAT_GET | |
| 447 | RIGHT_FD_FILESTAT_SET_TIMES | | 453 | FD_FILESTAT_SET_SIZE | |
| 448 | RIGHT_PATH_SYMLINK | | 454 | FD_FILESTAT_SET_TIMES | |
| 449 | RIGHT_PATH_REMOVE_DIRECTORY | | 455 | PATH_SYMLINK | |
| 450 | RIGHT_PATH_UNLINK_FILE | | 456 | PATH_REMOVE_DIRECTORY | |
| 451 | RIGHT_POLL_FD_READWRITE | | 457 | PATH_UNLINK_FILE | |
| 452 | RIGHT_SOCK_SHUTDOWN; | 458 | POLL_FD_READWRITE | |
| 459 | SOCK_SHUTDOWN; | ||
| 460 | }; | ||
| 453 | 461 | ||
| 454 | pub const sdflags_t = u8; | 462 | pub const sdflags_t = u8; |
| 455 | pub const SHUT_RD: sdflags_t = 0x01; | 463 | pub const SHUT_RD: sdflags_t = 0x01; |
| ... | @@ -524,25 +532,20 @@ pub const timestamp_t = u64; | ... | @@ -524,25 +532,20 @@ pub const timestamp_t = u64; |
| 524 | 532 | ||
| 525 | pub const userdata_t = u64; | 533 | pub const userdata_t = u64; |
| 526 | 534 | ||
| 527 | pub const whence_t = u8; | 535 | pub const whence_t = enum(u8) { SET, CUR, END }; |
| 528 | pub const WHENCE_SET: whence_t = 0; | 536 | |
| 529 | pub const WHENCE_CUR: whence_t = 1; | 537 | pub const S = struct { |
| 530 | pub const WHENCE_END: whence_t = 2; | 538 | pub const IEXEC = @compileError("TODO audit this"); |
| 531 | 539 | pub const IFBLK = 0x6000; | |
| 532 | pub const S_IEXEC = S_IXUSR; | 540 | pub const IFCHR = 0x2000; |
| 533 | pub const S_IFBLK = 0x6000; | 541 | pub const IFDIR = 0x4000; |
| 534 | pub const S_IFCHR = 0x2000; | 542 | pub const IFIFO = 0xc000; |
| 535 | pub const S_IFDIR = 0x4000; | 543 | pub const IFLNK = 0xa000; |
| 536 | pub const S_IFIFO = 0xc000; | 544 | pub const IFMT = IFBLK | IFCHR | IFDIR | IFIFO | IFLNK | IFREG | IFSOCK; |
| 537 | pub const S_IFLNK = 0xa000; | 545 | pub const IFREG = 0x8000; |
| 538 | pub const S_IFMT = S_IFBLK | S_IFCHR | S_IFDIR | S_IFIFO | S_IFLNK | S_IFREG | S_IFSOCK; | 546 | // There's no concept of UNIX domain socket but we define this value here in order to line with other OSes. |
| 539 | pub const S_IFREG = 0x8000; | 547 | pub const IFSOCK = 0x1; |
| 540 | // There's no concept of UNIX domain socket but we define this value here in order to line with other OSes. | 548 | }; |
| 541 | pub const S_IFSOCK = 0x1; | ||
| 542 | |||
| 543 | pub const SEEK_SET = WHENCE_SET; | ||
| 544 | pub const SEEK_CUR = WHENCE_CUR; | ||
| 545 | pub const SEEK_END = WHENCE_END; | ||
| 546 | 549 | ||
| 547 | pub const LOCK = struct { | 550 | pub const LOCK = struct { |
| 548 | pub const SH = 0x1; | 551 | pub const SH = 0x1; |
lib/std/os/windows.zig+6-11| ... | @@ -2971,7 +2971,7 @@ pub const EXCEPTION_RECORD = extern struct { | ... | @@ -2971,7 +2971,7 @@ pub const EXCEPTION_RECORD = extern struct { |
| 2971 | ExceptionInformation: [15]usize, | 2971 | ExceptionInformation: [15]usize, |
| 2972 | }; | 2972 | }; |
| 2973 | 2973 | ||
| 2974 | const arch_bits = switch (native_arch) { | 2974 | pub usingnamespace switch (native_arch) { |
| 2975 | .i386 => struct { | 2975 | .i386 => struct { |
| 2976 | pub const FLOATING_SAVE_AREA = extern struct { | 2976 | pub const FLOATING_SAVE_AREA = extern struct { |
| 2977 | ControlWord: DWORD, | 2977 | ControlWord: DWORD, |
| ... | @@ -3037,8 +3037,8 @@ const arch_bits = switch (native_arch) { | ... | @@ -3037,8 +3037,8 @@ const arch_bits = switch (native_arch) { |
| 3037 | Reserved3: WORD, | 3037 | Reserved3: WORD, |
| 3038 | MxCsr: DWORD, | 3038 | MxCsr: DWORD, |
| 3039 | MxCsr_Mask: DWORD, | 3039 | MxCsr_Mask: DWORD, |
| 3040 | FloatRegisters: [8]arch_bits.M128A, | 3040 | FloatRegisters: [8]M128A, |
| 3041 | XmmRegisters: [16]arch_bits.M128A, | 3041 | XmmRegisters: [16]M128A, |
| 3042 | Reserved4: [96]BYTE, | 3042 | Reserved4: [96]BYTE, |
| 3043 | }; | 3043 | }; |
| 3044 | 3044 | ||
| ... | @@ -3082,8 +3082,8 @@ const arch_bits = switch (native_arch) { | ... | @@ -3082,8 +3082,8 @@ const arch_bits = switch (native_arch) { |
| 3082 | R15: DWORD64, | 3082 | R15: DWORD64, |
| 3083 | Rip: DWORD64, | 3083 | Rip: DWORD64, |
| 3084 | DUMMYUNIONNAME: extern union { | 3084 | DUMMYUNIONNAME: extern union { |
| 3085 | FltSave: arch_bits.XMM_SAVE_AREA32, | 3085 | FltSave: XMM_SAVE_AREA32, |
| 3086 | FloatSave: arch_bits.XMM_SAVE_AREA32, | 3086 | FloatSave: XMM_SAVE_AREA32, |
| 3087 | DUMMYSTRUCTNAME: extern struct { | 3087 | DUMMYSTRUCTNAME: extern struct { |
| 3088 | Header: [2]M128A, | 3088 | Header: [2]M128A, |
| 3089 | Legacy: [8]M128A, | 3089 | Legacy: [8]M128A, |
| ... | @@ -3189,15 +3189,10 @@ const arch_bits = switch (native_arch) { | ... | @@ -3189,15 +3189,10 @@ const arch_bits = switch (native_arch) { |
| 3189 | }, | 3189 | }, |
| 3190 | else => struct {}, | 3190 | else => struct {}, |
| 3191 | }; | 3191 | }; |
| 3192 | pub const M128A = arch_bits.M128A; | ||
| 3193 | pub const XMM_SAVE_AREA32 = arch_bits.XMM_SAVE_AREA32; | ||
| 3194 | pub const CONTEXT = arch_bits.CONTEXT; | ||
| 3195 | pub const FLOATING_SAVE_AREA = arch_bits.FLOATING_SAVE_AREA; | ||
| 3196 | pub const NEON128 = arch_bits.NEON128; | ||
| 3197 | 3192 | ||
| 3198 | pub const EXCEPTION_POINTERS = extern struct { | 3193 | pub const EXCEPTION_POINTERS = extern struct { |
| 3199 | ExceptionRecord: *EXCEPTION_RECORD, | 3194 | ExceptionRecord: *EXCEPTION_RECORD, |
| 3200 | ContextRecord: *CONTEXT, | 3195 | ContextRecord: *@This().CONTEXT, |
| 3201 | }; | 3196 | }; |
| 3202 | 3197 | ||
| 3203 | pub const VECTORED_EXCEPTION_HANDLER = fn (ExceptionInfo: *EXCEPTION_POINTERS) callconv(WINAPI) c_long; | 3198 | pub const VECTORED_EXCEPTION_HANDLER = fn (ExceptionInfo: *EXCEPTION_POINTERS) callconv(WINAPI) c_long; |
lib/std/os/windows/gdi32.zig+2| ... | @@ -5,6 +5,8 @@ const DWORD = windows.DWORD; | ... | @@ -5,6 +5,8 @@ const DWORD = windows.DWORD; |
| 5 | const WINAPI = windows.WINAPI; | 5 | const WINAPI = windows.WINAPI; |
| 6 | const HDC = windows.HDC; | 6 | const HDC = windows.HDC; |
| 7 | const HGLRC = windows.HGLRC; | 7 | const HGLRC = windows.HGLRC; |
| 8 | const WORD = windows.WORD; | ||
| 9 | const BYTE = windows.BYTE; | ||
| 8 | 10 | ||
| 9 | pub const PIXELFORMATDESCRIPTOR = extern struct { | 11 | pub const PIXELFORMATDESCRIPTOR = extern struct { |
| 10 | nSize: WORD = @sizeOf(PIXELFORMATDESCRIPTOR), | 12 | nSize: WORD = @sizeOf(PIXELFORMATDESCRIPTOR), |
lib/std/os/windows/kernel32.zig+20| ... | @@ -36,6 +36,26 @@ const HLOCAL = windows.HLOCAL; | ... | @@ -36,6 +36,26 @@ const HLOCAL = windows.HLOCAL; |
| 36 | const FILETIME = windows.FILETIME; | 36 | const FILETIME = windows.FILETIME; |
| 37 | const STARTUPINFOW = windows.STARTUPINFOW; | 37 | const STARTUPINFOW = windows.STARTUPINFOW; |
| 38 | const PROCESS_INFORMATION = windows.PROCESS_INFORMATION; | 38 | const PROCESS_INFORMATION = windows.PROCESS_INFORMATION; |
| 39 | const OVERLAPPED_ENTRY = windows.OVERLAPPED_ENTRY; | ||
| 40 | const LPHEAP_SUMMARY = windows.LPHEAP_SUMMARY; | ||
| 41 | const ULONG_PTR = windows.ULONG_PTR; | ||
| 42 | const FILE_NOTIFY_INFORMATION = windows.FILE_NOTIFY_INFORMATION; | ||
| 43 | const HANDLER_ROUTINE = windows.HANDLER_ROUTINE; | ||
| 44 | const ULONG = windows.ULONG; | ||
| 45 | const PVOID = windows.PVOID; | ||
| 46 | const LPSTR = windows.LPSTR; | ||
| 47 | const PENUM_PAGE_FILE_CALLBACKA = windows.PENUM_PAGE_FILE_CALLBACKA; | ||
| 48 | const PENUM_PAGE_FILE_CALLBACKW = windows.PENUM_PAGE_FILE_CALLBACKW; | ||
| 49 | const INIT_ONCE = windows.INIT_ONCE; | ||
| 50 | const CRITICAL_SECTION = windows.CRITICAL_SECTION; | ||
| 51 | const WIN32_FIND_DATAW = windows.WIN32_FIND_DATAW; | ||
| 52 | const CHAR = windows.CHAR; | ||
| 53 | const BY_HANDLE_FILE_INFORMATION = windows.BY_HANDLE_FILE_INFORMATION; | ||
| 54 | const SYSTEM_INFO = windows.SYSTEM_INFO; | ||
| 55 | const LPOVERLAPPED_COMPLETION_ROUTINE = windows.LPOVERLAPPED_COMPLETION_ROUTINE; | ||
| 56 | const UCHAR = windows.UCHAR; | ||
| 57 | const FARPROC = windows.FARPROC; | ||
| 58 | const INIT_ONCE_FN = windows.INIT_ONCE_FN; | ||
| 39 | 59 | ||
| 40 | pub extern "kernel32" fn AddVectoredExceptionHandler(First: c_ulong, Handler: ?VECTORED_EXCEPTION_HANDLER) callconv(WINAPI) ?*c_void; | 60 | pub extern "kernel32" fn AddVectoredExceptionHandler(First: c_ulong, Handler: ?VECTORED_EXCEPTION_HANDLER) callconv(WINAPI) ?*c_void; |
| 41 | pub extern "kernel32" fn RemoveVectoredExceptionHandler(Handle: HANDLE) callconv(WINAPI) c_ulong; | 61 | pub extern "kernel32" fn RemoveVectoredExceptionHandler(Handle: HANDLE) callconv(WINAPI) c_ulong; |
lib/std/os/windows/ntdll.zig+1| ... | @@ -21,6 +21,7 @@ const UNICODE_STRING = windows.UNICODE_STRING; | ... | @@ -21,6 +21,7 @@ const UNICODE_STRING = windows.UNICODE_STRING; |
| 21 | const RTL_OSVERSIONINFOW = windows.RTL_OSVERSIONINFOW; | 21 | const RTL_OSVERSIONINFOW = windows.RTL_OSVERSIONINFOW; |
| 22 | const FILE_BASIC_INFORMATION = windows.FILE_BASIC_INFORMATION; | 22 | const FILE_BASIC_INFORMATION = windows.FILE_BASIC_INFORMATION; |
| 23 | const SIZE_T = windows.SIZE_T; | 23 | const SIZE_T = windows.SIZE_T; |
| 24 | const CURDIR = windows.CURDIR; | ||
| 24 | 25 | ||
| 25 | pub extern "NtDll" fn RtlGetVersion( | 26 | pub extern "NtDll" fn RtlGetVersion( |
| 26 | lpVersionInformation: *RTL_OSVERSIONINFOW, | 27 | lpVersionInformation: *RTL_OSVERSIONINFOW, |
lib/std/os/windows/psapi.zig+43| ... | @@ -2,6 +2,49 @@ const std = @import("../../std.zig"); | ... | @@ -2,6 +2,49 @@ const std = @import("../../std.zig"); |
| 2 | const windows = std.os.windows; | 2 | const windows = std.os.windows; |
| 3 | const WINAPI = windows.WINAPI; | 3 | const WINAPI = windows.WINAPI; |
| 4 | const DWORD = windows.DWORD; | 4 | const DWORD = windows.DWORD; |
| 5 | const HANDLE = windows.HANDLE; | ||
| 6 | const PENUM_PAGE_FILE_CALLBACKW = windows.PENUM_PAGE_FILE_CALLBACKW; | ||
| 7 | const HMODULE = windows.HMODULE; | ||
| 8 | const BOOL = windows.BOOL; | ||
| 9 | const BOOLEAN = windows.BOOLEAN; | ||
| 10 | const CONDITION_VARIABLE = windows.CONDITION_VARIABLE; | ||
| 11 | const CONSOLE_SCREEN_BUFFER_INFO = windows.CONSOLE_SCREEN_BUFFER_INFO; | ||
| 12 | const COORD = windows.COORD; | ||
| 13 | const FILE_INFO_BY_HANDLE_CLASS = windows.FILE_INFO_BY_HANDLE_CLASS; | ||
| 14 | const HRESULT = windows.HRESULT; | ||
| 15 | const LARGE_INTEGER = windows.LARGE_INTEGER; | ||
| 16 | const LPCWSTR = windows.LPCWSTR; | ||
| 17 | const LPTHREAD_START_ROUTINE = windows.LPTHREAD_START_ROUTINE; | ||
| 18 | const LPVOID = windows.LPVOID; | ||
| 19 | const LPWSTR = windows.LPWSTR; | ||
| 20 | const MODULEINFO = windows.MODULEINFO; | ||
| 21 | const OVERLAPPED = windows.OVERLAPPED; | ||
| 22 | const PERFORMANCE_INFORMATION = windows.PERFORMANCE_INFORMATION; | ||
| 23 | const PROCESS_MEMORY_COUNTERS = windows.PROCESS_MEMORY_COUNTERS; | ||
| 24 | const PSAPI_WS_WATCH_INFORMATION = windows.PSAPI_WS_WATCH_INFORMATION; | ||
| 25 | const PSAPI_WS_WATCH_INFORMATION_EX = windows.PSAPI_WS_WATCH_INFORMATION_EX; | ||
| 26 | const SECURITY_ATTRIBUTES = windows.SECURITY_ATTRIBUTES; | ||
| 27 | const SIZE_T = windows.SIZE_T; | ||
| 28 | const SRWLOCK = windows.SRWLOCK; | ||
| 29 | const UINT = windows.UINT; | ||
| 30 | const VECTORED_EXCEPTION_HANDLER = windows.VECTORED_EXCEPTION_HANDLER; | ||
| 31 | const WCHAR = windows.WCHAR; | ||
| 32 | const WORD = windows.WORD; | ||
| 33 | const Win32Error = windows.Win32Error; | ||
| 34 | const va_list = windows.va_list; | ||
| 35 | const HLOCAL = windows.HLOCAL; | ||
| 36 | const FILETIME = windows.FILETIME; | ||
| 37 | const STARTUPINFOW = windows.STARTUPINFOW; | ||
| 38 | const PROCESS_INFORMATION = windows.PROCESS_INFORMATION; | ||
| 39 | const OVERLAPPED_ENTRY = windows.OVERLAPPED_ENTRY; | ||
| 40 | const LPHEAP_SUMMARY = windows.LPHEAP_SUMMARY; | ||
| 41 | const ULONG_PTR = windows.ULONG_PTR; | ||
| 42 | const FILE_NOTIFY_INFORMATION = windows.FILE_NOTIFY_INFORMATION; | ||
| 43 | const HANDLER_ROUTINE = windows.HANDLER_ROUTINE; | ||
| 44 | const ULONG = windows.ULONG; | ||
| 45 | const PVOID = windows.PVOID; | ||
| 46 | const LPSTR = windows.LPSTR; | ||
| 47 | const PENUM_PAGE_FILE_CALLBACKA = windows.PENUM_PAGE_FILE_CALLBACKA; | ||
| 5 | 48 | ||
| 6 | pub extern "psapi" fn EmptyWorkingSet(hProcess: HANDLE) callconv(WINAPI) BOOL; | 49 | pub extern "psapi" fn EmptyWorkingSet(hProcess: HANDLE) callconv(WINAPI) BOOL; |
| 7 | pub extern "psapi" fn EnumDeviceDrivers(lpImageBase: [*]LPVOID, cb: DWORD, lpcbNeeded: *DWORD) callconv(WINAPI) BOOL; | 50 | pub extern "psapi" fn EnumDeviceDrivers(lpImageBase: [*]LPVOID, cb: DWORD, lpcbNeeded: *DWORD) callconv(WINAPI) BOOL; |
lib/std/os/windows/user32.zig+24-2| ... | @@ -1,9 +1,31 @@ | ... | @@ -1,9 +1,31 @@ |
| 1 | const std = @import("../../std.zig"); | 1 | const std = @import("../../std.zig"); |
| 2 | const assert = std.debug.assert; | 2 | const assert = std.debug.assert; |
| 3 | |||
| 3 | const windows = std.os.windows; | 4 | const windows = std.os.windows; |
| 4 | const unexpectedError = windows.unexpectedError; | ||
| 5 | const GetLastError = windows.kernel32.GetLastError; | 5 | const GetLastError = windows.kernel32.GetLastError; |
| 6 | const SetLastError = windows.kernel32.SetLastError; | 6 | const SetLastError = windows.kernel32.SetLastError; |
| 7 | const unexpectedError = windows.unexpectedError; | ||
| 8 | const HWND = windows.HWND; | ||
| 9 | const UINT = windows.UINT; | ||
| 10 | const HDC = windows.HDC; | ||
| 11 | const LONG = windows.LONG; | ||
| 12 | const LONG_PTR = windows.LONG_PTR; | ||
| 13 | const WINAPI = windows.WINAPI; | ||
| 14 | const RECT = windows.RECT; | ||
| 15 | const DWORD = windows.DWORD; | ||
| 16 | const BOOL = windows.BOOL; | ||
| 17 | const TRUE = windows.TRUE; | ||
| 18 | const HMENU = windows.HMENU; | ||
| 19 | const HINSTANCE = windows.HINSTANCE; | ||
| 20 | const LPVOID = windows.LPVOID; | ||
| 21 | const ATOM = windows.ATOM; | ||
| 22 | const WPARAM = windows.WPARAM; | ||
| 23 | const LRESULT = windows.LRESULT; | ||
| 24 | const HICON = windows.HICON; | ||
| 25 | const LPARAM = windows.LPARAM; | ||
| 26 | const POINT = windows.POINT; | ||
| 27 | const HCURSOR = windows.HCURSOR; | ||
| 28 | const HBRUSH = windows.HBRUSH; | ||
| 7 | 29 | ||
| 8 | fn selectSymbol(comptime function_static: anytype, function_dynamic: @TypeOf(function_static), comptime os: std.Target.Os.WindowsVersion) @TypeOf(function_static) { | 30 | fn selectSymbol(comptime function_static: anytype, function_dynamic: @TypeOf(function_static), comptime os: std.Target.Os.WindowsVersion) @TypeOf(function_static) { |
| 9 | comptime { | 31 | comptime { |
| ... | @@ -1316,7 +1338,7 @@ pub fn showWindow(hWnd: HWND, nCmdShow: i32) bool { | ... | @@ -1316,7 +1338,7 @@ pub fn showWindow(hWnd: HWND, nCmdShow: i32) bool { |
| 1316 | 1338 | ||
| 1317 | pub extern "user32" fn UpdateWindow(hWnd: HWND) callconv(WINAPI) BOOL; | 1339 | pub extern "user32" fn UpdateWindow(hWnd: HWND) callconv(WINAPI) BOOL; |
| 1318 | pub fn updateWindow(hWnd: HWND) !void { | 1340 | pub fn updateWindow(hWnd: HWND) !void { |
| 1319 | if (ShowWindow(hWnd, nCmdShow) == 0) { | 1341 | if (UpdateWindow(hWnd) == 0) { |
| 1320 | switch (GetLastError()) { | 1342 | switch (GetLastError()) { |
| 1321 | .INVALID_WINDOW_HANDLE => unreachable, | 1343 | .INVALID_WINDOW_HANDLE => unreachable, |
| 1322 | .INVALID_PARAMETER => unreachable, | 1344 | .INVALID_PARAMETER => unreachable, |
lib/std/os/windows/ws2_32.zig+10| ... | @@ -8,6 +8,16 @@ const DWORD = windows.DWORD; | ... | @@ -8,6 +8,16 @@ const DWORD = windows.DWORD; |
| 8 | const GUID = windows.GUID; | 8 | const GUID = windows.GUID; |
| 9 | const USHORT = windows.USHORT; | 9 | const USHORT = windows.USHORT; |
| 10 | const WCHAR = windows.WCHAR; | 10 | const WCHAR = windows.WCHAR; |
| 11 | const BOOL = windows.BOOL; | ||
| 12 | const HANDLE = windows.HANDLE; | ||
| 13 | const timeval = windows.timeval; | ||
| 14 | const HWND = windows.HWND; | ||
| 15 | const INT = windows.INT; | ||
| 16 | const SHORT = windows.SHORT; | ||
| 17 | const CHAR = windows.CHAR; | ||
| 18 | const ULONG = windows.ULONG; | ||
| 19 | const LPARAM = windows.LPARAM; | ||
| 20 | const FARPROC = windows.FARPROC; | ||
| 11 | 21 | ||
| 12 | pub const SOCKET = *opaque {}; | 22 | pub const SOCKET = *opaque {}; |
| 13 | pub const INVALID_SOCKET = @intToPtr(SOCKET, ~@as(usize, 0)); | 23 | pub const INVALID_SOCKET = @intToPtr(SOCKET, ~@as(usize, 0)); |
lib/std/time.zig-2| ... | @@ -200,8 +200,6 @@ pub const Timer = struct { | ... | @@ -200,8 +200,6 @@ pub const Timer = struct { |
| 200 | .frequency = {}, | 200 | .frequency = {}, |
| 201 | }; | 201 | }; |
| 202 | } | 202 | } |
| 203 | |||
| 204 | return self; | ||
| 205 | } | 203 | } |
| 206 | 204 | ||
| 207 | /// Reads the timer value since start or the last reset in nanoseconds | 205 | /// Reads the timer value since start or the last reset in nanoseconds |
lib/std/zig.zig-1| ... | @@ -157,7 +157,6 @@ pub fn binNameAlloc(allocator: *std.mem.Allocator, options: BinNameOptions) erro | ... | @@ -157,7 +157,6 @@ pub fn binNameAlloc(allocator: *std.mem.Allocator, options: BinNameOptions) erro |
| 157 | } | 157 | } |
| 158 | }, | 158 | }, |
| 159 | } | 159 | } |
| 160 | return std.fmt.allocPrint(allocator, "{s}{s}{s}", .{ target.libPrefix(), root_name, suffix }); | ||
| 161 | }, | 160 | }, |
| 162 | .Obj => return std.fmt.allocPrint(allocator, "{s}.o", .{root_name}), | 161 | .Obj => return std.fmt.allocPrint(allocator, "{s}.o", .{root_name}), |
| 163 | }, | 162 | }, |