Don't enable dnsmasq IPSET functionality on 2.4 kernel
[tomato.git] / release / src / router / libdaemon / libdaemon / dpid.h
blobee493194b4c45fba47a43cdc699865bce9c9fe92
1 #ifndef foodaemonpidhfoo
2 #define foodaemonpidhfoo
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 #include <sys/types.h>
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
30 /** \file
32 * Contains an API for manipulating PID files.
35 /** Prototype of a function for generating the name of a PID file.
37 typedef const char* (*daemon_pid_file_proc_t)(void);
39 /** Identification string for the PID file name, only used when
40 * daemon_pid_file_proc is set to daemon_pid_file_proc_default(). Use
41 * daemon_ident_from_argv0() to generate an identification string from
42 * argv[0]
44 extern const char *daemon_pid_file_ident;
46 /** A function pointer which is used to generate the name of the PID
47 * file to manipulate. Points to daemon_pid_file_proc_default() by
48 * default.
50 extern daemon_pid_file_proc_t daemon_pid_file_proc;
52 /** A function for creating a pid file name from
53 * daemon_pid_file_ident
54 * @return The PID file path
56 const char *daemon_pid_file_proc_default(void);
58 /** Creates PID pid file for the current process
59 * @return zero on success, nonzero on failure
61 int daemon_pid_file_create(void);
63 /** Removes the PID file of the current process
64 * @return zero on success, nonzero on failure
66 int daemon_pid_file_remove(void);
68 /** Returns the PID file of a running daemon, if available
69 * @return The PID or negative on failure
71 pid_t daemon_pid_file_is_running(void);
73 /** Kills a running daemon, if available
74 * @param s The signal to send
75 * @return zero on success, nonzero on failure
77 int daemon_pid_file_kill(int s);
79 /** This variable is defined to 1 iff daemon_pid_file_kill_wait() is supported.
80 * @since 0.3
81 * @see daemon_pid_file_kill_wait() */
82 #define DAEMON_PID_FILE_KILL_WAIT_AVAILABLE 1
84 /** Similar to daemon_pid_file_kill() but waits until the process
85 * died. This functions is new in libdaemon 0.3. The macro
86 * DAEMON_PID_FILE_KILL_WAIT_AVAILABLE is defined iff libdaemon
87 * supports this function.
89 * @param s The signal to send
90 * @param m Seconds to wait at maximum
91 * @return zero on success, nonzero on failure (timeout condition is considered a failure)
92 * @since 0.3
93 * @see DAEMON_PID_FILE_KILL_WAIT_AVAILABLE
95 int daemon_pid_file_kill_wait(int s, int m);
97 #ifdef __cplusplus
99 #endif
101 #endif