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 36 of file legacy-pqsignal.c.

References SIG_ERR, SIGALRM, and SIGCHLD.

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