@@ -1494,38 +1494,33 @@ pub const speed_t = switch (native_os) {
1494
1494
pub const whence_t = if (native_os == .wasi ) std .os .wasi .whence_t else c_int ;
1495
1495
1496
1496
// Unix-like systems
1497
- pub usingnamespace switch (native_os ) {
1498
- .netbsd , .windows = > struct {},
1499
- else = > struct {
1500
- pub const DIR = opaque {};
1501
- pub extern "c" fn opendir (pathname : [* :0 ]const u8 ) ? * DIR ;
1502
- pub extern "c" fn fdopendir (fd : c_int ) ? * DIR ;
1503
- pub extern "c" fn rewinddir (dp : * DIR ) void ;
1504
- pub extern "c" fn closedir (dp : * DIR ) c_int ;
1505
- pub extern "c" fn telldir (dp : * DIR ) c_long ;
1506
- pub extern "c" fn seekdir (dp : * DIR , loc : c_long ) void ;
1497
+ pub const DIR = opaque {};
1498
+ pub extern "c" fn opendir (pathname : [* :0 ]const u8 ) ? * DIR ;
1499
+ pub extern "c" fn fdopendir (fd : c_int ) ? * DIR ;
1500
+ pub extern "c" fn rewinddir (dp : * DIR ) void ;
1501
+ pub extern "c" fn closedir (dp : * DIR ) c_int ;
1502
+ pub extern "c" fn telldir (dp : * DIR ) c_long ;
1503
+ pub extern "c" fn seekdir (dp : * DIR , loc : c_long ) void ;
1507
1504
1508
- pub extern "c" fn clock_gettime (clk_id : c_int , tp : * c.timespec ) c_int ;
1509
- pub extern "c" fn clock_getres (clk_id : c_int , tp : * c.timespec ) c_int ;
1510
- pub extern "c" fn gettimeofday (noalias tv : ? * c.timeval , noalias tz : ? * c.timezone ) c_int ;
1511
- pub extern "c" fn nanosleep (rqtp : * const c.timespec , rmtp : ? * c.timespec ) c_int ;
1505
+ pub extern "c" fn clock_gettime (clk_id : c_int , tp : * c.timespec ) c_int ;
1506
+ pub extern "c" fn clock_getres (clk_id : c_int , tp : * c.timespec ) c_int ;
1507
+ pub extern "c" fn gettimeofday (noalias tv : ? * c.timeval , noalias tz : ? * c.timezone ) c_int ;
1508
+ pub extern "c" fn nanosleep (rqtp : * const c.timespec , rmtp : ? * c.timespec ) c_int ;
1512
1509
1513
- pub extern "c" fn getrusage (who : c_int , usage : * c.rusage ) c_int ;
1510
+ pub extern "c" fn getrusage (who : c_int , usage : * c.rusage ) c_int ;
1514
1511
1515
- pub extern "c" fn sched_yield () c_int ;
1512
+ pub extern "c" fn sched_yield () c_int ;
1516
1513
1517
- pub extern "c" fn sigaction (sig : c_int , noalias act : ? * const c.Sigaction , noalias oact : ? * c.Sigaction ) c_int ;
1518
- pub extern "c" fn sigprocmask (how : c_int , noalias set : ? * const c.sigset_t , noalias oset : ? * c.sigset_t ) c_int ;
1519
- pub extern "c" fn sigfillset (set : ? * c.sigset_t ) void ;
1520
- pub extern "c" fn sigwait (set : ? * c.sigset_t , sig : ? * c_int ) c_int ;
1514
+ pub extern "c" fn sigaction (sig : c_int , noalias act : ? * const c.Sigaction , noalias oact : ? * c.Sigaction ) c_int ;
1515
+ pub extern "c" fn sigprocmask (how : c_int , noalias set : ? * const c.sigset_t , noalias oset : ? * c.sigset_t ) c_int ;
1516
+ pub extern "c" fn sigfillset (set : ? * c.sigset_t ) void ;
1517
+ pub extern "c" fn sigwait (set : ? * c.sigset_t , sig : ? * c_int ) c_int ;
1521
1518
1522
- pub extern "c" fn socket (domain : c_uint , sock_type : c_uint , protocol : c_uint ) c_int ;
1519
+ pub extern "c" fn socket (domain : c_uint , sock_type : c_uint , protocol : c_uint ) c_int ;
1523
1520
1524
- pub extern "c" fn alarm (seconds : c_uint ) c_uint ;
1521
+ pub extern "c" fn alarm (seconds : c_uint ) c_uint ;
1525
1522
1526
- pub extern "c" fn msync (addr : * align (page_size ) const anyopaque , len : usize , flags : c_int ) c_int ;
1527
- },
1528
- };
1523
+ pub extern "c" fn msync (addr : * align (page_size ) const anyopaque , len : usize , flags : c_int ) c_int ;
1529
1524
1530
1525
pub const fstat = switch (native_os ) {
1531
1526
.macos = > switch (native_arch ) {
@@ -1863,16 +1858,14 @@ pub extern "c" fn setlogmask(maskpri: c_int) c_int;
1863
1858
1864
1859
pub extern "c" fn if_nametoindex ([* :0 ]const u8 ) c_int ;
1865
1860
1866
- pub usingnamespace if (builtin .target .isAndroid ()) struct {
1867
- // android bionic libc does not implement getcontext,
1868
- // and std.os.linux.getcontext also cannot be built for
1869
- // bionic libc currently.
1870
- } else if (native_os == .linux and builtin .target .isMusl ()) struct {
1871
- // musl does not implement getcontext
1872
- pub const getcontext = std .os .linux .getcontext ;
1873
- } else struct {
1874
- pub extern "c" fn getcontext (ucp : * std.os.ucontext_t ) c_int ;
1875
- };
1861
+ pub const getcontext = if (builtin .target .isAndroid ())
1862
+ @compileError ("android bionic libc does not implement getcontext" )
1863
+ else if (native_os == .linux and builtin .target .isMusl ())
1864
+ std .os .linux .getcontext
1865
+ else
1866
+ struct {
1867
+ extern fn getcontext (ucp : * std.os.ucontext_t ) c_int ;
1868
+ }.getcontext ;
1876
1869
1877
1870
pub const max_align_t = if (native_abi == .msvc )
1878
1871
f64
0 commit comments