diff options
Diffstat (limited to 'libc/unistd/sysconf.c')
-rw-r--r-- | libc/unistd/sysconf.c | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c index 430759889..c02a25440 100644 --- a/libc/unistd/sysconf.c +++ b/libc/unistd/sysconf.c @@ -1,4 +1,3 @@ -/* vi: set sw=4 ts=4: */ /* Copyright (C) 1991, 93, 95, 96, 97, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -85,26 +84,6 @@ long int sysconf(int name) __set_errno(EINVAL); return -1; -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -# ifdef __NR_clock_getres - case _SC_MONOTONIC_CLOCK: - /* Check using the clock_getres system call. */ - { - 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; - } -# endif - case _SC_THREAD_CPUTIME: -# ifdef _POSIX_THREAD_CPUTIME > 0 - return _POSIX_THREAD_CPUTIME; -# else - return -1; -# endif -#endif - case _SC_ARG_MAX: #ifdef ARG_MAX return ARG_MAX; @@ -907,6 +886,34 @@ long int sysconf(int name) #else RETURN_NEG_1; #endif + +#ifdef __NR_clock_getres + case _SC_MONOTONIC_CLOCK: + /* 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: +# ifdef _POSIX_THREAD_CPUTIME > 0 + return _POSIX_THREAD_CPUTIME; +# else + RETURN_NEG_1; +# endif +#endif } } libc_hidden_def(sysconf) |