|
1 | 1 | /*------------------------------------------------------------------------- |
2 | 2 | * |
3 | 3 | * pqsignal.c |
4 | | - * reliable BSD-style signal(2) routine stolen from RWW who stole it |
5 | | - * from Stevens... |
| 4 | + * Backend signal(2) support (see also src/port/pqsignal.c) |
6 | 5 | * |
7 | 6 | * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group |
8 | 7 | * Portions Copyright (c) 1994, Regents of the University of California |
|
11 | 10 | * IDENTIFICATION |
12 | 11 | * src/backend/libpq/pqsignal.c |
13 | 12 | * |
14 | | - * NOTES |
15 | | - * This shouldn't be in libpq, but the monitor and some other |
16 | | - * things need it... |
17 | | - * |
18 | | - * A NOTE ABOUT SIGNAL HANDLING ACROSS THE VARIOUS PLATFORMS. |
19 | | - * |
20 | | - * pg_config.h defines the macro HAVE_POSIX_SIGNALS for some platforms and |
21 | | - * not for others. This file and pqsignal.h use that macro to decide |
22 | | - * how to handle signalling. |
23 | | - * |
24 | | - * signal(2) handling - this is here because it affects some of |
25 | | - * the frontend commands as well as the backend processes. |
26 | | - * |
27 | | - * Ultrix and SunOS provide BSD signal(2) semantics by default. |
28 | | - * |
29 | | - * SVID2 and POSIX signal(2) semantics differ from BSD signal(2) |
30 | | - * semantics. We can use the POSIX sigaction(2) on systems that |
31 | | - * allow us to request restartable signals (SA_RESTART). |
32 | | - * |
33 | | - * Some systems don't allow restartable signals at all unless we |
34 | | - * link to a special BSD library. |
35 | | - * |
36 | | - * We devoutly hope that there aren't any systems that provide |
37 | | - * neither POSIX signals nor BSD signals. The alternative |
38 | | - * is to do signal-handler reinstallation, which doesn't work well |
39 | | - * at all. |
40 | | - * ------------------------------------------------------------------------*/ |
| 13 | + * ------------------------------------------------------------------------ |
| 14 | + */ |
41 | 15 |
|
42 | 16 | #include "postgres.h" |
43 | 17 |
|
44 | | -#include <signal.h> |
45 | | - |
46 | 18 | #include "libpq/pqsignal.h" |
47 | 19 |
|
48 | 20 |
|
@@ -145,36 +117,3 @@ pqinitmask(void) |
145 | 117 | sigmask(SIGWINCH) | sigmask(SIGFPE); |
146 | 118 | #endif |
147 | 119 | } |
148 | | - |
149 | | - |
150 | | -/* Win32 signal handling is in backend/port/win32/signal.c */ |
151 | | -#ifndef WIN32 |
152 | | - |
153 | | -/* |
154 | | - * Set up a signal handler |
155 | | - */ |
156 | | -pqsigfunc |
157 | | -pqsignal(int signo, pqsigfunc func) |
158 | | -{ |
159 | | -#if !defined(HAVE_POSIX_SIGNALS) |
160 | | - return signal(signo, func); |
161 | | -#else |
162 | | - struct sigaction act, |
163 | | - oact; |
164 | | - |
165 | | - act.sa_handler = func; |
166 | | - sigemptyset(&act.sa_mask); |
167 | | - act.sa_flags = 0; |
168 | | - if (signo != SIGALRM) |
169 | | - act.sa_flags |= SA_RESTART; |
170 | | -#ifdef SA_NOCLDSTOP |
171 | | - if (signo == SIGCHLD) |
172 | | - act.sa_flags |= SA_NOCLDSTOP; |
173 | | -#endif |
174 | | - if (sigaction(signo, &act, &oact) < 0) |
175 | | - return SIG_ERR; |
176 | | - return oact.sa_handler; |
177 | | -#endif /* !HAVE_POSIX_SIGNALS */ |
178 | | -} |
179 | | - |
180 | | -#endif /* WIN32 */ |
0 commit comments