libi2ncommon: (tomj) implemented drop_root_priviledges using new User/Group classes
[libi2ncommon] / src / daemonfunc.hpp
CommitLineData
0a654ec0
TJ
1/***************************************************************************
2 * Copyright (C) 2008 by Intra2net AG - Thomas Jarosch *
3 * thomas.jarosch@intra2net.com *
4 * http://www.intra2net.com *
5 ***************************************************************************/
6#ifndef DAEMONFUNC_H
7#define DAEMONFUNC_H
8
9#include <sys/types.h>
10#include <string>
6a93d84a 11#include <vector>
0a654ec0
TJ
12
13/// Collection of functions for daemons
5de0c58a 14namespace I2n
0a654ec0 15{
6a93d84a
TJ
16namespace daemon
17{
90246b4a 18void daemonize();
0a654ec0 19
90246b4a
TJ
20bool drop_root_privileges(const std::string &username,
21 const std::string &group, bool get_group_from_user=false);
0a654ec0 22
90246b4a 23bool pid_of(const std::string& name, std::vector< pid_t >& result);
6a93d84a
TJ
24}
25}
0a654ec0
TJ
26
27#endif