about summary refs log tree commit diff
path: root/hurd/intr-msg.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-08-31 00:02:32 +0000
committerRoland McGrath <roland@gnu.org>1995-08-31 00:02:32 +0000
commita993273c0d4d1907028adee7a2ae012826fd316c (patch)
tree3b1f5f64ea2b79fff7a61283d1ae60ac9291f38f /hurd/intr-msg.c
parent18926cf415b65008c849b592209a85f733be39f7 (diff)
downloadglibc-a993273c0d4d1907028adee7a2ae012826fd316c.tar.gz
glibc-a993273c0d4d1907028adee7a2ae012826fd316c.tar.xz
glibc-a993273c0d4d1907028adee7a2ae012826fd316c.zip
Wed Aug 30 16:44:55 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
	* 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.
Diffstat (limited to 'hurd/intr-msg.c')
-rw-r--r--hurd/intr-msg.c21
1 files changed, 16 insertions, 5 deletions
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.  */