dpkg (1.18.25) stretch; urgency=medium
[dpkg] / lib / dpkg / subproc.h
CommitLineData
1479465f
GJ
1/*
2 * libdpkg - Debian packaging suite library routines
3 * subproc.h - sub-process handling routines
4 *
5 * Copyright © 2008-2014 Guillem Jover <guillem@debian.org>
6 *
7 * This is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef LIBDPKG_SUBPROC_H
22#define LIBDPKG_SUBPROC_H
23
24#include <sys/types.h>
25
26#include <dpkg/macros.h>
27
28DPKG_BEGIN_DECLS
29
30/**
31 * @defgroup subproc Sub-process handling
32 * @ingroup dpkg-internal
33 * @{
34 */
35
36enum subproc_flags {
37 /** Default subprocess flags. */
38 SUBPROC_NORMAL = 0,
39 /** Emit a warning instead of an error. */
40 SUBPROC_WARN = DPKG_BIT(0),
41 /** Ignore SIGPIPE, and make it return 0. */
42 SUBPROC_NOPIPE = DPKG_BIT(1),
43 /** Do not check the subprocess status. */
44 SUBPROC_NOCHECK = DPKG_BIT(2),
45 /** Do not emit errors, just return the exit status. */
46 SUBPROC_RETERROR = DPKG_BIT(3),
47 /** Do not emit errors, just return the signal number. */
48 SUBPROC_RETSIGNO = DPKG_BIT(3),
49};
50
51void subproc_signals_ignore(const char *name);
52void subproc_signals_cleanup(int argc, void **argv);
53void subproc_signals_restore(void);
54
55pid_t subproc_fork(void);
56int subproc_reap(pid_t pid, const char *desc, enum subproc_flags flags);
57
58/** @} */
59
60DPKG_END_DECLS
61
62#endif /* LIBDPKG_SUBPROC_H */