bin: compile lttng-sessiond as C++
[lttng-tools.git] / src / common / daemonize.h
CommitLineData
99ed9c43
MD
1#ifndef LTTNG_DAEMONIZE_H
2#define LTTNG_DAEMONIZE_H
3
4/*
ab5be9fa
MJ
5 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
6 * Copyright (C) 2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
99ed9c43 7 *
ab5be9fa 8 * SPDX-License-Identifier: GPL-2.0-only
99ed9c43 9 *
99ed9c43
MD
10 */
11
12#include <unistd.h>
d5d51699 13#include <common/macros.h>
99ed9c43 14
7966af57
SM
15#ifdef __cplusplus
16extern "C" {
17#endif
18
99ed9c43
MD
19/*
20 * Daemonize this process by forking and making the parent wait for the child
21 * to signal it indicating readiness. Once received, the parent successfully
22 * quits.
23 *
24 * The child process undergoes the same action that daemon(3) does meaning
25 * setsid, chdir, and dup /dev/null into 0, 1 and 2.
26 *
27 * Return 0 on success else -1 on error.
28 */
29int lttng_daemonize(pid_t *child_ppid, int *completion_flag,
30 int close_fds);
31
7966af57
SM
32#ifdef __cplusplus
33}
34#endif
35
99ed9c43 36#endif /* LTTNG_DAEMONIZE_H */
This page took 0.046532 seconds and 4 git commands to generate.