From e241896cd5ebe5d6b8e725fe4ac7a8d9c0980319 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 24 May 2012 12:21:34 -0400 Subject: [PATCH] avoid deprecated (by linux) alarm syscall; use setitimer instead --- src/unistd/alarm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 +#include #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; } -- 2.25.1