[git commit future 1/1] sysconf.c: the clock_getres function is good for NPTL as well
Bernhard Reutner-Fischer
rep.dot.nop at gmail.com
Thu Mar 24 19:59:36 UTC 2011
On Sat, Mar 19, 2011 at 11:51:25AM -0700, Khem Raj wrote:
>
>commit: http://git.uclibc.org/uClibc/commit/?id=0fd8c2345dd601d8c139291001df531f2517b491
>branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future
>
>Even if glibc reuses the syscall (bloat), we can reuse the function.
>Make sure, that we use it only if it is provided by the syscall
>and the function is really around (UCLIBC_HAS_REALTIME disables it),
>else we get into a loop.
>
>Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
>---
> libc/unistd/sysconf.c | 15 +++------------
> 1 files changed, 3 insertions(+), 12 deletions(-)
>
>diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c
>index 2859ddd..b9aacff 100644
>--- a/libc/unistd/sysconf.c
>+++ b/libc/unistd/sysconf.c
>@@ -984,22 +984,13 @@ long int sysconf(int name)
> #endif
>
> case _SC_MONOTONIC_CLOCK:
>-#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 defined __UCLIBC_HAS_REALTIME__ && defined __NR_clock_getres
> if (clock_getres(CLOCK_MONOTONIC, NULL) >= 0)
> return _POSIX_VERSION;
>
> RETURN_NEG_1;
>-# endif
>+#else
>+ RETURN_NEG_1;
nitpick: just NEG_1 once.
i.e.
case _SC_MONOTONIC_CLOCK:
#if defined __UCLIBC_HAS_REALTIME__ && defined __NR_clock_getres
if (clock_getres(CLOCK_MONOTONIC, NULL) >= 0)
return _POSIX_VERSION;
# endif
RETURN_NEG_1;
> #endif
>
> #ifdef __UCLIBC_HAS_THREADS_NATIVE__
More information about the uClibc-cvs
mailing list