summaryrefslogtreecommitdiff
path: root/hurd/hurd
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-08-14 22:49:23 +0000
committerRoland McGrath <roland@gnu.org>1995-08-14 22:49:23 +0000
commit54da5be39c868b55c234c23bb38eb42babc084d7 (patch)
tree64fe7cd0dfeaef3a8b6f469f3a7a83a3a974067a /hurd/hurd
parent047f282dd7e83f24abce284dcc9d2d78cab42f9b (diff)
Mon Aug 14 16:51:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* 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.
Diffstat (limited to 'hurd/hurd')
-rw-r--r--hurd/hurd/signal.h62
1 files changed, 9 insertions, 53 deletions
diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h
index d28d1c6c11..a032313e4e 100644
--- a/hurd/hurd/signal.h
+++ b/hurd/hurd/signal.h
@@ -84,6 +84,8 @@ struct hurd_sigstate
<hurd/userlink.h> for details. This member is only used by the
thread itself, and always inside a critical section. */
struct hurd_userlink *active_resources;
+
+ volatile int cancel; /* Flag set by hurd_thread_cancel. */
};
/* Linked list of states of all threads whose state has been asked for. */
@@ -253,20 +255,14 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
extern void _hurd_msgport_receive (void);
-/* STATE describes a thread that had intr_port set (meaning it was inside
- HURD_EINTR_RPC), after it has been thread_abort'd. It 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. */
-
-extern int _hurdsig_rcv_interrupted_p (struct machine_thread_all_state *state,
- mach_port_t *port);
-
/* Set up STATE with a thread state that, when resumed, is
like `longjmp (_hurd_sigthread_fault_env, 1)'. */
extern void _hurd_initialize_fault_recovery_state (void *state);
+/* Set up STATE to do the equivalent of `longjmp (ENV, VAL);'. */
+
+extern void _hurd_longjmp_thread_state (void *state, jmp_buf env, int value);
/* Function run for SIGINFO when its action is SIG_DFL and the current
process is the session leader. */
@@ -274,50 +270,10 @@ extern void _hurd_initialize_fault_recovery_state (void *state);
extern void _hurd_siginfo_handler (int);
-/* Perform interruptible RPC CALL on PORT.
- The call should use
- The args in CALL should be constant or local variable refs.
- They may be evaluated many times, and must not change.
- PORT must not be deallocated before this RPC is finished. */
-#define HURD_EINTR_RPC(port, call) \
- ({ \
- __label__ __do_call; /* Give this label block scope. */ \
- error_t __err; \
- struct hurd_sigstate *__ss = _hurd_self_sigstate (); \
- __do_call: \
- /* 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 \
- thread will set this variable to MACH_PORT_NULL. The RPC might \
- return EINTR when some other thread gets a signal, in which case we \
- want to restart our call. */ \
- __ss->intr_port = (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 set properly when \
- we actually did send the RPC, and a later signal wouldn't interrupt \
- that RPC. So, _hurd_setup_sighandler saves intr_port in the \
- sigcontext, and sigreturn restores it. */ \
- switch (__err = (call)) \
- { \
- case EINTR: /* RPC went out and was 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 \
- 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 __do_call; \
- /* FALLTHROUGH */ \
- case MACH_RCV_PORT_DIED: \
- /* Server didn't respond to interrupt_operation, \
- so the signal thread destroyed the reply port. */ \
- __err = EINTR; \
- break; \
- default: /* Quiet -Wswitch-enum. */ \
- } \
- __ss->intr_port = MACH_PORT_NULL; \
- __err; \
- }) \
+/* Milliseconds to wait for an interruptible RPC to return after
+ `interrupt_operation'. */
+
+extern mach_msg_timeout_t _hurd_interrupted_rpc_timeout;
/* Mask of signals that cannot be caught, blocked, or ignored. */