From ad355abe2ae2ecc802fe9066924aac53d4140324 Mon Sep 17 00:00:00 2001 From: Waldemar Kozaczuk Date: Mon, 18 Dec 2023 09:23:32 -0500 Subject: [PATCH] syscall: expose getrlimit and implement rt_sigtimedwait This patch exposes getrlimit and adds limited implementation of rt_sigtimedwait system call. The latter only supports calls without the timeout parameter. Signed-off-by: Waldemar Kozaczuk --- linux.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/linux.cc b/linux.cc index b2222fad7a..db7975fbe9 100644 --- a/linux.cc +++ b/linux.cc @@ -373,8 +373,17 @@ int rt_sigprocmask(int how, sigset_t * nset, sigset_t * oset, size_t sigsetsize) return sigprocmask(how, nset, oset); } -#define __NR_sys_exit __NR_exit +int rt_sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout, size_t sigsetsize) +{ + if (!timeout || (!timeout->tv_sec && !timeout->tv_nsec)) { + return sigwaitinfo(set, info); + } else { + errno = ENOSYS; + return -1; + } +} +#define __NR_sys_exit __NR_exit static int sys_exit(int ret) { sched::thread::current()->exit(); @@ -720,6 +729,8 @@ TRACEPOINT(trace_syscall_shmctl, "%d <= %d %d %p", int, int, int, struct shmid_d TRACEPOINT(trace_syscall_shmdt, "%d <= 0x%x", int, const void *) TRACEPOINT(trace_syscall_shmget, "%d <= %d %lu %d", int, key_t, size_t, int); TRACEPOINT(trace_syscall_rename, "%d <= %s %s", int, const char *, const char *); +TRACEPOINT(trace_syscall_rt_sigtimedwait, "%d <= %p %p %p %lu", int, const sigset_t *, siginfo_t *, const struct timespec *, size_t); +TRACEPOINT(trace_syscall_getrlimit, "%d <= %d %p", int, int, struct rlimit *); OSV_LIBC_API long syscall(long number, ...) { @@ -873,6 +884,8 @@ OSV_LIBC_API long syscall(long number, ...) SYSCALL1(shmdt, const void *); SYSCALL3(shmget, key_t, size_t, int); SYSCALL2(rename, const char *, const char *); + SYSCALL4(rt_sigtimedwait, const sigset_t *, siginfo_t *, const struct timespec *, size_t); + SYSCALL2(getrlimit, int, struct rlimit *); } debug_always("syscall(): unimplemented system call %d\n", number);