Merge profiler branch
[bpt/emacs.git] / src / syssignal.h
1 /* syssignal.h - System-dependent definitions for signals.
2
3 Copyright (C) 1993, 1999, 2001-2012 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 #include <stdbool.h>
22
23 extern void init_signals (bool);
24
25 #ifdef HAVE_PTHREAD
26 #include <pthread.h>
27 /* If defined, asynchronous signals delivered to a non-main thread are
28 forwarded to the main thread. */
29 #define FORWARD_SIGNAL_TO_MAIN_THREAD
30 #endif
31
32 extern sigset_t empty_mask;
33
34 typedef void (*signal_handler_t) (int);
35
36 extern void emacs_sigaction_init (struct sigaction *, signal_handler_t);
37
38 #if NSIG < NSIG_MINIMUM
39 # undef NSIG
40 # define NSIG NSIG_MINIMUM
41 #endif
42
43 #ifndef emacs_raise
44 # define emacs_raise(sig) raise (sig)
45 #endif
46
47 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
48 Must do that using the killpg call. */
49 #ifdef BSD_SYSTEM
50 #define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo)))
51 #else
52 #ifdef WINDOWSNT
53 #define EMACS_KILLPG(gid, signo) (kill (gid, signo))
54 #else
55 #define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo)))
56 #endif
57 #endif
58
59 /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
60 testing SIGCHLD. */
61 #ifdef SIGCLD
62 #ifndef SIGCHLD
63 #define SIGCHLD SIGCLD
64 #endif /* SIGCHLD */
65 #endif /* ! defined (SIGCLD) */
66
67 #ifndef HAVE_STRSIGNAL
68 /* strsignal is in sysdep.c */
69 char *strsignal (int);
70 #endif
71
72 void deliver_process_signal (int, signal_handler_t);