| ... | @@ -1503,6 +1503,10 @@ pub const libc = struct { | ... | @@ -1503,6 +1503,10 @@ pub const libc = struct { |
| 1503 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getchar_unlocked.html | 1503 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getchar_unlocked.html |
| 1504 | pub extern fn getchar_unlocked() c_int; | 1504 | pub extern fn getchar_unlocked() c_int; |
| 1505 | | 1505 | |
| | 1506 | /// char *getcwd(char *buf, size_t size); |
| | 1507 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getcwd.html |
| | 1508 | pub extern fn getcwd(buf: [*]u8, size: usize) ?[*:0]u8; |
| | 1509 | |
| 1506 | /// gid_t getegid(void); | 1510 | /// gid_t getegid(void); |
| 1507 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getegid.html | 1511 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/getegid.html |
| 1508 | pub extern fn getegid() gid_t; | 1512 | pub extern fn getegid() gid_t; |
| ... | @@ -3713,3 +3717,8 @@ pub fn lseek(fd: c_int, offset: off_t, whence: c_int) !void { | ... | @@ -3713,3 +3717,8 @@ pub fn lseek(fd: c_int, offset: off_t, whence: c_int) !void { |
| 3713 | if (rc == -1) return errno.fromInt(errno.fromLibC()); | 3717 | if (rc == -1) return errno.fromInt(errno.fromLibC()); |
| 3714 | std.debug.assert(rc >= 0); | 3718 | std.debug.assert(rc >= 0); |
| 3715 | } | 3719 | } |
| | 3720 | pub fn getcwd(buf: []u8) ![*:0]u8 { |
| | 3721 | const rc = libc.getcwd(buf.ptr, buf.len); |
| | 3722 | if (rc == null) return errno.fromInt(errno.fromLibC()); |
| | 3723 | return rc.?; |
| | 3724 | } |