Merge from emacs-24; up to 2014-05-01T10:21:17Z!rgm@gnu.org
[bpt/emacs.git] / src / syssignal.h
1 /* syssignal.h - System-dependent definitions for signals.
2
3 Copyright (C) 1993, 1999, 2001-2014 Free Software Foundation, Inc.
4
5 This file is part of GNU Emacs.
6
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20 #include <signal.h>
21
22 extern void init_signals (bool);
23 extern void block_tty_out_signal (sigset_t *);
24 extern void unblock_tty_out_signal (sigset_t const *);
25
26 #ifdef HAVE_PTHREAD
27 #include <pthread.h>
28 /* If defined, asynchronous signals delivered to a non-main thread are
29 forwarded to the main thread. */
30 #define FORWARD_SIGNAL_TO_MAIN_THREAD
31 #endif
32
33 #if defined HAVE_TIMER_SETTIME && defined SIGEV_SIGNAL
34 # define HAVE_ITIMERSPEC
35 #endif
36
37 #if (defined SIGPROF && !defined PROFILING \
38 && (defined HAVE_SETITIMER || defined HAVE_ITIMERSPEC))
39 # define PROFILER_CPU_SUPPORT
40 #endif
41
42 extern sigset_t empty_mask;
43
44 typedef void (*signal_handler_t) (int);
45
46 extern void emacs_sigaction_init (struct sigaction *, signal_handler_t);
47 char const *safe_strsignal (int) ATTRIBUTE_CONST;
48
49 #if NSIG < NSIG_MINIMUM
50 # undef NSIG
51 # define NSIG NSIG_MINIMUM
52 #endif
53
54 #ifndef SA_SIGINFO
55 # define SA_SIGINFO 0
56 #endif
57
58 #ifndef emacs_raise
59 # define emacs_raise(sig) raise (sig)
60 #endif
61
62 #ifndef HAVE_STRSIGNAL
63 # define strsignal(sig) safe_strsignal (sig)
64 #endif
65
66 void deliver_process_signal (int, signal_handler_t);