blob: b9e1879880e100f89f19514c5216bdb70b17e803 [file] [log] [blame]
Lennart Poetteringf4aa9a82003-12-11 18:56:42 +00001#ifndef foodexechfoo
2#define foodexechfoo
3
4/* $Id: exec.h 4 2003-08-10 19:56:53Z lennart $ */
5
6/*
7 * This file is part of libdaemon.
8 *
9 * libdaemon is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
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 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with libdaemon; if not, write to the Free Software Foundation,
21 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 */
23
24/** \file
25 *
26 * Contains a robust API for running sub processes with STDOUT and
27 * STDERR redirected to syslog
28 */
29
30/** If this variable is defined to 1 iff daemon_pid_file_kill_wait() is supported.*/
31#define DAEMON_EXEC_AVAILABLE 1
32
33/** Run the specified executable with the specified arguments in the
34 * specified directory and return the return value of the program in
35 * the specified pointer. The calling process is blocked until the
36 * child finishes, alls child output (either STDOUT or STDIN) is
37 * written to syslog.
38 *
39 * @param dir Working directory for the process.
40 * @param ret A pointer to an integer to write the return value of the program to.
41 * @param prog The path to the executable
42 * @param ... The arguments to be passed to the program, followed by a (char *) NULL
43 * @return Nonzero on failure, zero on success
44 */
45int daemon_exec(const char *dir, int *ret, const char *prog, ...);
46
47#endif