powerpc: add PTRACE_SYSEMU from linux v4.20
[oweals/musl.git] / src / unistd / alarm.c
index 244af1c0470f0e3e2ff2d2bd20d5600448eb6320..2e3263ac5986019f57576f6b0777f483b449eba7 100644 (file)
@@ -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;
 }