| ... | @@ -1334,6 +1334,10 @@ pub const libc = struct { | ... | @@ -1334,6 +1334,10 @@ pub const libc = struct { |
| 1334 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fstat.html | 1334 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fstat.html |
| 1335 | pub extern fn fstat(fd: c_int, buf: *struct_stat) c_int; | 1335 | pub extern fn fstat(fd: c_int, buf: *struct_stat) c_int; |
| 1336 | | 1336 | |
| | 1337 | /// int fstatat(int fd, const char *restrict path, struct stat *restrict buf, int flag); |
| | 1338 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/fstatat.html |
| | 1339 | pub extern fn fstatat(fd: c_int, noalias path: [*:0]const u8, noalias buf: *struct_stat, flag: c_int) c_int; |
| | 1340 | |
| 1337 | /// int getchar(void); | 1341 | /// int getchar(void); |
| 1338 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getchar.html | 1342 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getchar.html |
| 1339 | pub extern fn getchar() c_int; | 1343 | pub extern fn getchar() c_int; |
| ... | @@ -1643,3 +1647,11 @@ pub fn pthread_self() pthread_t { | ... | @@ -1643,3 +1647,11 @@ pub fn pthread_self() pthread_t { |
| 1643 | pub fn gettid() pid_t { | 1647 | pub fn gettid() pid_t { |
| 1644 | return libc.gettid(); | 1648 | return libc.gettid(); |
| 1645 | } | 1649 | } |
| | 1650 | |
| | 1651 | pub fn fstatat(fd: c_int, path: [*:0]const u8, flag: c_int) errno.Error!struct_stat { |
| | 1652 | var buf: struct_stat = undefined; |
| | 1653 | const rc = libc.fstatat(fd, path, &buf, flag); |
| | 1654 | if (rc == -1) return errno.fromInt(errno.fromLibC()); |
| | 1655 | std.debug.assert(rc == 0); |
| | 1656 | return buf; |
| | 1657 | } |