diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-05-24 12:21:34 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-05-24 12:21:34 -0400 |
commit | e241896cd5ebe5d6b8e725fe4ac7a8d9c0980319 (patch) | |
tree | f5fcc368a075a4cd34ec817bbb7e421ce271a354 | |
parent | c37afdfdf393261e18364aed52571d0a5b011044 (diff) | |
download | musl-e241896cd5ebe5d6b8e725fe4ac7a8d9c0980319.tar.gz musl-e241896cd5ebe5d6b8e725fe4ac7a8d9c0980319.tar.bz2 musl-e241896cd5ebe5d6b8e725fe4ac7a8d9c0980319.tar.xz musl-e241896cd5ebe5d6b8e725fe4ac7a8d9c0980319.zip |
avoid deprecated (by linux) alarm syscall; use setitimer instead
-rw-r--r-- | src/unistd/alarm.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/unistd/alarm.c b/src/unistd/alarm.c index 244af1c0..2e3263ac 100644 --- a/src/unistd/alarm.c +++ b/src/unistd/alarm.c @@ -1,7 +1,10 @@ #include <unistd.h> +#include <sys/time.h> #include "syscall.h" unsigned alarm(unsigned seconds) { - return syscall(SYS_alarm, seconds); + struct itimerval it = { .it_value.tv_sec = seconds }; + __syscall(SYS_setitimer, ITIMER_REAL, &it, &it); + return it.it_value.tv_sec + !!it.it_value.tv_usec; } |