authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2024-02-14 13:14:30-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-14 19:26:12-08:00
log7e83e7d9a8c77e875090174b167fd2d376574087
treee4e515147466d09069e11fed93ebd6417a215ab8
parentbec85117283998c1e8cefa7a448c9c18b02236f9

bsd: debitrot type-safe std.c.O

Minor changes as per 7680c5330cb mostly about pipe2() flags. closes #18927

7 files changed, 9 insertions(+), 9 deletions(-)

lib/std/c/dragonfly.zig+1-1
...@@ -12,7 +12,7 @@ pub fn _errno() *c_int {...@@ -12,7 +12,7 @@ pub fn _errno() *c_int {
12pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) c_int;12pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) c_int;
13pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;13pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
14pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;14pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;
15pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int;15pub extern "c" fn pipe2(fds: *[2]fd_t, flags: std.c.O) c_int;
16pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;16pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;
1717
18pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;18pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
lib/std/c/emscripten.zig+1-1
...@@ -147,7 +147,7 @@ pub const pwritev64 = std.c.pwritev;...@@ -147,7 +147,7 @@ pub const pwritev64 = std.c.pwritev;
147pub const setrlimit64 = std.c.setrlimit;147pub const setrlimit64 = std.c.setrlimit;
148148
149pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;149pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
150pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int;150pub extern "c" fn pipe2(fds: *[2]fd_t, flags: std.c.O) c_int;
151pub extern "c" fn getentropy(buffer: [*]u8, size: usize) c_int;151pub extern "c" fn getentropy(buffer: [*]u8, size: usize) c_int;
152152
153pub const pthread_attr_t = extern struct {153pub const pthread_attr_t = extern struct {
lib/std/c/freebsd.zig+1-1
...@@ -15,7 +15,7 @@ pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize...@@ -15,7 +15,7 @@ pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize
15pub extern "c" fn pthread_getthreadid_np() c_int;15pub extern "c" fn pthread_getthreadid_np() c_int;
16pub extern "c" fn pthread_set_name_np(thread: std.c.pthread_t, name: [*:0]const u8) void;16pub extern "c" fn pthread_set_name_np(thread: std.c.pthread_t, name: [*:0]const u8) void;
17pub extern "c" fn pthread_get_name_np(thread: std.c.pthread_t, name: [*:0]u8, len: usize) void;17pub extern "c" fn pthread_get_name_np(thread: std.c.pthread_t, name: [*:0]u8, len: usize) void;
18pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int;18pub extern "c" fn pipe2(fds: *[2]fd_t, flags: std.c.O) c_int;
19pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;19pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;
2020
21pub extern "c" fn posix_memalign(memptr: *?*anyopaque, alignment: usize, size: usize) c_int;21pub extern "c" fn posix_memalign(memptr: *?*anyopaque, alignment: usize, size: usize) c_int;
lib/std/c/netbsd.zig+3-3
...@@ -15,7 +15,7 @@ pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*an...@@ -15,7 +15,7 @@ pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*an
1515
16pub extern "c" fn _lwp_self() lwpid_t;16pub extern "c" fn _lwp_self() lwpid_t;
1717
18pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int;18pub extern "c" fn pipe2(fds: *[2]fd_t, flags: std.c.O) c_int;
19pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;19pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;
2020
21pub extern "c" fn __stat50(path: [*:0]const u8, buf: *Stat) c_int;21pub extern "c" fn __stat50(path: [*:0]const u8, buf: *Stat) c_int;
...@@ -59,7 +59,7 @@ pub extern "c" fn posix_memalign(memptr: *?*anyopaque, alignment: usize, size: u...@@ -59,7 +59,7 @@ pub extern "c" fn posix_memalign(memptr: *?*anyopaque, alignment: usize, size: u
59pub extern "c" fn __msync13(addr: *align(std.mem.page_size) const anyopaque, len: usize, flags: c_int) c_int;59pub extern "c" fn __msync13(addr: *align(std.mem.page_size) const anyopaque, len: usize, flags: c_int) c_int;
60pub const msync = __msync13;60pub const msync = __msync13;
6161
62const pthread_spin_t = switch (builtin.cpu.arch) {62pub const pthread_spin_t = switch (builtin.cpu.arch) {
63 .aarch64, .aarch64_be, .aarch64_32 => u8,63 .aarch64, .aarch64_be, .aarch64_32 => u8,
64 .mips, .mipsel, .mips64, .mips64el => u32,64 .mips, .mipsel, .mips64, .mips64el => u32,
65 .powerpc, .powerpc64, .powerpc64le => i32,65 .powerpc, .powerpc64, .powerpc64le => i32,
...@@ -70,7 +70,7 @@ const pthread_spin_t = switch (builtin.cpu.arch) {...@@ -70,7 +70,7 @@ const pthread_spin_t = switch (builtin.cpu.arch) {
70 else => @compileError("undefined pthread_spin_t for this arch"),70 else => @compileError("undefined pthread_spin_t for this arch"),
71};71};
7272
73const padded_pthread_spin_t = switch (builtin.cpu.arch) {73pub const padded_pthread_spin_t = switch (builtin.cpu.arch) {
74 .x86, .x86_64 => u32,74 .x86, .x86_64 => u32,
75 .sparc, .sparcel, .sparc64 => u32,75 .sparc, .sparcel, .sparc64 => u32,
76 else => pthread_spin_t,76 else => pthread_spin_t,
lib/std/c/openbsd.zig+1-1
...@@ -14,7 +14,7 @@ pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*an...@@ -14,7 +14,7 @@ pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*an
14pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;14pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;
1515
16pub extern "c" fn getthrid() pid_t;16pub extern "c" fn getthrid() pid_t;
17pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int;17pub extern "c" fn pipe2(fds: *[2]fd_t, flags: std.c.O) c_int;
1818
19pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) c_int;19pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) c_int;
20pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;20pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
lib/std/c/solaris.zig+1-1
...@@ -14,7 +14,7 @@ pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*an...@@ -14,7 +14,7 @@ pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*an
1414
15pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;15pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;
16pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;16pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
17pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int;17pub extern "c" fn pipe2(fds: *[2]fd_t, flags: std.c.O) c_int;
18pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;18pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;
19pub extern "c" fn posix_memalign(memptr: *?*anyopaque, alignment: usize, size: usize) c_int;19pub extern "c" fn posix_memalign(memptr: *?*anyopaque, alignment: usize, size: usize) c_int;
20pub extern "c" fn sysconf(sc: c_int) i64;20pub extern "c" fn sysconf(sc: c_int) i64;
lib/std/fs/Dir.zig+1-1
...@@ -174,7 +174,7 @@ pub const Iterator = switch (builtin.os.tag) {...@@ -174,7 +174,7 @@ pub const Iterator = switch (builtin.os.tag) {
174 self.end_index = @as(usize, @intCast(rc));174 self.end_index = @as(usize, @intCast(rc));
175 }175 }
176 const bsd_entry = @as(*align(1) posix.system.dirent, @ptrCast(&self.buf[self.index]));176 const bsd_entry = @as(*align(1) posix.system.dirent, @ptrCast(&self.buf[self.index]));
177 const next_index = self.index + bsd_entry.reclen;177 const next_index = self.index + if (@hasDecl(posix.system.dirent, "reclen")) bsd_entry.reclen() else bsd_entry.reclen;
178 self.index = next_index;178 self.index = next_index;
179179
180 const name = @as([*]u8, @ptrCast(&bsd_entry.name))[0..bsd_entry.namlen];180 const name = @as([*]u8, @ptrCast(&bsd_entry.name))[0..bsd_entry.namlen];