From a993273c0d4d1907028adee7a2ae012826fd316c Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 31 Aug 1995 00:02:32 +0000 Subject: Wed Aug 30 16:44:55 1995 Roland McGrath * sysdeps/mach/hurd/select.c: Deal with out of order replies during io_select request loop. Handle MACH_RCV_TIMED_OUT error from requests. * hurd/intr-msg.c: If the user passed the MACH_RCV_TIMEOUT option, distinguish MACH_RCV_TIMED_OUT from EINTR. * posix/glob.c (glob): Use realloc to extend strings for GLOB_MARK slash. (glob_in_dir): Don't allocate extra byte here. * sysdeps/i386/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC): Decrement the DT_RELSZ value for the skipped reloc. --- hurd/intr-msg.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'hurd/intr-msg.c') diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c index 024cbfbd3e..b345e72cc4 100644 --- a/hurd/intr-msg.c +++ b/hurd/intr-msg.c @@ -35,6 +35,9 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, { struct hurd_sigstate *ss = _hurd_self_sigstate (); error_t err; + /* Notice now if the user requested a timeout. OPTION may have the bit + added by interruption semantics, and we must distinguish. */ + int user_timeout = option & MACH_RCV_TIMEOUT; /* Tell the signal thread that we are doing an interruptible RPC on this port. If we get a signal and should return EINTR, the signal @@ -64,6 +67,15 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, switch (err) { + case MACH_RCV_TIMED_OUT: + if (user_timeout) + /* The real user RPC timed out. */ + break; + else + /* The operation was supposedly interrupted, but still has + not returned. Declare it interrupted. */ + goto interrupted; + case MACH_SEND_INTERRUPTED: /* RPC didn't get out. */ if (ss->intr_port != MACH_PORT_NULL) /* If this signal was for us and it should interrupt calls, the @@ -78,10 +90,7 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, so the signal thread destroyed the reply port. */ /* FALLTHROUGH */ - case MACH_RCV_TIMED_OUT: - /* The operation was supposedly interrupted, but still has - not returned. Declare it interrupted. */ - + interrupted: err = EINTR; /* The EINTR return indicates cancellation, so clear the flag. */ @@ -95,7 +104,9 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, /* This signal or cancellation was for us. We need to wait for the reply, but not hang forever. */ option |= MACH_RCV_TIMEOUT; - timeout = _hurd_interrupted_rpc_timeout; + /* Never decrease the user's timeout. */ + if (!user_timeout || timeout > _hurd_interrupted_rpc_timeout) + timeout = _hurd_interrupted_rpc_timeout; } goto message; /* Retry the receive. */ -- cgit v1.2.3