1998-11-11 Roland McGrath <roland@baalperazim.frob.com>

* hurd/hurdsig.c (_hurdsig_init): Take new args, INTARRAY and 
INTARRAYSIZE.  Initialize main thread's sigstate from INIT_SIG* ints. 
* hurd/hurd/signal.h: Update _hurdsig_init decl. 
* hurd/hurdinit.c (_hurd_proc_init): Take new args, INTARRAY and 
INTARRAYSIZE, pass them down to _hurdsig_init. 
* hurd/hurd.h: Update _hurd_proc_init decl.
This commit is contained in:
Roland McGrath 1998-11-11 09:56:51 +00:00
parent 74eee8866d
commit 62495816a5
4 changed files with 36 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -235,9 +235,12 @@ extern void _hurd_init (int flags, char **argv,
mach_port_t *portarray, size_t portarraysize, mach_port_t *portarray, size_t portarraysize,
int *intarray, size_t intarraysize); int *intarray, size_t intarraysize);
/* Do startup handshaking with the proc server. */ /* Do startup handshaking with the proc server, and initialize library data
structures that require proc server interaction. This includes
initializing signals; see _hurdsig_init in <hurd/signal.h>. */
extern void _hurd_proc_init (char **argv); extern void _hurd_proc_init (char **argv,
const int *intarray, size_t intarraysize);
/* Return the socket server for sockaddr domain DOMAIN. If DEAD is /* Return the socket server for sockaddr domain DOMAIN. If DEAD is

View File

@ -1,5 +1,5 @@
/* Implementing POSIX.1 signals under the Hurd. /* Implementing POSIX.1 signals under the Hurd.
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1993, 94, 95, 96, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -216,9 +216,10 @@ _hurd_critical_section_unlock (void *our_lock)
#define HURD_CRITICAL_END \ #define HURD_CRITICAL_END \
_hurd_critical_section_unlock (__hurd_critical__); } while (0) _hurd_critical_section_unlock (__hurd_critical__); } while (0)
/* Initialize the signal code, and start the signal thread. */ /* Initialize the signal code, and start the signal thread.
Arguments give the "init ints" from exec_startup. */
extern void _hurdsig_init (void); extern void _hurdsig_init (const int *intarray, size_t intarraysize);
/* Initialize proc server-assisted fault recovery for the signal thread. */ /* Initialize proc server-assisted fault recovery for the signal thread. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc. /* Copyright (C) 1992, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -42,8 +42,6 @@ _hurd_ports_use (int which, error_t (*operate) (mach_port_t))
return HURD_PORT_USE (&_hurd_ports[which], (*operate) (port)); return HURD_PORT_USE (&_hurd_ports[which], (*operate) (port));
} }
void _hurd_proc_init (char **argv);
DEFINE_HOOK (_hurd_subinit, (void)); DEFINE_HOOK (_hurd_subinit, (void));
/* Initialize the library data structures from the /* Initialize the library data structures from the
@ -84,7 +82,7 @@ _hurd_init (int flags, char **argv,
/* Tell the proc server we exist, if it does. */ /* Tell the proc server we exist, if it does. */
if (portarray[INIT_PORT_PROC] != MACH_PORT_NULL) if (portarray[INIT_PORT_PROC] != MACH_PORT_NULL)
_hurd_proc_init (argv); _hurd_proc_init (argv, intarray, intarraysize);
/* All done with init ints and ports. */ /* All done with init ints and ports. */
__vm_deallocate (__mach_task_self (), __vm_deallocate (__mach_task_self (),
@ -120,14 +118,15 @@ DEFINE_HOOK (_hurd_proc_subinit, (void));
Call _hurdsig_init to set up signal processing. */ Call _hurdsig_init to set up signal processing. */
void void
_hurd_proc_init (char **argv) _hurd_proc_init (char **argv,
const int *intarray, size_t intarraysize)
{ {
mach_port_t oldmsg; mach_port_t oldmsg;
struct hurd_userlink ulink; struct hurd_userlink ulink;
process_t procserver; process_t procserver;
/* Initialize the signal code; Mach exceptions will become signals. */ /* Initialize the signal code; Mach exceptions will become signals. */
_hurdsig_init (); _hurdsig_init (intarray, intarraysize);
/* The signal thread is now prepared to receive messages. /* The signal thread is now prepared to receive messages.
It is safe to give the port to the proc server. */ It is safe to give the port to the proc server. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc. /* Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -1167,10 +1167,11 @@ extern void __mig_init (void *);
thread. */ thread. */
void void
_hurdsig_init (void) _hurdsig_init (const int *intarray, size_t intarraysize)
{ {
error_t err; error_t err;
vm_size_t stacksize; vm_size_t stacksize;
struct hurd_sigstate *ss;
__mutex_init (&_hurd_siglock); __mutex_init (&_hurd_siglock);
@ -1186,9 +1187,26 @@ _hurdsig_init (void)
MACH_MSG_TYPE_MAKE_SEND); MACH_MSG_TYPE_MAKE_SEND);
assert_perror (err); assert_perror (err);
/* Initialize the main thread's signal state. */
ss = _hurd_self_sigstate ();
/* Copy inherited values from our parent (or pre-exec process state)
into the signal settings of the main thread. */
if (intarraysize > INIT_SIGMASK)
ss->blocked = intarray[INIT_SIGMASK];
if (intarraysize > INIT_SIGPENDING)
ss->blocked = intarray[INIT_SIGPENDING];
if (intarraysize > INIT_SIGIGN && intarray[INIT_SIGIGN] != 0)
{
int signo;
for (signo = 1; signo < NSIG; ++signo)
if (intarray[INIT_SIGIGN] & __sigmask(signo))
ss->actions[signo].sa_handler = SIG_IGN;
}
/* Set the default thread to receive task-global signals /* Set the default thread to receive task-global signals
to this one, the main (first) user thread. */ to this one, the main (first) user thread. */
_hurd_sigthread = __mach_thread_self (); _hurd_sigthread = ss->thread;
/* Start the signal thread listening on the message port. */ /* Start the signal thread listening on the message port. */
@ -1215,8 +1233,6 @@ _hurdsig_init (void)
err = __thread_resume (_hurd_msgport_thread); err = __thread_resume (_hurd_msgport_thread);
assert_perror (err); assert_perror (err);
(void) _hurd_self_sigstate ();
/* Receive exceptions on the signal port. */ /* Receive exceptions on the signal port. */
__task_set_special_port (__mach_task_self (), __task_set_special_port (__mach_task_self (),
TASK_EXCEPTION_PORT, _hurd_msgport); TASK_EXCEPTION_PORT, _hurd_msgport);