[LibOS] Add clock_nanosleep() syscall emulation

This commit is contained in:
Dmitrii Kuvaiskii
2020-03-17 21:57:11 +01:00
committed by Michał Kowalczyk
parent 4aa0dc474a
commit 69997ad460
3 changed files with 20 additions and 4 deletions
+4 -2
View File
@@ -463,6 +463,8 @@ int shim_do_epoll_wait(int epfd, struct __kernel_epoll_event* events, int maxeve
int shim_do_epoll_ctl(int epfd, int op, int fd, struct __kernel_epoll_event* event);
int shim_do_clock_gettime(clockid_t which_clock, struct timespec* tp);
int shim_do_clock_getres(clockid_t which_clock, struct timespec* tp);
int shim_do_clock_nanosleep(clockid_t clock_id, int flags, const struct __kernel_timespec* rqtp,
struct __kernel_timespec* rmtp);
noreturn int shim_do_exit_group(int error_code);
int shim_do_tgkill(int tgid, int pid, int sig);
int shim_do_mbind(void* start, unsigned long len, int mode, unsigned long* nmask,
@@ -735,8 +737,8 @@ int shim_timer_delete(timer_t timer_id);
int shim_clock_settime(clockid_t which_clock, const struct timespec* tp);
int shim_clock_gettime(clockid_t which_clock, struct timespec* tp);
int shim_clock_getres(clockid_t which_clock, struct timespec* tp);
int shim_clock_nanosleep(clockid_t which_clock, int flags, const struct timespec* rqtp,
struct timespec* rmtp);
int shim_clock_nanosleep(clockid_t which_clock, int flags, const struct __kernel_timespec* rqtp,
struct __kernel_timespec* rmtp);
int shim_exit_group(int error_code);
int shim_epoll_wait(int epfd, struct __kernel_epoll_event* events, int maxevents, int timeout_ms);
int shim_epoll_ctl(int epfd, int op, int fd, struct __kernel_epoll_event* event);
+3 -2
View File
@@ -795,8 +795,9 @@ DEFINE_SHIM_SYSCALL(clock_gettime, 2, shim_do_clock_gettime, int, clockid_t, whi
DEFINE_SHIM_SYSCALL(clock_getres, 2, shim_do_clock_getres, int, clockid_t, which_clock,
struct timespec*, tp)
SHIM_SYSCALL_PASSTHROUGH(clock_nanosleep, 4, int, clockid_t, which_clock, int, flags,
const struct timespec*, rqtp, struct timespec*, rmtp)
/* clock_nanosleep: sys/shim_sleep.c */
DEFINE_SHIM_SYSCALL(clock_nanosleep, 4, shim_do_clock_nanosleep, int, clockid_t, which_clock, int,
flags, const struct __kernel_timespec*, rqtp, struct __kernel_timespec*, rmtp)
/* exit_group: sys/shim_exit.c */
DEFINE_SHIM_SYSCALL(exit_group, 1, shim_do_exit_group, int, int, error_code)
+13
View File
@@ -94,3 +94,16 @@ int shim_do_nanosleep(const struct __kernel_timespec* rqtp, struct __kernel_time
return 0;
}
int shim_do_clock_nanosleep(clockid_t clock_id, int flags, const struct __kernel_timespec* rqtp,
struct __kernel_timespec* rmtp) {
/* all clocks are the same */
__UNUSED(clock_id);
if (flags) {
debug("Graphene's clock_nanosleep does not support non-zero flags (%d)\n", flags);
return -EINVAL;
}
return shim_do_nanosleep(rqtp, rmtp);
}