diff options
| author | Joseph Myers <joseph@codesourcery.com> | 2012-08-16 14:03:43 +0000 |
|---|---|---|
| committer | Joseph Myers <joseph@codesourcery.com> | 2012-08-16 14:03:43 +0000 |
| commit | 93a78ac437ba44f493333d7e2a4b0249839ce460 (patch) | |
| tree | be93f2f5a76313d6decc7ccca7623671e23c7974 | |
| parent | 4b4f2771c217d7b038bcfc17c985ba057da554db (diff) | |
| download | glibc-93a78ac437ba44f493333d7e2a4b0249839ce460.tar.xz glibc-93a78ac437ba44f493333d7e2a4b0249839ce460.zip | |
Remove __ASSUME_POSIX_TIMERS.
20 files changed, 326 insertions, 865 deletions
@@ -1,3 +1,24 @@ +2012-08-16 Joseph Myers <joseph@codesourcery.com> + + * sysdeps/unix/sysv/linux/kernel-features.h + (__ASSUME_POSIX_TIMERS): Remove. + * sysdeps/unix/sysv/linux/clock_getcpuclockid.c + [!__ASSUME_POSIX_TIMERS]: Remove conditional code. + * sysdeps/unix/sysv/linux/clock_getres.c [__ASSUME_POSIX_TIMERS]: + Make code unconditional. + [!__ASSUME_POSIX_TIMERS]: Remove conditional code. + * sysdeps/unix/sysv/linux/clock_gettime.c [__ASSUME_POSIX_TIMERS]: + Make code unconditional. + [!__ASSUME_POSIX_TIMERS]: Remove conditional code. + * sysdeps/unix/sysv/linux/clock_nanosleep.c + [__ASSUME_POSIX_TIMERS]: Make code unconditional. + [!__ASSUME_POSIX_TIMERS]: Remove conditional code. + * sysdeps/unix/sysv/linux/clock_settime.c [__ASSUME_POSIX_TIMERS]: + Make code unconditional. + [!__ASSUME_POSIX_TIMERS]: Remove conditional code. + [__ASSUME_POSIX_CPU_TIMERS <= 0 && __NR_clock_settime] + (__libc_missing_posix_timers): Remove. + 2012-08-15 Roland McGrath <roland@hack.frob.com> * elf/dl-load.c (_dl_map_object_from_fd) [SHARED]: Conditionalize diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 545b2c2152..6f5527242d 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,42 @@ +2012-08-16 Joseph Myers <joseph@codesourcery.com> + + * pthread_cond_timedwait.c (__pthread_cond_timedwait) + [!__ASSUME_POSIX_TIMERS]: Remove conditional code. + * pthread_condattr_setclock.c (pthread_condattr_setclock) + [!__ASSUME_POSIX_TIMERS]: Likewise. + * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S + (__pthread_cond_timedwait) [!__ASSUME_POSIX_TIMERS]: Likewise. + * sysdeps/unix/sysv/linux/pthread_getcpuclockid.c + [!__ASSUME_POSIX_TIMERS]: Likewise. + * sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S + (__pthread_cond_timedwait) [!__ASSUME_POSIX_TIMERS]: Likewise. + * sysdeps/unix/sysv/linux/timer_create.c [__NR_timer_create]: Make + code unconditional. + [!__NR-timer_create]: Remove conditional code. + (timer_create) [!__ASSUME_POSIX_TIMERS]: Likewise. + * sysdeps/unix/sysv/linux/timer_delete.c [__NR_timer_delete]: Make + code unconditional. + [!__NR_timer_delete]: Remove conditional code. + (timer_delete) [!__ASSUME_POSIX_TIMERS]: Likewise. + * sysdeps/unix/sysv/linux/timer_getoverr.c + [__NR_timer_getoverrun]: Make code unconditional. + [!__NR_timer_getoverrun]: Remove conditional code. + (timer_getoverrun) [!__ASSUME_POSIX_TIMERS]: Likewise. + * sysdeps/unix/sysv/linux/timer_gettime.c [__NR_timer_gettime]: + Make code unconditional. + [!__NR_timer_gettime]: Remove conditional code. + (timer_gettime) [!__ASSUME_POSIX_TIMERS]: Likewise. + * sysdeps/unix/sysv/linux/timer_routines.c [__NR_timer_create]: + Make code unconditional. + [!__ASSUME_POSIX_TIMERS]: Remove conditional code. + * sysdeps/unix/sysv/linux/timer_settime.c [__NR_timer_settime]: + Make code unconditional. + [!__NR_timer_settime]: Remove conditional code. + (timer_settime) [!__ASSUME_POSIX_TIMERS]: Likewise. + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S + (__pthread_cond_timedwait) [!__ASSUME_POSIX_TIMERS]: Remove + conditional code. + 2012-08-15 Tom de Vries <vries@codesourcery.com> Maxim Kuvyrkov <maxim@codesourcery.com> diff --git a/nptl/pthread_cond_timedwait.c b/nptl/pthread_cond_timedwait.c index 9605cd74cc..51a34ba4f2 100644 --- a/nptl/pthread_cond_timedwait.c +++ b/nptl/pthread_cond_timedwait.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003,2004,2007,2010,2011 Free Software Foundation, Inc. +/* Copyright (C) 2003-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003. @@ -113,23 +113,9 @@ __pthread_cond_timedwait (cond, mutex, abstime) (cond->__data.__nwaiters & ((1 << COND_NWAITERS_SHIFT) - 1)), &rt); -# ifndef __ASSUME_POSIX_TIMERS - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (ret, err), 0)) - { - struct timeval tv; - (void) gettimeofday (&tv, NULL); - - /* Convert the absolute timeout value to a relative timeout. */ - rt.tv_sec = abstime->tv_sec - tv.tv_sec; - rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000; - } - else -# endif - { - /* Convert the absolute timeout value to a relative timeout. */ - rt.tv_sec = abstime->tv_sec - rt.tv_sec; - rt.tv_nsec = abstime->tv_nsec - rt.tv_nsec; - } + /* Convert the absolute timeout value to a relative timeout. */ + rt.tv_sec = abstime->tv_sec - rt.tv_sec; + rt.tv_nsec = abstime->tv_nsec - rt.tv_nsec; #else /* Get the current time. So far we support only one clock. */ struct timeval tv; diff --git a/nptl/pthread_condattr_setclock.c b/nptl/pthread_condattr_setclock.c index a3030e227a..8b05dc84e9 100644 --- a/nptl/pthread_condattr_setclock.c +++ b/nptl/pthread_condattr_setclock.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004, 2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2003-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -30,32 +30,8 @@ pthread_condattr_setclock (attr, clock_id) pthread_condattr_t *attr; clockid_t clock_id; { - /* Only a few clocks are allowed. CLOCK_REALTIME is always allowed. - CLOCK_MONOTONIC only if the kernel has the necessary support. */ - if (clock_id == CLOCK_MONOTONIC) - { -#ifndef __ASSUME_POSIX_TIMERS -# ifdef __NR_clock_getres - /* Check whether the clock is available. */ - static int avail; - - if (avail == 0) - { - struct timespec ts; - - INTERNAL_SYSCALL_DECL (err); - int val; - val = INTERNAL_SYSCALL (clock_getres, err, 2, CLOCK_MONOTONIC, &ts); - avail = INTERNAL_SYSCALL_ERROR_P (val, err) ? -1 : 1; - } - - if (avail < 0) -# endif - /* Not available. */ - return EINVAL; -#endif - } - else if (clock_id != CLOCK_REALTIME) + /* Only a few clocks are allowed. */ + if (clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_REALTIME) /* If more clocks are allowed some day the storing of the clock ID in the pthread_cond_t structure needs to be adjusted. */ return EINVAL; diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S index 8170ab321b..5f1fd5ddc6 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S @@ -122,10 +122,6 @@ __pthread_cond_timedwait: leal 4(%esp), %ecx movl $__NR_clock_gettime, %eax ENTER_KERNEL -# ifndef __ASSUME_POSIX_TIMERS - cmpl $-ENOSYS, %eax - je 19f -# endif movl %edx, %ebx /* Compute relative timeout. */ @@ -482,30 +478,6 @@ __pthread_cond_timedwait: call __lll_unlock_wake jmp 11b -#if defined __NR_clock_gettime && !defined __ASSUME_POSIX_TIMERS - /* clock_gettime not available. */ -19: leal 4(%esp), %ebx - xorl %ecx, %ecx - movl $__NR_gettimeofday, %eax - ENTER_KERNEL - movl %edx, %ebx - - /* Compute relative timeout. */ - movl 8(%esp), %eax - movl $1000, %edx - mul %edx /* Milli seconds to nano seconds. */ - movl (%ebp), %ecx - movl 4(%ebp), %edx - subl 4(%esp), %ecx - subl %eax, %edx - jns 20f - addl $1000000000, %edx - subl $1, %ecx -20: testl %ecx, %ecx - movl $-ETIMEDOUT, %esi - js 6b - jmp 21b -#endif .size __pthread_cond_timedwait, .-__pthread_cond_timedwait versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, GLIBC_2_3_2) diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c b/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c index 909f4686c6..7d7287b4b8 100644 --- a/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c +++ b/nptl/sysdeps/unix/sysv/linux/pthread_getcpuclockid.c @@ -1,5 +1,5 @@ /* pthread_getcpuclockid -- Get POSIX clockid_t for a pthread_t. Linux version - Copyright (C) 2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc. + Copyright (C) 2000-2012 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 @@ -27,9 +27,6 @@ #if !(__ASSUME_POSIX_CPU_TIMERS > 0) int __libc_missing_posix_cpu_timers attribute_hidden; #endif -#if !(__ASSUME_POSIX_TIMERS > 0) -int __libc_missing_posix_timers attribute_hidden; -#endif int pthread_getcpuclockid (threadid, clockid) @@ -51,10 +48,6 @@ pthread_getcpuclockid (threadid, clockid) const clockid_t tidclock = MAKE_THREAD_CPUCLOCK (pd->tid, CPUCLOCK_SCHED); # if !(__ASSUME_POSIX_CPU_TIMERS > 0) -# if !(__ASSUME_POSIX_TIMERS > 0) - if (__libc_missing_posix_timers && !__libc_missing_posix_cpu_timers) - __libc_missing_posix_cpu_timers = 1; -# endif if (!__libc_missing_posix_cpu_timers) { INTERNAL_SYSCALL_DECL (err); @@ -67,21 +60,12 @@ pthread_getcpuclockid (threadid, clockid) } # if !(__ASSUME_POSIX_CPU_TIMERS > 0) -# if !(__ASSUME_POSIX_TIMERS > 0) - if (INTERNAL_SYSCALL_ERRNO (r, err) == ENOSYS) + if (INTERNAL_SYSCALL_ERRNO (r, err) == EINVAL) { - /* The kernel doesn't support these calls at all. */ - __libc_missing_posix_timers = 1; + /* The kernel doesn't support these clocks at all. */ __libc_missing_posix_cpu_timers = 1; } else -# endif - if (INTERNAL_SYSCALL_ERRNO (r, err) == EINVAL) - { - /* The kernel doesn't support these clocks at all. */ - __libc_missing_posix_cpu_timers = 1; - } - else return INTERNAL_SYSCALL_ERRNO (r, err); } # endif diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S index 0937d6c237..a0ccacc8e3 100644 --- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S +++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S @@ -158,10 +158,6 @@ __pthread_cond_timedwait: mov.w .L__NR_clock_gettime, r3 trapa #0x12 SYSCALL_INST_PAD -# ifndef __ASSUME_POSIX_TIMERS - cmp/eq #-ENOSYS, r0 - bt 19f -# endif /* Compute relative timeout. */ mov.l @r13, r2 @@ -172,24 +168,6 @@ __pthread_cond_timedwait: .L__NR_clock_gettime: .word __NR_clock_gettime -# ifndef __ASSUME_POSIX_TIMERS -19: - mov r15, r4 - add #16, r4 - mov #0, r5 - mov #__NR_gettimeofday, r3 - trapa #0x12 - SYSCALL_INST_PAD - - /* Compute relative timeout. */ - mov.l @(20,r15), r0 - mov.w .L1k, r1 - dmulu.l r0, r1 /* Micro seconds to nano seconds. */ - mov.l @r13, r2 - mov.l @(4,r13), r3 - mov.l @(16,r15), r0 - sts macl, r1 -#endif 0: #else mov r15, r4 diff --git a/nptl/sysdeps/unix/sysv/linux/timer_create.c b/nptl/sysdeps/unix/sysv/linux/timer_create.c index 8d365eb9a4..c2865fb4f3 100644 --- a/nptl/sysdeps/unix/sysv/linux/timer_create.c +++ b/nptl/sysdeps/unix/sysv/linux/timer_create.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003,2004, 2007, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2003-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -30,21 +30,9 @@ #include "kernel-posix-cpu-timers.h" -#ifdef __NR_timer_create -# ifndef __ASSUME_POSIX_TIMERS -static int compat_timer_create (clockid_t clock_id, struct sigevent *evp, - timer_t *timerid); -# define timer_create static compat_timer_create -# include <nptl/sysdeps/pthread/timer_create.c> -# undef timer_create - -/* Nonzero if the system calls are not available. */ -int __no_posix_timers attribute_hidden; -# endif - -# ifdef timer_create_alias -# define timer_create timer_create_alias -# endif +#ifdef timer_create_alias +# define timer_create timer_create_alias +#endif int @@ -53,190 +41,140 @@ timer_create (clock_id, evp, timerid) struct sigevent *evp; timer_t *timerid; { -# undef timer_create -# ifndef __ASSUME_POSIX_TIMERS - if (__no_posix_timers >= 0) -# endif - { - clockid_t syscall_clockid = (clock_id == CLOCK_PROCESS_CPUTIME_ID - ? MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED) - : clock_id == CLOCK_THREAD_CPUTIME_ID - ? MAKE_THREAD_CPUCLOCK (0, CPUCLOCK_SCHED) - : clock_id); - - /* If the user wants notification via a thread we need to handle - this special. */ - if (evp == NULL - || __builtin_expect (evp->sigev_notify != SIGEV_THREAD, 1)) - { - struct sigevent local_evp; - - /* We avoid allocating too much memory by basically - using struct timer as a derived class with the - first two elements being in the superclass. We only - need these two elements here. */ - struct timer *newp = (struct timer *) malloc (offsetof (struct timer, - thrfunc)); - if (newp == NULL) - /* No more memory. */ +#undef timer_create + { + clockid_t syscall_clockid = (clock_id == CLOCK_PROCESS_CPUTIME_ID + ? MAKE_PROCESS_CPUCLOCK (0, CPUCLOCK_SCHED) + : clock_id == CLOCK_THREAD_CPUTIME_ID + ? MAKE_THREAD_CPUCLOCK (0, CPUCLOCK_SCHED) + : clock_id); + + /* If the user wants notification via a thread we need to handle + this special. */ + if (evp == NULL + || __builtin_expect (evp->sigev_notify != SIGEV_THREAD, 1)) + { + struct sigevent local_evp; + + /* We avoid allocating too much memory by basically + using struct timer as a derived class with the + first two elements being in the superclass. We only + need these two elements here. */ + struct timer *newp = (struct timer *) malloc (offsetof (struct timer, + thrfunc)); + if (newp == NULL) + /* No more memory. */ + return -1; + + if (evp == NULL) + { + /* The kernel has to pass up the timer ID which is a + userlevel object. Therefore we cannot leave it up to + the kernel to determine it. */ + local_evp.sigev_notify = SIGEV_SIGNAL; + local_evp.sigev_signo = SIGALRM; + local_evp.sigev_value.sival_ptr = newp; + + evp = &local_evp; + } + + kernel_timer_t ktimerid; + int retval = INLINE_SYSCALL (timer_create, 3, syscall_clockid, evp, + &ktimerid); + + if (retval != -1) + { + newp->sigev_notify = (evp != NULL + ? evp->sigev_notify : SIGEV_SIGNAL); + newp->ktimerid = ktimerid; + + *timerid = (timer_t) newp; + } + else + { + /* Cannot allocate the timer, fail. */ + free (newp); + retval = -1; + } + + return retval; + } + else + { + /* Create the helper thread. */ + pthread_once (&__helper_once, __start_helper_thread); + if (__helper_tid == 0) + { + /* No resources to start the helper thread. */ + __set_errno (EAGAIN); return -1; - - if (evp == NULL) - { - /* The kernel has to pass up the timer ID which is a - userlevel object. Therefore we cannot leave it up to - the kernel to determine it. */ - local_evp.sigev_notify = SIGEV_SIGNAL; - local_evp.sigev_signo = SIGALRM; - local_evp.sigev_value.sival_ptr = newp; - - evp = &local_evp; - } - - kernel_timer_t ktimerid; - int retval = INLINE_SYSCALL (timer_create, 3, syscall_clockid, evp, - &ktimerid); - -# ifndef __ASSUME_POSIX_TIMERS - if (retval != -1 || errno != ENOSYS) -# endif - { -# ifndef __ASSUME_POSIX_TIMERS - __no_posix_timers = 1; -# endif - - if (retval != -1) - { - newp->sigev_notify = (evp != NULL - ? evp->sigev_notify : SIGEV_SIGNAL); - newp->ktimerid = ktimerid; - - *timerid = (timer_t) newp; - } - else - { - /* Cannot allocate the timer, fail. */ - free (newp); - retval = -1; - } - - return retval; - } - - free (newp); - -# ifndef __ASSUME_POSIX_TIMERS - /* When we come here the syscall does not exist. Make sure we - do not try to use it again. */ - __no_posix_timers = -1; -# endif - } - else - { -# ifndef __ASSUME_POSIX_TIMERS - /* Make sure we have the necessary kernel support. */ - if (__no_posix_timers == 0) - { - INTERNAL_SYSCALL_DECL (err); - struct timespec ts; - int res; - res = INTERNAL_SYSCALL (clock_getres, err, 2, - CLOCK_REALTIME, &ts); - __no_posix_timers = (INTERNAL_SYSCALL_ERROR_P (res, err) - ? -1 : 1); - } - - if (__no_posix_timers > 0) -# endif - { - /* Create the helper thread. */ - pthread_once (&__helper_once, __start_helper_thread); - if (__helper_tid == 0) - { - /* No resources to start the helper thread. */ - __set_errno (EAGAIN); - return -1; - } - - struct timer *newp; - newp = (struct timer *) malloc (sizeof (struct timer)); - if (newp == NULL) - return -1; - - /* Copy the thread parameters the user provided. */ - newp->sival = evp->sigev_value; - newp->thrfunc = evp->sigev_notify_function; - newp->sigev_notify = SIGEV_THREAD; - - /* We cannot simply copy the thread attributes since the - implementation might keep internal information for - each instance. */ - (void) pthread_attr_init (&newp->attr); - if (evp->sigev_notify_attributes != NULL) - { - struct pthread_attr *nattr; - struct pthread_attr *oattr; - - nattr = (struct pthread_attr *) &newp->attr; - oattr = (struct pthread_attr *) evp->sigev_notify_attributes; - - nattr->schedparam = oattr->schedparam; - nattr->schedpolicy = oattr->schedpolicy; - nattr->flags = oattr->flags; - nattr->guardsize = oattr->guardsize; - nattr->stackaddr = oattr->stackaddr; - nattr->stacksize = oattr->stacksize; - } - - /* In |
