#include <signal.h>
Go to the source code of this file.
Defines | |
#define | PG_SETMASK(mask) sigsetmask(*((int*)(mask))) |
#define | sigaddset(set, signum) (*(set) |= (sigmask(signum))) |
#define | sigdelset(set, signum) (*(set) &= ~(sigmask(signum))) |
Functions | |
void | pqinitmask (void) |
Variables | |
int | UnBlockSig |
int | BlockSig |
int | StartupBlockSig |
#define PG_SETMASK | ( | mask | ) | sigsetmask(*((int*)(mask))) |
Definition at line 30 of file pqsignal.h.
Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), BackendInitialize(), BackgroundWorkerBlockSignals(), BackgroundWorkerUnblockSignals(), BackgroundWriterMain(), bg_quickdie(), bgworker_die(), bgworker_quickdie(), bootstrap_signals(), CheckpointerMain(), chkpt_quickdie(), PgArchiverMain(), PgstatCollectorMain(), pmdie(), PostgresMain(), PostmasterMain(), quickdie(), reaper(), ServerLoop(), SIGHUP_handler(), sigusr1_handler(), startupproc_quickdie(), StartupProcessMain(), SysLoggerMain(), wal_quickdie(), WalRcvQuickDieHandler(), WalReceiverMain(), and WalWriterMain().
#define sigaddset | ( | set, | ||
signum | ||||
) | (*(set) |= (sigmask(signum))) |
Definition at line 36 of file pqsignal.h.
Referenced by bgworker_quickdie(), quickdie(), and system().
#define sigdelset | ( | set, | ||
signum | ||||
) | (*(set) &= ~(sigmask(signum))) |
Definition at line 37 of file pqsignal.h.
Referenced by BackgroundWriterMain(), CheckpointerMain(), PostgresMain(), pqinitmask(), WalReceiverMain(), and WalWriterMain().
void pqinitmask | ( | void | ) |
Definition at line 46 of file pqsignal.c.
References BlockSig, SIGABRT, SIGALRM, SIGCHLD, SIGCONT, sigdelset, SIGHUP, sigmask, SIGQUIT, SIGTRAP, SIGUSR1, SIGUSR2, SIGWINCH, StartupBlockSig, and UnBlockSig.
Referenced by PostgresMain(), and PostmasterMain().
{ #ifdef HAVE_SIGPROCMASK sigemptyset(&UnBlockSig); /* First set all signals, then clear some. */ sigfillset(&BlockSig); sigfillset(&StartupBlockSig); /* * Unmark those signals that should never be blocked. Some of these signal * names don't exist on all platforms. Most do, but might as well ifdef * them all for consistency... */ #ifdef SIGTRAP sigdelset(&BlockSig, SIGTRAP); sigdelset(&StartupBlockSig, SIGTRAP); #endif #ifdef SIGABRT sigdelset(&BlockSig, SIGABRT); sigdelset(&StartupBlockSig, SIGABRT); #endif #ifdef SIGILL sigdelset(&BlockSig, SIGILL); sigdelset(&StartupBlockSig, SIGILL); #endif #ifdef SIGFPE sigdelset(&BlockSig, SIGFPE); sigdelset(&StartupBlockSig, SIGFPE); #endif #ifdef SIGSEGV sigdelset(&BlockSig, SIGSEGV); sigdelset(&StartupBlockSig, SIGSEGV); #endif #ifdef SIGBUS sigdelset(&BlockSig, SIGBUS); sigdelset(&StartupBlockSig, SIGBUS); #endif #ifdef SIGSYS sigdelset(&BlockSig, SIGSYS); sigdelset(&StartupBlockSig, SIGSYS); #endif #ifdef SIGCONT sigdelset(&BlockSig, SIGCONT); sigdelset(&StartupBlockSig, SIGCONT); #endif /* Signals unique to startup */ #ifdef SIGQUIT sigdelset(&StartupBlockSig, SIGQUIT); #endif #ifdef SIGTERM sigdelset(&StartupBlockSig, SIGTERM); #endif #ifdef SIGALRM sigdelset(&StartupBlockSig, SIGALRM); #endif #else /* Set the signals we want. */ UnBlockSig = 0; BlockSig = sigmask(SIGQUIT) | sigmask(SIGTERM) | sigmask(SIGALRM) | /* common signals between two */ sigmask(SIGHUP) | sigmask(SIGINT) | sigmask(SIGUSR1) | sigmask(SIGUSR2) | sigmask(SIGCHLD) | sigmask(SIGWINCH) | sigmask(SIGFPE); StartupBlockSig = sigmask(SIGHUP) | sigmask(SIGINT) | sigmask(SIGUSR1) | sigmask(SIGUSR2) | sigmask(SIGCHLD) | sigmask(SIGWINCH) | sigmask(SIGFPE); #endif }
int BlockSig |
Definition at line 26 of file pqsignal.c.
Referenced by BackendInitialize(), BackgroundWorkerBlockSignals(), BackgroundWriterMain(), bg_quickdie(), bgworker_die(), bgworker_quickdie(), CheckpointerMain(), chkpt_quickdie(), pmdie(), PostgresMain(), PostmasterMain(), pqinitmask(), quickdie(), reaper(), ServerLoop(), SIGHUP_handler(), sigusr1_handler(), startupproc_quickdie(), wal_quickdie(), WalRcvQuickDieHandler(), WalReceiverMain(), and WalWriterMain().
int StartupBlockSig |
Definition at line 26 of file pqsignal.c.
Referenced by BackendInitialize(), and pqinitmask().
int UnBlockSig |
Definition at line 26 of file pqsignal.c.
Referenced by AutoVacLauncherMain(), AutoVacWorkerMain(), BackgroundWorkerUnblockSignals(), BackgroundWriterMain(), bootstrap_signals(), CheckpointerMain(), PgArchiverMain(), PgstatCollectorMain(), pmdie(), PostgresMain(), pqinitmask(), reaper(), ServerLoop(), SIGHUP_handler(), sigusr1_handler(), StartupProcessMain(), SysLoggerMain(), WalReceiverMain(), and WalWriterMain().