about summary refs log tree commit diff
path: root/hurd/hurdsig.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1998-11-11 09:56:51 +0000
committerRoland McGrath <roland@gnu.org>1998-11-11 09:56:51 +0000
commit62495816a5df7632ef6cc6f0e6f09e135aa763a1 (patch)
tree15c2c1b07617600b9d1da5271928fe347be5abf5 /hurd/hurdsig.c
parent74eee8866db0c7e01216e6a73b9b19414a95b04b (diff)
downloadglibc-62495816a5df7632ef6cc6f0e6f09e135aa763a1.tar.gz
glibc-62495816a5df7632ef6cc6f0e6f09e135aa763a1.tar.xz
glibc-62495816a5df7632ef6cc6f0e6f09e135aa763a1.zip
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.
Diffstat (limited to 'hurd/hurdsig.c')
-rw-r--r--hurd/hurdsig.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index 6597198464..67f5bd0fe6 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -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.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -1167,10 +1167,11 @@ extern void __mig_init (void *);
    thread.  */
 
 void
-_hurdsig_init (void)
+_hurdsig_init (const int *intarray, size_t intarraysize)
 {
   error_t err;
   vm_size_t stacksize;
+  struct hurd_sigstate *ss;
 
   __mutex_init (&_hurd_siglock);
 
@@ -1186,9 +1187,26 @@ _hurdsig_init (void)
 				  MACH_MSG_TYPE_MAKE_SEND);
   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
      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.  */
 
@@ -1215,8 +1233,6 @@ _hurdsig_init (void)
   err = __thread_resume (_hurd_msgport_thread);
   assert_perror (err);
 
-  (void) _hurd_self_sigstate ();
-
   /* Receive exceptions on the signal port.  */
   __task_set_special_port (__mach_task_self (),
 			   TASK_EXCEPTION_PORT, _hurd_msgport);