authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2023-01-27 13:27:41-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-28 19:05:38-05:00
log599b3ef9e947f044799d11aecf0dfe659f9a7728
tree31399068174f1e2b7a75cbf9e98dfbef6df5c391
parent2b27bc2c65195a82e96995669314a86c76203a3e

netbsd: use versioned __msync13 from libc

The system linker shows warning when `msync` is linked instead of `__msync13`: "warning: reference to compatibility msync(); include <sys/mman.h> for correct reference" closes #14422

2 files changed, 5 insertions(+), 1 deletions(-)

lib/std/c.zig+2-1
......@@ -90,6 +90,8 @@ pub usingnamespace switch (builtin.os.tag) {
9090 pub extern "c" fn stat(noalias path: [*:0]const u8, noalias buf: *c.Stat) c_int;
9191
9292 pub extern "c" fn alarm(seconds: c_uint) c_uint;
93
94 pub extern "c" fn msync(addr: *align(page_size) const anyopaque, len: usize, flags: c_int) c_int;
9395 },
9496};
9597
......@@ -145,7 +147,6 @@ pub extern "c" fn write(fd: c.fd_t, buf: [*]const u8, nbyte: usize) isize;
145147pub extern "c" fn pwrite(fd: c.fd_t, buf: [*]const u8, nbyte: usize, offset: c.off_t) isize;
146148pub extern "c" fn mmap(addr: ?*align(page_size) anyopaque, len: usize, prot: c_uint, flags: c_uint, fd: c.fd_t, offset: c.off_t) *anyopaque;
147149pub extern "c" fn munmap(addr: *align(page_size) const anyopaque, len: usize) c_int;
148pub extern "c" fn msync(addr: *align(page_size) const anyopaque, len: usize, flags: c_int) c_int;
149150pub extern "c" fn mprotect(addr: *align(page_size) anyopaque, len: usize, prot: c_uint) c_int;
150151pub extern "c" fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8, flags: c_int) c_int;
151152pub 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;
lib/std/c/netbsd.zig+3
......@@ -59,6 +59,9 @@ pub const sched_yield = __libc_thr_yield;
5959
6060pub extern "c" fn posix_memalign(memptr: *?*anyopaque, alignment: usize, size: usize) c_int;
6161
62pub extern "c" fn __msync13(addr: *align(std.mem.page_size) const anyopaque, len: usize, flags: c_int) c_int;
63pub const msync = __msync13;
64
6265pub const pthread_mutex_t = extern struct {
6366 magic: u32 = 0x33330003,
6467 errorcheck: padded_pthread_spin_t = 0,