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:
e898a79
)
make ualarm actually work (obsolete function removed from SUS)
author
Rich Felker
<dalias@aerifal.cx>
Sun, 3 Apr 2011 23:18:43 +0000
(19:18 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Sun, 3 Apr 2011 23:18:43 +0000
(19:18 -0400)
src/unistd/ualarm.c
patch
|
blob
|
history
diff --git
a/src/unistd/ualarm.c
b/src/unistd/ualarm.c
index 1eb086923eef4fd89b1851acad074e6269c53548..855504bca42c743580fbbb3425a3176736411c7a 100644
(file)
--- a/
src/unistd/ualarm.c
+++ b/
src/unistd/ualarm.c
@@
-1,8
+1,13
@@
+#define _GNU_SOURCE
#include <unistd.h>
-#include
"syscall.h"
+#include
<sys/time.h>
-/* FIXME: ?? */
-unsigned ualarm(unsigned useconds, unsigned interval)
+unsigned ualarm(unsigned value, unsigned interval)
{
- return -1;
+ struct itimerval it = {
+ .it_interval.tv_usec = interval,
+ .it_value.tv_usec = value
+ };
+ setitimer(ITIMER_REAL, &it, &it);
+ return it.it_value.tv_sec*1000000 + it.it_value.tv_usec;
}