mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 02:40:08 +00:00
Update.
2002-12-07 Ulrich Drepper <drepper@redhat.com> * sysdeps/generic/bits/stdio-lock.h (_IO_lock_trylock): New define.
This commit is contained in:
parent
6ccb3834eb
commit
09efc3ba12
@ -1,3 +1,7 @@
|
||||
2002-12-07 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* sysdeps/generic/bits/stdio-lock.h (_IO_lock_trylock): New define.
|
||||
|
||||
2002-12-07 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* sysdeps/generic/libc-tls.c (__libc_setup_tls): Reintroduce changes
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Thread package specific definitions of stream lock type. Generic version.
|
||||
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2002 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
|
||||
@ -34,6 +34,7 @@ __libc_lock_define_recursive (typedef, _IO_lock_t)
|
||||
#define _IO_lock_init(_name) __libc_lock_init_recursive (_name)
|
||||
#define _IO_lock_fini(_name) __libc_lock_fini_recursive (_name)
|
||||
#define _IO_lock_lock(_name) __libc_lock_lock_recursive (_name)
|
||||
#define _IO_lock_trylock(_name) __libc_lock_trylock_recursive (_name)
|
||||
#define _IO_lock_unlock(_name) __libc_lock_unlock_recursive (_name)
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
nptl 0.11 by Ulrich Drepper
|
||||
nptl 0.12 by Ulrich Drepper
|
||||
|
@ -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>
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -75,3 +75,4 @@ __pthread_mutex_lock (mutex)
|
||||
return 0;
|
||||
}
|
||||
strong_alias (__pthread_mutex_lock, pthread_mutex_lock)
|
||||
INTDEF(__pthread_mutex_lock)
|
||||
|
@ -63,3 +63,4 @@ __pthread_mutex_unlock (mutex)
|
||||
return 0;
|
||||
}
|
||||
strong_alias (__pthread_mutex_unlock, pthread_mutex_unlock)
|
||||
INTDEF(__pthread_mutex_unlock)
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Thread package specific definitions of stream lock type. Generic version.
|
||||
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000, 2001, 2002 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
|
||||
@ -34,6 +34,7 @@ __libc_lock_define_recursive (typedef, _IO_lock_t)
|
||||
#define _IO_lock_init(_name) __libc_lock_init_recursive (_name)
|
||||
#define _IO_lock_fini(_name) __libc_lock_fini_recursive (_name)
|
||||
#define _IO_lock_lock(_name) __libc_lock_lock_recursive (_name)
|
||||
#define _IO_lock_trylock(_name) __libc_lock_trylock_recursive (_name)
|
||||
#define _IO_lock_unlock(_name) __libc_lock_unlock_recursive (_name)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user