about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2015-02-07 22:13:46 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2015-02-07 22:13:46 +0100
commita9a002fb6cb9941ba283ef832e2a88ab00033683 (patch)
tree83f16a823d5a59fa241b209408962b3979bf82af
parentbd959902bcb2e71b4f3ac72535c4d2fe86f4ce79 (diff)
downloadglibc-a9a002fb6cb9941ba283ef832e2a88ab00033683.tar.gz
glibc-a9a002fb6cb9941ba283ef832e2a88ab00033683.tar.xz
glibc-a9a002fb6cb9941ba283ef832e2a88ab00033683.zip
hurdselect: Let select get interrupted by signals
We need to set MACH_RCV_INTERRUPT to avoid __mach_msg just looping on signals,
and then we can handle the interruption.
-rw-r--r--ChangeLog2
-rw-r--r--hurd/hurdselect.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 03a987aa9e..5081237ce5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,8 @@
 	* hurd/hurd/resource.h (MACH_PRIORITY_TO_NICE,
 	NICE_TO_MACH_PRIORITY): Align nice levels on Mach priorities from 5 to
 	45.
+	* hurd/hurdselect.c (_hurd_select): Pass MACH_RCV_INTERRUPT to
+	__mach_msg.  If that returns MACH_RCV_INTERRUPTED, set ERR to EINTR.
 
 2015-02-06  Roland McGrath  <roland@hack.frob.com>
 
diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c
index 2996be2c8b..bd31c94aae 100644
--- a/hurd/hurdselect.c
+++ b/hurd/hurdselect.c
@@ -335,7 +335,7 @@ _hurd_select (int nfds,
       mach_msg_option_t options = (timeout == NULL ? 0 : MACH_RCV_TIMEOUT);
       error_t msgerr;
       while ((msgerr = __mach_msg (&msg.head,
-				   MACH_RCV_MSG | options,
+				   MACH_RCV_MSG | MACH_RCV_INTERRUPT | options,
 				   0, sizeof msg, portset, to,
 				   MACH_PORT_NULL)) == MACH_MSG_SUCCESS)
 	{
@@ -414,6 +414,9 @@ _hurd_select (int nfds,
 	   effect a poll, so ERR is MACH_RCV_TIMED_OUT when the poll finds no
 	   message waiting.  */
 	err = 0;
+      if (msgerr == MACH_RCV_INTERRUPTED)
+	/* Interruption on our side (e.g. signal reception).  */
+	err = EINTR;
 
       if (got)
 	/* At least one descriptor is known to be ready now, so we will