diff options
author | Ulrich Drepper <drepper@redhat.com> | 2002-12-08 03:13:06 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2002-12-08 03:13:06 +0000 |
commit | 09efc3ba1269f79b78ee0724501fc762c2d5ab49 (patch) | |
tree | 840ca5c526b221f3510f23b1f17c9e379b84129f /nptl | |
parent | 6ccb3834ebf1cb65d180144442a68cd1c24f1dd5 (diff) | |
download | glibc-09efc3ba1269f79b78ee0724501fc762c2d5ab49.zip glibc-09efc3ba1269f79b78ee0724501fc762c2d5ab49.tar.gz glibc-09efc3ba1269f79b78ee0724501fc762c2d5ab49.tar.bz2 |
Update.
2002-12-07 Ulrich Drepper <drepper@redhat.com>
* sysdeps/generic/bits/stdio-lock.h (_IO_lock_trylock): New define.
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/Banner | 2 | ||||
-rw-r--r-- | nptl/ChangeLog | 41 | ||||
-rw-r--r-- | nptl/Makefile | 1 | ||||
-rw-r--r-- | nptl/cleanup.c | 5 | ||||
-rw-r--r-- | nptl/ftrylockfile.c | 5 | ||||
-rw-r--r-- | nptl/pthreadP.h | 25 | ||||
-rw-r--r-- | nptl/pthread_cancel.c | 2 | ||||
-rw-r--r-- | nptl/pthread_cond_timedwait.c | 4 | ||||
-rw-r--r-- | nptl/pthread_cond_wait.c | 4 | ||||
-rw-r--r-- | nptl/pthread_mutex_lock.c | 1 | ||||
-rw-r--r-- | nptl/pthread_mutex_unlock.c | 1 | ||||
-rw-r--r-- | nptl/pthread_setcanceltype.c | 3 | ||||
-rw-r--r-- | nptl/sem_open.c | 8 | ||||
-rw-r--r-- | nptl/sem_unlink.c | 2 | ||||
-rw-r--r-- | nptl/sysdeps/pthread/bits/libc-lock.h | 9 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S | 3 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/pthread_kill.c | 3 |
17 files changed, 93 insertions, 26 deletions
diff --git a/nptl/Banner b/nptl/Banner index 99b45d9..60acf42 100644 --- a/nptl/Banner +++ b/nptl/Banner @@ -1 +1 @@ -nptl 0.11 by Ulrich Drepper +nptl 0.12 by Ulrich Drepper diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 697086c..d254492 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,5 +1,46 @@ 2002-12-07 Ulrich Drepper <drepper@redhat.com> + * Makefile (CFLAGS-ftrylockfile.c): Add -D_IO_MTSAFE_IO. + + * cleanup.c: Move declarations of _GI_pthread_cleanup_push and + _GI_pthread_cleanup_pop to pthreadP.h. + + * ftrylockfile.c: Use _IO_lock_trylock instead of + pthread_mutex_trylock. + + * pthreadP.h (CANCEL_ASYNC): Use __pthread_setcanceltype. + (CANCEL_RESET): Likewise. + (__pthread_setcanceltype_): Declare. + (__pthread_mutex_lock_internal): Declare. + (__pthread_mutex_unlock_internal): Declare. + (__pthread_once_internal): Declare. + (pthread_cleanup_push): Redefine using _GI_pthread_cleanup_push. + (pthread_cleanup_pop): Redefine using _GI_pthread_cleanup_pop. + + * pthread_cond_timedwait.c: Use INTUSE is calls to pthread_mutex_lock + and pthread_mutex_unlock. + * pthread_cond_wait.c: Likewise. + * pthread_mutex_lock.c: Use INTDEF to define alias if needed. + * pthread_mutex_unlock.c: Likewise. + + * pthread_setcanceltype.c: Add additional alias + __pthread_setcanceltype. + + * sem_unlink.c (sem_unlink): Use __pthread_once with INTDEF. + * sem_open.c (sem_open): Likewise. + Use __libc_open, __libc_write, and __libc_close instead of + open, write, and close respectively. + + * sysdeps/pthread/bits/libc-lock.h (__libc_lock_trylock_internal): + Rewrite as statement expression since it must return a value. + + * pthread_cancel.c: Use __pthread_kill instead of pthread_kill. + * sysdeps/unix/sysv/linux/pthread_kill.c: Define additional alias + __pthread_kill. + + * sysdeps/unix/sysv/linux/i386/pthread_once.S: Define additional + alias __pthread_once_internal. + * sysdeps/unix/sysv/linux/raise.c: Use libc_hidden_def for raise. 2002-12-06 Ulrich Drepper <drepper@redhat.com> diff --git a/nptl/Makefile b/nptl/Makefile index 77541b8..00c63d8 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -157,6 +157,7 @@ CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions endif CFLAGS-flockfile.c = -D_IO_MTSAFE_IO +CFLAGS-ftrylockfile.c = -D_IO_MTSAFE_IO CFLAGS-funlockfile.c = -D_IO_MTSAFE_IO ifeq ($(build-static),yes) diff --git a/nptl/cleanup.c b/nptl/cleanup.c index 6c7ba61..68c0f1d 100644 --- a/nptl/cleanup.c +++ b/nptl/cleanup.c @@ -38,9 +38,6 @@ _pthread_cleanup_push (buffer, routine, arg) THREAD_SETMEM (self, cleanup, buffer); } -extern void _GI_pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer, - void (*routine) (void *), void *arg) - attribute_hidden; strong_alias (_pthread_cleanup_push, _GI_pthread_cleanup_push) @@ -58,6 +55,4 @@ _pthread_cleanup_pop (buffer, execute) if (execute) buffer->__routine (buffer->__arg); } -extern void _GI_pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer, - int execute) attribute_hidden; strong_alias (_pthread_cleanup_pop, _GI_pthread_cleanup_pop) diff --git a/nptl/ftrylockfile.c b/nptl/ftrylockfile.c index 9ed010d..2266b25 100644 --- a/nptl/ftrylockfile.c +++ b/nptl/ftrylockfile.c @@ -17,15 +17,16 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <errno.h> #include <pthread.h> #include <stdio.h> -#include <libio.h> +#include <bits/stdio-lock.h> int ftrylockfile (stream) FILE *stream; { - return pthread_mutex_trylock (stream->_lock); + return _IO_lock_trylock (*stream->_lock); } strong_alias (ftrylockfile, _IO_ftrylockfile) diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index c6c1e49..74243d1 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -80,10 +80,10 @@ extern int __pthread_debug attribute_hidden; /* Set cancellation mode to asynchronous. */ #define CANCEL_ASYNC(oldtype) \ - pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype) + __pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype) /* Reset to previous cancellation mode. */ #define CANCEL_RESET(oldtype) \ - pthread_setcanceltype (oldtype, NULL) + __pthread_setcanceltype (oldtype, NULL) /* Function performing the cancellation. */ extern void __do_cancel (char *currentframe) @@ -147,7 +147,9 @@ extern int __pthread_mutex_init (pthread_mutex_t *__mutex, extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex); extern int __pthread_mutex_trylock (pthread_mutex_t *_mutex); extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); +extern int __pthread_mutex_lock_internal (pthread_mutex_t *__mutex); extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); +extern int __pthread_mutex_unlock_internal (pthread_mutex_t *__mutex); extern int __pthread_mutexattr_init (pthread_mutexattr_t *attr); extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *attr); extern int __pthread_mutexattr_settype (pthread_mutexattr_t *attr, int kind); @@ -179,7 +181,26 @@ extern void *__pthread_getspecific (pthread_key_t key); extern int __pthread_setspecific (pthread_key_t key, const void *value); extern int __pthread_once (pthread_once_t *once_control, void (*init_routine) (void)); +extern int __pthread_once_internal (pthread_once_t *once_control, + void (*init_routine) (void)); extern int __pthread_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void)); +extern int __pthread_kill (pthread_t threadid, int signo); +extern int __pthread_setcanceltype (int type, int *oldtype); + +/* Special versions which use non-exported functions. */ +extern void _GI_pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer, + void (*routine) (void *), void *arg) + attribute_hidden; +#undef pthread_cleanup_push +#define pthread_cleanup_push(routine,arg) \ + { struct _pthread_cleanup_buffer _buffer; \ + _GI_pthread_cleanup_push (&_buffer, (routine), (arg)); + +extern void _GI_pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer, + int execute) attribute_hidden; +#undef pthread_cleanup_pop +#define pthread_cleanup_pop(execute) \ + _GI_pthread_cleanup_pop (&_buffer, (execute)); } #endif /* pthreadP.h */ diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c index 1fa20e0..a189b6e 100644 --- a/nptl/pthread_cancel.c +++ b/nptl/pthread_cancel.c @@ -46,7 +46,7 @@ pthread_cancel (th) { /* The cancellation handler will take care of marking the thread as canceled. */ - pthread_kill (th, SIGCANCEL); + __pthread_kill (th, SIGCANCEL); break; } diff --git a/nptl/pthread_cond_timedwait.c b/nptl/pthread_cond_timedwait.c index 826d16f..b88d11d 100644 --- a/nptl/pthread_cond_timedwait.c +++ b/nptl/pthread_cond_timedwait.c @@ -40,7 +40,7 @@ pthread_cond_timedwait (cond, mutex, abstime) lll_mutex_lock (cond->__data.__lock); /* Release the mutex. This might fail. */ - err = pthread_mutex_unlock (mutex); + err = INTUSE(__pthread_mutex_unlock) (mutex); if (__builtin_expect (err != 0, 0)) { lll_mutex_unlock (cond->__data.__lock); @@ -61,7 +61,7 @@ pthread_cond_timedwait (cond, mutex, abstime) lll_mutex_unlock (cond->__data.__lock); /* We have to get the mutex before returning. */ - err = pthread_mutex_lock (mutex); + err = INTUSE(__pthread_mutex_lock) (mutex); if (err != 0) /* XXX Unconditionally overwrite the result of the wait? */ result = err; diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c index 37c5ffe..0e3e87f 100644 --- a/nptl/pthread_cond_wait.c +++ b/nptl/pthread_cond_wait.c @@ -36,7 +36,7 @@ pthread_cond_wait (cond, mutex) lll_mutex_lock (cond->__data.__lock); /* Release the mutex. This might fail. */ - err = pthread_mutex_unlock (mutex); + err = INTUSE(__pthread_mutex_unlock) (mutex); if (__builtin_expect (err != 0, 0)) { lll_mutex_unlock (cond->__data.__lock); @@ -57,7 +57,7 @@ pthread_cond_wait (cond, mutex) lll_mutex_unlock (cond->__data.__lock); /* We have to get the mutex before returning. */ - err = pthread_mutex_lock (mutex); + err = INTUSE(__pthread_mutex_lock) (mutex); /* Cancellation handling. */ CANCELLATION_P (THREAD_SELF); diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c index 8398003..991ef01 100644 --- a/nptl/pthread_mutex_lock.c +++ b/nptl/pthread_mutex_lock.c @@ -75,3 +75,4 @@ __pthread_mutex_lock (mutex) return 0; } strong_alias (__pthread_mutex_lock, pthread_mutex_lock) +INTDEF(__pthread_mutex_lock) diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c index be510cb..cd410e8 100644 --- a/nptl/pthread_mutex_unlock.c +++ b/nptl/pthread_mutex_unlock.c @@ -63,3 +63,4 @@ __pthread_mutex_unlock (mutex) return 0; } strong_alias (__pthread_mutex_unlock, pthread_mutex_unlock) +INTDEF(__pthread_mutex_unlock) diff --git a/nptl/pthread_setcanceltype.c b/nptl/pthread_setcanceltype.c index 8f84634..63867d3 100644 --- a/nptl/pthread_setcanceltype.c +++ b/nptl/pthread_setcanceltype.c @@ -23,7 +23,7 @@ int -pthread_setcanceltype (type, oldtype) +__pthread_setcanceltype (type, oldtype) int type; int *oldtype; { @@ -69,3 +69,4 @@ pthread_setcanceltype (type, oldtype) return 0; } +strong_alias (__pthread_setcanceltype, pthread_setcanceltype) diff --git a/nptl/sem_open.c b/nptl/sem_open.c index 6fc72f7..e8ef8f5 100644 --- a/nptl/sem_open.c +++ b/nptl/sem_open.c @@ -131,7 +131,7 @@ sem_open (const char *name, int oflag, ...) int fd; /* Determine where the shmfs is mounted. */ - pthread_once (&__namedsem_once, __where_is_shmfs); + INTUSE(__pthread_once) (&__namedsem_once, __where_is_shmfs); /* If we don't know the mount points there is nothing we can do. Ever. */ if (mountpoint.dir == NULL) @@ -160,7 +160,7 @@ sem_open (const char *name, int oflag, ...) /* If the semaphore object has to exist simply open it. */ if ((oflag & O_CREAT) == 0) { - fd = open (finalname, oflag | O_NOFOLLOW); + fd = __libc_open (finalname, oflag | O_NOFOLLOW); if (fd == -1) /* Return. errno is already set. */ @@ -210,7 +210,7 @@ sem_open (const char *name, int oflag, ...) memset ((char *) &initsem + sizeof (struct sem), '\0', sizeof (sem_t) - sizeof (struct sem)); - if (TEMP_FAILURE_RETRY (write (fd, &initsem, sizeof (sem_t))) + if (TEMP_FAILURE_RETRY (__libc_write (fd, &initsem, sizeof (sem_t))) != sizeof (sem_t) /* Adjust the permission. */ || fchmod (fd, mode) != 0) @@ -252,7 +252,7 @@ sem_open (const char *name, int oflag, ...) } /* We don't need the file descriptor anymore. */ - close (fd); + __libc_close (fd); return result; } diff --git a/nptl/sem_unlink.c b/nptl/sem_unlink.c index b8e3de1..87440f6 100644 --- a/nptl/sem_unlink.c +++ b/nptl/sem_unlink.c @@ -33,7 +33,7 @@ sem_unlink (name) size_t namelen; /* Determine where the shmfs is mounted. */ - pthread_once (&__namedsem_once, __where_is_shmfs); + INTDEF(__pthread_once) (&__namedsem_once, __where_is_shmfs); /* If we don't know the mount points there is nothing we can do. Ever. */ if (mountpoint.dir == NULL) diff --git a/nptl/sysdeps/pthread/bits/libc-lock.h b/nptl/sysdeps/pthread/bits/libc-lock.h index 30e3410..cb21549 100644 --- a/nptl/sysdeps/pthread/bits/libc-lock.h +++ b/nptl/sysdeps/pthread/bits/libc-lock.h @@ -1,4 +1,4 @@ -/* libc-internal interface for mutex locks. LinuxThreads version. +/* libc-internal interface for mutex locks. NPTL version. Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -254,8 +254,8 @@ typedef pthread_key_t __libc_key_t; /* Try to lock the recursive named lock variable. */ #if defined _LIBC && (!defined NOT_IN_libc || defined IS_IN_libpthread) -# define __libc_lock_trylock_recursive(NAME) \ - do { \ +# define __libc_lock_trylock_recursive(NAME) \ + ({ \ int result = 0; \ void *self = THREAD_SELF; \ if ((NAME).owner != self) \ @@ -270,7 +270,8 @@ typedef pthread_key_t __libc_key_t; } \ else \ ++(NAME).cnt; \ - } while (0) + result; \ + }) #else # define __libc_lock_trylock_recursive(NAME) \ __libc_maybe_call (__pthread_mutex_trylock, (&(NAME)), 0) diff --git a/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S index 747c8ec..931e38b 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S +++ b/nptl/sysdeps/unix/sysv/linux/i386/pthread_once.S @@ -134,6 +134,9 @@ __pthread_once: .size __pthread_once,.-__pthread_once + .globl __pthread_once_internal +__pthread_once_internal = __pthread_once + .globl pthread_once pthread_once = __pthread_once diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c index f5c2377..2c31dd6 100644 --- a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c +++ b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c @@ -25,7 +25,7 @@ int -pthread_kill (threadid, signo) +__pthread_kill (threadid, signo) pthread_t threadid; int signo; { @@ -34,3 +34,4 @@ pthread_kill (threadid, signo) /* We have a special syscall to do the work. */ return INLINE_SYSCALL (tkill, 2, pd->tid, signo); } +strong_alias (__pthread_kill, pthread_kill) |