| author | |
| committer | |
| log | 5ae5dc507b10116f90f1e1491d70566f99ac0981 |
| tree | 013f2a9106ac57c0be4d9c698e201e5f619e5bbf |
| parent | f3f554b9b89cc39cf00b4df68bd3455e8ef34984 |
| parent | e288c546996d202e87168f25d689a2f21fe03b60 |
| signature |
de-bitrot the BSDs5 files changed, 85 insertions(+), 4 deletions(-)
lib/std/c/dragonfly.zig+54| ... | @@ -34,6 +34,10 @@ pub const pthread_attr_t = extern struct { // copied from freebsd | ... | @@ -34,6 +34,10 @@ pub const pthread_attr_t = extern struct { // copied from freebsd |
| 34 | __align: c_long, | 34 | __align: c_long, |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | pub const pthread_rwlock_t = extern struct { | ||
| 38 | ptr: ?*anyopaque = null, | ||
| 39 | }; | ||
| 40 | |||
| 37 | pub const sem_t = ?*opaque {}; | 41 | pub const sem_t = ?*opaque {}; |
| 38 | 42 | ||
| 39 | pub extern "c" fn pthread_setname_np(thread: std.c.pthread_t, name: [*:0]const u8) E; | 43 | pub extern "c" fn pthread_setname_np(thread: std.c.pthread_t, name: [*:0]const u8) E; |
| ... | @@ -55,6 +59,56 @@ pub const gid_t = u32; | ... | @@ -55,6 +59,56 @@ pub const gid_t = u32; |
| 55 | pub const time_t = isize; | 59 | pub const time_t = isize; |
| 56 | pub const suseconds_t = c_long; | 60 | pub const suseconds_t = c_long; |
| 57 | 61 | ||
| 62 | pub const ucontext_t = extern struct { | ||
| 63 | sigmask: sigset_t, | ||
| 64 | mcontext: mcontext_t, | ||
| 65 | link: ?*ucontext_t, | ||
| 66 | stack: stack_t, | ||
| 67 | cofunc: ?*fn (?*ucontext_t, ?*anyopaque) void, | ||
| 68 | arg: ?*void, | ||
| 69 | _spare: [4]c_int, | ||
| 70 | }; | ||
| 71 | |||
| 72 | pub const mcontext_t = extern struct { | ||
| 73 | onstack: register_t, // XXX - sigcontext compat. | ||
| 74 | rdi: register_t, | ||
| 75 | rsi: register_t, | ||
| 76 | rdx: register_t, | ||
| 77 | rcx: register_t, | ||
| 78 | r8: register_t, | ||
| 79 | r9: register_t, | ||
| 80 | rax: register_t, | ||
| 81 | rbx: register_t, | ||
| 82 | rbp: register_t, | ||
| 83 | r10: register_t, | ||
| 84 | r11: register_t, | ||
| 85 | r12: register_t, | ||
| 86 | r13: register_t, | ||
| 87 | r14: register_t, | ||
| 88 | r15: register_t, | ||
| 89 | xflags: register_t, | ||
| 90 | trapno: register_t, | ||
| 91 | addr: register_t, | ||
| 92 | flags: register_t, | ||
| 93 | err: register_t, | ||
| 94 | rip: register_t, | ||
| 95 | cs: register_t, | ||
| 96 | rflags: register_t, | ||
| 97 | rsp: register_t, // machine state | ||
| 98 | ss: register_t, | ||
| 99 | |||
| 100 | len: c_uint, // sizeof(mcontext_t) | ||
| 101 | fpformat: c_uint, | ||
| 102 | ownedfp: c_uint, | ||
| 103 | reserved: c_uint, | ||
| 104 | unused: [8]c_uint, | ||
| 105 | |||
| 106 | // NOTE! 64-byte aligned as of here. Also must match savefpu structure. | ||
| 107 | fpregs: [256]c_int align(64), | ||
| 108 | }; | ||
| 109 | |||
| 110 | pub const register_t = isize; | ||
| 111 | |||
| 58 | pub const E = enum(u16) { | 112 | pub const E = enum(u16) { |
| 59 | /// No error occurred. | 113 | /// No error occurred. |
| 60 | SUCCESS = 0, | 114 | SUCCESS = 0, |
lib/std/c/netbsd.zig+24-1| ... | @@ -93,7 +93,7 @@ pub const pthread_rwlock_t = extern struct { | ... | @@ -93,7 +93,7 @@ pub const pthread_rwlock_t = extern struct { |
| 93 | wblocked_first: ?*u8 = null, | 93 | wblocked_first: ?*u8 = null, |
| 94 | wblocked_last: ?*u8 = null, | 94 | wblocked_last: ?*u8 = null, |
| 95 | nreaders: c_uint = 0, | 95 | nreaders: c_uint = 0, |
| 96 | owner: std.c.pthread_t = null, | 96 | owner: ?std.c.pthread_t = null, |
| 97 | private: ?*anyopaque = null, | 97 | private: ?*anyopaque = null, |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| ... | @@ -1227,9 +1227,32 @@ pub const REG = switch (builtin.cpu.arch) { | ... | @@ -1227,9 +1227,32 @@ pub const REG = switch (builtin.cpu.arch) { |
| 1227 | pub const PC = 15; | 1227 | pub const PC = 15; |
| 1228 | }, | 1228 | }, |
| 1229 | .x86_64 => struct { | 1229 | .x86_64 => struct { |
| 1230 | pub const RDI = 0; | ||
| 1231 | pub const RSI = 1; | ||
| 1232 | pub const RDX = 2; | ||
| 1233 | pub const RCX = 3; | ||
| 1234 | pub const R8 = 4; | ||
| 1235 | pub const R9 = 5; | ||
| 1236 | pub const R10 = 6; | ||
| 1237 | pub const R11 = 7; | ||
| 1238 | pub const R12 = 8; | ||
| 1239 | pub const R13 = 9; | ||
| 1240 | pub const R14 = 10; | ||
| 1241 | pub const R15 = 11; | ||
| 1230 | pub const RBP = 12; | 1242 | pub const RBP = 12; |
| 1243 | pub const RBX = 13; | ||
| 1244 | pub const RAX = 14; | ||
| 1245 | pub const GS = 15; | ||
| 1246 | pub const FS = 16; | ||
| 1247 | pub const ES = 17; | ||
| 1248 | pub const DS = 18; | ||
| 1249 | pub const TRAPNO = 19; | ||
| 1250 | pub const ERR = 20; | ||
| 1231 | pub const RIP = 21; | 1251 | pub const RIP = 21; |
| 1252 | pub const CS = 22; | ||
| 1253 | pub const RFLAGS = 23; | ||
| 1232 | pub const RSP = 24; | 1254 | pub const RSP = 24; |
| 1255 | pub const SS = 25; | ||
| 1233 | }, | 1256 | }, |
| 1234 | else => struct {}, | 1257 | else => struct {}, |
| 1235 | }; | 1258 | }; |
lib/std/debug.zig+2-1| ... | @@ -168,6 +168,7 @@ pub fn relocateContext(context: *ThreadContext) void { | ... | @@ -168,6 +168,7 @@ pub fn relocateContext(context: *ThreadContext) void { |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | pub const have_getcontext = @hasDecl(os.system, "getcontext") and | 170 | pub const have_getcontext = @hasDecl(os.system, "getcontext") and |
| 171 | builtin.os.tag != .openbsd and | ||
| 171 | (builtin.os.tag != .linux or switch (builtin.cpu.arch) { | 172 | (builtin.os.tag != .linux or switch (builtin.cpu.arch) { |
| 172 | .x86, | 173 | .x86, |
| 173 | .x86_64, | 174 | .x86_64, |
| ... | @@ -1228,7 +1229,7 @@ pub fn readElfDebugInfo( | ... | @@ -1228,7 +1229,7 @@ pub fn readElfDebugInfo( |
| 1228 | } | 1229 | } |
| 1229 | 1230 | ||
| 1230 | var cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined; | 1231 | var cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined; |
| 1231 | const cwd_path = fs.cwd().realpath("", &cwd_buf) catch break :blk; | 1232 | const cwd_path = os.realpath(".", &cwd_buf) catch break :blk; |
| 1232 | 1233 | ||
| 1233 | // <global debug directory>/<absolute folder of current binary>/<gnu_debuglink> | 1234 | // <global debug directory>/<absolute folder of current binary>/<gnu_debuglink> |
| 1234 | for (global_debug_directories) |global_directory| { | 1235 | for (global_debug_directories) |global_directory| { |
lib/std/dwarf/abi.zig+1-1| ... | @@ -229,7 +229,7 @@ pub fn regBytes( | ... | @@ -229,7 +229,7 @@ pub fn regBytes( |
| 229 | else => error.UnimplementedOs, | 229 | else => error.UnimplementedOs, |
| 230 | }, | 230 | }, |
| 231 | .x86_64 => switch (builtin.os.tag) { | 231 | .x86_64 => switch (builtin.os.tag) { |
| 232 | .linux, .netbsd, .solaris => switch (reg_number) { | 232 | .linux, .solaris => switch (reg_number) { |
| 233 | 0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RAX]), | 233 | 0 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RAX]), |
| 234 | 1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RDX]), | 234 | 1 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RDX]), |
| 235 | 2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RCX]), | 235 | 2 => mem.asBytes(&ucontext_ptr.mcontext.gregs[os.REG.RCX]), |
lib/std/fs/test.zig+4-1| ... | @@ -102,7 +102,10 @@ test "openDir cwd parent .." { | ... | @@ -102,7 +102,10 @@ test "openDir cwd parent .." { |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | test "openDir non-cwd parent .." { | 104 | test "openDir non-cwd parent .." { |
| 105 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | 105 | switch (builtin.os.tag) { |
| 106 | .wasi, .netbsd, .openbsd => return error.SkipZigTest, | ||
| 107 | else => {}, | ||
| 108 | } | ||
| 106 | 109 | ||
| 107 | var tmp = tmpDir(.{}); | 110 | var tmp = tmpDir(.{}); |
| 108 | defer tmp.cleanup(); | 111 | defer tmp.cleanup(); |