]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/include/iosignal.h
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / ntp / include / iosignal.h
1 #ifndef IOSIGNAL_H
2 #define IOSIGNAL_H
3
4 #include "ntp_refclock.h"
5
6  /*
7  * Some systems (MOST) define SIGPOLL == SIGIO, others SIGIO == SIGPOLL, and
8  * a few have separate SIGIO and SIGPOLL signals.  This code checks for the
9  * SIGIO == SIGPOLL case at compile time.
10  * Do not define USE_SIGPOLL or USE_SIGIO.
11  * these are interal only to iosignal.c and ntpd/work_fork.c!
12  */
13 #if defined(USE_SIGPOLL)
14 # undef USE_SIGPOLL
15 #endif
16 #if defined(USE_SIGIO)
17 # undef USE_SIGIO
18 #endif
19
20 /* type of input handler function - only shared between iosignal.c and ntp_io.c */
21 typedef void (input_handler_t)(l_fp *);
22
23 #if defined(HAVE_SIGNALED_IO)
24 # if defined(USE_TTY_SIGPOLL) || defined(USE_UDP_SIGPOLL)
25 #  define USE_SIGPOLL
26 # endif
27
28 # if !defined(USE_TTY_SIGPOLL) || !defined(USE_UDP_SIGPOLL)
29 #  define USE_SIGIO
30 # endif
31
32 # if defined(USE_SIGIO) && defined(USE_SIGPOLL)
33 #  if SIGIO == SIGPOLL
34 #   define USE_SIGIO
35 #   undef USE_SIGPOLL
36 #  endif        /* SIGIO == SIGPOLL */
37 # endif         /* USE_SIGIO && USE_SIGPOLL */
38
39 #define USING_SIGIO()   using_sigio
40
41 extern int              using_sigio;
42
43 extern void             block_sigio     (void);
44 extern void             unblock_sigio   (void);
45 extern int              init_clock_sig  (struct refclockio *);
46 extern void             init_socket_sig (int);
47 extern void             set_signal      (input_handler_t *);
48
49 # define BLOCKIO()      block_sigio()
50 # define UNBLOCKIO()    unblock_sigio()
51
52 #else   /* !HAVE_SIGNALED_IO follows */
53 # define BLOCKIO()      do {} while (0)
54 # define UNBLOCKIO()    do {} while (0)
55 # define USING_SIGIO()  FALSE
56 #endif
57
58 #endif  /* IOSIGNAL_H */