Re: [PATCH v3 2/3] tools/nolibc: unistd: Add readlink()
From: Willy Tarreau
Date: Thu Jul 02 2026 - 08:07:50 EST
On Thu, Jul 02, 2026 at 05:51:00PM +0900, Daniel Palmer wrote:
> Add readlink(). This is needed to test getcwd().
>
> Signed-off-by: Daniel Palmer <daniel@xxxxxxxxx>
> ---
> tools/include/nolibc/unistd.h | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/tools/include/nolibc/unistd.h b/tools/include/nolibc/unistd.h
> index 2e0edbc26315..a264a20da13d 100644
> --- a/tools/include/nolibc/unistd.h
> +++ b/tools/include/nolibc/unistd.h
> @@ -128,6 +128,22 @@ int msleep(unsigned int msecs)
> return 0;
> }
>
> +/*
> + * ssize_t readlink(const char *path, char *buf, size_t bufsiz);
> + */
> +
> +static __attribute__((unused))
> +ssize_t _sys_readlink(const char *path, char *buf, size_t bufsiz)
> +{
> + return __nolibc_syscall4(__NR_readlinkat, AT_FDCWD, path, buf, bufsiz);
> +}
> +
> +static __attribute__((unused))
> +ssize_t readlink(const char *path, char *buf, size_t bufsiz)
> +{
> + return __sysret(_sys_readlink(path, buf, bufsiz));
> +}
> +
> static __attribute__((unused))
> unsigned int sleep(unsigned int seconds)
> {
Acked-by: Willy Tarreau <w@xxxxxx>
Willy