@@ -3,7 +3,7 @@ const builtin = @import("builtin");
33const c = @This ();
44const maxInt = std .math .maxInt ;
55const assert = std .debug .assert ;
6- const page_size = std .mem . page_size ;
6+ const page_size = std .heap . page_size_min ;
77const native_abi = builtin .abi ;
88const native_arch = builtin .cpu .arch ;
99const native_os = builtin .os .tag ;
@@ -2227,6 +2227,39 @@ pub const SC = switch (native_os) {
22272227 .linux = > linux .SC ,
22282228 else = > void ,
22292229};
2230+
2231+ pub const _SC = switch (native_os ) {
2232+ .driverkit , .ios , .macos , .tvos , .visionos , .watchos = > enum (c_int ) {
2233+ PAGESIZE = 29 ,
2234+ },
2235+ .dragonfly = > enum (c_int ) {
2236+ PAGESIZE = 47 ,
2237+ },
2238+ .freebsd = > enum (c_int ) {
2239+ PAGESIZE = 47 ,
2240+ },
2241+ .fuchsia = > enum (c_int ) {
2242+ PAGESIZE = 30 ,
2243+ },
2244+ .haiku = > enum (c_int ) {
2245+ PAGESIZE = 27 ,
2246+ },
2247+ .linux = > enum (c_int ) {
2248+ PAGESIZE = 30 ,
2249+ },
2250+ .netbsd = > enum (c_int ) {
2251+ PAGESIZE = 28 ,
2252+ },
2253+ .openbsd = > enum (c_int ) {
2254+ PAGESIZE = 28 ,
2255+ },
2256+ .solaris , .illumos = > enum (c_int ) {
2257+ PAGESIZE = 11 ,
2258+ NPROCESSORS_ONLN = 15 ,
2259+ },
2260+ else = > void ,
2261+ };
2262+
22302263pub const SEEK = switch (native_os ) {
22312264 .linux = > linux .SEEK ,
22322265 .emscripten = > emscripten .SEEK ,
@@ -7834,6 +7867,11 @@ pub const MAP = switch (native_os) {
78347867 else = > void ,
78357868};
78367869
7870+ pub const MREMAP = switch (native_os ) {
7871+ .linux = > linux .MREMAP ,
7872+ else = > void ,
7873+ };
7874+
78377875/// Used by libc to communicate failure. Not actually part of the underlying syscall.
78387876pub const MAP_FAILED : * anyopaque = @ptrFromInt (maxInt (usize ));
78397877
@@ -9232,7 +9270,7 @@ pub extern "c" fn getpwnam(name: [*:0]const u8) ?*passwd;
92329270pub extern "c" fn getpwuid (uid : uid_t ) ? * passwd ;
92339271pub extern "c" fn getrlimit64 (resource : rlimit_resource , rlim : * rlimit ) c_int ;
92349272pub extern "c" fn lseek64 (fd : fd_t , offset : i64 , whence : c_int ) i64 ;
9235- pub extern "c" fn mmap64 (addr : ? * align (std.mem. page_size ) anyopaque , len : usize , prot : c_uint , flags : c_uint , fd : fd_t , offset : i64 ) * anyopaque ;
9273+ pub extern "c" fn mmap64 (addr : ? * align (page_size ) anyopaque , len : usize , prot : c_uint , flags : c_uint , fd : fd_t , offset : i64 ) * anyopaque ;
92369274pub extern "c" fn open64 (path : [* :0 ]const u8 , oflag : O , ... ) c_int ;
92379275pub extern "c" fn openat64 (fd : c_int , path : [* :0 ]const u8 , oflag : O , ... ) c_int ;
92389276pub extern "c" fn pread64 (fd : fd_t , buf : [* ]u8 , nbyte : usize , offset : i64 ) isize ;
@@ -9324,13 +9362,13 @@ pub extern "c" fn signalfd(fd: fd_t, mask: *const sigset_t, flags: u32) c_int;
93249362
93259363pub extern "c" fn prlimit (pid : pid_t , resource : rlimit_resource , new_limit : * const rlimit , old_limit : * rlimit ) c_int ;
93269364pub extern "c" fn mincore (
9327- addr : * align (std.mem. page_size ) anyopaque ,
9365+ addr : * align (page_size ) anyopaque ,
93289366 length : usize ,
93299367 vec : [* ]u8 ,
93309368) c_int ;
93319369
93329370pub extern "c" fn madvise (
9333- addr : * align (std.mem. page_size ) anyopaque ,
9371+ addr : * align (page_size ) anyopaque ,
93349372 length : usize ,
93359373 advice : u32 ,
93369374) c_int ;
@@ -9428,6 +9466,10 @@ pub const posix_memalign = switch (native_os) {
94289466 .dragonfly , .netbsd , .freebsd , .solaris , .openbsd , .linux , .macos , .ios , .tvos , .watchos , .visionos = > private .posix_memalign ,
94299467 else = > {},
94309468};
9469+ pub const sysconf = switch (native_os ) {
9470+ .solaris = > solaris .sysconf ,
9471+ else = > private .sysconf ,
9472+ };
94319473
94329474pub const sf_hdtr = switch (native_os ) {
94339475 .freebsd , .macos , .ios , .tvos , .watchos , .visionos = > extern struct {
@@ -9471,6 +9513,7 @@ pub extern "c" fn write(fd: fd_t, buf: [*]const u8, nbyte: usize) isize;
94719513pub extern "c" fn pwrite (fd : fd_t , buf : [* ]const u8 , nbyte : usize , offset : off_t ) isize ;
94729514pub extern "c" fn mmap (addr : ? * align (page_size ) anyopaque , len : usize , prot : c_uint , flags : MAP , fd : fd_t , offset : off_t ) * anyopaque ;
94739515pub extern "c" fn munmap (addr : * align (page_size ) const anyopaque , len : usize ) c_int ;
9516+ pub extern "c" fn mremap (addr : ? * align (page_size ) const anyopaque , old_len : usize , new_len : usize , flags : MREMAP , ... ) * anyopaque ;
94749517pub extern "c" fn mprotect (addr : * align (page_size ) anyopaque , len : usize , prot : c_uint ) c_int ;
94759518pub extern "c" fn link (oldpath : [* :0 ]const u8 , newpath : [* :0 ]const u8 ) c_int ;
94769519pub extern "c" fn linkat (oldfd : fd_t , oldpath : [* :0 ]const u8 , newfd : fd_t , newpath : [* :0 ]const u8 , flags : c_int ) c_int ;
@@ -9823,7 +9866,6 @@ pub const SCM = solaris.SCM;
98239866pub const SETCONTEXT = solaris .SETCONTEXT ;
98249867pub const SETUSTACK = solaris .GETUSTACK ;
98259868pub const SFD = solaris .SFD ;
9826- pub const _SC = solaris ._SC ;
98279869pub const cmsghdr = solaris .cmsghdr ;
98289870pub const ctid_t = solaris .ctid_t ;
98299871pub const file_obj = solaris .file_obj ;
@@ -9840,7 +9882,6 @@ pub const priority = solaris.priority;
98409882pub const procfs = solaris .procfs ;
98419883pub const projid_t = solaris .projid_t ;
98429884pub const signalfd_siginfo = solaris .signalfd_siginfo ;
9843- pub const sysconf = solaris .sysconf ;
98449885pub const taskid_t = solaris .taskid_t ;
98459886pub const zoneid_t = solaris .zoneid_t ;
98469887
@@ -9997,6 +10038,7 @@ pub const host_t = darwin.host_t;
999710038pub const ipc_space_t = darwin .ipc_space_t ;
999810039pub const ipc_space_port_t = darwin .ipc_space_port_t ;
999910040pub const kern_return_t = darwin .kern_return_t ;
10041+ pub const vm_size_t = darwin .vm_size_t ;
1000010042pub const kevent64 = darwin .kevent64 ;
1000110043pub const kevent64_s = darwin .kevent64_s ;
1000210044pub const mach_absolute_time = darwin .mach_absolute_time ;
@@ -10168,6 +10210,7 @@ const private = struct {
1016810210 extern "c" fn socket (domain : c_uint , sock_type : c_uint , protocol : c_uint ) c_int ;
1016910211 extern "c" fn stat (noalias path : [* :0 ]const u8 , noalias buf : * Stat ) c_int ;
1017010212 extern "c" fn sigaltstack (ss : ? * stack_t , old_ss : ? * stack_t ) c_int ;
10213+ extern "c" fn sysconf (sc : c_int ) c_long ;
1017110214
1017210215 extern "c" fn pthread_setname_np (thread : pthread_t , name : [* :0 ]const u8 ) c_int ;
1017310216 extern "c" fn getcontext (ucp : * ucontext_t ) c_int ;
@@ -10202,7 +10245,7 @@ const private = struct {
1020210245 extern "c" fn __getrusage50 (who : c_int , usage : * rusage ) c_int ;
1020310246 extern "c" fn __gettimeofday50 (noalias tv : ? * timeval , noalias tz : ? * timezone ) c_int ;
1020410247 extern "c" fn __libc_thr_yield () c_int ;
10205- extern "c" fn __msync13 (addr : * align (std.mem. page_size ) const anyopaque , len : usize , flags : c_int ) c_int ;
10248+ extern "c" fn __msync13 (addr : * align (page_size ) const anyopaque , len : usize , flags : c_int ) c_int ;
1020610249 extern "c" fn __nanosleep50 (rqtp : * const timespec , rmtp : ? * timespec ) c_int ;
1020710250 extern "c" fn __sigaction14 (sig : c_int , noalias act : ? * const Sigaction , noalias oact : ? * Sigaction ) c_int ;
1020810251 extern "c" fn __sigfillset14 (set : ? * sigset_t ) void ;
0 commit comments