1285612Sdelphij#ifndef IOSIGNAL_H 2285612Sdelphij#define IOSIGNAL_H 354359Sroberto 454359Sroberto#include "ntp_refclock.h" 554359Sroberto 6285612Sdelphij /* 7285612Sdelphij * Some systems (MOST) define SIGPOLL == SIGIO, others SIGIO == SIGPOLL, and 8285612Sdelphij * a few have separate SIGIO and SIGPOLL signals. This code checks for the 9285612Sdelphij * SIGIO == SIGPOLL case at compile time. 10285612Sdelphij * Do not define USE_SIGPOLL or USE_SIGIO. 11285612Sdelphij * these are interal only to iosignal.c and ntpd/work_fork.c! 12285612Sdelphij */ 13285612Sdelphij#if defined(USE_SIGPOLL) 14285612Sdelphij# undef USE_SIGPOLL 15285612Sdelphij#endif 16285612Sdelphij#if defined(USE_SIGIO) 17285612Sdelphij# undef USE_SIGIO 18285612Sdelphij#endif 19285612Sdelphij 20285612Sdelphij/* type of input handler function - only shared between iosignal.c and ntp_io.c */ 21285612Sdelphijtypedef void (input_handler_t)(l_fp *); 22285612Sdelphij 2354359Sroberto#if defined(HAVE_SIGNALED_IO) 24285612Sdelphij# if defined(USE_TTY_SIGPOLL) || defined(USE_UDP_SIGPOLL) 25285612Sdelphij# define USE_SIGPOLL 26285612Sdelphij# endif 2754359Sroberto 28285612Sdelphij# if !defined(USE_TTY_SIGPOLL) || !defined(USE_UDP_SIGPOLL) 29285612Sdelphij# define USE_SIGIO 30285612Sdelphij# endif 3154359Sroberto 32285612Sdelphij# if defined(USE_SIGIO) && defined(USE_SIGPOLL) 33285612Sdelphij# if SIGIO == SIGPOLL 34285612Sdelphij# define USE_SIGIO 35285612Sdelphij# undef USE_SIGPOLL 36285612Sdelphij# endif /* SIGIO == SIGPOLL */ 37285612Sdelphij# endif /* USE_SIGIO && USE_SIGPOLL */ 3854359Sroberto 39285612Sdelphij#define USING_SIGIO() using_sigio 4054359Sroberto 41285612Sdelphijextern int using_sigio; 42285612Sdelphij 43285612Sdelphijextern void block_sigio (void); 44285612Sdelphijextern void unblock_sigio (void); 45285612Sdelphijextern int init_clock_sig (struct refclockio *); 46285612Sdelphijextern void init_socket_sig (int); 47285612Sdelphijextern void set_signal (input_handler_t *); 48285612Sdelphij 49285612Sdelphij# define BLOCKIO() block_sigio() 50285612Sdelphij# define UNBLOCKIO() unblock_sigio() 51285612Sdelphij 52285612Sdelphij#else /* !HAVE_SIGNALED_IO follows */ 53285612Sdelphij# define BLOCKIO() do {} while (0) 54285612Sdelphij# define UNBLOCKIO() do {} while (0) 55285612Sdelphij# define USING_SIGIO() FALSE 5654359Sroberto#endif 57285612Sdelphij 58285612Sdelphij#endif /* IOSIGNAL_H */ 59