1169321c9SNick Mathewson /* 2b85b710cSNick Mathewson * Copyright 2000-2007 Niels Provos <[email protected]> 3e49e2891SNick Mathewson * Copyright 2007-2012 Niels Provos and Nick Mathewson 4169321c9SNick Mathewson * 5169321c9SNick Mathewson * Redistribution and use in source and binary forms, with or without 6169321c9SNick Mathewson * modification, are permitted provided that the following conditions 7169321c9SNick Mathewson * are met: 8169321c9SNick Mathewson * 1. Redistributions of source code must retain the above copyright 9169321c9SNick Mathewson * notice, this list of conditions and the following disclaimer. 10169321c9SNick Mathewson * 2. Redistributions in binary form must reproduce the above copyright 11169321c9SNick Mathewson * notice, this list of conditions and the following disclaimer in the 12169321c9SNick Mathewson * documentation and/or other materials provided with the distribution. 13169321c9SNick Mathewson * 3. The name of the author may not be used to endorse or promote products 14169321c9SNick Mathewson * derived from this software without specific prior written permission. 15169321c9SNick Mathewson * 16169321c9SNick Mathewson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17169321c9SNick Mathewson * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18169321c9SNick Mathewson * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19169321c9SNick Mathewson * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20169321c9SNick Mathewson * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21169321c9SNick Mathewson * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22169321c9SNick Mathewson * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23169321c9SNick Mathewson * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24169321c9SNick Mathewson * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25169321c9SNick Mathewson * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26169321c9SNick Mathewson */ 273f8c7cd0SNick Mathewson #ifndef EVSIGNAL_INTERNAL_H_INCLUDED_ 283f8c7cd0SNick Mathewson #define EVSIGNAL_INTERNAL_H_INCLUDED_ 29169321c9SNick Mathewson 30169321c9SNick Mathewson #ifndef evutil_socket_t 3102801e5bSNick Mathewson #include "event2/util.h" 32169321c9SNick Mathewson #endif 3302801e5bSNick Mathewson #include <signal.h> 34169321c9SNick Mathewson 35169321c9SNick Mathewson typedef void (*ev_sighandler_t)(int); 36169321c9SNick Mathewson 37720bd933SNick Mathewson /* Data structure for the default signal-handling implementation in signal.c 38720bd933SNick Mathewson */ 39169321c9SNick Mathewson struct evsig_info { 40720bd933SNick Mathewson /* Event watching ev_signal_pair[1] */ 41169321c9SNick Mathewson struct event ev_signal; 42720bd933SNick Mathewson /* Socketpair used to send notifications from the signal handler */ 43169321c9SNick Mathewson evutil_socket_t ev_signal_pair[2]; 44720bd933SNick Mathewson /* True iff we've added the ev_signal event yet. */ 45169321c9SNick Mathewson int ev_signal_added; 46720bd933SNick Mathewson /* Count of the number of signals we're currently watching. */ 47720bd933SNick Mathewson int ev_n_signals_added; 48720bd933SNick Mathewson 49720bd933SNick Mathewson /* Array of previous signal handler objects before Libevent started 50720bd933SNick Mathewson * messing with them. Used to restore old signal handlers. */ 5168120d9bSNick Mathewson #ifdef EVENT__HAVE_SIGACTION 52169321c9SNick Mathewson struct sigaction **sh_old; 53169321c9SNick Mathewson #else 54169321c9SNick Mathewson ev_sighandler_t **sh_old; 55169321c9SNick Mathewson #endif 56720bd933SNick Mathewson /* Size of sh_old. */ 57169321c9SNick Mathewson int sh_old_max; 58169321c9SNick Mathewson }; 598ac3c4c2SNick Mathewson int evsig_init_(struct event_base *); 608ac3c4c2SNick Mathewson void evsig_dealloc_(struct event_base *); 61169321c9SNick Mathewson 628ac3c4c2SNick Mathewson void evsig_set_base_(struct event_base *base); 63*041ca00cSMark Ellzey void evsig_free_globals_(void); 64720bd933SNick Mathewson 653f8c7cd0SNick Mathewson #endif /* EVSIGNAL_INTERNAL_H_INCLUDED_ */ 66