Don't enable dnsmasq IPSET functionality on 2.4 kernel
[tomato.git] / release / src / router / libdaemon / libdaemon / dsignal.h
blob1719784eb03a78dbd47dd075bfabec1bebeb4acc
1 #ifndef foodaemonsignalhfoo
2 #define foodaemonsignalhfoo
4 /***
5 This file is part of libdaemon.
7 Copyright 2003-2008 Lennart Poettering
9 libdaemon is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as
11 published by the Free Software Foundation, either version 2.1 of the
12 License, or (at your option) any later version.
14 libdaemon is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with libdaemon. If not, see
21 <http://www.gnu.org/licenses/>.
22 ***/
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
28 /** \file
30 * Contains the API for serializing signals to a pipe for
31 * usage with select() or poll().
33 * You should register all signals you
34 * wish to handle with select() in your main loop with
35 * daemon_signal_init() or daemon_signal_install(). After that you
36 * should sleep on the file descriptor returned by daemon_signal_fd()
37 * and get the next signal recieved with daemon_signal_next(). You
38 * should call daemon_signal_done() before exiting.
41 /** Installs signal handlers for the specified signals
42 * @param s, ... The signals to install handlers for. The list should be terminated by 0
43 * @return zero on success, nonzero on failure
45 int daemon_signal_init(int s, ...);
47 /** Install a signal handler for the specified signal
48 * @param s The signalto install handler for
49 * @return zero onsuccess,nonzero on failure
51 int daemon_signal_install(int s);
53 /** Free resources of signal handling, should be called before daemon exit
55 void daemon_signal_done(void);
57 /** Return the next signal recieved. This function will not
58 * block. Instead it returns 0 if no signal is queued.
59 * @return The next queued signal if one is queued, zero if none is
60 * queued, negative on failure.
62 int daemon_signal_next(void);
64 /** Return the file descriptor the daemon should select() on for
65 * reading. Whenever the descriptor is ready you should call
66 * daemon_signal_next() to get the next signal queued.
67 * @return The file descriptor or negative on failure
69 int daemon_signal_fd(void);
71 #ifdef __cplusplus
73 #endif
75 #endif