]> sourceware.org Git - glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 11 Mar 2003 19:02:26 +0000 (19:02 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 11 Mar 2003 19:02:26 +0000 (19:02 +0000)
* sysdeps/unix/sysv/linux/ia64/system.c: New file.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_CLONE_THREAD_FLAGS): Define for IA-64 and s390* with
kernel >= 2.5.64.

2003-03-11  Jakub Jelinek  <jakub@redhat.com>

* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Don't clobber R7.

16 files changed:
ChangeLog
nptl/init.c
nptl/sysdeps/ia64/bits/atomic.h
nptl/sysdeps/pthread/pthread_cond_timedwait.c
nptl/sysdeps/pthread/pthread_cond_wait.c
nptl/sysdeps/unix/sysv/linux/ia64/sem_post.c
nptl/sysdeps/unix/sysv/linux/ia64/sem_timedwait.c
nptl/sysdeps/unix/sysv/linux/ia64/sem_trywait.c
nptl/sysdeps/unix/sysv/linux/ia64/sem_wait.c
nptl/sysdeps/unix/sysv/linux/s390/sem_post.c
nptl/sysdeps/unix/sysv/linux/s390/sem_timedwait.c
nptl/sysdeps/unix/sysv/linux/s390/sem_trywait.c
nptl/sysdeps/unix/sysv/linux/s390/sem_wait.c
nptl/version.c
sysdeps/unix/sysv/linux/ia64/system.c [new file with mode: 0644]
sysdeps/unix/sysv/linux/kernel-features.h

index 34d1e6d435dbb49d33204afdec91f63b6609381b..d2659db611fc20c9e2f7b3c8016467166824fddd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-03-11  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/unix/sysv/linux/ia64/system.c: New file.
+       * sysdeps/unix/sysv/linux/kernel-features.h
+       (__ASSUME_CLONE_THREAD_FLAGS): Define for IA-64 and s390* with
+       kernel >= 2.5.64.
+
 2003-03-11  Jakub Jelinek  <jakub@redhat.com>
 
        * sysdeps/generic/dl-sysdep.c (_dl_important_hwcaps): If CNT == 1,
@@ -13,7 +20,7 @@
 
 2003-03-10  Steven Munroe  <sjmunroe@us.ibm.com>
 
-        * sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Don't clobber R7.
+       * sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S: Don't clobber R7.
        Copy extra params for NPTL to registers used in clone syscall.
 
 2003-03-10  Martin Schwidefsky  <schwidefsky@de.ibm.com>
index df8e67a83eb0c23d323c6125efc4962492bca584..e4e30815a63051c1641f44822f8dc2f326e64719 100644 (file)
@@ -209,6 +209,13 @@ __pthread_initialize_minimal_internal (void)
 
   (void) __libc_sigaction (SIGCANCEL, &sa, NULL);
 
+  /* The parent process might have left the signal blocked.  Just in
+     case, unblock it.  We reuse the signal mask in the sigaction
+     structure.  It is already cleared.  */
+  __sigaddset (&sa.sa_mask, SIGCANCEL);
+  (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &sa.sa_mask,
+                          NULL, _NSIG / 8);
+
 
   /* Determine the default allowed stack size.  This is the size used
      in case the user does not specify one.  */
index 4b1d24f8e71176b86560c24e82f64f0ed7cfcf20..cfccc6ad715a7f0cc26effdce633a943cfd70e3a 100644 (file)
@@ -78,15 +78,17 @@ typedef uintmax_t uatomic_max_t;
       do                                                                     \
        __oldval = __val;                                                     \
       while ((__val                                                          \
-             = __arch_compare_and_exchange_32_val_acq (__memp, __oldval,     \
-                                                       __oldval + __value))  \
+             = __arch_compare_and_exchange_32_val_acq (__memp,               \
+                                                       __oldval + __value,   \
+                                                       __oldval))            \
             != __oldval);                                                    \
     else if (sizeof (*mem) == 8)                                             \
       do                                                                     \
        __oldval = __val;                                                     \
       while ((__val                                                          \
-             = __arch_compare_and_exchange_64_val_acq (__memp, __oldval,     \
-                                                       __oldval + __value))  \
+             = __arch_compare_and_exchange_64_val_acq (__memp,               \
+                                                       __oldval + __value,   \
+                                                       __oldval))            \
             != __oldval);                                                    \
     else                                                                     \
       abort ();                                                                      \
index d6a4ae7cfec0632760aaf0dd0994ddcbafa8ac86..417f873868b34fdf54f2d25c0331ca60dffef6b6 100644 (file)
@@ -46,7 +46,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
 {
   struct _pthread_cleanup_buffer buffer;
   struct _condvar_cleanup_buffer cbuffer;
-  int result = 0, err;
+  int result = 0;
 
   /* Catch invalid parameters.  */
   if (abstime->tv_nsec >= 1000000000)
@@ -56,7 +56,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
   lll_mutex_lock (cond->__data.__lock);
 
   /* Now we can release the mutex.  */
-  err = __pthread_mutex_unlock_internal (mutex);
+  int err = __pthread_mutex_unlock_internal (mutex);
   if (err)
     {
       lll_mutex_unlock (cond->__data.__lock);
@@ -92,8 +92,6 @@ __pthread_cond_timedwait (cond, mutex, abstime)
 
   while (1)
     {
-      int err;
-
       /* Get the current time.  So far we support only one clock.  */
       struct timeval tv;
       (void) gettimeofday (&tv, NULL);
@@ -162,9 +160,9 @@ __pthread_cond_timedwait (cond, mutex, abstime)
   __pthread_cleanup_pop (&buffer, 0);
 
   /* Get the mutex before returning.  */
-  __pthread_mutex_lock_internal (mutex);
+  err = __pthread_mutex_lock_internal (mutex);
 
-  return result;
+  return err ?: result;
 }
 
 versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
index d96444f49b9fe78283796e28db636449e33176ef..399cee89ee5c86ce46f5fcdc8ed9a97759424d5c 100644 (file)
@@ -141,9 +141,7 @@ __pthread_cond_wait (cond, mutex)
   __pthread_cleanup_pop (&buffer, 0);
 
   /* Get the mutex before returning.  */
-  __pthread_mutex_lock_internal (mutex);
-
-  return 0;
+  return __pthread_mutex_lock_internal (mutex);
 }
 
 versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
index 5a7596288b7170caa7049e0518484e5e741281bc..32dba265a981df30acb999231f9752ebe0f58fd1 100644 (file)
@@ -21,6 +21,7 @@
 #include <sysdep.h>
 #include <lowlevellock.h>
 #include <internaltypes.h>
+#include <semaphore.h>
 
 #include <shlib-compat.h>
 
index 85b4e3ce5ca1d76bf42cc8e3da3064b3895c9e17..b271217c41d5588ae82427f4282273f35cc7fb1a 100644 (file)
@@ -21,6 +21,7 @@
 #include <sysdep.h>
 #include <lowlevellock.h>
 #include <internaltypes.h>
+#include <semaphore.h>
 
 #include <shlib-compat.h>
 
index a07d3468a389b1109496a8a0d8d07a0f48cf37b2..25127c21a146f46fd477e6c1097597539f6e1deb 100644 (file)
@@ -21,6 +21,7 @@
 #include <sysdep.h>
 #include <lowlevellock.h>
 #include <internaltypes.h>
+#include <semaphore.h>
 
 #include <shlib-compat.h>
 
index 54092375131eeaa32f1c58ba6917423e42b3eb7c..958159f2d5bdffd7997829b0cd3f54612360ecc7 100644 (file)
@@ -21,6 +21,7 @@
 #include <sysdep.h>
 #include <lowlevellock.h>
 #include <internaltypes.h>
+#include <semaphore.h>
 
 #include <shlib-compat.h>
 
index 6bf577bc5f1f70464825f614f6c0838e010712b5..b36ebdbcebdbdc0ffe49d01b4cb4099a6b036922 100644 (file)
@@ -21,6 +21,7 @@
 #include <sysdep.h>
 #include <lowlevellock.h>
 #include <internaltypes.h>
+#include <semaphore.h>
 
 #include <shlib-compat.h>
 
index 669dc3ce12d20fd604c63d921ddb4960ad985a6e..d2ef2ceb30114130534caaca8ef6ff902e7e67ad 100644 (file)
@@ -21,6 +21,7 @@
 #include <sysdep.h>
 #include <lowlevellock.h>
 #include <internaltypes.h>
+#include <semaphore.h>
 
 #include <shlib-compat.h>
 
index eb6fd04ce151a0f66d501a6613e5939a884aae74..3695ccddfd8d028d4bd4052fd4955481fa185c50 100644 (file)
@@ -21,6 +21,7 @@
 #include <sysdep.h>
 #include <lowlevellock.h>
 #include <internaltypes.h>
+#include <semaphore.h>
 
 #include <shlib-compat.h>
 
index 2437de0e8a3bc9ed362ce7858488b4fd989204a1..a56e1e0a60a7a791d37b47750085d5995ece5736 100644 (file)
@@ -21,6 +21,7 @@
 #include <sysdep.h>
 #include <lowlevellock.h>
 #include <internaltypes.h>
+#include <semaphore.h>
 
 #include <shlib-compat.h>
 
index 0f12c6aa182f6e96b041e34fa652952e1b01b90b..d0658bac0ccfd1b2939d25d56a5cbd074073692e 100644 (file)
@@ -34,7 +34,8 @@ void
 __nptl_main (void)
 {
   INTERNAL_SYSCALL_DECL (err);
-  INTERNAL_SYSCALL (write, err, 3, STDOUT_FILENO, banner, sizeof banner - 1);
+  INTERNAL_SYSCALL (write, err, 3, STDOUT_FILENO, (const char *) banner,
+                   sizeof banner - 1);
 
   _exit (0);
 }
diff --git a/sysdeps/unix/sysv/linux/ia64/system.c b/sysdeps/unix/sysv/linux/ia64/system.c
new file mode 100644 (file)
index 0000000..db4fcfe
--- /dev/null
@@ -0,0 +1,74 @@
+/* Copyright (C) 2002, 2003 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.  */
+
+#include <sched.h>
+#include <signal.h>
+#include <sysdep.h>
+#include <unistd.h>
+#include <sys/wait.h>
+#include <bits/libc-lock.h>
+#include <kernel-features.h>
+
+/* We have to and actually can handle cancelable system().  The big
+   problem: we have to kill the child process if necessary.  To do
+   this a cleanup handler has to be registered and is has to be able
+   to find the PID of the child.  The main problem is to reliable have
+   the PID when needed.  It is not necessary for the parent thread to
+   return.  It might still be in the kernel when the cancellation
+   request comes.  Therefore we have to use the clone() calls ability
+   to have the kernel write the PID into the user-level variable.  */
+#ifdef __ASSUME_CLONE_THREAD_FLAGS
+# define FORK() \
+  INLINE_SYSCALL (clone2, 6, CLONE_PARENT_SETTID | SIGCHLD, NULL, 0, \
+                 NULL, &pid, NULL)
+#endif
+
+static void cancel_handler (void *arg);
+
+#define CLEANUP_HANDLER \
+  __libc_cleanup_region_start (1, cancel_handler, &pid)
+
+#define CLEANUP_RESET \
+  __libc_cleanup_region_end (0)
+
+
+/* Linux has waitpid(), so override the generic unix version.  */
+#include <sysdeps/posix/system.c>
+
+
+/* The cancellation handler.  */
+static void
+cancel_handler (void *arg)
+{
+  pid_t child = *(pid_t *) arg;
+
+  INTERNAL_SYSCALL_DECL (err);
+  INTERNAL_SYSCALL (kill, err, 2, child, SIGKILL);
+
+  TEMP_FAILURE_RETRY (__waitpid (child, NULL, 0));
+
+  DO_LOCK ();
+
+  if (SUB_REF () == 0)
+    {
+      (void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL);
+      (void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL);
+    }
+
+  DO_UNLOCK ();
+}
index f9d1f09050096e79c4a08db5c87042150bb742ed..53d8860f43d7701554be77d20a0019b1703f8511 100644 (file)
 #if __LINUX_KERNEL_VERSION >= 132415
 # define __ASSUME_POSIX_TIMERS         1
 #endif
+
+/* The late 2.5 kernels saw a lot of new CLONE_* flags.  Summarize
+   their availability with one define.  The changes were made first
+   for i386 and the have to be done separately for the other archs.
+   For ia64 and s390* we pick 2.5.64 as the first version with support.  */
+#if __LINUX_KERNEL_VERSION >= 132416 \
+    && (defined __ia64__ || defined __s390__)
+# define __ASSUME_CLONE_THREAD_FLAGS   1
+#endif
This page took 0.059788 seconds and 5 git commands to generate.