summaryrefslogtreecommitdiff
path: root/hurd/hurd/signal.h
diff options
context:
space:
mode:
Diffstat (limited to 'hurd/hurd/signal.h')
-rw-r--r--hurd/hurd/signal.h54
1 files changed, 28 insertions, 26 deletions
diff --git a/hurd/hurd/signal.h b/hurd/hurd/signal.h
index c589c59b4e..f84c4ef485 100644
--- a/hurd/hurd/signal.h
+++ b/hurd/hurd/signal.h
@@ -1,5 +1,5 @@
/* Implementing POSIX.1 signals under the Hurd.
- Copyright (C) 1993-2016 Free Software Foundation, Inc.
+ Copyright (C) 1993-2018 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
@@ -20,10 +20,6 @@
#define _HURD_SIGNAL_H 1
#include <features.h>
-/* Make sure <signal.h> is going to define NSIG. */
-#ifndef __USE_GNU
-#error "Must have `_GNU_SOURCE' feature test macro to use this file"
-#endif
#define __need_size_t
#define __need_NULL
@@ -35,12 +31,21 @@
#include <hurd/hurd_types.h>
#include <signal.h>
#include <errno.h>
+#include <bits/types/error_t.h>
+#include <bits/types/stack_t.h>
+#include <bits/types/sigset_t.h>
+#include <bits/sigaction.h>
#include <hurd/msg.h>
#include <cthreads.h> /* For `struct mutex'. */
#include <setjmp.h> /* For `jmp_buf'. */
#include <spin-lock.h>
struct hurd_signal_preemptor; /* <hurd/sigpreempt.h> */
+#if defined __USE_EXTERN_INLINES && defined _LIBC
+# if IS_IN (libc) || IS_IN (libpthread)
+# include <sigsetops.h>
+# endif
+#endif
/* Full details of a signal. */
@@ -68,8 +73,8 @@ struct hurd_sigstate
sigset_t blocked; /* What signals are blocked. */
sigset_t pending; /* Pending signals, possibly blocked. */
- struct sigaction actions[NSIG];
- struct sigaltstack sigaltstack;
+ struct sigaction actions[_NSIG];
+ stack_t sigaltstack;
/* Chain of thread-local signal preemptors; see <hurd/sigpreempt.h>.
Each element of this chain is in local stack storage, and the chain
@@ -78,7 +83,7 @@ struct hurd_sigstate
struct hurd_signal_preemptor *preemptors;
/* For each signal that may be pending, the details to deliver it with. */
- struct hurd_signal_detail pending_data[NSIG];
+ struct hurd_signal_detail pending_data[_NSIG];
/* If `suspended' is set when this thread gets a signal,
the signal thread sends an empty message to it. */
@@ -129,16 +134,15 @@ extern struct hurd_sigstate *_hurd_self_sigstate (void)
#endif
#if defined __USE_EXTERN_INLINES && defined _LIBC
-# if IS_IN (libc)
+# if IS_IN (libc)
_HURD_SIGNAL_H_EXTERN_INLINE struct hurd_sigstate *
_hurd_self_sigstate (void)
{
- struct hurd_sigstate **location = &THREAD_SELF->_hurd_sigstate;
- if (*location == NULL)
- *location = _hurd_thread_sigstate (__mach_thread_self ());
- return *location;
+ if (THREAD_SELF->_hurd_sigstate == NULL)
+ THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
+ return THREAD_SELF->_hurd_sigstate;
}
-# endif
+# endif
#endif
/* Thread listening on our message port; also called the "signal thread". */
@@ -169,28 +173,26 @@ extern int _hurd_core_limit;
extern void *_hurd_critical_section_lock (void);
#if defined __USE_EXTERN_INLINES && defined _LIBC
-# if IS_IN (libc)
+# if IS_IN (libc)
_HURD_SIGNAL_H_EXTERN_INLINE void *
_hurd_critical_section_lock (void)
{
- struct hurd_sigstate **location;
struct hurd_sigstate *ss;
#ifdef __LIBC_NO_TLS
- if (__LIBC_NO_TLS())
+ if (__LIBC_NO_TLS ())
/* TLS is currently initializing, no need to enter critical section. */
return NULL;
#endif
- location = &THREAD_SELF->_hurd_sigstate;
- ss = *location;
+ ss = THREAD_SELF->_hurd_sigstate;
if (ss == NULL)
{
/* The thread variable is unset; this must be the first time we've
asked for it. In this case, the critical section flag cannot
possible already be set. Look up our sigstate structure the slow
way. */
- ss = *location = _hurd_thread_sigstate (__mach_thread_self ());
+ ss = THREAD_SELF->_hurd_sigstate = _hurd_thread_sigstate (__mach_thread_self ());
}
if (! __spin_try_lock (&ss->critical_section_lock))
@@ -202,13 +204,13 @@ _hurd_critical_section_lock (void)
_hurd_critical_section_unlock to unlock it. */
return ss;
}
-# endif
+# endif
#endif
extern void _hurd_critical_section_unlock (void *our_lock);
#if defined __USE_EXTERN_INLINES && defined _LIBC
-# if IS_IN (libc)
+# if IS_IN (libc)
_HURD_SIGNAL_H_EXTERN_INLINE void
_hurd_critical_section_unlock (void *our_lock)
{
@@ -231,7 +233,7 @@ _hurd_critical_section_unlock (void *our_lock)
__msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
}
}
-# endif
+# endif
#endif
/* Convenient macros for simple uses of critical sections.
@@ -362,18 +364,18 @@ extern mach_msg_timeout_t _hurd_interrupted_rpc_timeout;
do \
{ \
/* Get the message port. */ \
- __err = (fetch_msgport_expr); \
+ __err = (error_t) (fetch_msgport_expr); \
if (__err) \
break; \
/* Get the reference port. */ \
- __err = (fetch_refport_expr); \
+ __err = (error_t) (fetch_refport_expr); \
if (__err) \
{ \
/* Couldn't get it; deallocate MSGPORT and fail. */ \
__mach_port_deallocate (__mach_task_self (), msgport); \
break; \
} \
- __err = (rpc_expr); \
+ __err = (error_t) (rpc_expr); \
__mach_port_deallocate (__mach_task_self (), msgport); \
if ((dealloc_refport) && refport != MACH_PORT_NULL) \
__mach_port_deallocate (__mach_task_self (), refport); \