Fix last change.
[emacs.git] / src / syssignal.h
blob2bf2f046aa5f69dbd1e35ea04902956486ad0c81
1 /* syssignal.h - System-dependent definitions for signals.
3 Copyright (C) 1993, 1999, 2001-2012 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
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.
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.
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/>. */
20 #include <signal.h>
21 #include <stdbool.h>
23 extern void init_signals (bool);
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
32 #if defined HAVE_TIMER_SETTIME && defined SIGEV_SIGNAL
33 # define HAVE_ITIMERSPEC
34 #endif
36 #if (defined SIGPROF && !defined PROFILING \
37 && (defined HAVE_SETITIMER || defined HAVE_ITIMERSPEC))
38 # define PROFILER_CPU_SUPPORT
39 #endif
41 extern sigset_t empty_mask;
43 typedef void (*signal_handler_t) (int);
45 extern void emacs_sigaction_init (struct sigaction *, signal_handler_t);
46 char const *safe_strsignal (int) ATTRIBUTE_CONST;
48 #if NSIG < NSIG_MINIMUM
49 # undef NSIG
50 # define NSIG NSIG_MINIMUM
51 #endif
53 #ifndef emacs_raise
54 # define emacs_raise(sig) raise (sig)
55 #endif
57 /* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
58 Must do that using the killpg call. */
59 #ifdef BSD_SYSTEM
60 #define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo)))
61 #else
62 #ifdef WINDOWSNT
63 #define EMACS_KILLPG(gid, signo) (kill (gid, signo))
64 #else
65 #define EMACS_KILLPG(gid, signo) (kill (-(gid), (signo)))
66 #endif
67 #endif
69 /* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
70 testing SIGCHLD. */
71 #ifdef SIGCLD
72 #ifndef SIGCHLD
73 #define SIGCHLD SIGCLD
74 #endif /* SIGCHLD */
75 #endif /* ! defined (SIGCLD) */
77 #ifndef HAVE_STRSIGNAL
78 # define strsignal(sig) safe_strsignal (sig)
79 #endif
81 void deliver_process_signal (int, signal_handler_t);