Commit e2e138a8 authored by Ondřej Surý's avatar Ondřej Surý
Browse files

Don't assert on failed getrlimit call to allow called to handle this...

Don't assert on failed getrlimit call to allow called to handle this gracefully as it already does, just abort where we need to know the numbers
parent a831e0f7
......@@ -1068,14 +1068,18 @@ setup(void) {
/*
* Get the initial resource limits.
*/
(void)isc_resource_getlimit(isc_resource_stacksize,
&named_g_initstacksize);
(void)isc_resource_getlimit(isc_resource_datasize,
&named_g_initdatasize);
(void)isc_resource_getlimit(isc_resource_coresize,
&named_g_initcoresize);
(void)isc_resource_getlimit(isc_resource_openfiles,
&named_g_initopenfiles);
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_stacksize,
&named_g_initstacksize)
== ISC_R_SUCCESS);
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_datasize,
&named_g_initdatasize)
== ISC_R_SUCCESS);
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_coresize,
&named_g_initcoresize)
== ISC_R_SUCCESS);
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_openfiles,
&named_g_initopenfiles)
== ISC_R_SUCCESS);
/*
* System resources cannot effectively be tuned on some systems.
......@@ -1083,8 +1087,9 @@ setup(void) {
*/
old_openfiles = named_g_initopenfiles;
named_os_adjustnofile();
(void)isc_resource_getlimit(isc_resource_openfiles,
&named_g_initopenfiles);
RUNTIME_CHECK(isc_resource_getlimit(isc_resource_openfiles,
&named_g_initopenfiles)
== ISC_R_SUCCESS);
if (old_openfiles != named_g_initopenfiles) {
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE,
......
......@@ -180,34 +180,38 @@ isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value) {
isc_result_t
isc_resource_getlimit(isc_resource_t resource, isc_resourcevalue_t *value) {
int unixresult;
int unixresource;
struct rlimit rl;
isc_result_t result;
result = resource2rlim(resource, &unixresource);
if (result == ISC_R_SUCCESS) {
unixresult = getrlimit(unixresource, &rl);
INSIST(unixresult == 0);
*value = rl.rlim_max;
if (result != ISC_R_SUCCESS) {
return (result);
}
return (result);
if (getrlimit(unixresource, &rl) != 0) {
return (isc__errno2result(errno));
}
*value = rl.rlim_max;
return (ISC_R_SUCCESS);
}
isc_result_t
isc_resource_getcurlimit(isc_resource_t resource, isc_resourcevalue_t *value) {
int unixresult;
int unixresource;
struct rlimit rl;
isc_result_t result;
result = resource2rlim(resource, &unixresource);
if (result == ISC_R_SUCCESS) {
unixresult = getrlimit(unixresource, &rl);
INSIST(unixresult == 0);
*value = rl.rlim_cur;
if (result != ISC_R_SUCCESS) {
return (result);
}
return (result);
if (getrlimit(unixresource, &rl) != 0) {
return (isc__errno2result(errno));
}
*value = rl.rlim_cur;
return (ISC_R_SUCCESS);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment