summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoan Lledó <joanlluislledo@gmail.com>2018-08-11 18:17:09 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-08-14 00:36:20 +0200
commit829970b29fa73cdfdc0a5e229411c2f31cf4a3fb (patch)
treed8c76227a33d9a35ab671b5f663b7cdd2b72ddd7
parent9deab2b025e1aa512d1378753dbe1e1ef43686b8 (diff)
lwip: return EINTR when a select() IPC thread is cancelled
Needed to properly support poll in glibc (_hurd_select). * lwip/io-ops.c (lwip_io_select_common): Detect when the current RPC is cancelled by checking the reply port.
-rw-r--r--lwip/io-ops.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lwip/io-ops.c b/lwip/io-ops.c
index 1429bc55..72e08e26 100644
--- a/lwip/io-ops.c
+++ b/lwip/io-ops.c
@@ -198,6 +198,8 @@ lwip_io_select_common (struct sock_user *user,
int timeout;
struct pollfd fdp;
nfds_t nfds;
+ mach_port_type_t type;
+ error_t err;
if (!user)
return EOPNOTSUPP;
@@ -227,6 +229,12 @@ lwip_io_select_common (struct sock_user *user,
timeout = tv ? tv->tv_sec * 1000 + tv->tv_nsec / 1000000 : -1;
ret = lwip_poll (&fdp, nfds, timeout);
+ err = mach_port_type (mach_task_self (), reply, &type);
+ if (err || (type & MACH_PORT_TYPE_DEAD_NAME))
+ /* The reply port is dead, we were cancelled */
+ return EINTR;
+
+
if (ret > 0)
{
if (fdp.revents & POLLERR)