My Project
Daemon.h
1
/*
2
* Copyright (C) 2013 Canonical Ltd
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License version 3 as
6
* published by the Free Software Foundation.
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
12
*
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* Authored by: Michi Henning <michi.henning@canonical.com>
17
*/
18
19
#ifndef LOMIRI_UTIL_DAEMON_H
20
#define LOMIRI_UTIL_DAEMON_H
21
22
#include <
lomiri/util/DefinesPtrs.h
>
23
#include <lomiri/util/NonCopyable.h>
24
25
#include <sys/types.h>
26
27
namespace
lomiri
28
{
29
30
namespace
util
31
{
32
33
namespace
internal
34
{
35
class
DaemonImpl;
36
}
37
66
class
LOMIRI_API
Daemon
final
67
{
68
public
:
70
NONCOPYABLE(
Daemon
);
71
LOMIRI_DEFINES_PTRS
(
Daemon
);
73
78
static
UPtr create();
79
84
void
close_fds() noexcept;
85
89
void
reset_signals() noexcept;
90
95
void
set_umask(mode_t mask) noexcept;
96
105
void
set_working_directory(std::string
const
& working_directory);
106
120
void
daemonize_me();
121
122
~
Daemon
() noexcept;
123
124
private
:
125
Daemon
();
// Class is final, instantiation only via create()
126
127
std::unique_ptr<internal::DaemonImpl> p_;
128
};
129
130
}
// namespace util
131
132
}
// namespace lomiri
133
134
#endif
LOMIRI_DEFINES_PTRS
#define LOMIRI_DEFINES_PTRS(classname)
Macro to add smart pointer definitions to a class.
Definition:
DefinesPtrs.h:52
DefinesPtrs.h
lomiri::util::Daemon
Helper class to turn a process into a daemon.
Definition:
Daemon.h:66
lomiri
Top-level namespace for all things Lomiri-related.
Definition:
Version.h:37
include
lomiri
util
Daemon.h
Generated on Tue Jan 17 2023 07:09:42 for My Project by
1.8.17