mirror of
https://sourceware.org/git/glibc.git
synced 2026-01-06 11:51:29 +03:00
* sysdeps/posix/sysconf.c (__sysconf): Use #if _POSIX_FOO > 0
rather than #ifdef _POSIX_FOO for options. We should return -1 at runtime for an option defined to 0 at compile time. * sysdeps/mach/hurd/bits/posix_opt.h: Define many missing options, many to -1 or 0. 2006-03-05 Roland McGrath <roland@redhat.com> * sysdeps/unix/sysv/linux/sysconf.c (__sysconf) [__NR_clock_getres || HP_TIMING_AVAIL]: Handle _SC_CPUTIME, _SC_THREAD_CPUTIME.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/* Get file-specific information about a file. Linux version.
|
||||
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@@ -48,6 +48,28 @@ __sysconf (int name)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined __NR_clock_getres || HP_TIMING_AVAIL
|
||||
case _SC_CPUTIME:
|
||||
case _SC_THREAD_CPUTIME:
|
||||
{
|
||||
/* If we have HP_TIMING, we will fall back on that if the system
|
||||
call does not work, so we support it either way. */
|
||||
# if !HP_TIMING_AVAIL
|
||||
/* Check using the clock_getres system call. */
|
||||
struct timespec ts;
|
||||
INTERNAL_SYSCALL_DECL (err);
|
||||
int r = INTERNAL_SYSCALL (clock_getres, err, 2,
|
||||
(name == _SC_CPUTIME
|
||||
? CLOCK_PROCESS_CPUTIME_ID
|
||||
: CLOCK_THREAD_CPUTIME_ID),
|
||||
&ts);
|
||||
if (INTERNAL_SYSCALL_ERROR_P (r, err))
|
||||
return -1;
|
||||
# endif
|
||||
return _POSIX_VERSION;
|
||||
}
|
||||
#endif
|
||||
|
||||
case _SC_NGROUPS_MAX:
|
||||
/* Try to read the information from the /proc/sys/kernel/ngroups_max
|
||||
file. */
|
||||
|
||||
Reference in New Issue
Block a user