~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to src/include/libpq/pqsignal.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-------------------------------------------------------------------------
 
2
 *
 
3
 * pqsignal.h
 
4
 *        prototypes for the reliable BSD-style signal(2) routine.
 
5
 *
 
6
 *
 
7
 * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
 
8
 * Portions Copyright (c) 1994, Regents of the University of California
 
9
 *
 
10
 * src/include/libpq/pqsignal.h
 
11
 *
 
12
 * NOTES
 
13
 *        This shouldn't be in libpq, but the monitor and some other
 
14
 *        things need it...
 
15
 *
 
16
 *-------------------------------------------------------------------------
 
17
 */
 
18
#ifndef PQSIGNAL_H
 
19
#define PQSIGNAL_H
 
20
 
 
21
#include <signal.h>
 
22
 
 
23
#ifdef HAVE_SIGPROCMASK
 
24
extern sigset_t UnBlockSig,
 
25
                        BlockSig,
 
26
                        StartupBlockSig;
 
27
 
 
28
#define PG_SETMASK(mask)        sigprocmask(SIG_SETMASK, mask, NULL)
 
29
#else                                                   /* not HAVE_SIGPROCMASK */
 
30
extern int      UnBlockSig,
 
31
                        BlockSig,
 
32
                        StartupBlockSig;
 
33
 
 
34
#ifndef WIN32
 
35
#define PG_SETMASK(mask)        sigsetmask(*((int*)(mask)))
 
36
#else
 
37
#define PG_SETMASK(mask)                pqsigsetmask(*((int*)(mask)))
 
38
int                     pqsigsetmask(int mask);
 
39
#endif
 
40
 
 
41
#define sigaddset(set, signum)  (*(set) |= (sigmask(signum)))
 
42
#define sigdelset(set, signum)  (*(set) &= ~(sigmask(signum)))
 
43
#endif   /* not HAVE_SIGPROCMASK */
 
44
 
 
45
typedef void (*pqsigfunc) (int);
 
46
 
 
47
extern void pqinitmask(void);
 
48
 
 
49
extern pqsigfunc pqsignal(int signo, pqsigfunc func);
 
50
 
 
51
#endif   /* PQSIGNAL_H */