Update copyright dates with scripts/update-copyrights.
[platform/upstream/glibc.git] / hurd / hurdsig.c
index 1bfc093..87a7a6b 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,01
-       Free Software Foundation, Inc.
+/* Copyright (C) 1991-2015 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
@@ -13,9 +12,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -31,6 +29,7 @@
 
 #include "hurdfault.h"
 #include "hurdmalloc.h"                /* XXX */
+#include "../locale/localeinfo.h"
 
 const char *_hurdsig_getenv (const char *);
 
@@ -131,7 +130,7 @@ _hurd_thread_sigstate (thread_t thread)
 #include <setjmp.h>
 #include <fcntl.h>
 #include <sys/wait.h>
-#include "thread_state.h"
+#include <thread_state.h>
 #include <hurd/msg_server.h>
 #include <hurd/msg_reply.h>    /* For __msg_sig_post_reply.  */
 #include <hurd/interrupt.h>
@@ -255,7 +254,7 @@ interrupted_reply_port_location (struct machine_thread_all_state *thread_state,
 }
 \f
 #include <hurd/sigpreempt.h>
-#include "intr-msg.h"
+#include <intr-msg.h>
 
 /* Timeout on interrupt_operation calls.  */
 mach_msg_timeout_t _hurdsig_interrupt_timeout = 1000;
@@ -742,6 +741,11 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
       break;
 
     case ignore:
+      if (detail->exc)
+       /* Blocking or ignoring a machine exception is fatal.
+          Otherwise we could just spin on the faulting instruction.  */
+       goto fatal;
+
       /* Nobody cares about this signal.  If there was a call to resume
         above in SIGCONT processing and we've left a thread suspended,
         now's the time to set it going. */
@@ -758,6 +762,8 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
         Nothing to do but die; BSD gets SIGILL in this case.  */
       detail->code = signo;    /* XXX ? */
       signo = SIGILL;
+
+    fatal:
       act = core;
       /* FALLTHROUGH */
 
@@ -1126,6 +1132,7 @@ signal_allowed (int signo, mach_port_t refport)
              }
            _hurd_port_free (&_hurd_dtable[d]->port, &ulink, port);
          }
+       __mutex_unlock (&_hurd_dtable_lock);
        /* If we found a lucky winner, we've set D to -1 in the loop.  */
        if (lucky)
          goto win;
@@ -1265,6 +1272,10 @@ _hurdsig_init (const int *intarray, size_t intarraysize)
        malloc (__hurd_threadvar_max * sizeof (unsigned long int));
       if (__hurd_sigthread_variables == NULL)
        __libc_fatal ("hurd: Can't allocate threadvars for signal thread\n");
+      memset (__hurd_sigthread_variables, 0,
+             __hurd_threadvar_max * sizeof (unsigned long int));
+      __hurd_sigthread_variables[_HURD_THREADVAR_LOCALE]
+       = (unsigned long int) &_nl_global_locale;
 
       /* Reinitialize the MiG support routines so they will use a per-thread
         variable for the cached reply port.  */
@@ -1358,6 +1369,9 @@ text_set_element (_hurd_reauth_hook, reauth_proc);
 const char *
 _hurdsig_getenv (const char *variable)
 {
+  if (__libc_enable_secure)
+    return NULL;
+
   if (_hurdsig_catch_memory_fault (__environ))
     /* We bombed in getenv.  */
     return NULL;