wibble  1.1
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 #include <sys/types.h>
28 
29 namespace wibble {
30 namespace sys {
31 namespace process {
32 
34 std::string getcwd();
35 
36 #ifdef POSIX
37 
39 std::string formatStatus(int status);
40 
42 void chdir(const std::string& dir);
43 
45 void chroot(const std::string& dir);
46 
48 mode_t umask(mode_t mask);
49 
51 void setPerms(const std::string& user);
52 void setPerms(const std::string& user, const std::string& group);
53 void setPerms(uid_t user);
54 void setPerms(uid_t user, gid_t group);
55 
58 int getCPUTimeLimit(int* max = 0);
59 int getFileSizeLimit(int* max = 0);
60 int getDataMemoryLimit(int* max = 0);
61 int getChildrenLimit(int* max = 0);
62 int getOpenFilesLimit(int* max = 0);
63 int getCoreSizeLimit(int* max = 0);
64 
66 void setCPUTimeLimit(int value);
67 void setFileSizeLimit(int value);
68 void setDataMemoryLimit(int value);
69 void setChildrenLimit(int value);
70 void setOpenFilesLimit(int value);
71 void setCoreSizeLimit(int value);
72 
74 void detachFromTTY();
75 
82 void initproctitle(int argc, char **argv);
83 
90 void setproctitle(const std::string& title);
91 #endif
92 
93 }
94 }
95 }
96 
97 // vim:set ts=4 sw=4:
98 #endif