[PATCH] Add clock_nanosleep()

Jean-Christian de Rivaz jc at eclis.ch
Wed Mar 3 08:25:22 UTC 2010


Hello,

While trying to use jackd on a ARM926 I get a runtime error caused by
the missing clock_nanosleep symbol. After having verified that the
clock_nanosleep syscall is present into the kernel, I cam to the
conclusion that the librt from uclibc simply lack the clock_nanosleep()
declaration. So I wrote this simple patch to try, and it actually seem
to work perfectly well on the target: jackd start and work as expected.

--- /dev/null   2010-03-02 08:54:51.506676601 +0100
+++ b/librt/clock_nanosleep.c   2010-03-02 11:26:15.000000000 +0100
@@ -0,0 +1,23 @@
+#include <errno.h>
+#include <stdlib.h>
+#include <time.h>
+#include <sys/syscall.h>
+
+#include "kernel-posix-timers.h"
+
+#ifdef __NR_clock_nanosleep
+
+#define __NR___syscall_clock_nanosleep __NR_clock_nanosleep
+static __inline__ _syscall4(long, __syscall_clock_nanosleep,
+                           clockid_t, clock_id, int, flags,
+                           const struct timespec *, req,
+                           struct timespec *, rem);
+
+long clock_nanosleep(clockid_t clock_id, int flags,
+                   const struct timespec *req,
+                   struct timespec *rem)
+{
+       return __syscall_clock_nanosleep(clock_id, flags, req, rem);
+}
+
+#endif


I don't know if this patch is good enough, so I am open to any comment
about it.

Regards,
 
Jean-Christian de Rivaz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uClibc-0.9.30.1-add-clock-nanosleep.patch
Type: text/x-diff
Size: 721 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20100303/f64ca7a7/attachment.bin>


More information about the uClibc mailing list