Skip to content

Commit

Permalink
syscall: expose getrlimit and implement rt_sigtimedwait
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
wkozaczuk committed Dec 18, 2023
1 parent 310930b commit ad355ab
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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, ...)
{
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ad355ab

Please sign in to comment.