About RISC-V syscalls and the __ARCH_WANT_TIME32_SYSCALLS macro
Yimin Gu
ustcymgu at gmail.com
Sat Feb 19 10:44:26 EST 2022
I'm tweaking RISC-V 32-bit kernel and toolchains, and seems by default
some syscalls are not enabled -- for example, adjtimex. In kernel headers
(usr/include/asm-generic/unistd.h)it is guarded by the macro:
#if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
...
#define __NR_adjtimex 171
__SC_3264(__NR_adjtimex, sys_adjtimex_time32, sys_adjtimex)
which is not enabled on 32-bit because __ARCH_WANT_TIME32_SYSCALLS is not
defined for RISC-V, and there's no 32-bit counterparts in the unistd.h file
,unlike, for example, ppoll:
#if __BITS_PER_LONG == 32
...
#define __NR_ppoll_time64 414
__SC_COMP(__NR_ppoll_time64, sys_ppoll, compat_sys_ppoll_time64)
In other architectures like ARM 32-bit, I find adjtimex listed in the
syscalls.tbl file, which doesn't exist for RISC-V.
So is syscalls like adjtimex just shouldn't exist for RISC-V 32-bit?
If not, is it good to manually define __ARCH_WANT_TIME32_SYSCALLS? I got
uclibc compiled and run after defining this macro in kernel, but I'm not
sure if this is good.
More information about the Kernelnewbies
mailing list