#include <ndb_global.h>#include <BaseString.hpp>#include <InputStream.hpp>#include "common.hpp"#include "CPCD.hpp"#include <pwd.h>Include dependency graph for Process.cpp:

Go to the source code of this file.
Functions | |
| static void | setup_environment (const char *env) |
| static int | set_ulimit (const BaseString &pair) |
| static int set_ulimit | ( | const BaseString & | pair | ) | [static] |
Definition at line 210 of file Process.cpp.
References atoi(), BaseString::c_str(), errno, list(), logger, BaseString::split(), trim(), and value.
Referenced by CPCD::Process::do_exec().
00210 { 00211 #ifdef HAVE_GETRLIMIT 00212 errno = 0; 00213 Vector<BaseString> list; 00214 pair.split(list, ":"); 00215 if(list.size() != 2){ 00216 logger.error("Unable to process ulimit: split >%s< list.size()=%d", 00217 pair.c_str(), list.size()); 00218 return -1; 00219 } 00220 00221 int res; 00222 rlim_t value = RLIM_INFINITY; 00223 if(!(list[1].trim() == "unlimited")){ 00224 value = atoi(list[1].c_str()); 00225 } 00226 00227 struct rlimit rlp; 00228 #define _RLIMIT_FIX(x) { res = getrlimit(x,&rlp); if(!res){ rlp.rlim_cur = value; res = setrlimit(x, &rlp); }} 00229 00230 if(list[0].trim() == "c"){ 00231 _RLIMIT_FIX(RLIMIT_CORE); 00232 } else if(list[0] == "d"){ 00233 _RLIMIT_FIX(RLIMIT_DATA); 00234 } else if(list[0] == "f"){ 00235 _RLIMIT_FIX(RLIMIT_FSIZE); 00236 } else if(list[0] == "n"){ 00237 _RLIMIT_FIX(RLIMIT_NOFILE); 00238 } else if(list[0] == "s"){ 00239 _RLIMIT_FIX(RLIMIT_STACK); 00240 } else if(list[0] == "t"){ 00241 _RLIMIT_FIX(RLIMIT_CPU); 00242 } else { 00243 res= -11; 00244 errno = EINVAL; 00245 } 00246 if(res){ 00247 logger.error("Unable to process ulimit: %s res=%d error=%d(%s)", 00248 pair.c_str(), res, errno, strerror(errno)); 00249 return -1; 00250 } 00251 #endif 00252 return 0; 00253 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void setup_environment | ( | const char * | env | ) | [static] |
Definition at line 200 of file Process.cpp.
References BaseString::argify(), NULL, and p.
Referenced by CPCD::Process::do_exec().
00200 { 00201 char **p; 00202 p = BaseString::argify("", env); 00203 for(int i = 0; p[i] != NULL; i++){ 00204 /*int res = */ putenv(p[i]); 00205 } 00206 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.4.7

