wibble
0.1.28
|
00001 #ifndef WIBBLE_SYS_PROCESS_H 00002 #define WIBBLE_SYS_PROCESS_H 00003 00004 /* 00005 * OO base class for process functions and child processes 00006 * 00007 * Copyright (C) 2003--2010 Enrico Zini <enrico@debian.org> 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 */ 00023 00024 #include <wibble/sys/macros.h> 00025 #include <wibble/exception.h> 00026 00027 #ifdef POSIX 00028 #include <sys/types.h> 00029 00030 namespace wibble { 00031 namespace sys { 00032 namespace process { 00033 00035 std::string formatStatus(int status); 00036 00038 void chdir(const std::string& dir); 00039 00041 std::string getcwd(); 00042 00044 void chroot(const std::string& dir); 00045 00047 mode_t umask(mode_t mask); 00048 00050 void setPerms(const std::string& user); 00051 void setPerms(const std::string& user, const std::string& group); 00052 void setPerms(uid_t user); 00053 void setPerms(uid_t user, gid_t group); 00054 00057 int getCPUTimeLimit(int* max = 0); 00058 int getFileSizeLimit(int* max = 0); 00059 int getDataMemoryLimit(int* max = 0); 00060 int getChildrenLimit(int* max = 0); 00061 int getOpenFilesLimit(int* max = 0); 00062 int getCoreSizeLimit(int* max = 0); 00063 00065 void setCPUTimeLimit(int value); 00066 void setFileSizeLimit(int value); 00067 void setDataMemoryLimit(int value); 00068 void setChildrenLimit(int value); 00069 void setOpenFilesLimit(int value); 00070 void setCoreSizeLimit(int value); 00071 00073 void detachFromTTY(); 00074 00081 void initproctitle(int argc, char **argv); 00082 00089 void setproctitle(const std::string& title); 00090 00091 } 00092 } 00093 } 00094 00095 #endif 00096 00097 // vim:set ts=4 sw=4: 00098 #endif