|
Packit |
e9ba0d |
/*
|
|
Packit |
e9ba0d |
* Copyright 2000-2007 Niels Provos <provos@citi.umich.edu>
|
|
Packit |
e9ba0d |
* Copyright 2007-2012 Niels Provos and Nick Mathewson
|
|
Packit |
e9ba0d |
*
|
|
Packit |
e9ba0d |
* Redistribution and use in source and binary forms, with or without
|
|
Packit |
e9ba0d |
* modification, are permitted provided that the following conditions
|
|
Packit |
e9ba0d |
* are met:
|
|
Packit |
e9ba0d |
* 1. Redistributions of source code must retain the above copyright
|
|
Packit |
e9ba0d |
* notice, this list of conditions and the following disclaimer.
|
|
Packit |
e9ba0d |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
Packit |
e9ba0d |
* notice, this list of conditions and the following disclaimer in the
|
|
Packit |
e9ba0d |
* documentation and/or other materials provided with the distribution.
|
|
Packit |
e9ba0d |
* 3. The name of the author may not be used to endorse or promote products
|
|
Packit |
e9ba0d |
* derived from this software without specific prior written permission.
|
|
Packit |
e9ba0d |
*
|
|
Packit |
e9ba0d |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
Packit |
e9ba0d |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
Packit |
e9ba0d |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
Packit |
e9ba0d |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
Packit |
e9ba0d |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
Packit |
e9ba0d |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Packit |
e9ba0d |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Packit |
e9ba0d |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit |
e9ba0d |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
Packit |
e9ba0d |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
e9ba0d |
*/
|
|
Packit |
e9ba0d |
#ifndef _EVSIGNAL_H_
|
|
Packit |
e9ba0d |
#define _EVSIGNAL_H_
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
#ifndef evutil_socket_t
|
|
Packit |
e9ba0d |
#include "event2/util.h"
|
|
Packit |
e9ba0d |
#endif
|
|
Packit |
e9ba0d |
#include <signal.h>
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
typedef void (*ev_sighandler_t)(int);
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
/* Data structure for the default signal-handling implementation in signal.c
|
|
Packit |
e9ba0d |
*/
|
|
Packit |
e9ba0d |
struct evsig_info {
|
|
Packit |
e9ba0d |
/* Event watching ev_signal_pair[1] */
|
|
Packit |
e9ba0d |
struct event ev_signal;
|
|
Packit |
e9ba0d |
/* Socketpair used to send notifications from the signal handler */
|
|
Packit |
e9ba0d |
evutil_socket_t ev_signal_pair[2];
|
|
Packit |
e9ba0d |
/* True iff we've added the ev_signal event yet. */
|
|
Packit |
e9ba0d |
int ev_signal_added;
|
|
Packit |
e9ba0d |
/* Count of the number of signals we're currently watching. */
|
|
Packit |
e9ba0d |
int ev_n_signals_added;
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
/* Array of previous signal handler objects before Libevent started
|
|
Packit |
e9ba0d |
* messing with them. Used to restore old signal handlers. */
|
|
Packit |
e9ba0d |
#ifdef _EVENT_HAVE_SIGACTION
|
|
Packit |
e9ba0d |
struct sigaction **sh_old;
|
|
Packit |
e9ba0d |
#else
|
|
Packit |
e9ba0d |
ev_sighandler_t **sh_old;
|
|
Packit |
e9ba0d |
#endif
|
|
Packit |
e9ba0d |
/* Size of sh_old. */
|
|
Packit |
e9ba0d |
int sh_old_max;
|
|
Packit |
e9ba0d |
};
|
|
Packit |
e9ba0d |
int evsig_init(struct event_base *);
|
|
Packit |
e9ba0d |
void evsig_dealloc(struct event_base *);
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
void evsig_set_base(struct event_base *base);
|
|
Packit |
e9ba0d |
|
|
Packit |
e9ba0d |
#endif /* _EVSIGNAL_H_ */
|