summaryrefslogtreecommitdiff
path: root/librt/timer_settime.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2005-01-11 09:41:40 +0000
committerEric Andersen <andersen@codepoet.org>2005-01-11 09:41:40 +0000
commit50a6ac7fb90ad4008b354ff8e72c6ce511dbeb3a (patch)
treebbfa2262a83889c6aeed9e9017df8517536e3b4a /librt/timer_settime.c
parent45a95a466117aee2cd60f97be8310b6a04197244 (diff)
Patch from Paul Mundt (lethal) adding an initial librt implementation.
I then reworked the syscall handling and made minor cleanups. With luck I've not completely broken his patch...
Diffstat (limited to 'librt/timer_settime.c')
-rw-r--r--librt/timer_settime.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/librt/timer_settime.c b/librt/timer_settime.c
new file mode 100644
index 000000000..1a042283c
--- /dev/null
+++ b/librt/timer_settime.c
@@ -0,0 +1,28 @@
+/*
+ * timer_settime.c - set the timer.
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+#include <time.h>
+#include <sys/syscall.h>
+
+#include "kernel-posix-timers.h"
+
+#ifdef __NR_timer_settime
+
+#define __NR___syscall_timer_settime __NR_timer_settime
+static inline _syscall4(int, __syscall_timer_settime, kernel_timer_t, ktimerid,
+ int, flags, const void *, value, void *, ovalue);
+
+/* Set the expiration time for a timer */
+int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
+ struct itimerspec *ovalue)
+{
+ struct timer *kt = (struct timer *) timerid;
+
+ /* Set timeout */
+ return __syscall_timer_settime(kt->ktimerid, flags, value, ovalue);
+}
+
+#endif