summaryrefslogtreecommitdiff
path: root/tools/include
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2026-04-18 12:19:58 +0200
committerThomas Weißschuh <linux@weissschuh.net>2026-04-27 20:08:54 +0200
commitc503c3deb9b56645413d8f8560dcc24efe7cea59 (patch)
treeecb1078f987c841be26fdd06b2237288960436a9 /tools/include
parent32db83195f75bda670ca9282d9868ad02b1d6185 (diff)
downloadlwn-c503c3deb9b56645413d8f8560dcc24efe7cea59.tar.gz
lwn-c503c3deb9b56645413d8f8560dcc24efe7cea59.zip
tools/nolibc: cast pointers returned from system calls through integers
Currently all system call wrappers return 'long' integers which can be directly cast to 'void *' if the returned value is actually a pointer. An upcoming change will change the system call wrappers to sometimes return 'long long' which can not be cast to a pointer directly. Add explicit cast through 'long' to prepare for this. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260418-nolibc-largefile-v1-3-b91f0775bac3@weissschuh.net
Diffstat (limited to 'tools/include')
-rw-r--r--tools/include/nolibc/sys.h2
-rw-r--r--tools/include/nolibc/sys/mman.h6
2 files changed, 4 insertions, 4 deletions
diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h
index 841158eb07c3..33f9c970ae57 100644
--- a/tools/include/nolibc/sys.h
+++ b/tools/include/nolibc/sys.h
@@ -101,7 +101,7 @@ static __inline__ int __nolibc_enosys(const char *syscall, ...)
static __attribute__((unused))
void *_sys_brk(void *addr)
{
- return (void *)__nolibc_syscall1(__NR_brk, addr);
+ return (void *)(unsigned long)__nolibc_syscall1(__NR_brk, addr);
}
static __attribute__((unused))
diff --git a/tools/include/nolibc/sys/mman.h b/tools/include/nolibc/sys/mman.h
index 91d77a51412d..72bc1d43d1d4 100644
--- a/tools/include/nolibc/sys/mman.h
+++ b/tools/include/nolibc/sys/mman.h
@@ -27,7 +27,7 @@ void *_sys_mmap(void *addr, size_t length, int prot, int flags, int fd,
n = __NR_mmap;
#endif
- return (void *)__nolibc_syscall6(n, addr, length, prot, flags, fd, offset);
+ return (void *)(unsigned long)__nolibc_syscall6(n, addr, length, prot, flags, fd, offset);
}
#endif
@@ -46,8 +46,8 @@ void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset)
static __attribute__((unused))
void *_sys_mremap(void *old_address, size_t old_size, size_t new_size, int flags, void *new_address)
{
- return (void *)__nolibc_syscall5(__NR_mremap, old_address, old_size,
- new_size, flags, new_address);
+ return (void *)(unsigned long)__nolibc_syscall5(__NR_mremap, old_address, old_size,
+ new_size, flags, new_address);
}
static __attribute__((unused))