wibble  0.1.28
process.h
Go to the documentation of this file.
1 #ifndef WIBBLE_SYS_PROCESS_H
2 #define WIBBLE_SYS_PROCESS_H
3 
4 /*
5  * OO base class for process functions and child processes
6  *
7  * Copyright (C) 2003--2010 Enrico Zini <enrico@debian.org>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */
23 
24 #include <wibble/sys/macros.h>
25 #include <wibble/exception.h>
26 
27 #ifdef POSIX
28 #include <sys/types.h>
29 
30 namespace wibble {
31 namespace sys {
32 namespace process {
33 
35 std::string formatStatus(int status);
36 
38 void chdir(const std::string& dir);
39 
41 std::string getcwd();
42 
44 void chroot(const std::string& dir);
45 
47 mode_t umask(mode_t mask);
48 
50 void setPerms(const std::string& user);
51 void setPerms(const std::string& user, const std::string& group);
52 void setPerms(uid_t user);
53 void setPerms(uid_t user, gid_t group);
54 
57 int getCPUTimeLimit(int* max = 0);
58 int getFileSizeLimit(int* max = 0);
59 int getDataMemoryLimit(int* max = 0);
60 int getChildrenLimit(int* max = 0);
61 int getOpenFilesLimit(int* max = 0);
62 int getCoreSizeLimit(int* max = 0);
63 
65 void setCPUTimeLimit(int value);
66 void setFileSizeLimit(int value);
67 void setDataMemoryLimit(int value);
68 void setChildrenLimit(int value);
69 void setOpenFilesLimit(int value);
70 void setCoreSizeLimit(int value);
71 
73 void detachFromTTY();
74 
81 void initproctitle(int argc, char **argv);
82 
89 void setproctitle(const std::string& title);
90 
91 }
92 }
93 }
94 
95 #endif
96 
97 // vim:set ts=4 sw=4:
98 #endif