|
|
@ -102,20 +102,23 @@ namespace i2p |
|
|
|
LogPrint(eLogError, "Daemon: limits.openfiles exceeds system limit: ", limit.rlim_max); |
|
|
|
LogPrint(eLogError, "Daemon: limits.openfiles exceeds system limit: ", limit.rlim_max); |
|
|
|
} |
|
|
|
} |
|
|
|
uint32_t cfsize; i2p::config::GetOption("limits.coresize", cfsize); |
|
|
|
uint32_t cfsize; i2p::config::GetOption("limits.coresize", cfsize); |
|
|
|
cfsize *= 1024; |
|
|
|
if (cfsize) // core file size set
|
|
|
|
getrlimit(RLIMIT_CORE, &limit); |
|
|
|
{ |
|
|
|
if (cfsize <= limit.rlim_max) { |
|
|
|
cfsize *= 1024; |
|
|
|
limit.rlim_cur = cfsize; |
|
|
|
getrlimit(RLIMIT_CORE, &limit); |
|
|
|
if (setrlimit(RLIMIT_CORE, &limit) != 0) { |
|
|
|
if (cfsize <= limit.rlim_max) { |
|
|
|
LogPrint(eLogError, "Daemon: can't set max size of coredump: ", strerror(errno)); |
|
|
|
limit.rlim_cur = cfsize; |
|
|
|
} else if (cfsize == 0) { |
|
|
|
if (setrlimit(RLIMIT_CORE, &limit) != 0) { |
|
|
|
LogPrint(eLogInfo, "Daemon: coredumps disabled"); |
|
|
|
LogPrint(eLogError, "Daemon: can't set max size of coredump: ", strerror(errno)); |
|
|
|
|
|
|
|
} else if (cfsize == 0) { |
|
|
|
|
|
|
|
LogPrint(eLogInfo, "Daemon: coredumps disabled"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
LogPrint(eLogInfo, "Daemon: set max size of core files to ", cfsize / 1024, "Kb"); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
LogPrint(eLogInfo, "Daemon: set max size of core files to ", cfsize / 1024, "Kb"); |
|
|
|
LogPrint(eLogError, "Daemon: limits.coresize exceeds system limit: ", limit.rlim_max); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
LogPrint(eLogError, "Daemon: limits.coresize exceeds system limit: ", limit.rlim_max); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Pidfile
|
|
|
|
// Pidfile
|
|
|
|
// this code is c-styled and a bit ugly, but we need fd for locking pidfile
|
|
|
|
// this code is c-styled and a bit ugly, but we need fd for locking pidfile
|
|
|
|