From fb8e70d6dd3a9c3a0e0d2713b5be3cbc9d7a6409 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 4 Jan 1996 10:00:22 +0000 Subject: Wed Jan 3 20:23:42 1996 Roland McGrath * hurd/catch-signal.c: New file. * hurd/intr-msg.c: When restarting RPC, fetch a new reply port. * hurd/hurdsig.c: Use new hurdfault.h interface. (abort_all_rpcs): Mutate return value to EINTR in threads whose replies we will wait for. * hurd/hurdkill.c (_hurd_sig_post): When doing pgrp, make sure we do ourselves last. Wed Jan 3 19:17:10 1996 Miles Bader * sysdeps/mach/hurd/access.c (__access): Put the uid/gid arguments to auth_makeauth() in the right order. Wed Jan 3 17:19:04 1996 Roland McGrath * sysdeps/generic/strsep.c: Rewritten. * sysdeps/mach/hurd/fork.c: Use a different workaround for the suspended page fault deadlock kernel bug: thread_abort our signal thread first thing after proc_dostop. * sysdeps/mach/hurd/setgid.c: Rewrote gid frobnication to recognize rootness properly. * hurd/hurdsig.c: Use new signal preemption interface. --- hurd/intr-msg.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'hurd/intr-msg.c') diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c index 41f43e1e28..9362731240 100644 --- a/hurd/intr-msg.c +++ b/hurd/intr-msg.c @@ -1,5 +1,5 @@ /* Replacement for mach_msg used in interruptible Hurd RPCs. -Copyright (C) 1995 Free Software Foundation, Inc. +Copyright (C) 1995, 1996 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 @@ -19,6 +19,7 @@ Cambridge, MA 02139, USA. */ #include #include +#include #include #include "intr-msg.h" @@ -45,7 +46,7 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, return EINTR when some other thread gets a signal, in which case we want to restart our call. */ ss->intr_port = msg->msgh_remote_port; - + /* A signal may arrive here, after intr_port is set, but before the mach_msg system call. The signal handler might do an interruptible RPC, and clobber intr_port; then it would not be @@ -58,12 +59,12 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, if (ss->cancel) { - err = EINTR; ss->cancel = 0; + return EINTR; } - else - err = INTR_MSG_TRAP (msg, option, send_size, - rcv_size, rcv_name, timeout, notify); + + err = INTR_MSG_TRAP (msg, option, send_size, + rcv_size, rcv_name, timeout, notify); switch (err) { @@ -83,7 +84,14 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, signal thread will have cleared SS->intr_port. Since it's not cleared, the signal was for another thread, or SA_RESTART is set. Restart the interrupted call. */ - goto message; + { + restart: + if (rcv_name != MACH_PORT_NULL) + /* Make sure we have a valid reply port. The one we were using + may have been destroyed by interruption. */ + msg->msgh_local_port = rcv_name = __mig_get_reply_port (); + goto message; + } /* FALLTHROUGH */ case MACH_RCV_PORT_DIED: @@ -139,7 +147,7 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, if (ss->intr_port != MACH_PORT_NULL) /* Nope; repeat the RPC. XXX Resources moved? */ - goto message; + goto restart; else /* The EINTR return indicates cancellation, so clear the flag. */ -- cgit v1.2.3