]> git.proxmox.com Git - wasi-libc.git/blame - 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
CommitLineData
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
10ssize_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) {
320054e8
DG
17 return -1;
18 }
19 return bufused;
20}