about summary refs log tree commit diff
path: root/src/unistd/alarm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/unistd/alarm.c')
-rw-r--r--src/unistd/alarm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/unistd/alarm.c b/src/unistd/alarm.c
index 244af1c0..2e3263ac 100644
--- 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;
 }