| ... | ... | @@ -2206,6 +2206,14 @@ pub const libc = struct { |
| 2206 | 2206 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/read.html |
| 2207 | 2207 | pub extern fn read(fd: c_int, buf: [*]u8, count: usize) isize; |
| 2208 | 2208 | |
| 2209 | /// ssize_t readlink(const char *restrict path, char *restrict buf, size_t bufsize); |
| 2210 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/readlink.html |
| 2211 | pub extern fn readlink(noalias path: [*:0]const u8, noalias buf: [*]u8, len: usize) isize; |
| 2212 | |
| 2213 | /// ssize_t readlinkat(int fd, const char *restrict path, char *restrict buf, size_t bufsize); |
| 2214 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/readlinkat.html |
| 2215 | pub extern fn readlinkat(fd: c_int, noalias path: [*:0]const u8, noalias buf: [*]u8, len: usize) isize; |
| 2216 | |
| 2209 | 2217 | /// ssize_t recv(int socket, void *buffer, size_t length, int flags); |
| 2210 | 2218 | /// https://pubs.opengroup.org/onlinepubs/9699919799.orig/functions/recv.html |
| 2211 | 2219 | pub extern fn recv(fd: c_int, buffer: [*]u8, length: usize, flags: c_int) isize; |
| ... | ... | @@ -3137,3 +3145,9 @@ pub fn memfd_create(name: [*:0]const u8, flags: c_uint) !c_int { |
| 3137 | 3145 | std.debug.assert(rc >= 0); |
| 3138 | 3146 | return rc; |
| 3139 | 3147 | } |
| 3148 | pub fn readlinkat(dirfd: c_int, noalias path: [*:0]const u8, noalias buf: []u8) ![:0]u8 { |
| 3149 | const rc = libc.readlinkat(dirfd, path, buf.ptr, buf.len); |
| 3150 | if (rc == -1) return errno.fromInt(errno.fromLibC()); |
| 3151 | std.debug.assert(rc >= 0); |
| 3152 | return buf[0..@intCast(rc) :0]; |
| 3153 | } |