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

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