PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pqsignal.c File Reference
#include "c.h"
#include <signal.h>
Include dependency graph for pqsignal.c:

Go to the source code of this file.

Functions

pqsigfunc pqsignal (int signo, pqsigfunc func)
 

Function Documentation

pqsigfunc pqsignal ( int  signo,
pqsigfunc  func 
)

Definition at line 40 of file pqsignal.c.

References pg_signal_array, SIG_ERR, and SIGCHLD.

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