8d402bfbc298c170fafe5de344bbbf6874c4d126
[libi2ncommon] / src / daemonfunc.hpp
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>
11 #include <vector>
12
13 /// Collection of functions for daemons
14 namespace I2n
15 {
16 namespace Daemon
17 {
18 void daemonize();
19
20 bool drop_root_privileges(const std::string &username,
21                           const std::string &group, bool get_group_from_user=false);
22
23 bool pid_of(const std::string& name, std::vector< pid_t >& result);
24 }
25 }
26
27 #endif