]>
Commit | Line | Data |
---|---|---|
320054e8 DG |
1 | // Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/ |
2 | // | |
3 | // SPDX-License-Identifier: BSD-2-Clause | |
4 | ||
446cb3f1 | 5 | #include <wasi/api.h> |
320054e8 DG |
6 | #include <errno.h> |
7 | #include <string.h> | |
8 | #include <unistd.h> | |
9 | ||
f2e779e5 DG |
10 | ssize_t __wasilibc_nocwd_readlinkat(int fd, const char *restrict path, char *restrict buf, |
11 | size_t bufsize) { | |
320054e8 | 12 | size_t bufused; |
446cb3f1 | 13 | // TODO: Remove the cast on `buf` once the witx is updated with char8 support. |
2b7e73ae | 14 | __wasi_errno_t error = __wasi_path_readlink(fd, path, |
446cb3f1 | 15 | (uint8_t*)buf, bufsize, &bufused); |
320054e8 | 16 | if (error != 0) { |
099caae3 | 17 | errno = error; |
320054e8 DG |
18 | return -1; |
19 | } | |
20 | return bufused; | |
21 | } |