PostgreSQL Source Code git master
legacy-pqsignal.c File Reference
#include "postgres_fe.h"
#include <signal.h>
Include dependency graph for legacy-pqsignal.c:

Go to the source code of this file.

Functions

pqsigfunc pqsignal (int signo, pqsigfunc func)
 

Function Documentation

◆ pqsignal()

pqsigfunc pqsignal ( int  signo,
pqsigfunc  func 
)

Definition at line 42 of file legacy-pqsignal.c.

43{
44#ifndef WIN32
45 struct sigaction act,
46 oact;
47
48 act.sa_handler = func;
49 sigemptyset(&act.sa_mask);
50 act.sa_flags = 0;
51 if (signo != SIGALRM)
52 act.sa_flags |= SA_RESTART;
53#ifdef SA_NOCLDSTOP
54 if (signo == SIGCHLD)
55 act.sa_flags |= SA_NOCLDSTOP;
56#endif
57 if (sigaction(signo, &act, &oact) < 0)
58 return SIG_ERR;
59 return oact.sa_handler;
60#else /* WIN32 */
61 return signal(signo, func);
62#endif
63}
#define SIGCHLD
Definition: win32_port.h:168
#define SIGALRM
Definition: win32_port.h:164