From 54da5be39c868b55c234c23bb38eb42babc084d7 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 14 Aug 1995 22:49:23 +0000 Subject: Mon Aug 14 16:51:13 1995 Roland McGrath * hurd/thread-cancel.c: New file. * sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler): In rpc_wait case, frob mach_msg args to set timeout on receive. (_hurdsig_rcv_interrupted_p): Function removed. * sysdeps/mach/hurd/alpha/trampoline.c: Likewise. * sysdeps/mach/hurd/hppa/trampoline.c: Likewise. * sysdeps/mach/hurd/mips/trampoline.c: Likewise. * hurd/intr-msg.c: New file. * hurd/hurd/signal.h (struct hurd_sigstate): New member `cancel'. (_hurdsig_rcv_interrupted_p): Declaration removed. (HURD_EINTR_RPC): Macro removed. (_hurd_longjmp_thread_state, _hurd_interrupted_rpc_timeout): Declare these. * hurd/intr-rpc.h: New file. * hurd/intr-rpc.defs: Just import intr-rpc.h. * hurd/hurdsig.c (_hurd_interrupted_rpc_timeout): New variable. (interrupted_reply_port_location): Take new flag arg; only catch faults if it's set. (abort_rpcs): Rename to _hurdsig_abort_rpcs; take same new flag arg. No longer use _hurdsig_rcv_interrupted_p; instead compare PC to &_hurd_intr_rpc_msg_in_trap. If before it, mutate state to simulate MACH_SEND_INTERRUPTED return; on it, interrupt the operation. All callers changed. * hurd/hurd.h (hurd_thread_cancel, hurd_check_cancel): Declare these. * hurd/Makefile (distribute): Remove intr-rpc.awk. (sig): Add thread-cancel. (transform-user-stub, transform-user-stub-output): Variables removed. * sysdeps/mach/hurd/dl-sysdep.c: Change all RPCs from `__hurd_intr_rpc_*' to `__*'. (_hurd_intr_rpc_mach_msg): New function. (_hurd_thread_sigstate): Function removed. * sysdeps/mach/hurd/ioctl.c: Use _hurd_intr_rpc_mach_msg function, instead of __mach_msg inside HURD_EINTR_RPC macro. * sysdeps/generic/morecore.c [__GNU_LIBRARY__]: Declare `__sbrk' to take ptrdiff_t arg. * sysdeps/mach/hurd/fork.c: Remove _hurd_longjmp_thread_state decl. * sysdeps/mach/hurd/kill.c (kill_pid): Don't make `inline'. * libc-symbols.h [GCC >= 2.7] (strong_alias, weak_symbol, weak_alias): Use `extern' storage class. --- sysdeps/mach/hurd/alpha/trampoline.c | 47 ++++++------------------------------ 1 file changed, 7 insertions(+), 40 deletions(-) (limited to 'sysdeps/mach/hurd/alpha') diff --git a/sysdeps/mach/hurd/alpha/trampoline.c b/sysdeps/mach/hurd/alpha/trampoline.c index 85f4964e14..f3872fcfe6 100644 --- a/sysdeps/mach/hurd/alpha/trampoline.c +++ b/sysdeps/mach/hurd/alpha/trampoline.c @@ -1,5 +1,5 @@ /* Set thread_state for sighandler, and sigcontext to recover. Alpha version. -Copyright (C) 1994 Free Software Foundation, Inc. +Copyright (C) 1994, 1995 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 @@ -160,6 +160,12 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler, calls we retry need only wait to receive the reply message. */ args->option &= ~MACH_SEND_MSG; + /* Limit the time to receive the reply message, in case the server + claimed that `interrupt_operation' succeeded but in fact the RPC + is hung. */ + args->option |= MACH_RCV_TIMEOUT; + args->timeout = _hurd_interrupted_rpc_timeout; + state->basic.pc = (long int) &&rpc_wait_trampoline; /* After doing the message receive, the trampoline code will need to update the v0 ($0) value to be restored by sigreturn. To simplify @@ -245,42 +251,3 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler, /* NOTREACHED */ return NULL; } - -/* STATE describes a thread that had intr_port set (meaning it was inside - HURD_EINTR_RPC), after it has been thread_abort'd. If it looks to have - just completed a mach_msg_trap system call that returned - MACH_RCV_INTERRUPTED, return nonzero and set *PORT to the receive right - being waited on. */ -int -_hurdsig_rcv_interrupted_p (struct machine_thread_all_state *state, - mach_port_t *port) -{ - if (state->basic.r0 == MACH_RCV_INTERRUPTED) - { - const unsigned int *pc = (void *) state->basic.pc; - struct mach_msg_trap_args *args = (void *) &state->basic.r16; - - if (_hurdsig_catch_fault (SIGSEGV)) - { - assert (_hurdsig_fault_sigcode == (long int) (pc - 1) || - _hurdsig_fault_sigcode == (long int) &args->rcv_name); - /* We got a fault trying to read the PC or stack. */ - return 0; - } - else - { - if (pc[-1] == ((alpha_instruction) { pal_format: - { opcode: op_pal, - function: op_chmk } }).bits) - { - /* We did just return from a mach_msg_trap system call - doing a message receive that was interrupted. - Examine the parameters to find the receive right. */ - *port = args->rcv_name; - return 1; - } - } - } - - return 0; -} -- cgit 1.4.1