This patch, written by Nathan Sidwell, implements clock_nanosleep. Ok?
Bernd
Index: include/time.h
===================================================================
--- include/time.h (revision 307155)
+++ include/time.h (revision 307156)
@@ -349,9 +349,8 @@ extern int clock_gettime (clockid_t __cl
extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
__THROW;
#endif /* __UCLIBC_HAS_REALTIME__ */
-#ifdef __UCLIBC_MJN3_ONLY__
-#warning "mjn3 FIXME: a bunch of unimplemented function prototypes."
-# if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__
+
+#if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__
/* High-resolution sleep with the specified clock.
This function is a cancellation point and therefore not marked with
@@ -362,8 +361,7 @@ extern int clock_nanosleep (clockid_t __
/* Return clock ID for CPU-time clock. */
extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW;
-# endif
-#endif /* __UCLIBC_MJN3_ONLY__ */
+#endif
# if defined __UCLIBC_HAS_REALTIME__
/* Create new per-process timer using CLOCK_ID. */
Index: libc/sysdeps/linux/common/clock_nanosleep.c
===================================================================
--- libc/sysdeps/linux/common/clock_nanosleep.c (revision 0)
+++ libc/sysdeps/linux/common/clock_nanosleep.c (revision 307156)
@@ -0,0 +1,24 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * clock_nanosleep() for uClibc
+ *
+ * Copyright (C) 2010 Nathan Sidwell <[email protected]>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+#include <time.h>
+
+#if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__ \
+ && defined __NR_clock_nanosleep
+
+extern __typeof(clock_nanosleep) __libc_clock_nanosleep;
+#define __NR___libc_clock_nanosleep __NR_clock_nanosleep
+_syscall4(int, __libc_clock_nanosleep,
+ clockid_t, clock_id, int, flags,
+ const struct timespec *, req, struct timespec *, rem)
+libc_hidden_proto(clock_nanosleep)
+weak_alias(__libc_clock_nanosleep,clock_nanosleep)
+libc_hidden_weak(clock_nanosleep)
+#endif
Index: libc/sysdeps/linux/common/Makefile.in
===================================================================
--- libc/sysdeps/linux/common/Makefile.in (revision 307155)
+++ libc/sysdeps/linux/common/Makefile.in (revision 307156)
@@ -52,7 +52,7 @@ endif
ifneq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
#
clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typed_mem_get_info|pthread_mutex_timedlock|sem_timedwait
-CSRC := $(filter-out posix_fadvise64.c posix_fadvise.c,$(CSRC))
+CSRC := $(filter-out posix_fadvise64.c posix_fadvise.c
clock_nanosleep.c,$(CSRC))
endif
ifneq ($(UCLIBC_HAS_EPOLL),y)
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc