Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf333204

Browse files
committed
Actually, it's not that hard to merge the Windows pqsignal code ...
... just need to typedef sigset_t and provide sigemptyset/sigfillset,which are easy enough.
1 parent2c713d6 commitf333204

File tree

2 files changed

+10
-35
lines changed

2 files changed

+10
-35
lines changed

‎src/backend/libpq/pqsignal.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,10 @@
1818
#include"libpq/pqsignal.h"
1919

2020

21-
#ifndefWIN32
21+
/* Global variables */
2222
sigset_tUnBlockSig,
2323
BlockSig,
2424
StartupBlockSig;
25-
#else
26-
intUnBlockSig,
27-
BlockSig,
28-
StartupBlockSig;
29-
#endif
3025

3126

3227
/*
@@ -45,8 +40,6 @@ intUnBlockSig,
4540
void
4641
pqinitmask(void)
4742
{
48-
#ifndefWIN32
49-
5043
sigemptyset(&UnBlockSig);
5144

5245
/* First set all signals, then clear some. */
@@ -101,19 +94,4 @@ pqinitmask(void)
10194
#ifdefSIGALRM
10295
sigdelset(&StartupBlockSig,SIGALRM);
10396
#endif
104-
#else/* WIN32 */
105-
/* Set the signals we want. */
106-
UnBlockSig=0;
107-
BlockSig=sigmask(SIGQUIT) |
108-
sigmask(SIGTERM) |sigmask(SIGALRM) |
109-
/* common signals between two */
110-
sigmask(SIGHUP) |
111-
sigmask(SIGINT) |sigmask(SIGUSR1) |
112-
sigmask(SIGUSR2) |sigmask(SIGCHLD) |
113-
sigmask(SIGWINCH) |sigmask(SIGFPE);
114-
StartupBlockSig=sigmask(SIGHUP) |
115-
sigmask(SIGINT) |sigmask(SIGUSR1) |
116-
sigmask(SIGUSR2) |sigmask(SIGCHLD) |
117-
sigmask(SIGWINCH) |sigmask(SIGFPE);
118-
#endif
11997
}

‎src/include/libpq/pqsignal.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,24 @@
1616
#include<signal.h>
1717

1818
#ifndefWIN32
19-
externsigset_tUnBlockSig,
20-
BlockSig,
21-
StartupBlockSig;
22-
2319
#definePG_SETMASK(mask)sigprocmask(SIG_SETMASK, mask, NULL)
24-
#else/* WIN32 */
25-
/*
26-
* Windows doesn't provide the POSIX signal API, so we use something
27-
* approximating the old BSD signal API.
28-
*/
29-
externintUnBlockSig,
30-
BlockSig,
31-
StartupBlockSig;
20+
#else
21+
/* Emulate POSIX sigset_t APIs on Windows */
22+
typedefintsigset_t;
3223

3324
externintpqsigsetmask(intmask);
3425

3526
#definePG_SETMASK(mask)pqsigsetmask(*(mask))
27+
#definesigemptyset(set)(*(set) = 0)
28+
#definesigfillset(set)(*(set) = ~0)
3629
#definesigaddset(set,signum)(*(set) |= (sigmask(signum)))
3730
#definesigdelset(set,signum)(*(set) &= ~(sigmask(signum)))
3831
#endif/* WIN32 */
3932

33+
externsigset_tUnBlockSig,
34+
BlockSig,
35+
StartupBlockSig;
36+
4037
externvoidpqinitmask(void);
4138

4239
#endif/* PQSIGNAL_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp