about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--linuxthreads/ChangeLog8
-rw-r--r--linuxthreads/condvar.c60
-rw-r--r--locale/programs/ld-collate.c2
-rw-r--r--locale/weightwc.h3
-rw-r--r--sysdeps/unix/sysv/linux/i386/msgctl.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/semctl.c4
7 files changed, 82 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index fa25e1c96a..a859dc66f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
+2000-02-12  Andreas Jaeger  <aj@suse.de>
+
+	* sysdeps/unix/sysv/linux/i386/msgctl.c (__new_msgctl): Move errno
+	declaration to place where it's needed to avoid compiler warning.
+	* sysdeps/unix/sysv/linux/i386/semctl.c (__new_semctl): Likewise.
+
 2000-02-12  Ulrich Drepper  <drepper@redhat.com>
 
+	* locale/weightwc.h (findidx): Correct find index value.
+
 	* locale/nl_langinfo.h: Add casts to prevent warnings.
 
 	* wctype/iswctype_l.c: Use correct types for mapped data.
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index cf9bfa03bd..382ad68604 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,11 @@
+2000-02-13  Ulrich Drepper  <drepper@redhat.com>
+
+	* condvar.c (pthread_cond_timedwait_relative_old): Undo last patch
+	but keep the code around.  A bug in the kernel prevent us from
+	using the code.
+	(pthread_cond_timedwait_relative_new): Likewise.
+	(PR libc/1597 and libc/1598).
+
 2000-02-01  Kaz Kylheku  <kaz@ashi.footprints.net>
 
 	* condvar.c (pthread_cond_timedwait_relative_old): Do tight
diff --git a/linuxthreads/condvar.c b/linuxthreads/condvar.c
index c0c619992d..b1cde4d9f3 100644
--- a/linuxthreads/condvar.c
+++ b/linuxthreads/condvar.c
@@ -134,11 +134,25 @@ pthread_cond_timedwait_relative_old(pthread_cond_t *cond,
 {
   volatile pthread_descr self = thread_self();
   sigset_t unblock, initial_mask;
+#ifdef NANOSLEEP_WORKS
   int already_canceled = 0;
   int was_signalled = 0;
+#else
+  int retsleep;
+  int already_canceled;
+  int was_signalled;
+#endif
   sigjmp_buf jmpbuf;
   pthread_extricate_if extr;
 
+#ifndef NANOSLEEP_WORKS
+ requeue_and_wait_again:
+
+  retsleep = 0;
+  already_canceled = 0;
+  was_signalled = 0;
+#endif
+
   /* Set up extrication interface */
   extr.pu_object = cond;
   extr.pu_extricate_func = cond_extricate_func;
@@ -173,14 +187,22 @@ pthread_cond_timedwait_relative_old(pthread_cond_t *cond,
       sigemptyset(&unblock);
       sigaddset(&unblock, __pthread_sig_restart);
       sigprocmask(SIG_UNBLOCK, &unblock, &initial_mask);
+#ifdef NANOSLEEP_WORKS
       /* Sleep for the required duration. If woken by a signal, resume waiting
 	 as required by Single Unix Specification.  */
       while (__libc_nanosleep(reltime, reltime) != 0)
 	;
+#else
+      /* Sleep for the required duration */
+      retsleep = __libc_nanosleep(&reltime, NULL);
+#endif
       /* Block the restart signal again */
       sigprocmask(SIG_SETMASK, &initial_mask, NULL);
       was_signalled = 0;
     } else {
+#ifndef NANOSLEEP_WORKS
+      retsleep = -1;
+#endif
       was_signalled = 1;
     }
     THREAD_SETMEM(self, p_signal_jmp, NULL);
@@ -212,7 +234,15 @@ pthread_cond_timedwait_relative_old(pthread_cond_t *cond,
       if (was_on_queue) {
 	__pthread_set_own_extricate_if(self, 0);
 	pthread_mutex_lock(mutex);
+#ifdef NANOSLEEP_WORKS
 	return ETIMEDOUT;
+#else
+	if (retsleep == 0)
+	  return ETIMEDOUT;
+	/* Woken by a signal: resume waiting as required by Single Unix
+	   Specification.  */
+	goto requeue_and_wait_again;
+#endif
       }
 
       suspend(self);
@@ -245,14 +275,28 @@ pthread_cond_timedwait_relative_new(pthread_cond_t *cond,
 {
   volatile pthread_descr self = thread_self();
   sigset_t unblock, initial_mask;
+#ifdef NANOSLEEP_WORKS
   int already_canceled = 0;
   int was_signalled = 0;
+#else
+  int retsleep;
+  int already_canceled;
+  int was_signalled;
+#endif
   sigjmp_buf jmpbuf;
   pthread_extricate_if extr;
 
   already_canceled = 0;
   was_signalled = 0;
 
+#ifndef NANOSLEEP_WORKS
+ requeue_and_wait_again:
+
+  retsleep = 0;
+  already_canceled = 0;
+  was_signalled = 0;
+#endif
+
   /* Set up extrication interface */
   extr.pu_object = cond;
   extr.pu_extricate_func = cond_extricate_func;
@@ -286,14 +330,22 @@ pthread_cond_timedwait_relative_new(pthread_cond_t *cond,
     sigemptyset(&unblock);
     sigaddset(&unblock, __pthread_sig_restart);
     sigprocmask(SIG_UNBLOCK, &unblock, &initial_mask);
+#ifdef NANOSLEEP_WORKS
     /* Sleep for the required duration. If woken by a signal, resume waiting
        as required by Single Unix Specification.  */
     while (__libc_nanosleep(reltime, reltime) != 0)
       ;
+#else
+    /* Sleep for the required duration */
+    retsleep = __libc_nanosleep(&reltime, NULL);
+#endif
     /* Block the restart signal again */
     sigprocmask(SIG_SETMASK, &initial_mask, NULL);
     was_signalled = 0;
   } else {
+#ifndef NANOSLEEP_WORKS
+    retsleep = -1;
+#endif
     was_signalled = 1;
   }
   THREAD_SETMEM(self, p_signal_jmp, NULL);
@@ -322,7 +374,15 @@ pthread_cond_timedwait_relative_new(pthread_cond_t *cond,
     if (was_on_queue) {
       __pthread_set_own_extricate_if(self, 0);
       pthread_mutex_lock(mutex);
+#ifdef NANOSLEEP_WORKS
       return ETIMEDOUT;
+#else
+      if (retsleep == 0)
+	return ETIMEDOUT;
+      /* Woken by a signal: resume waiting as required by Single Unix
+	 Specification.  */
+      goto requeue_and_wait_again;
+#endif
     }
 
     /* Eat the outstanding restart() from the signaller */
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index d3f13ada5b..d8363bd2ac 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -1548,7 +1548,7 @@ collate_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	dont_insert:
 	}
 
-      if (runp->wcs != NULL)
+      if (runp->used_in_level)
 	{
 	  runp->wcorder = wcact++;
 
diff --git a/locale/weightwc.h b/locale/weightwc.h
index 9e5bcf7f4d..d0ca018e70 100644
--- a/locale/weightwc.h
+++ b/locale/weightwc.h
@@ -51,8 +51,7 @@ findidx (const wint_t **cpp)
       const wint_t *usrc = *cpp;
 
       /* The first thing is the index.  */
-      i = cp;
-      ++cp;
+      i = *cp++;
 
       /* Next is the length of the byte sequence.  These are always
 	 short byte sequences so there is no reason to call any
diff --git a/sysdeps/unix/sysv/linux/i386/msgctl.c b/sysdeps/unix/sysv/linux/i386/msgctl.c
index 2ff88882c6..07b5d0d720 100644
--- a/sysdeps/unix/sysv/linux/i386/msgctl.c
+++ b/sysdeps/unix/sysv/linux/i386/msgctl.c
@@ -79,7 +79,7 @@ __new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
   }
 
   {
-    int save_errno, result;
+    int result;
     struct __old_msqid_ds old;
 
 #ifdef __NR_getuid32
@@ -87,7 +87,7 @@ __new_msgctl (int msqid, int cmd, struct msqid_ds *buf)
       {
 	if (__libc_missing_32bit_uids < 0)
 	  {
-	    save_errno = errno;
+	    int save_errno = errno;
 
 	    /* Test presence of new IPC by testing for getuid32 syscall.  */
 	    result = INLINE_SYSCALL (getuid32, 0);
diff --git a/sysdeps/unix/sysv/linux/i386/semctl.c b/sysdeps/unix/sysv/linux/i386/semctl.c
index 7704d2387b..6eb64b3a64 100644
--- a/sysdeps/unix/sysv/linux/i386/semctl.c
+++ b/sysdeps/unix/sysv/linux/i386/semctl.c
@@ -104,7 +104,7 @@ __new_semctl (int semid, int semnum, int cmd, ...)
   }
 
   {
-    int save_errno, result;
+    int result;
     struct __old_semid_ds old;
     struct semid_ds *buf;
 
@@ -113,7 +113,7 @@ __new_semctl (int semid, int semnum, int cmd, ...)
       {
 	if (__libc_missing_32bit_uids < 0)
 	  {
-	    save_errno = errno;
+	    int save_errno = errno;
 
 	    /* Test presence of new IPC by testing for getuid32 syscall.  */
 	    result = INLINE_SYSCALL (getuid32, 0);