about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-07-21 16:50:21 +0000
committerRoland McGrath <roland@gnu.org>1999-07-21 16:50:21 +0000
commite26996aa991c92637310c12f37e266ad3931b289 (patch)
tree7b0ce9531400f1a4def71ab4be8df0be3f0ccb89
parent6818bcaef77f8c1082a18bdb9e0626cd188ae87b (diff)
downloadglibc-e26996aa991c92637310c12f37e266ad3931b289.tar.gz
glibc-e26996aa991c92637310c12f37e266ad3931b289.tar.xz
glibc-e26996aa991c92637310c12f37e266ad3931b289.zip
1999-07-20 Mark Kettenis <kettenis@gnu.org>
	* sysdeps/mach/_strerror.c: Include <libintl.h>.

1999-07-19  Roland McGrath  <roland@baalperazim.frob.com>

	* hurd/hurdsig.c (_hurd_internal_post_signal): If a
	hurd_signal_preemptor matches but its `preemptor' field is null, use
	its `handler' field directly.  This is to comply with behavior
	documented in <hurd/sigpreempt.h>.
-rw-r--r--ChangeLog11
-rw-r--r--hurd/hurdsig.c45
2 files changed, 42 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index f78d1aac4f..bc01740f44 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+1999-07-20  Mark Kettenis  <kettenis@gnu.org>
+
+	* sysdeps/mach/_strerror.c: Include <libintl.h>.
+
+1999-07-19  Roland McGrath  <roland@baalperazim.frob.com>
+
+	* hurd/hurdsig.c (_hurd_internal_post_signal): If a
+	hurd_signal_preemptor matches but its `preemptor' field is null, use
+	its `handler' field directly.  This is to comply with behavior
+	documented in <hurd/sigpreempt.h>.
+
 1999-07-21  Andreas Schwab  <schwab@suse.de>
 
 	* libio/fileops.c (_IO_new_file_underflow): Set error indicator
diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 1c1a22932c..f2a01201b5 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99 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
@@ -448,7 +448,6 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
   error_t err;
   struct machine_thread_all_state thread_state;
   enum { stop, ignore, core, term, handle } act;
-  struct hurd_signal_preemptor *pe;
   sighandler_t handler;
   sigset_t pending;
   int ss_suspended;
@@ -549,20 +548,38 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
 
   /* Check for a preempted signal.  Preempted signals can arrive during
      critical sections.  */
+  {
+    inline sighandler_t try_preemptor (struct hurd_signal_preemptor *pe)
+      {				/* PE cannot be null.  */
+	do
+	  {
+	    if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->code))
+	      {
+		if (pe->preemptor)
+		  {
+		    sighandler_t handler = (*pe->preemptor) (pe, ss,
+							     &signo, detail);
+		    if (handler != SIG_ERR)
+		      return handler;
+		  }
+		else
+		  return pe->handler;
+	      }
+	    pe = pe->next;
+	  } while (pe != 0);
+	return SIG_ERR;
+      }
 
-  handler = SIG_ERR;
-  for (pe = ss->preemptors; pe && handler == SIG_ERR; pe = pe->next)
-    if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->code))
-      handler = (*pe->preemptor) (pe, ss, &signo, detail);
+    handler = ss->preemptors ? try_preemptor (ss->preemptors) : SIG_ERR;
 
-  if (handler == SIG_ERR && (__sigmask (signo) & _hurdsig_preempted_set))
-    {
-      __mutex_lock (&_hurd_siglock);
-      for (pe = _hurdsig_preemptors; pe && handler == SIG_ERR; pe = pe->next)
-	if (HURD_PREEMPT_SIGNAL_P (pe, signo, detail->code))
-	  handler = (*pe->preemptor) (pe, ss, &signo, detail);
-      __mutex_unlock (&_hurd_siglock);
-    }
+    /* If no thread-specific preemptor, check for a global one.  */
+    if (handler == SIG_ERR && (__sigmask (signo) & _hurdsig_preempted_set))
+      {
+	__mutex_lock (&_hurd_siglock);
+	handler = try_preemptor (_hurdsig_preemptors);
+	__mutex_unlock (&_hurd_siglock);
+      }
+  }
 
   ss_suspended = 0;