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