| author | |
| committer | |
| log | 83d837813999b73771a0e9623ed1c6c5339e4f4c |
| tree | a1cd60d6c0780a629bd60a4975060cc1b6027b80 |
| parent | ac1aaec9c38eb44b93099ff18579a9401f107100 |
2 files changed, 19 insertions(+), 0 deletions(-)
lib/std/c.zig+15| ... | @@ -59,6 +59,20 @@ pub usingnamespace switch (builtin.os.tag) { | ... | @@ -59,6 +59,20 @@ pub usingnamespace switch (builtin.os.tag) { |
| 59 | 59 | ||
| 60 | pub const whence_t = if (builtin.os.tag == .wasi) std.os.wasi.whence_t else c_int; | 60 | pub const whence_t = if (builtin.os.tag == .wasi) std.os.wasi.whence_t else c_int; |
| 61 | 61 | ||
| 62 | // Unix-like systems | ||
| 63 | pub usingnamespace switch (builtin.os.tag) { | ||
| 64 | .netbsd, .windows => struct {}, | ||
| 65 | else => struct { | ||
| 66 | pub const DIR = opaque {}; | ||
| 67 | pub extern "c" fn opendir(pathname: [*:0]const u8) ?*DIR; | ||
| 68 | pub extern "c" fn fdopendir(fd: c_int) ?*DIR; | ||
| 69 | pub extern "c" fn rewinddir(dp: *DIR) void; | ||
| 70 | pub extern "c" fn closedir(dp: *DIR) c_int; | ||
| 71 | pub extern "c" fn telldir(dp: *DIR) c_long; | ||
| 72 | pub extern "c" fn seekdir(dp: *DIR, loc: c_long) void; | ||
| 73 | }, | ||
| 74 | }; | ||
| 75 | |||
| 62 | pub usingnamespace switch (builtin.os.tag) { | 76 | pub usingnamespace switch (builtin.os.tag) { |
| 63 | .netbsd, .macos, .ios, .watchos, .tvos, .windows => struct {}, | 77 | .netbsd, .macos, .ios, .watchos, .tvos, .windows => struct {}, |
| 64 | else => struct { | 78 | else => struct { |
| ... | @@ -76,6 +90,7 @@ pub usingnamespace switch (builtin.os.tag) { | ... | @@ -76,6 +90,7 @@ pub usingnamespace switch (builtin.os.tag) { |
| 76 | pub extern "c" fn sigfillset(set: ?*c.sigset_t) void; | 90 | pub extern "c" fn sigfillset(set: ?*c.sigset_t) void; |
| 77 | pub extern "c" fn alarm(seconds: c_uint) c_uint; | 91 | pub extern "c" fn alarm(seconds: c_uint) c_uint; |
| 78 | pub extern "c" fn sigwait(set: ?*c.sigset_t, sig: ?*c_int) c_int; | 92 | pub extern "c" fn sigwait(set: ?*c.sigset_t, sig: ?*c_int) c_int; |
| 93 | pub extern "c" fn readdir(dp: *c.DIR) ?*c.dirent; | ||
| 79 | }, | 94 | }, |
| 80 | }; | 95 | }; |
| 81 | 96 |
lib/std/c/darwin.zig+4| ... | @@ -62,9 +62,13 @@ const private = struct { | ... | @@ -62,9 +62,13 @@ const private = struct { |
| 62 | /// force 64bit version. | 62 | /// force 64bit version. |
| 63 | /// Note that this is fixed on aarch64 and no longer necessary. | 63 | /// Note that this is fixed on aarch64 and no longer necessary. |
| 64 | extern "c" fn @"fstatat$INODE64"(dirfd: fd_t, path_name: [*:0]const u8, buf: *Stat, flags: u32) c_int; | 64 | extern "c" fn @"fstatat$INODE64"(dirfd: fd_t, path_name: [*:0]const u8, buf: *Stat, flags: u32) c_int; |
| 65 | |||
| 66 | extern "c" fn readdir(dir: *std.c.DIR) ?*dirent; | ||
| 67 | extern "c" fn @"readdir$INODE64"(dir: *std.c.DIR) ?*dirent; | ||
| 65 | }; | 68 | }; |
| 66 | pub const fstat = if (native_arch == .aarch64) private.fstat else private.@"fstat$INODE64"; | 69 | pub const fstat = if (native_arch == .aarch64) private.fstat else private.@"fstat$INODE64"; |
| 67 | pub const fstatat = if (native_arch == .aarch64) private.fstatat else private.@"fstatat$INODE64"; | 70 | pub const fstatat = if (native_arch == .aarch64) private.fstatat else private.@"fstatat$INODE64"; |
| 71 | pub const readdir = if (native_arch == .aarch64) private.readdir else private.@"readdir$INODE64"; | ||
| 68 | 72 | ||
| 69 | pub extern "c" fn mach_absolute_time() u64; | 73 | pub extern "c" fn mach_absolute_time() u64; |
| 70 | pub extern "c" fn mach_continuous_time() u64; | 74 | pub extern "c" fn mach_continuous_time() u64; |