summaryrefslogtreecommitdiff
path: root/hurd/hurdselect.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-08-20 20:09:56 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-08-20 20:09:56 +0200
commitcb7b04137eb70d8ab640cc94098b6d5f68ba2526 (patch)
tree3367e12e0df0a04976db85b99f2a7cef7e082bf5 /hurd/hurdselect.c
parent511e536ffac341707bb4bb89a321c93f629bf11c (diff)
parentf76453c31593957fec1a99b986bfa5506618b79c (diff)
Merge commit 'refs/top-bases/t/single-select-timeout' into t/single-select-timeout
Diffstat (limited to 'hurd/hurdselect.c')
-rw-r--r--hurd/hurdselect.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c
index 01272ee14c..4a87394410 100644
--- a/hurd/hurdselect.c
+++ b/hurd/hurdselect.c
@@ -1,5 +1,5 @@
/* Guts of both `select' and `poll' for Hurd.
- Copyright (C) 1991-2014 Free Software Foundation, Inc.
+ Copyright (C) 1991-2015 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
@@ -67,7 +67,7 @@ _hurd_select (int nfds,
assert (sizeof (union typeword) == sizeof (mach_msg_type_t));
assert (sizeof (uint32_t) == sizeof (mach_msg_type_t));
- if (nfds < 0 || nfds > FD_SETSIZE)
+ if (nfds < 0 || (pollfds == NULL && nfds > FD_SETSIZE))
{
errno = EINVAL;
return -1;
@@ -332,7 +332,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)
{
@@ -404,13 +404,9 @@ _hurd_select (int nfds,
}
}
- if (err == MACH_RCV_TIMED_OUT)
- /* This is the normal value for ERR. We might have timed out and
- read no messages. Otherwise, after receiving the first message,
- we poll for more messages. We receive with a timeout of 0 to
- 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