summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-25 07:44:41 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-25 07:44:41 +0000
commit5f66b766e7b1929b07ab3e0374a9a627a45c9be6 (patch)
tree337255bdc09e5c1f32039ae5f732eeef8059de79
parent51499423041892397b8ee123bbe45fd8eadda534 (diff)
downloadglibc-5f66b766e7b1929b07ab3e0374a9a627a45c9be6.tar.gz
glibc-5f66b766e7b1929b07ab3e0374a9a627a45c9be6.tar.xz
glibc-5f66b766e7b1929b07ab3e0374a9a627a45c9be6.zip
Update.
2004-09-25  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/i386/setuid.c (__setuid): Remove second
	result declaration.

2004-09-22  Andreas Schwab  <schwab@suse.de>

	* sysdeps/unix/sysv/linux/ia64/sysdep.h: Adjust whitespace.
-rw-r--r--ChangeLog9
-rw-r--r--nptl/ChangeLog8
-rw-r--r--nptl/descr.h3
-rw-r--r--nptl/pthread_create.c15
-rw-r--r--nptl/sysdeps/pthread/createthread.c8
-rw-r--r--sysdeps/unix/sysv/linux/i386/setuid.c1
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sysdep.h20
7 files changed, 45 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 30772a98bd..9d835e94e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-09-25  Jakub Jelinek  <jakub@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/setuid.c (__setuid): Remove second
+	result declaration.
+
+2004-09-22  Andreas Schwab  <schwab@suse.de>
+
+	* sysdeps/unix/sysv/linux/ia64/sysdep.h: Adjust whitespace.
+
 2004-09-24  Ulrich Drepper  <drepper@redhat.com>
 
 	* misc/daemon.c (daemon): Don't succeed if /dev/null cannot be
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 01c6c10165..157b793f42 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,11 @@
+2004-09-25  Ulrich Drepper  <drepper@redhat.com>
+
+	* descr.h (struct pthread): Add stopped_start field.
+	* sysdeps/pthread/createthread.c (create_thread): Set
+	start_stopped flag in descriptor for new thread appropriately.
+	* pthread_create.c (start_thread): Only take lock to be stopped on
+	startup if stopped_start flag says so.
+
 2004-09-24  Ulrich Drepper  <drepper@redhat.com>
 
 	* pthread_create.c (__pthread_create_2_1): Remember whether thread
diff --git a/nptl/descr.h b/nptl/descr.h
index 0f8d347b79..d81392921c 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -197,6 +197,9 @@ struct pthread
   /* True if the user provided the stack.  */
   bool user_stack;
 
+  /* True if thread must stop at startup time.  */
+  bool stopped_start;
+
   /* Lock to synchronize access to the descriptor.  */
   lll_lock_t lock;
 
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 34cc37d527..1bab72d1e9 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -252,14 +252,17 @@ start_thread (void *arg)
       /* Store the new cleanup handler info.  */
       THREAD_SETMEM (pd, cleanup_jmp_buf, &unwind_buf);
 
-      int oldtype = CANCEL_ASYNC ();
+      if (__builtin_expect (pd->stopped_start, 0))
+	{
+	  int oldtype = CANCEL_ASYNC ();
 
-      /* Get the lock the parent locked to force synchronization.  */
-      lll_lock (pd->lock);
-      /* And give it up right away.  */
-      lll_unlock (pd->lock);
+	  /* Get the lock the parent locked to force synchronization.  */
+	  lll_lock (pd->lock);
+	  /* And give it up right away.  */
+	  lll_unlock (pd->lock);
 
-      CANCEL_RESET (oldtype);
+	  CANCEL_RESET (oldtype);
+	}
 
       /* Run the code the user provided.  */
 #ifdef CALL_THREAD_FCT
diff --git a/nptl/sysdeps/pthread/createthread.c b/nptl/sysdeps/pthread/createthread.c
index fb8d8ce937..8620519887 100644
--- a/nptl/sysdeps/pthread/createthread.c
+++ b/nptl/sysdeps/pthread/createthread.c
@@ -186,6 +186,9 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr,
       if ((_mask & (__nptl_threads_events.event_bits[_idx]
 		    | pd->eventbuf.eventmask.event_bits[_idx])) != 0)
 	{
+	  /* We always must have the thread start stopped.  */
+	  pd->stopped_start = true;
+
 	  /* Create the thread.  We always create the thread stopped
 	     so that it does not get far before we tell the debugger.  */
 	  int res = do_clone (pd, attr, clone_flags, start_thread,
@@ -224,10 +227,11 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr,
   /* Determine whether the newly created threads has to be started
      stopped since we have to set the scheduling parameters or set the
      affinity.  */
-  int stopped = 0;
+  bool stopped = false;
   if (attr != NULL && (attr->cpuset != NULL
 		       || (attr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0))
-    stopped = 1;
+    stopped = true;
+  pd->stopped_start = stopped;
 
   /* Actually create the thread.  */
   int res = do_clone (pd, attr, clone_flags, start_thread,
diff --git a/sysdeps/unix/sysv/linux/i386/setuid.c b/sysdeps/unix/sysv/linux/i386/setuid.c
index a11fb7f60c..0d948fb775 100644
--- a/sysdeps/unix/sysv/linux/i386/setuid.c
+++ b/sysdeps/unix/sysv/linux/i386/setuid.c
@@ -47,7 +47,6 @@ __setuid (uid_t uid)
 # ifdef __NR_setuid32
   if (__libc_missing_32bit_uids <= 0)
     {
-      int result;
       int saved_errno = errno;
 
       result = INLINE_SYSCALL (setuid32, 1, uid);
diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h
index 0347641dfe..a4453ddcc7 100644
--- a/sysdeps/unix/sysv/linux/ia64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h
@@ -165,7 +165,7 @@
 
 #undef PSEUDO_ERRVAL
 #define	PSEUDO_ERRVAL(name, syscall_name, args)	\
-  ENTRY(name)						\
+  ENTRY(name)					\
     DO_CALL (SYS_ify(syscall_name));		\
 	cmp.eq p6,p0=-1,r10;			\
 (p6)	mov r10=r8;
@@ -241,14 +241,14 @@
   DO_INLINE_SYSCALL_NCS (__NR_##name, nr, ##args)
 
 #undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...)	\
-  ({						\
-    DO_INLINE_SYSCALL_NCS(__NR_##name, nr, args)\
-    if (_r10 == -1)				\
-      {						\
-	__set_errno (_retval);			\
-	_retval = -1;				\
-      }						\
+#define INLINE_SYSCALL(name, nr, args...)		\
+  ({							\
+    DO_INLINE_SYSCALL_NCS (__NR_##name, nr, args)	\
+    if (_r10 == -1)					\
+      {							\
+	__set_errno (_retval);				\
+	_retval = -1;					\
+      }							\
     _retval; })
 
 #undef INTERNAL_SYSCALL_DECL
@@ -257,7 +257,7 @@
 #undef INTERNAL_SYSCALL
 #define INTERNAL_SYSCALL_NCS(name, err, nr, args...)	\
   ({							\
-    DO_INLINE_SYSCALL_NCS(name, nr, args)		\
+    DO_INLINE_SYSCALL_NCS (name, nr, args)		\
     err = _r10;						\
     _retval; })
 #define INTERNAL_SYSCALL(name, err, nr, args...)	\