]> git.proxmox.com Git - wasi-libc.git/blob - libc-bottom-half/cloudlibc/src/libc/unistd/readlinkat.c
Delete several blocks of unused code. (#294)
[wasi-libc.git] / libc-bottom-half / cloudlibc / src / libc / unistd / readlinkat.c
1 // Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
2 //
3 // SPDX-License-Identifier: BSD-2-Clause
4
5 #include <wasi/api.h>
6 #include <errno.h>
7 #include <string.h>
8 #include <unistd.h>
9
10 ssize_t __wasilibc_nocwd_readlinkat(int fd, const char *restrict path, char *restrict buf,
11 size_t bufsize) {
12 size_t bufused;
13 // TODO: Remove the cast on `buf` once the witx is updated with char8 support.
14 __wasi_errno_t error = __wasi_path_readlink(fd, path,
15 (uint8_t*)buf, bufsize, &bufused);
16 if (error != 0) {
17 return -1;
18 }
19 return bufused;
20 }