summaryrefslogtreecommitdiff
path: root/sysdeps/mach
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2008-08-12 13:03:06 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-04-07 23:29:53 +0200
commitf214670f86b9355183e2478dd1827474f60439b8 (patch)
treeb66ca2ddbbce91ff1c6c68d924b38e420be6b7a4 /sysdeps/mach
parent7a69a458fe11877a7b162191a6c583d7c6bd764f (diff)
parent0236089d351775cf41a9a951621b7c083488ec20 (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.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/bits/spin-lock-inline.h90
-rw-r--r--sysdeps/mach/bits/spin-lock.h61
-rw-r--r--sysdeps/mach/hurd/ia32/pt-setup.c10
-rw-r--r--sysdeps/mach/hurd/pt-docancel.c4
4 files changed, 99 insertions, 66 deletions
diff --git a/sysdeps/mach/bits/spin-lock-inline.h b/sysdeps/mach/bits/spin-lock-inline.h
new file mode 100644
index 0000000..bb066d0
--- /dev/null
+++ b/sysdeps/mach/bits/spin-lock-inline.h
@@ -0,0 +1,90 @@
+/* Definitions of user-visible names for spin locks.
+ Copyright (C) 1994, 1997, 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
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _BITS_SPIN_LOCK_INLINE_H
+#define _BITS_SPIN_LOCK_INLINE_H 1
+
+#include <features.h>
+#include <bits/spin-lock.h>
+#include <machine-lock.h> /* This does all the work. */
+
+__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)
+{
+ return __spin_try_lock (__lock) ? 0 : __EBUSY;
+}
+
+__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)
+{
+ __spin_unlock (__lock);
+ return 0;
+}
+
+#endif /* Use extern inlines or force inlines. */
+
+__END_DECLS
+
+#endif /* bits/spin-lock.h */
diff --git a/sysdeps/mach/bits/spin-lock.h b/sysdeps/mach/bits/spin-lock.h
index e137c24..54425cc 100644
--- a/sysdeps/mach/bits/spin-lock.h
+++ b/sysdeps/mach/bits/spin-lock.h
@@ -1,5 +1,5 @@
/* Definitions of user-visible names for spin locks.
- Copyright (C) 1994, 1997, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1997, 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
@@ -33,65 +33,6 @@ typedef __spin_lock_t __pthread_spinlock_t;
#error __SPIN_LOCK_INITIALIZER undefined: should be defined by <lock-intern.h>.
#endif
-#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)
-{
- return __spin_try_lock (__lock) ? 0 : __EBUSY;
-}
-
-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)
-{
- __spin_unlock (__lock);
- return 0;
-}
-
-#endif /* Use extern inlines or force inlines. */
-
__END_DECLS
#endif /* bits/spin-lock.h */
diff --git a/sysdeps/mach/hurd/ia32/pt-setup.c b/sysdeps/mach/hurd/ia32/pt-setup.c
index 32ace6a..ba438d6 100644
--- a/sysdeps/mach/hurd/ia32/pt-setup.c
+++ b/sysdeps/mach/hurd/ia32/pt-setup.c
@@ -1,5 +1,5 @@
/* Setup thread stack. Hurd/i386 version.
- Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc.
+ 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
@@ -58,13 +58,15 @@ stack_setup (struct __pthread *thread,
top -= __hurd_threadvar_max;
/* Save the self pointer. */
- top[_HURD_THREADVAR_THREAD] = (void *) thread;
+ top[_HURD_THREADVAR_THREAD] = (uintptr_t) thread;
if (start_routine)
{
/* And then the call frame. */
- *--top = (uintptr_t) arg; /* Argument to START_ROUTINE. */
- *--top = (uintptr_t) start_routine;
+ top -= 2;
+ top = (uintptr_t) top & ~0xf;
+ top[1] = (uintptr_t) arg; /* Argument to START_ROUTINE. */
+ top[0] = (uintptr_t) start_routine;
*--top = 0; /* Fake return address. */
}
diff --git a/sysdeps/mach/hurd/pt-docancel.c b/sysdeps/mach/hurd/pt-docancel.c
index bac62a7..b81a5c7 100644
--- a/sysdeps/mach/hurd/pt-docancel.c
+++ b/sysdeps/mach/hurd/pt-docancel.c
@@ -1,5 +1,5 @@
/* Cancel a thread.
- 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
@@ -33,7 +33,7 @@ __pthread_do_cancel (struct __pthread *p)
mach_port_t ktid;
int me;
- assert (p->cancel_pending = 1);
+ assert (p->cancel_pending == 1);
assert (p->cancel_state == PTHREAD_CANCEL_ENABLE);
ktid = __mach_thread_self ();