Commit 535b70c1 authored by Thomas Weißschuh's avatar Thomas Weißschuh

tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks

The ENOSYS fallback code does not use its functions parameters.
This can lead to compiler warnings about unused parameters.

Explicitly avoid these warnings.
Signed-off-by: default avatarThomas Weißschuh <linux@weissschuh.net>
Acked-by: default avatarWilly Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20230917-nolibc-syscall-nr-v2-2-03863d509b9a@weissschuh.net
parent 95315486
...@@ -43,6 +43,16 @@ ...@@ -43,6 +43,16 @@
: __sysret_arg; /* return original value */ \ : __sysret_arg; /* return original value */ \
}) })
/* Syscall ENOSYS helper: Avoids unused-parameter warnings and provides a
* debugging hook.
*/
static __inline__ int __nolibc_enosys(const char *syscall, ...)
{
(void)syscall;
return -ENOSYS;
}
/* Functions in this file only describe syscalls. They're declared static so /* Functions in this file only describe syscalls. They're declared static so
* that the compiler usually decides to inline them while still being allowed * that the compiler usually decides to inline them while still being allowed
...@@ -133,7 +143,7 @@ int sys_chmod(const char *path, mode_t mode) ...@@ -133,7 +143,7 @@ int sys_chmod(const char *path, mode_t mode)
#elif defined(__NR_chmod) #elif defined(__NR_chmod)
return my_syscall2(__NR_chmod, path, mode); return my_syscall2(__NR_chmod, path, mode);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, path, mode);
#endif #endif
} }
...@@ -156,7 +166,7 @@ int sys_chown(const char *path, uid_t owner, gid_t group) ...@@ -156,7 +166,7 @@ int sys_chown(const char *path, uid_t owner, gid_t group)
#elif defined(__NR_chown) #elif defined(__NR_chown)
return my_syscall3(__NR_chown, path, owner, group); return my_syscall3(__NR_chown, path, owner, group);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, path, owner, group);
#endif #endif
} }
...@@ -230,7 +240,7 @@ int sys_dup2(int old, int new) ...@@ -230,7 +240,7 @@ int sys_dup2(int old, int new)
#elif defined(__NR_dup2) #elif defined(__NR_dup2)
return my_syscall2(__NR_dup2, old, new); return my_syscall2(__NR_dup2, old, new);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, old, new);
#endif #endif
} }
...@@ -312,7 +322,7 @@ pid_t sys_fork(void) ...@@ -312,7 +322,7 @@ pid_t sys_fork(void)
#elif defined(__NR_fork) #elif defined(__NR_fork)
return my_syscall0(__NR_fork); return my_syscall0(__NR_fork);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__);
#endif #endif
} }
#endif #endif
...@@ -486,7 +496,7 @@ int sys_gettimeofday(struct timeval *tv, struct timezone *tz) ...@@ -486,7 +496,7 @@ int sys_gettimeofday(struct timeval *tv, struct timezone *tz)
#ifdef __NR_gettimeofday #ifdef __NR_gettimeofday
return my_syscall2(__NR_gettimeofday, tv, tz); return my_syscall2(__NR_gettimeofday, tv, tz);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, tv, tz);
#endif #endif
} }
...@@ -563,7 +573,7 @@ int sys_link(const char *old, const char *new) ...@@ -563,7 +573,7 @@ int sys_link(const char *old, const char *new)
#elif defined(__NR_link) #elif defined(__NR_link)
return my_syscall2(__NR_link, old, new); return my_syscall2(__NR_link, old, new);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, old, new);
#endif #endif
} }
...@@ -584,7 +594,7 @@ off_t sys_lseek(int fd, off_t offset, int whence) ...@@ -584,7 +594,7 @@ off_t sys_lseek(int fd, off_t offset, int whence)
#ifdef __NR_lseek #ifdef __NR_lseek
return my_syscall3(__NR_lseek, fd, offset, whence); return my_syscall3(__NR_lseek, fd, offset, whence);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, fd, offset, whence);
#endif #endif
} }
...@@ -607,7 +617,7 @@ int sys_mkdir(const char *path, mode_t mode) ...@@ -607,7 +617,7 @@ int sys_mkdir(const char *path, mode_t mode)
#elif defined(__NR_mkdir) #elif defined(__NR_mkdir)
return my_syscall2(__NR_mkdir, path, mode); return my_syscall2(__NR_mkdir, path, mode);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, path, mode);
#endif #endif
} }
...@@ -629,7 +639,7 @@ int sys_rmdir(const char *path) ...@@ -629,7 +639,7 @@ int sys_rmdir(const char *path)
#elif defined(__NR_unlinkat) #elif defined(__NR_unlinkat)
return my_syscall3(__NR_unlinkat, AT_FDCWD, path, AT_REMOVEDIR); return my_syscall3(__NR_unlinkat, AT_FDCWD, path, AT_REMOVEDIR);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, path);
#endif #endif
} }
...@@ -652,7 +662,7 @@ long sys_mknod(const char *path, mode_t mode, dev_t dev) ...@@ -652,7 +662,7 @@ long sys_mknod(const char *path, mode_t mode, dev_t dev)
#elif defined(__NR_mknod) #elif defined(__NR_mknod)
return my_syscall3(__NR_mknod, path, mode, dev); return my_syscall3(__NR_mknod, path, mode, dev);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, path, mode, dev);
#endif #endif
} }
...@@ -742,7 +752,7 @@ int sys_open(const char *path, int flags, mode_t mode) ...@@ -742,7 +752,7 @@ int sys_open(const char *path, int flags, mode_t mode)
#elif defined(__NR_open) #elif defined(__NR_open)
return my_syscall3(__NR_open, path, flags, mode); return my_syscall3(__NR_open, path, flags, mode);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, path, flags, mode);
#endif #endif
} }
...@@ -842,7 +852,7 @@ int sys_poll(struct pollfd *fds, int nfds, int timeout) ...@@ -842,7 +852,7 @@ int sys_poll(struct pollfd *fds, int nfds, int timeout)
#elif defined(__NR_poll) #elif defined(__NR_poll)
return my_syscall3(__NR_poll, fds, nfds, timeout); return my_syscall3(__NR_poll, fds, nfds, timeout);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, fds, nfds, timeout);
#endif #endif
} }
...@@ -934,7 +944,7 @@ int sys_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeva ...@@ -934,7 +944,7 @@ int sys_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeva
#endif #endif
return my_syscall5(__NR__newselect, nfds, rfds, wfds, efds, timeout); return my_syscall5(__NR__newselect, nfds, rfds, wfds, efds, timeout);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, nfds, rfds, wfds, efds, timeout);
#endif #endif
} }
...@@ -989,7 +999,7 @@ int sys_statx(int fd, const char *path, int flags, unsigned int mask, struct sta ...@@ -989,7 +999,7 @@ int sys_statx(int fd, const char *path, int flags, unsigned int mask, struct sta
#ifdef __NR_statx #ifdef __NR_statx
return my_syscall5(__NR_statx, fd, path, flags, mask, buf); return my_syscall5(__NR_statx, fd, path, flags, mask, buf);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, fd, path, flags, mask, buf);
#endif #endif
} }
...@@ -1047,7 +1057,7 @@ int sys_symlink(const char *old, const char *new) ...@@ -1047,7 +1057,7 @@ int sys_symlink(const char *old, const char *new)
#elif defined(__NR_symlink) #elif defined(__NR_symlink)
return my_syscall2(__NR_symlink, old, new); return my_syscall2(__NR_symlink, old, new);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, old, new);
#endif #endif
} }
...@@ -1104,7 +1114,7 @@ int sys_unlink(const char *path) ...@@ -1104,7 +1114,7 @@ int sys_unlink(const char *path)
#elif defined(__NR_unlink) #elif defined(__NR_unlink)
return my_syscall1(__NR_unlink, path); return my_syscall1(__NR_unlink, path);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, path);
#endif #endif
} }
...@@ -1127,7 +1137,7 @@ pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage) ...@@ -1127,7 +1137,7 @@ pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage)
#ifdef __NR_wait4 #ifdef __NR_wait4
return my_syscall4(__NR_wait4, pid, status, options, rusage); return my_syscall4(__NR_wait4, pid, status, options, rusage);
#else #else
return -ENOSYS; return __nolibc_enosys(__func__, pid, status, options, rusage);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment