projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c37afdf
)
avoid deprecated (by linux) alarm syscall; use setitimer instead
author
Rich Felker
<dalias@aerifal.cx>
Thu, 24 May 2012 16:21:34 +0000
(12:21 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Thu, 24 May 2012 16:21:34 +0000
(12:21 -0400)
src/unistd/alarm.c
patch
|
blob
|
history
diff --git
a/src/unistd/alarm.c
b/src/unistd/alarm.c
index 244af1c0470f0e3e2ff2d2bd20d5600448eb6320..2e3263ac5986019f57576f6b0777f483b449eba7 100644
(file)
--- 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;
}