diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-08-20 20:10:07 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-08-20 20:10:07 +0200 |
commit | 105611191fe003c18764798b9ed12ec1491a8968 (patch) | |
tree | 3eee1d9f42f52747355adf548e50ebfe090a9d29 /hurd/hurdselect.c | |
parent | ca390b50e442414f7d9349dca0e7796ed4cedcf7 (diff) | |
parent | cb7b04137eb70d8ab640cc94098b6d5f68ba2526 (diff) |
Merge commit 'refs/top-bases/t/io_select_timeout' into t/io_select_timeout
Diffstat (limited to 'hurd/hurdselect.c')
-rw-r--r-- | hurd/hurdselect.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c index d453042203..82bf325bf5 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 @@ -72,7 +72,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; @@ -367,7 +367,7 @@ _hurd_select (int nfds, } 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) { @@ -442,13 +442,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 (ready) /* At least one descriptor is known to be ready now, so we will |