syssignal.h 2.14 KB
Newer Older
Jim Blandy's avatar
Jim Blandy committed
1
/* syssignal.h - System-dependent definitions for signals.
2 3

Copyright (C) 1993, 1999, 2001-2012 Free Software Foundation, Inc.
Jim Blandy's avatar
Jim Blandy committed
4 5 6

This file is part of GNU Emacs.

7
GNU Emacs is free software: you can redistribute it and/or modify
Jim Blandy's avatar
Jim Blandy committed
8
it under the terms of the GNU General Public License as published by
9 10
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Jim Blandy's avatar
Jim Blandy committed
11 12 13 14 15 16 17

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

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/>.  */
Jim Blandy's avatar
Jim Blandy committed
19

Paul Eggert's avatar
Paul Eggert committed
20
#include <signal.h>
21
#include <stdbool.h>
Paul Eggert's avatar
Paul Eggert committed
22

23
extern void init_signals (bool);
24

25
#ifdef HAVE_PTHREAD
26
#include <pthread.h>
27 28 29 30 31
/* If defined, asynchronous signals delivered to a non-main thread are
   forwarded to the main thread.  */
#define FORWARD_SIGNAL_TO_MAIN_THREAD
#endif

32 33
#if (defined SIGPROF && (defined HAVE_TIMER_SETTIME || defined HAVE_SETITIMER) \
     && !defined PROFILING)
34 35 36
# define PROFILER_CPU_SUPPORT
#endif

37
extern sigset_t empty_mask;
Jim Blandy's avatar
Jim Blandy committed
38

39
typedef void (*signal_handler_t) (int);
40

Paul Eggert's avatar
Paul Eggert committed
41
extern void emacs_sigaction_init (struct sigaction *, signal_handler_t);
42
char const *safe_strsignal (int);
Paul Eggert's avatar
Paul Eggert committed
43

44
#if NSIG < NSIG_MINIMUM
Paul Eggert's avatar
Paul Eggert committed
45
# undef NSIG
46 47 48
# define NSIG NSIG_MINIMUM
#endif

49 50 51 52
#ifndef emacs_raise
# define emacs_raise(sig) raise (sig)
#endif

Jim Blandy's avatar
Jim Blandy committed
53 54
/* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
   Must do that using the killpg call.  */
55
#ifdef BSD_SYSTEM
Jim Blandy's avatar
Jim Blandy committed
56 57
#define EMACS_KILLPG(gid, signo) (killpg ( (gid), (signo)))
#else
58
#ifdef WINDOWSNT
59
#define EMACS_KILLPG(gid, signo) (kill (gid, signo))
60
#else
Jim Blandy's avatar
Jim Blandy committed
61 62
#define EMACS_KILLPG(gid, signo) (kill   (-(gid), (signo)))
#endif
63
#endif
Jim Blandy's avatar
Jim Blandy committed
64 65 66 67 68 69

/* Define SIGCHLD as an alias for SIGCLD.  There are many conditionals
   testing SIGCHLD.  */
#ifdef SIGCLD
#ifndef SIGCHLD
#define SIGCHLD SIGCLD
70 71
#endif /* SIGCHLD */
#endif /* ! defined (SIGCLD) */
72 73

#ifndef HAVE_STRSIGNAL
74
# define strsignal(sig) safe_strsignal (sig)
75
#endif
Miles Bader's avatar
Miles Bader committed
76

77
void deliver_process_signal (int, signal_handler_t);