Skip to content

Commit

Permalink
fixup! [LibOS] Add support for timerfd system calls
Browse files Browse the repository at this point in the history
Signed-off-by: Kailun Qin <[email protected]>
  • Loading branch information
kailun-qin committed Jun 11, 2024
1 parent ebeb395 commit c327e2f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions libos/src/sys/libos_timerfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ long libos_syscall_timerfd_settime(int fd, int flags, const struct __kernel_itim
if (!hdl)
return -EBADF;

if (hdl->type != TYPE_TIMERFD) {
ret = -EINVAL;
goto out;
}

if (hdl->info.timerfd.broken_in_child) {
log_warning("Child process tried to access timerfd created by parent process. This is "
"disallowed in Gramine.");
return -EIO;
}

if (hdl->type != TYPE_TIMERFD) {
ret = -EINVAL;
goto out;
}

if (!is_user_memory_readable(value, sizeof(*value))) {
ret = -EFAULT;
goto out;
Expand Down Expand Up @@ -253,17 +253,17 @@ long libos_syscall_timerfd_gettime(int fd, struct __kernel_itimerspec* value) {
if (!hdl)
return -EBADF;

if (hdl->type != TYPE_TIMERFD) {
ret = -EINVAL;
goto out;
}

if (hdl->info.timerfd.broken_in_child) {
log_warning("Child process tried to access timerfd created by parent process. This is "
"disallowed in Gramine.");
return -EIO;
}

if (hdl->type != TYPE_TIMERFD) {
ret = -EINVAL;
goto out;
}

if (!is_user_memory_writable(value, sizeof(*value))) {
ret = -EFAULT;
goto out;
Expand Down
2 changes: 1 addition & 1 deletion libos/test/regression/timerfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static void test_epoll_modes(int fd) {
errx(1, "epoll: unexpected number of fds (expected 1, got %u)", nfds);

/* waiting for another event without reading the expiration count: here, even though the timer
* expired at least one, there is no event reported because we're in edge-triggered mode (which
* expired at least once, there is no event reported because we're in edge-triggered mode (which
* does not "reset" the event since there was no read) */
nfds = CHECK(epoll_wait(epfd, events, 1, /*timeout=*/PERIODIC_INTERVAL * 1000 * 2));
if (nfds != 0)
Expand Down

0 comments on commit c327e2f

Please sign in to comment.