From a202cf6f119f41532b60ad28bc48746b535fd34c Mon Sep 17 00:00:00 2001 From: Austin Foxley Date: Sat, 17 Oct 2009 14:42:01 -0700 Subject: librt additions that are now possible with nptl * clock_getcpuclockid, clock_gettime, clock_nanosleep, mq_receive, mq_send, mq_timedreceive, mq_timedsend, _SC_MONOTONIC_CLOCK Signed-off-by: Austin Foxley --- libc/unistd/sysconf.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'libc/unistd') diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c index 87206648e..b3eb12021 100644 --- a/libc/unistd/sysconf.c +++ b/libc/unistd/sysconf.c @@ -33,6 +33,9 @@ #ifdef __UCLIBC_HAS_REGEX__ #include #endif +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +#include +#endif #ifdef HAVE_LINUX_CPUMASK_H # include @@ -881,13 +884,32 @@ long int sysconf(int name) #endif case _SC_MONOTONIC_CLOCK: -#if defined __UCLIBC_HAS_REALTIME__ && defined __NR_clock_getres - /* Check using the clock_getres system call. */ +#ifdef __NR_clock_getres + /* Check using the clock_getres system call. */ +# ifdef __UCLIBC_HAS_THREADS_NATIVE__ + { + struct timespec ts; + INTERNAL_SYSCALL_DECL (err); + int r; + r = INTERNAL_SYSCALL (clock_getres, err, 2, CLOCK_MONOTONIC, &ts); + return INTERNAL_SYSCALL_ERROR_P (r, err) ? -1 : _POSIX_VERSION; + } +# else if (clock_getres(CLOCK_MONOTONIC, NULL) >= 0) return _POSIX_VERSION; + + RETURN_NEG_1; +# endif #endif +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + case _SC_THREAD_CPUTIME: +# if _POSIX_THREAD_CPUTIME > 0 + return _POSIX_THREAD_CPUTIME; +# else RETURN_NEG_1; +# endif +#endif } } libc_hidden_def(sysconf) -- cgit v1.2.3