From b3ae0650bcff54f12d87f878000d4c488b365bf7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 13 Apr 2000 03:55:50 +0000 Subject: Update. * posix/getconf.c: Add support for many more POSIX options. * sysdeps/posix/sysconf.c: Likewise. * sysdeps/generic/bits/confname.h: Add many more POSIX options. * sysdeps/mach/hurd/bits/posix_opt.h: Add _POSIX_REGEXP and _POSIX_SHELL. * sysdeps/unix/sysv/linux/bits/posix_opt.h: Likewise. * sysdeps/unix/sysv/linux/i386/bits/time.h: Rename __CLOCK_HIGHRES to CLOCK_PROCESS_CPUTIME_ID. Add define CLOCK_MONOTONIC and CLOCK_THREAD_CPUTIME_ID. * sysdeps/unix/i386/clock_getcpuclockid.c: Set *clock_id to CLOCK_PROCESS_CPUTIME_ID. * sysdeps/unix/i386/i586/clock_getres.c: Change for renaming of __CLOCK_HIGHRES to CLOCK_PROCESS_CPUTIME_ID. Handle CLOCK_THREAD_CPUTIME_ID and CLOCK_MONOTONIC the same. * sysdeps/unix/i386/i586/clock_gettime.c: Likewise. --- sysdeps/generic/bits/confname.h | 89 +++++++++- sysdeps/mach/hurd/bits/posix_opt.h | 8 +- sysdeps/posix/sysconf.c | 271 +++++++++++++++++++++++++++++++ sysdeps/unix/i386/clock_getcpuclockid.c | 2 +- sysdeps/unix/i386/i586/clock_getres.c | 10 +- sysdeps/unix/i386/i586/clock_gettime.c | 10 +- sysdeps/unix/sysv/linux/bits/posix_opt.h | 6 + sysdeps/unix/sysv/linux/i386/bits/time.h | 10 +- 8 files changed, 395 insertions(+), 11 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h index 229088d67d..3c4dbdb98c 100644 --- a/sysdeps/generic/bits/confname.h +++ b/sysdeps/generic/bits/confname.h @@ -1,5 +1,5 @@ /* `sysconf', `pathconf', and `confstr' NAME values. Generic version. - Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1993, 1995-1998, 2000 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 @@ -335,8 +335,93 @@ enum #define _SC_XOPEN_LEGACY _SC_XOPEN_LEGACY _SC_XOPEN_REALTIME, #define _SC_XOPEN_REALTIME _SC_XOPEN_REALTIME - _SC_XOPEN_REALTIME_THREADS + _SC_XOPEN_REALTIME_THREADS, #define _SC_XOPEN_REALTIME_THREADS _SC_XOPEN_REALTIME_THREADS + + _SC_ADVISORY_INFO, +#define _SC_ADVISORY_INFO _SC_ADVISORY_INFO + _SC_BARRIERS, +#define _SC_BARRIERS _SC_BARRIERS + _SC_BASE, +#define _SC_BASE _SC_BASE + _SC_C_LANG_SUPPORT, +#define _SC_C_LANG_SUPPORT _SC_C_LANG_SUPPORT + _SC_C_LANG_SUPPORT_R, +#define _SC_C_LANG_SUPPORT_R _SC_C_LANG_SUPPORT_R + _SC_CLOCK_SELECTION, +#define _SC_CLOCK_SELECTION _SC_CLOCK_SELECTION + _SC_CPUTIME, +#define _SC_CPUTIME _SC_CPUTIME + _SC_THREAD_CPUTIME, +#define _SC_THREAD_CPUTIME _SC_THREAD_CPUTIME + _SC_DEVICE_IO, +#define _SC_DEVICE_IO _SC_DEVICE_IO + _SC_DEVICE_SPECIFIC, +#define _SC_DEVICE_SPECIFIC _SC_DEVICE_SPECIFIC + _SC_DEVICE_SPECIFIC_R, +#define _SC_DEVICE_SPECIFIC_R _SC_DEVICE_SPECIFIC_R + _SC_FD_MGMT, +#define _SC_FD_MGMT _SC_FD_MGMT + _SC_FIFO, +#define _SC_FIFO _SC_FIFO + _SC_PIPE, +#define _SC_PIPE _SC_PIPE + _SC_FILE_ATTRIBUTES, +#define _SC_FILE_ATTRIBUTES _SC_FILE_ATTRIBUTES + _SC_FILE_LOCKING, +#define _SC_FILE_LOCKING _SC_FILE_LOCKING + _SC_FILE_SYSTEM, +#define _SC_FILE_SYSTEM _SC_FILE_SYSTEM + _SC_MONOTONIC_CLOCK, +#define _SC_MONOTONIC_CLOCK _SC_MONOTONIC_CLOCK + _SC_MULTIPLE_PROCESS, +#define _SC_MULTIPLE_PROCESS _SC_MULTIPLE_PROCESS + _SC_SINGLE_PROCESS, +#define _SC_SINGLE_PROCESS _SC_SINGLE_PROCESS + _SC_NETWORKING, +#define _SC_NETWORKING _SC_NETWORKING + _SC_READER_WRITER_LOCKS, +#define _SC_READER_WRITER_LOCKS _SC_READER_WRITER_LOCKS + _SC_SPIN_LOCKS, +#define _SC_SPIN_LOCKS _SC_SPIN_LOCKS + _SC_REGEXP, +#define _SC_REGEXP _SC_REGEXP + _SC_REGEX_VERSION, +#define _SC_REGEX_VERSION _SC_REGEX_VERSION + _SC_SHELL, +#define _SC_SHELL _SC_SHELL + _SC_SIGNALS, +#define _SC_SIGNALS _SC_SIGNALS + _SC_SPAWN, +#define _SC_SPAWN _SC_SPAWN + _SC_SPORADIC_SERVER, +#define _SC_SPORADIC_SERVER _SC_SPORADIC_SERVER + _SC_THREAD_SPORADIC_SERVER, +#define _SC_THREAD_SPORADIC_SERVER _SC_THREAD_SPORADIC_SERVER + _SC_SYSTEM_DATABASE, +#define _SC_SYSTEM_DATABASE _SC_SYSTEM_DATABASE + _SC_SYSTEM_DATABASE_R, +#define _SC_SYSTEM_DATABASE_R _SC_SYSTEM_DATABASE_R + _SC_TIMEOUTS, +#define _SC_TIMEOUTS _SC_TIMEOUTS + _SC_TYPED_MEMORY_OBJECTS, +#define _SC_TYPED_MEMORY_OBJECTS _SC_TYPED_MEMORY_OBJECTS + _SC_USER_GROUPS, +#define _SC_USER_GROUPS _SC_USER_GROUPS + _SC_USER_GROUPS_R, +#define _SC_USER_GROUPS_R _SC_USER_GROUPS_R + _SC_PBS, +#define _SC_PBS _SC_PBS + _SC_PBS_ACCOUNTING, +#define _SC_PBS_ACCOUNTING _SC_PBS_ACCOUNTING + _SC_PBS_LOCATE, +#define _SC_PBS_LOCATE _SC_PBS_LOCATE + _SC_PBS_MESSAGE, +#define _SC_PBS_MESSAGE _SC_PBS_MESSAGE + _SC_PBS_TRACK, +#define _SC_PBS_TRACK _SC_PBS_TRACK + _SC_SYMLOOP, +#define _SC_SYMLOOP _SC_SYMLOOP }; #if (defined __USE_POSIX2 || defined __USE_UNIX98 \ diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h index 09eb5c1973..818df1f94d 100644 --- a/sysdeps/mach/hurd/bits/posix_opt.h +++ b/sysdeps/mach/hurd/bits/posix_opt.h @@ -1,5 +1,5 @@ /* Define POSIX options for GNU/Hurd. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2000 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 @@ -60,5 +60,11 @@ #undef _POSIX_NO_TRUNC /* Overlong file names get error? */ #undef _POSIX_SYNC_IO /* File supports O_SYNC et al? */ +/* GNU libc provides regular expression handling. */ +#define _POSIX_REGEXP 1 + +/* We have a POSIX shell. */ +#define _POSIX_SHELL 1 + #endif /* bits/posix_opt.h */ diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c index e3177d0155..0f6006cdaf 100644 --- a/sysdeps/posix/sysconf.c +++ b/sysdeps/posix/sysconf.c @@ -817,6 +817,277 @@ __sysconf (name) #else return -1; #endif + + case _SC_ADVISORY_INFO: +#ifdef _POSIX_ADVISORY_INFO + return _POSIX_ADVISORY_INFO; +#else + return -1; +#endif + + case _SC_BARRIERS: +#ifdef _POSIX_BARRIERS + return _POSIX_BARRIERS; +#else + return -1; +#endif + + case _SC_BASE: +#ifdef _POSIX_BASE + return _POSIX_BASE; +#else + return -1; +#endif + case _SC_C_LANG_SUPPORT: +#ifdef _POSIX_C_LANG_SUPPORT + return _POSIX_C_LANG_SUPPORT; +#else + return -1; +#endif + case _SC_C_LANG_SUPPORT_R: +#ifdef _POSIX_C_LANG_SUPPORT_R + return _POSIX_C_LANG_SUPPORT_R; +#else + return -1; +#endif + + case _SC_CLOCK_SELECTION: +#ifdef _POSIX_CLOCK_SELECTION + return _POSIX_CLOCK_SELECTION; +#else + return -1; +#endif + + case _SC_CPUTIME: +#ifdef _POSIX_CPUTIME + return _POSIX_CPUTIME; +#else + return -1; +#endif + + case _SC_DEVICE_IO: +#ifdef _POSIX_DEVICE_IO + return _POSIX_DEVICE_IO; +#else + return -1; +#endif + case _SC_DEVICE_SPECIFIC: +#ifdef _POSIX_DEVICE_SPCIFIC + return _POSIX_DEVICE_SPECIFIC; +#else + return -1; +#endif + case _SC_DEVICE_SPECIFIC_R: +#ifdef _POSIX_DEVICE_SPCIFIC_R + return _POSIX_DEVICE_SPECIFIC_R; +#else + return -1; +#endif + + case _SC_FD_MGMT: +#ifdef _POSIX_FD_MGMT + return _POSIX_FD_MGMT; +#else + return -1; +#endif + + case _SC_FIFO: +#ifdef _POSIX_FIFO + return _POSIX_FIFO; +#else + return -1; +#endif + case _SC_PIPE: +#ifdef _POSIX_PIPE + return _POSIX_PIPE; +#else + return -1; +#endif + + case _SC_FILE_ATTRIBUTES: +#ifdef _POSIX_FILE_ATTRIBUTES + return _POSIX_FILE_ATTRIBUTES; +#else + return -1; +#endif + case _SC_FILE_LOCKING: +#ifdef _POSIX_FILE_LOCKING + return _POSIX_FILE_LOCKING; +#else + return -1; +#endif + case _SC_FILE_SYSTEM: +#ifdef _POSIX_FILE_SYSTEM + return _POSIX_FILE_SYSTEM; +#else + return -1; +#endif + + case _SC_MONOTONIC_CLOCK: +#ifdef _POSIX_MONOTONIC_CLOCK + return _POSIX_MONOTONIC_CLOCK; +#else + return -1; +#endif + + case _SC_MULTIPLE_PROCESS: +#ifdef _POSIX_MULTIPLE_PROCESS + return _POSIX_MULTIPLE_PROCESS; +#else + return -1; +#endif + case _SC_SINGLE_PROCESS: +#ifdef _POSIX_SINGLE_PROCESS + return _POSIX_SINGLE_PROCESS; +#else + return -1; +#endif + + case _SC_NETWORKING: +#ifdef _POSIX_NETWORKING + return _POSIX_NETWORKING; +#else + return -1; +#endif + + case _SC_READER_WRITER_LOCKS: +#ifdef _POSIX_READER_WRITER_LOCKS + return _POSIX_READER_WRITER_LOCKS; +#else + return -1; +#endif + case _SC_SPIN_LOCKS: +#ifdef _POSIX_SPIN_LOCKS + return _POSIX_SPIN_LOCKS; +#else + return -1; +#endif + + case _SC_REGEXP: +#ifdef _POSIX_REGEXP + return _POSIX_REGEXP; +#else + return -1; +#endif + case _SC_REGEX_VERSION: +#ifdef _POSIX_REGEX_VERSION + return _POSIX_REGEX_VERSION; +#else + return -1; +#endif + + case _SC_SHELL: +#ifdef _POSIX_SHELL + return _POSIX_SHELL; +#else + return -1; +#endif + + case _SC_SIGNALS: +#ifdef _POSUX_SIGNALS + return _POSIX_SIGNALS; +#else + return -1; +#endif + + case _SC_SPAWN: +#ifdef _POSIX_SPAWN + return _POSIX_SPAWN; +#else + return -1; +#endif + + case _SC_SPORADIC_SERVER: +#ifdef _POSIX_SPORADIC_SERVER + return _POSIX_SPORADIC_SERVER; +#else + return -1; +#endif + case _SC_THREAD_SPORADIC_SERVER: +#ifdef _POSIX_THREAD_SPORADIC_SERVER + return _POSIX_THREAD_SPORADIC_SERVER; +#else + return -1; +#endif + + case _SC_SYSTEM_DATABASE: +#ifdef _POSIX_SYSTEM_DATABASE + return _POSIX_SYSTEM_DATABASE; +#else + return -1; +#endif + case _SC_SYSTEM_DATABASE_R: +#ifdef _POSIX_SYSTEM_DATABASE_R + return _POSIX_SYSTEM_DATABASE_R; +#else + return -1; +#endif + + case _SC_THREAD_CPUTIME: +#ifdef _POSIX_THREAD_CPUTIME + return _POSIX_THREAD_CPUTIME; +#else + return -1; +#endif + + case _SC_TIMEOUTS: +#ifdef _POSIX_TIMEOUTS + return _POSIX_TIMEOUTS; +#else + return -1; +#endif + + case _SC_TYPED_MEMORY_OBJECTS: +#ifdef _POSIX_TYPED_MEMORY_OBJECTS + return _POSIX_TYPED_MEMORY_OBJECTS; +#else + return -1; +#endif + + case _SC_USER_GROUPS: +#ifdef _POSIX_USER_GROUPS + return _POSIX_USER_GROUPS; +#else + return -1; +#endif + case _SC_USER_GROUPS_R: +#ifdef _POSIX_USER_GROUPS_R + return _POSIX_USER_GROUPS_R; +#else + return -1; +#endif + + case _SC_PBS: +#ifdef _POSIX2_PBS + return _POSIX2_PBS; +#else + return -1; +#endif + case _SC_PBS_ACCOUNTING: +#ifdef _POSIX2_PBS_ACCOUNTING + return _POSIX2_PBS_ACCOUNTING; +#else + return -1; +#endif + case _SC_PBS_LOCATE: +#ifdef _POSIX2_PBS_LOCATE + return _POSIX2_PBS_LOCATE; +#else + return -1; +#endif + case _SC_PBS_TRACK: +#ifdef _POSIX2_PBS_TRACK + return _POSIX2_PBS_TRACK; +#else + return -1; +#endif + + case _SC_SYMLOOP: +#ifdef SYMLOOP_MAX + return SYMLOOP_MAX; +#else + return -1; +#endif } } diff --git a/sysdeps/unix/i386/clock_getcpuclockid.c b/sysdeps/unix/i386/clock_getcpuclockid.c index 1fd8ad9044..cdd662c838 100644 --- a/sysdeps/unix/i386/clock_getcpuclockid.c +++ b/sysdeps/unix/i386/clock_getcpuclockid.c @@ -28,7 +28,7 @@ clock_getcpuclockid (pid_t pid, clockid_t *clock_id) return EPERM; /* Store the number. */ - *clock_id = __CLOCK_HIGHRES; + *clock_id = CLOCK_PROCESS_CPUTIME_ID; return 0; } diff --git a/sysdeps/unix/i386/i586/clock_getres.c b/sysdeps/unix/i386/i586/clock_getres.c index dacf7f49d3..2ea21a0f8e 100644 --- a/sysdeps/unix/i386/i586/clock_getres.c +++ b/sysdeps/unix/i386/i586/clock_getres.c @@ -39,9 +39,15 @@ static long int nsec; /* We add an limitation here: we assume that the machine is not up as long as it takes to wrap-around the 64-bit timestamp counter. On a 4GHz machine it would take 136 years of uptime to wrap around so - this "limitation" is not severe. */ + this "limitation" is not severe. + + We use this clock also as the monotonic clock since we don't allow + setting the CPU-time clock. If this should ever change we will have + to separate the two. */ #define EXTRA_CLOCK_CASES \ - case __CLOCK_HIGHRES: \ + case CLOCK_PROCESS_CPUTIME_ID: \ + case CLOCK_THREAD_CPUTIME_ID: \ + case CLOCK_MONOTONIC: \ { \ if (__builtin_expect (nsec == 0, 0)) \ { \ diff --git a/sysdeps/unix/i386/i586/clock_gettime.c b/sysdeps/unix/i386/i586/clock_gettime.c index 5163d877c6..38f7c4ab15 100644 --- a/sysdeps/unix/i386/i586/clock_gettime.c +++ b/sysdeps/unix/i386/i586/clock_gettime.c @@ -38,9 +38,15 @@ static unsigned long long int freq; /* We add an limitation here: we assume that the machine is not up as long as it takes to wrap-around the 64-bit timestamp counter. On a 4GHz machine it would take 136 years of uptime to wrap around so - this "limitation" is not severe. */ + this "limitation" is not severe. + + We use this clock also as the monotonic clock since we don't allow + setting the CPU-time clock. If this should ever change we will have + to separate the two. */ #define EXTRA_CLOCK_CASES \ - case __CLOCK_HIGHRES: \ + case CLOCK_PROCESS_CPUTIME_ID: \ + case CLOCK_THREAD_CPUTIME_ID: \ + case CLOCK_MONOTONIC: \ { \ unsigned long long int tsc; \ \ diff --git a/sysdeps/unix/sysv/linux/bits/posix_opt.h b/sysdeps/unix/sysv/linux/bits/posix_opt.h index 558140b9cc..ae83e24155 100644 --- a/sysdeps/unix/sysv/linux/bits/posix_opt.h +++ b/sysdeps/unix/sysv/linux/bits/posix_opt.h @@ -87,4 +87,10 @@ /* POSIX shared memory objects are implemented. */ #define _POSIX_SHARED_MEMORY_OBJECTS 1 +/* GNU libc provides regular expression handling. */ +#define _POSIX_REGEXP 1 + +/* We have a POSIX shell. */ +#define _POSIX_SHELL 1 + #endif /* bits/posix_opt.h */ diff --git a/sysdeps/unix/sysv/linux/i386/bits/time.h b/sysdeps/unix/sysv/linux/i386/bits/time.h index dfd3afac11..fd143634e5 100644 --- a/sysdeps/unix/sysv/linux/i386/bits/time.h +++ b/sysdeps/unix/sysv/linux/i386/bits/time.h @@ -47,12 +47,16 @@ typedef int __timer_t; # ifdef __USE_POSIX199309 /* Identifier for system-wide realtime clock. */ -# define CLOCK_REALTIME 0 +# define CLOCK_REALTIME 0 +/* Monotonic clock. */ +# define CLOCK_MONOTONIC 1 /* High-resolution timer from the CPU. */ -# define __CLOCK_HIGHRES 1 +# define CLOCK_PROCESS_CPUTIME_ID 2 +/* Thread-specific CPU-time clock. */ +# define CLOCK_THREAD_CPUTIME_ID 3 /* Flag to indicate time is absolute. */ -# define TIMER_ABSTIME 1 +# define TIMER_ABSTIME 1 # endif # endif /* bits/time.h */ -- cgit 1.4.1