]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 17 Mar 1998 00:07:36 +0000 (00:07 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 17 Mar 1998 00:07:36 +0000 (00:07 +0000)
1998-03-17 00:06  Ulrich Drepper  <drepper@cygnus.com>

* manager.c: Fix last patch which caused core dumps.

* pthread.c: Correctly handle missing SIGRTMIN.

linuxthreads/ChangeLog
linuxthreads/manager.c
linuxthreads/pthread.c

index 61d11a9eb4dee2165fbc937d29d5510590a7bdfd..63a3b7c758bb3f216b2b3e0681f0af2a682f862e 100644 (file)
@@ -1,3 +1,9 @@
+1998-03-17 00:06  Ulrich Drepper  <drepper@cygnus.com>
+
+       * manager.c: Fix last patch which caused core dumps.
+
+       * pthread.c: Correctly handle missing SIGRTMIN.
+
 1998-03-15  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
 
        * libpthread.map: Add __libc_internal_tsd_get and
index a650bbe4ddacd3c287e87c03bd2dc8a4d6840ba6..7fe4d468f68fa816dcc848c9e71b12aa432e6c9c 100644 (file)
@@ -100,6 +100,7 @@ int __pthread_manager(void *arg)
     timeout.tv_sec = 2;
     timeout.tv_usec = 0;
     n = __select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
+
     /* Check for termination of the main thread */
     if (getppid() == 1) {
       pthread_kill_all_threads(SIGKILL, 0);
@@ -179,7 +180,6 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
   int pid;
   pthread_descr new_thread;
   pthread_t new_thread_id;
-  int i;
   void *guardaddr = NULL;
 
   /* Find a free stack segment for the current stack */
@@ -201,11 +201,12 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
            {
              /* We manage to get a stack.  Now see whether we need a guard
                 and allocate it if necessary.  */
-             if (attr->guardsize != 0)
+             if (attr == NULL || attr->guardsize != 0)
                {
                  guardaddr = mmap ((caddr_t)((char *)(new_thread+1)
-                                             - 2*1024*1024),
-                                   attr->guardsize, 0, MAP_FIXED, -1, 0);
+                                             - STACK_SIZE),
+                                   attr ? attr->guardsize : __getpagesize (),
+                                   0, MAP_FIXED, -1, 0);
                  if (guardaddr == MAP_FAILED)
                    /* We don't make this an error.  */
                    guardaddr = NULL;
@@ -245,11 +246,13 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
   new_thread->p_h_errnop = &new_thread->p_h_errno;
   new_thread->p_h_errno = 0;
   new_thread->p_guardaddr = guardaddr;
-  new_thread->p_guardsize = (attr == NULL || !attr->stackaddr_set
-                            ? attr->guardsize : 0);
+  new_thread->p_guardsize = (guardaddr == NULL
+                            ? 0
+                            : (attr == NULL
+                               ? __getpagesize () : attr->guardsize));
   new_thread->p_userstack = attr != NULL && attr->stackaddr_set;
-  for (i = 0; i < PTHREAD_KEY_1STLEVEL_SIZE; i++)
-    new_thread->p_specific[i] = NULL;
+  memset (new_thread->p_specific, '\0',
+         PTHREAD_KEY_1STLEVEL_SIZE * sizeof (new_thread->p_specific[0]));
   /* Initialize the thread handle */
   __pthread_handles[sseg].h_spinlock = 0; /* should already be 0 */
   __pthread_handles[sseg].h_descr = new_thread;
@@ -285,7 +288,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
       {
        munmap((caddr_t)((char *)(new_thread+1) - INITIAL_STACK_SIZE),
               INITIAL_STACK_SIZE);
-       if (attr->guardsize != 0)
+       if (new_thread->p_guardsize != 0)
          munmap(new_thread->p_guardaddr, new_thread->p_guardsize);
       }
     __pthread_handles[sseg].h_descr = NULL;
index 729222e589ee868fed770da19e5a90222ab5fce4..9699b4ddccda7c7f25b5a4cf894b51d0803574ba 100644 (file)
@@ -166,6 +166,7 @@ static void pthread_initialize(void)
   /* The errno/h_errno variable of the main thread are the global ones.  */
   __pthread_initial_thread.p_errnop = &_errno;
   __pthread_initial_thread.p_h_errnop = &_h_errno;
+#ifdef SIGRTMIN
   /* Allocate the signals used.  */
   __pthread_sig_restart = __libc_allocate_rtsig (1);
   __pthread_sig_cancel = __libc_allocate_rtsig (1);
@@ -176,6 +177,7 @@ static void pthread_initialize(void)
       __pthread_sig_restart = SIGUSR1;
       __pthread_sig_cancel = SIGUSR2;
     }
+#endif
   /* Setup signal handlers for the initial thread.
      Since signal handlers are shared between threads, these settings
      will be inherited by all other threads. */