Skip to content

Commit

Permalink
Add clock_nanosleep(2) support
Browse files Browse the repository at this point in the history
  • Loading branch information
aDotInTheVoid committed Sep 2, 2022
1 parent 4a41a5a commit e87108e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/sbr-afl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,12 @@ int inanosleep(const struct timespec *req, struct timespec *rem) {
nanosleep((const struct timespec[]){{0, 1L}}, NULL);
return 0;
}

int iclock_nanosleep(clockid_t clockid, int flags,
const struct timespec *request, struct timespec *remain) {
clock_nanosleep(CLOCK_REALTIME, 0, (const struct timespec[]){{0, 1L}}, NULL);
return 0;
}
#endif // SF_SLEEP

// static int cpus[8] = {0};
Expand Down Expand Up @@ -968,6 +974,9 @@ long handle_syscall(long sc_no, long arg1, long arg2, long arg3, long arg4,
#ifdef SF_SLEEP
} else if (sc_no == SYS_nanosleep) {
return inanosleep((const struct timespec *)arg1, (struct timespec *)arg2);
} else if (sc_no == SYS_clock_nanosleep) {
return iclock_nanosleep(arg1, arg2, (const struct timespec *)arg3,
(struct timespec *)arg4);
#endif // SF_SLEEP
// } else if (sc_no == SYS_getpid) {
// assert(false);
Expand Down

0 comments on commit e87108e

Please sign in to comment.