From: Rich Felker Date: Sun, 3 Apr 2011 23:18:43 +0000 (-0400) Subject: make ualarm actually work (obsolete function removed from SUS) X-Git-Tag: v0.7.6~5 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3910e93340990a8107d9d9d1e8d5e9102817315f;p=oweals%2Fmusl.git make ualarm actually work (obsolete function removed from SUS) --- 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 -#include "syscall.h" +#include -/* 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; }