Header And Logo

PostgreSQL
| The world's most advanced open source database.

pqsignal.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * pqsignal.h
00004  *    Backend signal(2) support (see also src/port/pqsignal.c)
00005  *
00006  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00007  * Portions Copyright (c) 1994, Regents of the University of California
00008  *
00009  * src/include/libpq/pqsignal.h
00010  *
00011  *-------------------------------------------------------------------------
00012  */
00013 #ifndef PQSIGNAL_H
00014 #define PQSIGNAL_H
00015 
00016 #include <signal.h>
00017 
00018 #ifdef HAVE_SIGPROCMASK
00019 extern sigset_t UnBlockSig,
00020             BlockSig,
00021             StartupBlockSig;
00022 
00023 #define PG_SETMASK(mask)    sigprocmask(SIG_SETMASK, mask, NULL)
00024 #else                           /* not HAVE_SIGPROCMASK */
00025 extern int  UnBlockSig,
00026             BlockSig,
00027             StartupBlockSig;
00028 
00029 #ifndef WIN32
00030 #define PG_SETMASK(mask)    sigsetmask(*((int*)(mask)))
00031 #else
00032 #define PG_SETMASK(mask)        pqsigsetmask(*((int*)(mask)))
00033 int         pqsigsetmask(int mask);
00034 #endif
00035 
00036 #define sigaddset(set, signum)  (*(set) |= (sigmask(signum)))
00037 #define sigdelset(set, signum)  (*(set) &= ~(sigmask(signum)))
00038 #endif   /* not HAVE_SIGPROCMASK */
00039 
00040 extern void pqinitmask(void);
00041 
00042 #endif   /* PQSIGNAL_H */