summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-04-03 19:18:43 -0400
committerRich Felker <dalias@aerifal.cx>2011-04-03 19:18:43 -0400
commit3910e93340990a8107d9d9d1e8d5e9102817315f (patch)
treeeb62851f4bfbdeb364d7cb3a4a515ba29f5bdf4f /src
parente898a790538ba4c1b7fdb0d16e1cc4c98dd84185 (diff)
downloadmusl-3910e93340990a8107d9d9d1e8d5e9102817315f.tar.gz
musl-3910e93340990a8107d9d9d1e8d5e9102817315f.tar.bz2
musl-3910e93340990a8107d9d9d1e8d5e9102817315f.tar.xz
musl-3910e93340990a8107d9d9d1e8d5e9102817315f.zip
make ualarm actually work (obsolete function removed from SUS)
Diffstat (limited to 'src')
-rw-r--r--src/unistd/ualarm.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/unistd/ualarm.c b/src/unistd/ualarm.c
index 1eb08692..855504bc 100644
--- 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;
}