diff options
author | neal <neal> | 2008-08-12 13:03:03 +0000 |
---|---|---|
committer | neal <neal> | 2008-08-12 13:03:03 +0000 |
commit | 6b49ed9f8754ad8dc5c45d707c2a89095b12f20d (patch) | |
tree | 7fce6bc764e021a3fd57026369a7b8a2dcfb380d | |
parent | 9673f0b23c7e13f4a9e6729ab65ae22bc2fac3a4 (diff) |
2008-08-12 Neal H. Walfield <neal@gnu.org>
Merge in Samuel Thibault's changes from the main line.
* Makefile.am (libpthread_a_SOURCES): Add pt-getattr.c.
* headers.m4: Link libpthread/include/pthread/pthreadtypes.h to
sysroot/include/pthread/pthreadtypes.h and
libpthread/sysdeps/${arch}/bits/spin-lock-inline.h. to
sysroot/include/bits/spin-lock-inline.h.
* include/pthread/pthread.h: Include <sys/cdefs.h>.
(__extern_inline): If not defined, define appropriately.
2008-08-04 Samuel Thibault <samuel.thibault@ens-lyon.org>
* include/pthread/pthreadtypes.h (__pthread_inheritsched): Remove
comma at end of enumeration.
2008-08-03 Samuel Thibault <samuel.thibault@ens-lyon.org>
* Makefile (sysdeps_headers): Add spin-lock-inline.h.
(SYSDEP_PATH): Move sysdeps/ia32 right after
sysdeps/$(MICROKERNEL)/ia32.
* include/pthread/pthread.h: Include <bits/spin-lock-inline.h>.
* sysdeps/ia32/bits/spin-lock.h: Move inlines to...
* sysdeps/ia32/bits/spin-lock-inline.h: ... new file.
2008-08-02 Samuel Thibault <samuel.thibault@ens-lyon.org>
* sysdeps/generic/bits/mutex.h: Do not include <errno.h> and
<stddef.h>
* sysdeps/ia32/bits/memory.h (__memory_barrier): Add memory clobber.
* sysdeps/ia32/bits/spin-lock.h (__pthread_spin_trylock,
__pthread_spin_unlock): Add memory clobbers.
* sysdeps/l4/hurd/ia32/pt-setup.c (stack_setup): Fix reservation of
stack room for initial frame.
2008-07-18 Samuel Thibault <samuel.thibault@ens-lyon.org>
* Makefile (sysdeps_headers): add pthread/pthreadtypes.h
2008-06-27 Samuel Thibault <samuel.thibault@ens-lyon.org>
* include/pthread/pthread.h: Do not define __need_clockid_t, include
<time.h>, and define clockid_t if __clockid_defined is not defined.
Include <pthread/pthreadtypes.h>
(pthread_equal): New extern inline.
(pthread_cleanup_push, pthread_cleanup_pop): New macros.
(__pthread_process_shared, __pthread_inheritsched,
__pthread_contentionscope, __pthread_detachstate,
__pthread_mutex_protocol, __pthread_mutex_type,
pthread_attr_t, pthread_mutex_attr_t, pthread_mutex_t,
pthread_condattr_t, pthread_cond_t, pthread_spinlock_t,
pthread_rwlockattr_t, pthread_rwlock_t, pthread_barrierattr_t,
pthread_barrier_t, pthread_key_t, pthread_once_t): Move enums and
typedefs to...
* include/pthread/pthreadtypes.h: ... new file.
* sysdeps/generic/bits/cancelation.h (pthread_cleanup_push): Rename
macro to __pthread_cleanup_push.
(pthread_cleanup_pop): Rename macro to __pthread_cleanup_pop.
* sysdeps/generic/bits/barrier-attr.h (__pthread_process_shared):
Forward-declare enum.
* sysdeps/generic/bits/condition-attr.h (__pthread_process_shared):
Likewise.
* sysdeps/generic/bits/mutex-attr.h (__pthread_mutex_protocol,
__pthread_process_shared, __pthread_mutex_type):
Likewise.
* sysdeps/generic/bits/rwlock-attr.h (__pthread_process_shared):
Likewise.
* sysdeps/generic/bits/thread-attr.h (__pthread_detachstate,
__pthread_inheritsched, __pthread_contentionscope):
Likewise.
* sysdeps/generic/bits/pthread.h (pthread_t): Rename type to
__pthread_t.
(pthread_equal): Rename to __pthread_equal.
2008-06-27 Samuel Thibault <samuel.thibault@ens-lyon.org>
* sysdeps/generic/bits/thread-barrier.h: Remove unused file.
2008-05-17 Samuel Thibault <samuel.thibault@ens-lyon.org>
* include/pthread/pthread.h (pthread_getattr_np): New declaration.
* pthread/pt-getattr.c: New file.
* Makefile (SRCS): Add pt-getattr.c.
2008-03-16 Samuel Thibault <samuel.thibault@ens-lyon.org>
* include/libc-symbols.h (HAVE_ASM_PREVIOUS_DIRECTIVE): Define.
2008-02-29 Samuel Thibault <samuel.thibault@ens-lyon.org>
* sysdeps/l4/hurd/ia32/pt-setup.c (stack_setup): Align stack on 0x10
for MMX operations.
2008-01-01 Samuel Thibault <samuel.thibault@ens-lyon.org>
* include/pthread/pthread.h (pthread_spin_destroy, pthread_spin_init,
pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock): Use
__extern_inline macro instead of extern __inline.
* sysdeps/ia32/bits/spin-lock.h (__PT_SPIN_INLINE,
__pthread_spin_lock): Likewise
* sysdeps/generic/bits/pthread.h (pthread_equal): Declare ; only
provide inline when __USE_EXTERN_INLINES is defined. Use __extern_inline
macro instead of extern __inline.
* sysdeps/ia32/bits/memory.h (__memory_barrier): Add static to inline.
38 files changed, 532 insertions, 230 deletions
diff --git a/libpthread/ChangeLog b/libpthread/ChangeLog index b8a3b18..9e3080f 100644 --- a/libpthread/ChangeLog +++ b/libpthread/ChangeLog @@ -1,3 +1,110 @@ +2008-08-12 Neal H. Walfield <neal@gnu.org> + + Merge in Samuel Thibault's changes from the main line. + + * Makefile.am (libpthread_a_SOURCES): Add pt-getattr.c. + * headers.m4: Link libpthread/include/pthread/pthreadtypes.h to + sysroot/include/pthread/pthreadtypes.h and + libpthread/sysdeps/${arch}/bits/spin-lock-inline.h. to + sysroot/include/bits/spin-lock-inline.h. + + * include/pthread/pthread.h: Include <sys/cdefs.h>. + (__extern_inline): If not defined, define appropriately. + +2008-08-04 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * include/pthread/pthreadtypes.h (__pthread_inheritsched): Remove + comma at end of enumeration. + +2008-08-03 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * Makefile (sysdeps_headers): Add spin-lock-inline.h. + (SYSDEP_PATH): Move sysdeps/ia32 right after + sysdeps/$(MICROKERNEL)/ia32. + * include/pthread/pthread.h: Include <bits/spin-lock-inline.h>. + * sysdeps/ia32/bits/spin-lock.h: Move inlines to... + * sysdeps/ia32/bits/spin-lock-inline.h: ... new file. + +2008-08-02 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * sysdeps/generic/bits/mutex.h: Do not include <errno.h> and + <stddef.h> + * sysdeps/ia32/bits/memory.h (__memory_barrier): Add memory clobber. + * sysdeps/ia32/bits/spin-lock.h (__pthread_spin_trylock, + __pthread_spin_unlock): Add memory clobbers. + * sysdeps/l4/hurd/ia32/pt-setup.c (stack_setup): Fix reservation of + stack room for initial frame. + +2008-07-18 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * Makefile (sysdeps_headers): add pthread/pthreadtypes.h + +2008-06-27 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * include/pthread/pthread.h: Do not define __need_clockid_t, include + <time.h>, and define clockid_t if __clockid_defined is not defined. + Include <pthread/pthreadtypes.h> + (pthread_equal): New extern inline. + (pthread_cleanup_push, pthread_cleanup_pop): New macros. + (__pthread_process_shared, __pthread_inheritsched, + __pthread_contentionscope, __pthread_detachstate, + __pthread_mutex_protocol, __pthread_mutex_type, + pthread_attr_t, pthread_mutex_attr_t, pthread_mutex_t, + pthread_condattr_t, pthread_cond_t, pthread_spinlock_t, + pthread_rwlockattr_t, pthread_rwlock_t, pthread_barrierattr_t, + pthread_barrier_t, pthread_key_t, pthread_once_t): Move enums and + typedefs to... + * include/pthread/pthreadtypes.h: ... new file. + * sysdeps/generic/bits/cancelation.h (pthread_cleanup_push): Rename + macro to __pthread_cleanup_push. + (pthread_cleanup_pop): Rename macro to __pthread_cleanup_pop. + * sysdeps/generic/bits/barrier-attr.h (__pthread_process_shared): + Forward-declare enum. + * sysdeps/generic/bits/condition-attr.h (__pthread_process_shared): + Likewise. + * sysdeps/generic/bits/mutex-attr.h (__pthread_mutex_protocol, + __pthread_process_shared, __pthread_mutex_type): + Likewise. + * sysdeps/generic/bits/rwlock-attr.h (__pthread_process_shared): + Likewise. + * sysdeps/generic/bits/thread-attr.h (__pthread_detachstate, + __pthread_inheritsched, __pthread_contentionscope): + Likewise. + * sysdeps/generic/bits/pthread.h (pthread_t): Rename type to + __pthread_t. + (pthread_equal): Rename to __pthread_equal. + +2008-06-27 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * sysdeps/generic/bits/thread-barrier.h: Remove unused file. + +2008-05-17 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * include/pthread/pthread.h (pthread_getattr_np): New declaration. + * pthread/pt-getattr.c: New file. + * Makefile (SRCS): Add pt-getattr.c. + +2008-03-16 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * include/libc-symbols.h (HAVE_ASM_PREVIOUS_DIRECTIVE): Define. + +2008-02-29 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * sysdeps/l4/hurd/ia32/pt-setup.c (stack_setup): Align stack on 0x10 + for MMX operations. + +2008-01-01 Samuel Thibault <samuel.thibault@ens-lyon.org> + + * include/pthread/pthread.h (pthread_spin_destroy, pthread_spin_init, + pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock): Use + __extern_inline macro instead of extern __inline. + * sysdeps/ia32/bits/spin-lock.h (__PT_SPIN_INLINE, + __pthread_spin_lock): Likewise + * sysdeps/generic/bits/pthread.h (pthread_equal): Declare ; only + provide inline when __USE_EXTERN_INLINES is defined. Use __extern_inline + macro instead of extern __inline. + * sysdeps/ia32/bits/memory.h (__memory_barrier): Add static to inline. + 2008-06-22 Neal H. Walfield <neal@gnu.org> * sysdeps/generic/pt-mutex-timedlock.c diff --git a/libpthread/Makefile.am b/libpthread/Makefile.am index 3c7e63d..e59c946 100644 --- a/libpthread/Makefile.am +++ b/libpthread/Makefile.am @@ -28,10 +28,10 @@ endif # all these directories to the vpath. SYSDEP_PATH = $(srcdir)/sysdeps/l4/hurd/${arch} \ $(srcdir)/sysdeps/l4/${arch} \ + $(srcdir)/sysdeps/${arch} \ $(srcdir)/sysdeps/l4/hurd \ $(srcdir)/sysdeps/l4 \ $(srcdir)/sysdeps/hurd \ - $(srcdir)/sysdeps/${arch} \ $(srcdir)/sysdeps/generic \ $(srcdir)/sysdeps/posix \ $(srcdir)/pthread \ @@ -67,6 +67,7 @@ libpthread_a_SOURCES = pt-attr.c pt-attr-destroy.c pt-attr-getdetachstate.c \ pt-once.c \ pt-alloc.c \ pt-create.c \ + pt-getattr.c \ pt-pool-np.c \ pt-equal.c \ pt-dealloc.c \ diff --git a/libpthread/headers.m4 b/libpthread/headers.m4 index 1812e7d..5a58b9b 100644 --- a/libpthread/headers.m4 +++ b/libpthread/headers.m4 @@ -13,8 +13,10 @@ AC_CONFIG_LINKS([ sysroot/include/pthread.h:libpthread/include/pthread.h sysroot/include/pthread/pthread.h:libpthread/include/pthread/pthread.h + sysroot/include/pthread/pthreadtypes.h:libpthread/include/pthread/pthreadtypes.h sysroot/include/bits/memory.h:libpthread/sysdeps/${arch}/bits/memory.h sysroot/include/bits/spin-lock.h:libpthread/sysdeps/${arch}/bits/spin-lock.h + sysroot/include/bits/spin-lock-inline.h:libpthread/sysdeps/${arch}/bits/spin-lock-inline.h sysroot/include/bits/pthreadtypes.h:libpthread/sysdeps/generic/bits/pthreadtypes.h sysroot/include/bits/barrier-attr.h:libpthread/sysdeps/generic/bits/barrier-attr.h sysroot/include/bits/barrier.h:libpthread/sysdeps/generic/bits/barrier.h diff --git a/libpthread/include/libc-symbols.h b/libpthread/include/libc-symbols.h index efbd0c5..54dd6e2 100644 --- a/libpthread/include/libc-symbols.h +++ b/libpthread/include/libc-symbols.h @@ -1,6 +1,7 @@ /* Support macros for making weak and strong aliases for symbols, and for using symbol sets and linker warnings with GNU ld. - Copyright (C) 1995-1998,2000,2001,2002 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2008 + 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,6 +61,7 @@ #define HAVE_ELF #define HAVE_SECTION_QUOTES #define HAVE_VISIBILITY_ATTRIBUTE +#define HAVE_ASM_PREVIOUS_DIRECTIVE // #define SHARED /* The symbols in all the user (non-_) macros are C symbols. diff --git a/libpthread/include/pthread/pthread.h b/libpthread/include/pthread/pthread.h index 7f69573..c6e056a 100644 --- a/libpthread/include/pthread/pthread.h +++ b/libpthread/include/pthread/pthread.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2000, 2002, 2005, 2008 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002, 2005, 2006, 2007, 2008 + 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 @@ -25,67 +26,56 @@ #include <features.h> -#include <sched.h> -#define __need_clockid_t -#include <time.h> - -/* If we are in a mode where clockid_t is not automatically defined - and another header has already included <time.h> then defining - __need_clockid_t was not enough. */ -#ifndef __clockid_t_defined -# define __clockid_t_defined 1 -# include <bits/types.h> -/* Clock ID used in clock and timer functions. */ -typedef __clockid_t clockid_t; +#include <sys/cdefs.h> +#ifndef __extern_inline +/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 + inline semantics, unless -fgnu89-inline is used. */ +# if !defined __cplusplus || __GNUC_PREREQ (4,3) +# if defined __GNUC_STDC_INLINE__ || defined __cplusplus +# define __extern_inline extern __inline __attribute__ ((__gnu_inline__)) +# if __GNUC_PREREQ (4,3) +# define __extern_always_inline \ + extern __always_inline __attribute__ ((__gnu_inline__, __artificial__)) +# else +# define __extern_always_inline \ + extern __always_inline __attribute__ ((__gnu_inline__)) +# endif +# else +# define __extern_inline extern __inline +# define __extern_always_inline extern __always_inline +# endif +# endif #endif +#include <sched.h> + __BEGIN_DECLS +#include <pthread/pthreadtypes.h> + #include <bits/pthread.h> /* Possible values for the process shared attribute. */ -enum __pthread_process_shared - { - PTHREAD_PROCESS_PRIVATE = 0, -#define PTHREAD_PROCESS_PRIVATE 0 - PTHREAD_PROCESS_SHARED -#define PTHREAD_PROCESS_SHARED 1 - }; +#define PTHREAD_PROCESS_PRIVATE __PTHREAD_PROCESS_PRIVATE +#define PTHREAD_PROCESS_SHARED __PTHREAD_PROCESS_SHARED /* Thread attributes. */ /* Possible values for the inheritsched attribute. */ -enum __pthread_inheritsched - { - PTHREAD_EXPLICIT_SCHED = 0, -#define PTHREAD_EXPLICIT_SCHED 0 - PTHREAD_INHERIT_SCHED -#define PTHREAD_INHERIT_SCHED 1 - }; +#define PTHREAD_EXPLICIT_SCHED __PTHREAD_EXPLICIT_SCHED +#define PTHREAD_INHERIT_SCHED __PTHREAD_INHERIT_SCHED /* Possible values for the `contentionscope' attribute. */ -enum __pthread_contentionscope - { - PTHREAD_SCOPE_SYSTEM = 0, -#define PTHREAD_SCOPE_SYSTEM 0 - PTHREAD_SCOPE_PROCESS, -#define PTHREAD_SCOPE_PROCESS 1 - }; +#define PTHREAD_SCOPE_SYSTEM __PTHREAD_SCOPE_SYSTEM +#define PTHREAD_SCOPE_PROCESS __PTHREAD_SCOPE_PROCESS /* Possible values for the `detachstate' attribute. */ -enum __pthread_detachstate - { - PTHREAD_CREATE_JOINABLE = 0, -#define PTHREAD_CREATE_JOINABLE 0 - PTHREAD_CREATE_DETACHED -#define PTHREAD_CREATE_DETACHED 1 - }; +#define PTHREAD_CREATE_JOINABLE __PTHREAD_CREATE_JOINABLE +#define PTHREAD_CREATE_DETACHED __PTHREAD_CREATE_DETACHED #include <bits/thread-attr.h> -typedef struct __pthread_attr pthread_attr_t; - /* Initialize the thread attribute object in *ATTR to the default values. */ extern int pthread_attr_init (pthread_attr_t *attr); @@ -188,6 +178,13 @@ extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict attr, /* Set the value of the stacksize attribute in *ATTR to STACKSIZE. */ extern int pthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize); + +#ifdef __USE_GNU +/* Initialize thread attribute *ATTR with attributes corresponding to the + already running thread THREAD. It shall be called on an uninitialized ATTR + and destroyed with pthread_attr_destroy when no longer needed. */ +extern int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr); +#endif /* Create a thread with attributes given by ATTR, executing @@ -213,47 +210,48 @@ extern int pthread_detach (pthread_t __threadp); if they are not. */ extern int pthread_equal (pthread_t __t1, pthread_t __t2); +# ifdef __USE_EXTERN_INLINES + +__extern_inline int +pthread_equal (pthread_t __t1, pthread_t __t2) +{ + return __pthread_equal (__t1, __t2); +} + +# endif /* Use extern inlines. */ + + /* Return the thread ID of the calling thread. */ extern pthread_t pthread_self (void); /* Mutex attributes. */ -enum __pthread_mutex_protocol - { - PTHREAD_PRIO_NONE_NP = 0, - PTHREAD_PRIO_INHERIT_NP, - PTHREAD_PRIO_PROTECT_NP +#define PTHREAD_PRIO_NONE_NP __PTHREAD_PRIO_NONE +#define PTHREAD_PRIO_INHERIT_NP __PTHREAD_PRIO_INHERIT +#define PTHREAD_PRIO_PROTECT_NP __PTHREAD_PRIO_PROTECT #ifdef __USE_UNIX98 - , - PTHREAD_PRIO_NONE = PTHREAD_PRIO_NONE_NP, - PTHREAD_PRIO_INHERIT = PTHREAD_PRIO_INHERIT_NP, - PTHREAD_PRIO_PROTECT = PTHREAD_PRIO_PROTECT_NP +#define PTHREAD_PRIO_NONE PTHREAD_PRIO_NONE_NP +#define PTHREAD_PRIO_INHERIT PTHREAD_PRIO_INHERIT_NP +#define PTHREAD_PRIO_PROTECT PTHREAD_PRIO_PROTECT_NP #endif - }; -enum __pthread_mutex_type - { - PTHREAD_MUTEX_TIMED_NP = 0, - PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_RECURSIVE_NP +#define PTHREAD_MUTEX_TIMED_NP __PTHREAD_MUTEX_TIMED +#define PTHREAD_MUTEX_ERRORCHECK_NP __PTHREAD_MUTEX_ERRORCHECK +#define PTHREAD_MUTEX_RECURSIVE_NP __PTHREAD_MUTEX_RECURSIVE #ifdef __USE_UNIX98 - , - PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP, - PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL +#define PTHREAD_MUTEX_NORMAL PTHREAD_MUTEX_TIMED_NP +#define PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK_NP +#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP +#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL #endif #ifdef __USE_GNU - /* For compatibility. */ - , PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_TIMED_NP +/* For compatibility. */ +#define PTHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_TIMED_NP #endif - }; #include <bits/mutex-attr.h> -typedef struct __pthread_mutexattr pthread_mutexattr_t; - /* Initialize the mutex attribute object in *ATTR to the default values. */ extern int pthread_mutexattr_init(pthread_mutexattr_t *attr); @@ -311,8 +309,6 @@ extern int pthread_mutexattr_settype(pthread_mutexattr_t *attr, #include <bits/mutex.h> -typedef struct __pthread_mutex pthread_mutex_t; - #define PTHREAD_MUTEX_INITIALIZER __PTHREAD_MUTEX_INITIALIZER /* Static initializer for recursive mutexes. */ #define PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP \ @@ -365,8 +361,6 @@ extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict mutex, #include <bits/condition-attr.h> -typedef struct __pthread_condattr pthread_condattr_t; - /* Initialize the condition attribute in *ATTR to the default values. */ extern int pthread_condattr_init (pthread_condattr_t *attr); @@ -401,8 +395,6 @@ extern int pthread_condattr_setpshared (pthread_condattr_t *attr, #include <bits/condition.h> -typedef struct __pthread_cond pthread_cond_t; - #define PTHREAD_COND_INITIALIZER __PTHREAD_COND_INITIALIZER extern int pthread_cond_init (pthread_cond_t *__restrict cond, @@ -438,8 +430,6 @@ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, # include <bits/spin-lock.h> -typedef __pthread_spinlock_t pthread_spinlock_t; - #define PTHREAD_SPINLOCK_INITIALIZER __SPIN_LOCK_INITIALIZER /* Destroy the spin lock object LOCK. */ @@ -462,31 +452,33 @@ extern int pthread_spin_unlock (pthread_spinlock_t *__lock); # ifdef __USE_EXTERN_INLINES -extern __inline int +# include <bits/spin-lock-inline.h> + +__extern_inline int pthread_spin_destroy (pthread_spinlock_t *__lock) { return __pthread_spin_destroy (__lock); } -extern __inline int +__extern_inline int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared) { return __pthread_spin_init (__lock, __pshared); } -extern __inline int +__extern_inline int pthread_spin_lock (pthread_spinlock_t *__lock) { return __pthread_spin_lock (__lock); } -extern __inline int +__extern_inline int pthread_spin_trylock (pthread_spinlock_t *__lock) { return __pthread_spin_trylock (__lock); } -extern __inline int +__extern_inline int pthread_spin_unlock (pthread_spinlock_t *__lock) { return __pthread_spin_unlock (__lock); @@ -503,8 +495,6 @@ pthread_spin_unlock (pthread_spinlock_t *__lock) #include <bits/rwlock-attr.h> -typedef struct __pthread_rwlockattr pthread_rwlockattr_t; - /* Initialize rwlock attribute object in *ATTR to the default values. */ extern int pthread_rwlockattr_init (pthread_rwlockattr_t *attr); @@ -528,8 +518,6 @@ extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *attr, #include <bits/rwlock.h> -typedef struct __pthread_rwlock pthread_rwlock_t; - /* Create a rwlock object with attributes given by ATTR and strore the result in *RWLOCK. */ extern int pthread_rwlock_init (pthread_rwlock_t *__restrict rwlock, @@ -581,6 +569,9 @@ extern void pthread_cleanup_pop (int execute); #include <bits/cancelation.h> +#define pthread_cleanup_push(rt, rtarg) __pthread_cleanup_push(rt, rtarg) +#define pthread_cleanup_pop(execute) __pthread_cleanup_pop(execute) + #define PTHREAD_CANCEL_DISABLE 0 #define PTHREAD_CANCEL_ENABLE 1 @@ -612,8 +603,6 @@ extern void pthread_testcancel (void); #include <bits/barrier-attr.h> -typedef struct __pthread_barrierattr pthread_barrierattr_t; - /* Initialize barrier attribute object in *ATTR to the default values. */ extern int pthread_barrierattr_init (pthread_barrierattr_t *attr); @@ -637,8 +626,6 @@ extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *attr, #include <bits/barrier.h> -typedef struct __pthread_barrier pthread_barrier_t; - /* Returned by pthread_barrier_wait to exactly one thread each time a barrier is passed. */ #define PTHREAD_BARRIER_SERIAL_THREAD -1 @@ -662,8 +649,6 @@ extern int pthread_barrier_wait (pthread_barrier_t *barrier); #include <bits/thread-specific.h> -typedef __pthread_key pthread_key_t; - /* Create a thread specific data key in KEY visible to all threads. On thread destruction, DESTRUCTOR shall be called with the thread specific data associate with KEY if it is not NULL. */ @@ -685,8 +670,6 @@ extern int pthread_setspecific (pthread_key_t key, const void *value); #include <bits/once.h> -typedef struct __pthread_once pthread_once_t; - #define PTHREAD_ONCE_INIT __PTHREAD_ONCE_INIT /* Call INIT_ROUTINE if this function has never been called with diff --git a/libpthread/include/pthread/pthreadtypes.h b/libpthread/include/pthread/pthreadtypes.h new file mode 100644 index 0000000..471e08e --- /dev/null +++ b/libpthread/include/pthread/pthreadtypes.h @@ -0,0 +1,136 @@ +/* Copyright (C) 2000, 2002, 2005, 2008 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * POSIX Threads Extension: ??? <pthreadtypes.h> + */ + +#ifndef _PTHREADTYPES_H +#define _PTHREADTYPES_H 1 + +#include <features.h> + +#define __need_clockid_t +#include <time.h> + +/* If we are in a mode where clockid_t is not automatically defined + and another header has already included <time.h> then defining + __need_clockid_t was not enough. */ +#ifndef __clockid_t_defined +# define __clockid_t_defined 1 +# include <bits/types.h> +/* Clock ID used in clock and timer functions. */ +typedef __clockid_t clockid_t; +#endif + +__BEGIN_DECLS + +#include <bits/pthread.h> +typedef __pthread_t pthread_t; + +/* Possible values for the process shared attribute. */ +enum __pthread_process_shared + { + __PTHREAD_PROCESS_PRIVATE = 0, + __PTHREAD_PROCESS_SHARED + }; + +/* Possible values for the inheritsched attribute. */ +enum __pthread_inheritsched + { + __PTHREAD_EXPLICIT_SCHED = 0, + __PTHREAD_INHERIT_SCHED + }; + +/* Possible values for the `contentionscope' attribute. */ +enum __pthread_contentionscope + { + __PTHREAD_SCOPE_SYSTEM = 0, + __PTHREAD_SCOPE_PROCESS + }; + +/* Possible values for the `detachstate' attribute. */ +enum __pthread_detachstate + { + __PTHREAD_CREATE_JOINABLE = 0, + __PTHREAD_CREATE_DETACHED + }; + +#include <bits/thread-attr.h> +typedef struct __pthread_attr pthread_attr_t; + +enum __pthread_mutex_protocol + { + __PTHREAD_PRIO_NONE= 0, + __PTHREAD_PRIO_INHERIT, + __PTHREAD_PRIO_PROTECT + }; + +enum __pthread_mutex_type + { + __PTHREAD_MUTEX_TIMED, + __PTHREAD_MUTEX_ERRORCHECK, + __PTHREAD_MUTEX_RECURSIVE + }; + +#include <bits/mutex-attr.h> +typedef struct __pthread_mutexattr pthread_mutexattr_t; + +#include <bits/mutex.h> +typedef struct __pthread_mutex pthread_mutex_t; + +#include <bits/condition-attr.h> +typedef struct __pthread_condattr pthread_condattr_t; + +#include <bits/condition.h> +typedef struct __pthread_cond pthread_cond_t; + +#ifdef __USE_XOPEN2K +# include <bits/spin-lock.h> +typedef __pthread_spinlock_t pthread_spinlock_t; +#endif /* XPG6. */ + +#if defined __USE_UNIX98 || defined __USE_XOPEN2K + +#include <bits/rwlock-attr.h> +typedef struct __pthread_rwlockattr pthread_rwlockattr_t; + +#include <bits/rwlock.h> +typedef struct __pthread_rwlock pthread_rwlock_t; + +#endif /* __USE_UNIX98 || __USE_XOPEN2K */ + +#ifdef __USE_XOPEN2K + +#include <bits/barrier-attr.h> +typedef struct __pthread_barrierattr pthread_barrierattr_t; + +#include <bits/barrier.h> +typedef struct __pthread_barrier pthread_barrier_t; + +#endif /* __USE_XOPEN2K */ + +#include <bits/thread-specific.h> +typedef __pthread_key pthread_key_t; + +#include <bits/once.h> +typedef struct __pthread_once pthread_once_t; + +__END_DECLS + +#endif /* pthreadtypes.h */ diff --git a/libpthread/include/semaphore.h b/libpthread/include/semaphore.h index 06c9e73..657e796 100644 --- a/libpthread/include/semaphore.h +++ b/libpthread/include/semaphore.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 Free Software Foundation, Inc. +/* Copyright (C) 2005, 2007 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 diff --git a/libpthread/pthread/pt-getattr.c b/libpthread/pthread/pt-getattr.c new file mode 100644 index 0000000..24599c6 --- /dev/null +++ b/libpthread/pthread/pt-getattr.c @@ -0,0 +1,49 @@ +/* Thread attributes retrieval. + Copyright (C) 2008 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <assert.h> +#include <errno.h> +#include <pthread.h> + +#include <pt-internal.h> + +/* Initialize thread attribute *ATTR with attributes corresponding to the + already running thread THREAD. It shall be called on an uninitialized ATTR + and destroyed with pthread_attr_destroy when no longer needed. */ +int +pthread_getattr_np (pthread_t thread, pthread_attr_t *attr) +{ + struct __pthread *pthread; + + pthread = __pthread_getid(thread); + if (pthread == NULL) + return ESRCH; + + /* Some attributes (schedparam, inheritsched, contentionscope and schedpolicy) + are not supported yet, so fill them with our default values. */ + *attr = __pthread_default_attr; + + attr->stackaddr = pthread->stackaddr; + attr->stacksize = pthread->stacksize; + attr->guardsize = pthread->guardsize; + attr->detachstate = (pthread->state == PTHREAD_DETACHED + ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE); + + return 0; +} diff --git a/libpthread/pthread/pt-internal.h b/libpthread/pthread/pt-internal.h index 53e49e0..9eb84ed 100644 --- a/libpthread/pthread/pt-internal.h +++ b/libpthread/pthread/pt-internal.h @@ -1,5 +1,5 @@ /* Internal defenitions for pthreads library. - Copyright (C) 2000, 2005 Free Software Foundation, Inc. + Copyright (C) 2000, 2005, 2006, 2008 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 diff --git a/libpthread/sysdeps/generic/bits/barrier-attr.h b/libpthread/sysdeps/generic/bits/barrier-attr.h index 86f3cb0..a9900b7 100644 --- a/libpthread/sysdeps/generic/bits/barrier-attr.h +++ b/libpthread/sysdeps/generic/bits/barrier-attr.h @@ -1,5 +1,5 @@ /* Thread barrier attribute type. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 @@ -20,6 +20,8 @@ #ifndef _BITS_BARRIER_ATTR_H #define _BITS_BARRIER_ATTR_H 1 +enum __pthread_process_shared; + /* This structure describes the attributes of a POSIX thread barrier. Note that not all of them are supported on all systems. */ struct __pthread_barrierattr diff --git a/libpthread/sysdeps/generic/bits/cancelation.h b/libpthread/sysdeps/generic/bits/cancelation.h index bb6b58a..f446d59 100644 --- a/libpthread/sysdeps/generic/bits/cancelation.h +++ b/libpthread/sysdeps/generic/bits/cancelation.h @@ -1,5 +1,5 @@ /* Cancelation. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 @@ -32,7 +32,7 @@ struct __pthread_cancelation_handler /* Returns the thread local location of the cleanup handler stack. */ struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void); -#define pthread_cleanup_push(rt, rtarg) \ +#define __pthread_cleanup_push(rt, rtarg) \ { \ struct __pthread_cancelation_handler **__handlers \ = __pthread_get_cleanup_stack (); \ @@ -44,7 +44,7 @@ struct __pthread_cancelation_handler **__pthread_get_cleanup_stack (void); }; \ *__handlers = &__handler; -#define pthread_cleanup_pop(execute) \ +#define __pthread_cleanup_pop(execute) \ if (execute) \ __handler.handler (__handler.arg); \ assert (*__handlers == &__handler); \ diff --git a/libpthread/sysdeps/generic/bits/condition-attr.h b/libpthread/sysdeps/generic/bits/condition-attr.h index 2d48dfb..a131128 100644 --- a/libpthread/sysdeps/generic/bits/condition-attr.h +++ b/libpthread/sysdeps/generic/bits/condition-attr.h @@ -1,5 +1,5 @@ /* Condition attribute type. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 @@ -22,6 +22,8 @@ #include <time.h> +enum __pthread_process_shared; + /* User visible part of a condition attribute variable. */ struct __pthread_condattr { diff --git a/libpthread/sysdeps/generic/bits/mutex-attr.h b/libpthread/sysdeps/generic/bits/mutex-attr.h index 420d5d1..9161cda 100644 --- a/libpthread/sysdeps/generic/bits/mutex-attr.h +++ b/libpthread/sysdeps/generic/bits/mutex-attr.h @@ -20,6 +20,10 @@ #ifndef _BITS_MUTEX_ATTR_H #define _BITS_MUTEX_ATTR_H 1 +enum __pthread_mutex_protocol; +enum __pthread_process_shared; +enum __pthread_mutex_type; + /* This structure describes the attributes of a POSIX mutex attribute. */ struct __pthread_mutexattr diff --git a/libpthread/sysdeps/generic/bits/mutex.h b/libpthread/sysdeps/generic/bits/mutex.h index e0ae3db..f5f3fa9 100644 --- a/libpthread/sysdeps/generic/bits/mutex.h +++ b/libpthread/sysdeps/generic/bits/mutex.h @@ -1,5 +1,8 @@ /* Mutex type. Generic version. - Copyright (C) 2000, 2002, 2005, 2008 Free Software Foundation, Inc. + + Copyright (C) 2000, 2002, 2005, 2006, 2007, 2008 + 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 @@ -61,11 +64,4 @@ struct __pthread_mutex # endif #endif /* Not __pthread_mutex_defined. */ -#ifdef _BITS_MUTEX_H - -#include <errno.h> -#include <stddef.h> - -#endif - #endif /* bits/mutex.h */ diff --git a/libpthread/sysdeps/generic/bits/pthread.h b/libpthread/sysdeps/generic/bits/pthread.h index 3f9df13..80e6b09 100644 --- a/libpthread/sysdeps/generic/bits/pthread.h +++ b/libpthread/sysdeps/generic/bits/pthread.h @@ -1,5 +1,5 @@ /* Pthread data structures. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 @@ -20,14 +20,19 @@ #ifndef _BITS_PTHREAD_H #define _BITS_PTHREAD_H 1 -typedef int pthread_t; +typedef int __pthread_t; /* Return true if __T1 and __T2 both name the same thread. Otherwise, false. */ -extern __inline int -pthread_equal (pthread_t __t1, pthread_t __t2) +extern int +__pthread_equal (__pthread_t __t1, __pthread_t __t2); + +#ifdef __USE_EXTERN_INLINES +__extern_inline int +__pthread_equal (__pthread_t __t1, __pthread_t __t2) { return __t1 == __t2; } +#endif #endif /* bits/pthread.h */ diff --git a/libpthread/sysdeps/generic/bits/rwlock-attr.h b/libpthread/sysdeps/generic/bits/rwlock-attr.h index 44765bd..dba99f1 100644 --- a/libpthread/sysdeps/generic/bits/rwlock-attr.h +++ b/libpthread/sysdeps/generic/bits/rwlock-attr.h @@ -1,5 +1,5 @@ /* Thread rwlock attribute type. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 @@ -20,6 +20,8 @@ #ifndef _BITS_RWLOCK_ATTR_H #define _BITS_RWLOCK_ATTR_H 1 +enum __pthread_process_shared; + /* This structure describes the attributes of a POSIX thread rwlock. Note that not all of them are supported on all systems. */ struct __pthread_rwlockattr diff --git a/libpthread/sysdeps/generic/bits/rwlock.h b/libpthread/sysdeps/generic/bits/rwlock.h index 696f9c2..3d600ec 100644 --- a/libpthread/sysdeps/generic/bits/rwlock.h +++ b/libpthread/sysdeps/generic/bits/rwlock.h @@ -1,5 +1,5 @@ /* rwlock type. Generic version. - Copyright (C) 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 2006, 2007 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 diff --git a/libpthread/sysdeps/generic/bits/thread-attr.h b/libpthread/sysdeps/generic/bits/thread-attr.h index 3163022..c3a93fd 100644 --- a/libpthread/sysdeps/generic/bits/thread-attr.h +++ b/libpthread/sysdeps/generic/bits/thread-attr.h @@ -1,5 +1,5 @@ /* Thread attribute type. Generic version. - Copyright (C) 2000,02 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2008 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 @@ -22,6 +22,10 @@ #include <sched.h> +enum __pthread_detachstate; +enum __pthread_inheritsched; +enum __pthread_contentionscope; + /* This structure describes the attributes of a POSIX thread. Note that not all of them are supported on all systems. */ struct __pthread_attr diff --git a/libpthread/sysdeps/generic/bits/thread-barrier.h b/libpthread/sysdeps/generic/bits/thread-barrier.h deleted file mode 100644 index 23d51ae..0000000 --- a/libpthread/sysdeps/generic/bits/thread-barrier.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Thread barrier attribute type. Generic version. - Copyright (C) 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 - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _BITS_THREAD_BARRIER_H -#define _BITS_THREAD_BARRIER_H 1 - -/* This structure describes the attributes of a POSIX thread barrier. - Note that not all of them are supported on all systems. */ -struct __pthread_attr -{ - enum __ -}; - -#endif /* bits/thread-barrier.h */ diff --git a/libpthread/sysdeps/generic/pt-mutex-destroy.c b/libpthread/sysdeps/generic/pt-mutex-destroy.c index 0c9d514..b0ca00f 100644 --- a/libpthread/sysdeps/generic/pt-mutex-destroy.c +++ b/libpthread/sysdeps/generic/pt-mutex-destroy.c @@ -1,5 +1,5 @@ /* Destroy a mutex. Generic version. - Copyright (C) 2000,02, 2008 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 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 diff --git a/libpthread/sysdeps/generic/pt-mutex-init.c b/libpthread/sysdeps/generic/pt-mutex-init.c index 83f5b18..a818fe3 100644 --- a/libpthread/sysdeps/generic/pt-mutex-init.c +++ b/libpthread/sysdeps/generic/pt-mutex-init.c @@ -1,5 +1,5 @@ /* Initialize a mutex. Generic version. - Copyright (C) 2000, 2002, 2005, 2008 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2005, 2006, 2008 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 diff --git a/libpthread/sysdeps/generic/pt-mutex-lock.c b/libpthread/sysdeps/generic/pt-mutex-lock.c index 60fc55a..528e593 100644 --- a/libpthread/sysdeps/generic/pt-mutex-lock.c +++ b/libpthread/sysdeps/generic/pt-mutex-lock.c @@ -1,5 +1,5 @@ /* Lock a mutex. Generic version. - Copyright (C) 2000,02 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 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 diff --git a/libpthread/sysdeps/generic/pt-rwlock-destroy.c b/libpthread/sysdeps/generic/pt-rwlock-destroy.c index 034d930..045eebd 100644 --- a/libpthread/sysdeps/generic/pt-rwlock-destroy.c +++ b/libpthread/sysdeps/generic/pt-rwlock-destroy.c @@ -1,5 +1,5 @@ /* Destroy a rwlock. Generic version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 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 diff --git a/libpthread/sysdeps/generic/pt-rwlock-init.c b/libpthread/sysdeps/generic/pt-rwlock-init.c index 8aa495e..c9ff9b2 100644 --- a/libpthread/sysdeps/generic/pt-rwlock-init.c +++ b/libpthread/sysdeps/generic/pt-rwlock-init.c @@ -1,5 +1,5 @@ /* Initialize a rwlock. Generic version. - Copyright (C) 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 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 diff --git a/libpthread/sysdeps/generic/sem-destroy.c b/libpthread/sysdeps/generic/sem-destroy.c index 985f4ad..6486599 100644 --- a/libpthread/sysdeps/generic/sem-destroy.c +++ b/libpthread/sysdeps/generic/sem-destroy.c @@ -1,5 +1,5 @@ /* Destroy a semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 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 diff --git a/libpthread/sysdeps/generic/sem-getvalue.c b/libpthread/sysdeps/generic/sem-getvalue.c index 8e418e3..7762089 100644 --- a/libpthread/sysdeps/generic/sem-getvalue.c +++ b/libpthread/sysdeps/generic/sem-getvalue.c @@ -1,5 +1,5 @@ /* Get the value of a semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 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 diff --git a/libpthread/sysdeps/generic/sem-init.c b/libpthread/sysdeps/generic/sem-init.c index 6c6d79e..d2414f5 100644 --- a/libpthread/sysdeps/generic/sem-init.c +++ b/libpthread/sysdeps/generic/sem-init.c @@ -1,5 +1,5 @@ /* Initialize a semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 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 diff --git a/libpthread/sysdeps/generic/sem-open.c b/libpthread/sysdeps/generic/sem-open.c index 9eb13aa..bae87ed 100644 --- a/libpthread/sysdeps/generic/sem-open.c +++ b/libpthread/sysdeps/generic/sem-open.c @@ -1,5 +1,5 @@ /* Open a named semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 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 diff --git a/libpthread/sysdeps/generic/sem-post.c b/libpthread/sysdeps/generic/sem-post.c index 0e20ea7..6d438bf 100644 --- a/libpthread/sysdeps/generic/sem-post.c +++ b/libpthread/sysdeps/generic/sem-post.c @@ -1,5 +1,5 @@ /* Post a semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 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 diff --git a/libpthread/sysdeps/generic/sem-timedwait.c b/libpthread/sysdeps/generic/sem-timedwait.c index 995cf09..e34539a 100644 --- a/libpthread/sysdeps/generic/sem-timedwait.c +++ b/libpthread/sysdeps/generic/sem-timedwait.c @@ -1,5 +1,5 @@ /* Wait on a semaphore with a timeout. Generic version. - Copyright (C) 2005, 2008 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2008 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 diff --git a/libpthread/sysdeps/generic/sem-trywait.c b/libpthread/sysdeps/generic/sem-trywait.c index 199f317..437e282 100644 --- a/libpthread/sysdeps/generic/sem-trywait.c +++ b/libpthread/sysdeps/generic/sem-trywait.c @@ -1,5 +1,5 @@ /* Lock a semaphore if it does not require blocking. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 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 diff --git a/libpthread/sysdeps/generic/sem-unlink.c b/libpthread/sysdeps/generic/sem-unlink.c index 519f4f7..570ed61 100644 --- a/libpthread/sysdeps/generic/sem-unlink.c +++ b/libpthread/sysdeps/generic/sem-unlink.c @@ -1,5 +1,5 @@ /* Unlink a named semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 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 diff --git a/libpthread/sysdeps/generic/sem-wait.c b/libpthread/sysdeps/generic/sem-wait.c index 50752f3..8347480 100644 --- a/libpthread/sysdeps/generic/sem-wait.c +++ b/libpthread/sysdeps/generic/sem-wait.c @@ -1,5 +1,5 @@ /* Wait on a semaphore. Generic version. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 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 diff --git a/libpthread/sysdeps/ia32/bits/memory.h b/libpthread/sysdeps/ia32/bits/memory.h index 201305b..932c408 100644 --- a/libpthread/sysdeps/ia32/bits/memory.h +++ b/libpthread/sysdeps/ia32/bits/memory.h @@ -1,5 +1,5 @@ /* Memory barrier operations. i386 version. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2008 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 @@ -21,14 +21,14 @@ #define _BITS_MEMORY_H 1 /* Prevent read and write reordering across this function. */ -inline void +static inline void __memory_barrier (void) { int i; /* Any lock'ed instruction will do. We just do a simple increment. */ - __asm__ __volatile ("lock; incl %0" : "=m" (i) : "m" (i)); + __asm__ __volatile ("lock; incl %0" : "=m" (i) : "m" (i) : "memory"); } /* Prevent read reordering across this function. */ diff --git a/libpthread/sysdeps/ia32/bits/spin-lock-inline.h b/libpthread/sysdeps/ia32/bits/spin-lock-inline.h new file mode 100644 index 0000000..0f3ca58 --- /dev/null +++ b/libpthread/sysdeps/ia32/bits/spin-lock-inline.h @@ -0,0 +1,98 @@ +/* Machine-specific definitions for spin locks. i386 version. + Copyright (C) 2000, 2005, 2008 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 + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * Never include this file directly; use <pthread.h> or <cthreads.h> instead. + */ + +#ifndef _BITS_SPIN_LOCK_INLINE_H +#define _BITS_SPIN_LOCK_INLINE_H 1 + +#include <features.h> +#include <bits/spin-lock.h> + +__BEGIN_DECLS + +#if defined __USE_EXTERN_INLINES || defined _FORCE_INLINES + +# ifndef __EBUSY +# include <errno.h> +# define __EBUSY EBUSY +# endif + +# ifndef __PT_SPIN_INLINE +# define __PT_SPIN_INLINE __extern_inline +# endif + +__PT_SPIN_INLINE int __pthread_spin_destroy (__pthread_spinlock_t *__lock); + +__PT_SPIN_INLINE int +__pthread_spin_destroy (__pthread_spinlock_t *__lock) +{ + return 0; +} + +__PT_SPIN_INLINE int __pthread_spin_init (__pthread_spinlock_t *__lock, + int __pshared); + +__PT_SPIN_INLINE int +__pthread_spin_init (__pthread_spinlock_t *__lock, int __pshared) +{ + *__lock = __SPIN_LOCK_INITIALIZER; + return 0; +} + +__PT_SPIN_INLINE int __pthread_spin_trylock (__pthread_spinlock_t *__lock); + +__PT_SPIN_INLINE int +__pthread_spin_trylock (__pthread_spinlock_t *__lock) +{ + int __locked; + __asm__ __volatile ("xchgl %0, %1" + : "=&r" (__locked), "=m" (*__lock) : "0" (1) : "memory"); + return __locked ? __EBUSY : 0; +} + +__extern_inline int __pthread_spin_lock (__pthread_spinlock_t *__lock); +extern int _pthread_spin_lock (__pthread_spinlock_t *__lock); + +__extern_inline int +__pthread_spin_lock (__pthread_spinlock_t *__lock) +{ + if (__pthread_spin_trylock (__lock)) + return _pthread_spin_lock (__lock); + return 0; +} + +__PT_SPIN_INLINE int __pthread_spin_unlock (__pthread_spinlock_t *__lock); + +__PT_SPIN_INLINE int +__pthread_spin_unlock (__pthread_spinlock_t *__lock) +{ + int __unlocked; + __asm__ __volatile ("xchgl %0, %1" + : "=&r" (__unlocked), "=m" (*__lock) : "0" (0) : "memory"); + return 0; +} + +#endif /* Use extern inlines or force inlines. */ + +__END_DECLS + +#endif /* bits/spin-lock.h */ diff --git a/libpthread/sysdeps/ia32/bits/spin-lock.h b/libpthread/sysdeps/ia32/bits/spin-lock.h index 175656e..71af163 100644 --- a/libpthread/sysdeps/ia32/bits/spin-lock.h +++ b/libpthread/sysdeps/ia32/bits/spin-lock.h @@ -1,5 +1,5 @@ /* Machine-specific definitions for spin locks. i386 version. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2005, 2008 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,70 +34,6 @@ typedef __volatile int __pthread_spinlock_t; /* Initializer for a spin lock object. */ # define __SPIN_LOCK_INITIALIZER ((__pthread_spinlock_t) 0) -#if defined __USE_EXTERN_INLINES || defined _FORCE_INLINES - -# ifndef __EBUSY -# include <errno.h> -# define __EBUSY EBUSY -# endif - -# ifndef __PT_SPIN_INLINE -# define __PT_SPIN_INLINE extern __inline -# endif - -__PT_SPIN_INLINE int __pthread_spin_destroy (__pthread_spinlock_t *__lock); - -__PT_SPIN_INLINE int -__pthread_spin_destroy (__pthread_spinlock_t *__lock) -{ - return 0; -} - -__PT_SPIN_INLINE int __pthread_spin_init (__pthread_spinlock_t *__lock, - int __pshared); - -__PT_SPIN_INLINE int -__pthread_spin_init (__pthread_spinlock_t *__lock, int __pshared) -{ - *__lock = __SPIN_LOCK_INITIALIZER; - return 0; -} - -__PT_SPIN_INLINE int __pthread_spin_trylock (__pthread_spinlock_t *__lock); - -__PT_SPIN_INLINE int -__pthread_spin_trylock (__pthread_spinlock_t *__lock) -{ - int __locked; - __asm__ __volatile ("xchgl %0, %1" - : "=&r" (__locked), "=m" (*__lock) : "0" (1)); - return __locked ? __EBUSY : 0; -} - -extern inline int __pthread_spin_lock (__pthread_spinlock_t *__lock); -extern int _pthread_spin_lock (__pthread_spinlock_t *__lock); - -extern inline int -__pthread_spin_lock (__pthread_spinlock_t *__lock) -{ - if (__pthread_spin_trylock (__lock)) - return _pthread_spin_lock (__lock); - return 0; -} - -__PT_SPIN_INLINE int __pthread_spin_unlock (__pthread_spinlock_t *__lock); - -__PT_SPIN_INLINE int -__pthread_spin_unlock (__pthread_spinlock_t *__lock) -{ - int __unlocked; - __asm__ __volatile ("xchgl %0, %1" - : "=&r" (__unlocked), "=m" (*__lock) : "0" (0)); - return 0; -} - -#endif /* Use extern inlines or force inlines. */ - __END_DECLS #endif /* bits/spin-lock.h */ diff --git a/libpthread/sysdeps/ia32/machine-sp.h b/libpthread/sysdeps/ia32/machine-sp.h index 536f690..39a8b69 100644 --- a/libpthread/sysdeps/ia32/machine-sp.h +++ b/libpthread/sysdeps/ia32/machine-sp.h @@ -1,5 +1,5 @@ /* Machine-specific function to return the stack pointer. i386 version. - Copyright (C) 1994,97,2001 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 2001, 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 diff --git a/libpthread/sysdeps/l4/hurd/ia32/pt-setup.c b/libpthread/sysdeps/l4/hurd/ia32/pt-setup.c index cc2f075..579905c 100644 --- a/libpthread/sysdeps/l4/hurd/ia32/pt-setup.c +++ b/libpthread/sysdeps/l4/hurd/ia32/pt-setup.c @@ -72,6 +72,9 @@ stack_setup (struct __pthread *thread, /* Calculate top of the new stack. */ top = (uintptr_t *) ((uintptr_t) thread->stackaddr + thread->stacksize); + /* Align on 0x10 for MMX operations. */ + top = (uintptr_t) top & ~0xf; + if (start_routine) { /* Set up call frame. */ |