Header And Logo

| The world's most advanced open source database.

Defines | Functions | Variables

pqsignal.h File Reference

#include <signal.h>
Include dependency graph for pqsignal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define PG_SETMASK(mask)   sigsetmask(*((int*)(mask)))
#define sigaddset(set, signum)   (*(set) |= (sigmask(signum)))
#define sigdelset(set, signum)   (*(set) &= ~(sigmask(signum)))


void pqinitmask (void)


int UnBlockSig
int BlockSig
int StartupBlockSig

Define Documentation

#define PG_SETMASK (   mask  )     sigsetmask(*((int*)(mask)))
#define sigaddset (   set,
)    (*(set) |= (sigmask(signum)))

Definition at line 36 of file pqsignal.h.

Referenced by bgworker_quickdie(), quickdie(), and system().

#define sigdelset (   set,
)    (*(set) &= ~(sigmask(signum)))

Function Documentation

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().



    /* First set all signals, then clear some. */

     * 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);
#ifdef SIGABRT
    sigdelset(&BlockSig, SIGABRT);
    sigdelset(&StartupBlockSig, SIGABRT);
#ifdef SIGILL
    sigdelset(&BlockSig, SIGILL);
    sigdelset(&StartupBlockSig, SIGILL);
#ifdef SIGFPE
    sigdelset(&BlockSig, SIGFPE);
    sigdelset(&StartupBlockSig, SIGFPE);
#ifdef SIGSEGV
    sigdelset(&BlockSig, SIGSEGV);
    sigdelset(&StartupBlockSig, SIGSEGV);
#ifdef SIGBUS
    sigdelset(&BlockSig, SIGBUS);
    sigdelset(&StartupBlockSig, SIGBUS);
#ifdef SIGSYS
    sigdelset(&BlockSig, SIGSYS);
    sigdelset(&StartupBlockSig, SIGSYS);
#ifdef SIGCONT
    sigdelset(&BlockSig, SIGCONT);
    sigdelset(&StartupBlockSig, SIGCONT);

/* Signals unique to startup */
#ifdef SIGQUIT
    sigdelset(&StartupBlockSig, SIGQUIT);
#ifdef SIGTERM
    sigdelset(&StartupBlockSig, SIGTERM);
#ifdef SIGALRM
    sigdelset(&StartupBlockSig, SIGALRM);
    /* 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);

Variable Documentation

int BlockSig

Definition at line 26 of file pqsignal.c.

Referenced by BackendInitialize(), and pqinitmask().