diff options
| author | Daniel Palmer <daniel@thingy.jp> | 2026-07-02 17:51:00 +0900 |
|---|---|---|
| committer | Thomas Weißschuh <linux@weissschuh.net> | 2026-07-03 08:07:59 +0200 |
| commit | 94518b77e194d71b1d76a2dd75f4891954edc296 (patch) | |
| tree | 4ce1184052a4878322c4cc8d4015e231bdb25076 /tools/include | |
| parent | 0fbc34f028e9eb7705e1f4ee1591ecd6d05160e8 (diff) | |
tools/nolibc: unistd: Add readlink()
Add readlink(). This is needed to test getcwd().
Signed-off-by: Daniel Palmer <daniel@thingy.jp>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260702085101.3304547-3-daniel@thingy.jp
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Diffstat (limited to 'tools/include')
| -rw-r--r-- | tools/include/nolibc/unistd.h | 16 |
1 files changed, 16 insertions, 0 deletions
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) { |
