PostgreSQL Source Code: src/interfaces/libpq/legacy-pqsignal.c Source File (original) (raw)

Go to the documentation of this file.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

17

18#include <signal.h>

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38#undef pqsignal

40

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;

52 act.sa_flags |= SA_RESTART;

53#ifdef SA_NOCLDSTOP

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

61 return signal(signo, func);

62#endif

63}

pqsigfunc pqsignal(int signo, pqsigfunc func)

void(* pqsigfunc)(SIGNAL_ARGS)