resource.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2000, 2001, 2004, 2007-2009, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: resource.c,v 1.23 2009/02/13 23:48:14 tbox Exp $ */
#include <config.h>
#include <sys/resource.h>
#include <isc/platform.h>
#include <isc/resource.h>
#ifdef __linux__
#endif
#if defined(__hpux) && defined(HAVE_SYS_DYNTUNE_H)
#endif
#include "errno2result.h"
static isc_result_t
switch (resource) {
case isc_resource_coresize:
break;
case isc_resource_cputime:
break;
case isc_resource_datasize:
break;
case isc_resource_filesize:
break;
#ifdef RLIMIT_MEMLOCK
#else
#endif
break;
case isc_resource_openfiles:
#ifdef RLIMIT_NOFILE
#else
#endif
break;
case isc_resource_processes:
#ifdef RLIMIT_NPROC
#else
#endif
break;
#ifdef RLIMIT_RSS
#else
#endif
break;
case isc_resource_stacksize:
break;
default:
/*
* This test is not very robust if isc_resource_t
* changes, but generates a clear assertion message.
*/
break;
}
return (result);
}
int unixresult;
int unixresource;
if (result != ISC_R_SUCCESS)
return (result);
if (value == ISC_RESOURCE_UNLIMITED)
else {
/*
* isc_resourcevalue_t was chosen as an unsigned 64 bit
* integer so that it could contain the maximum range of
* reasonable values. Unfortunately, this exceeds the typical
* range on Unix systems. Ensure the range of
* ISC_PLATFORM_RLIMITTYPE is not overflowed.
*/
if (rlim_t_is_signed)
else
rlim_value = value;
}
if (unixresult == 0)
return (ISC_R_SUCCESS);
/*
* The Darwin kernel doesn't accept RLIM_INFINITY for rlim_cur; the
* maximum possible value is OPEN_MAX. BIND8 used to use
* sysconf(_SC_OPEN_MAX) for such a case, but this value is much
* smaller than OPEN_MAX and is not really effective.
*/
if (unixresult == 0)
return (ISC_R_SUCCESS);
}
#ifndef NR_OPEN
#endif
/*
* Some Linux kernels don't accept RLIM_INFINIT; the maximum
*/
if (unixresult == 0)
return (ISC_R_SUCCESS);
}
if (unixresult == 0)
return (ISC_R_SUCCESS);
}
}
#endif
if (unixresult == 0)
return (ISC_R_SUCCESS);
}
}
return (isc__errno2result(errno));
}
int unixresult;
int unixresource;
if (result == ISC_R_SUCCESS) {
INSIST(unixresult == 0);
}
return (result);
}
int unixresult;
int unixresource;
if (result == ISC_R_SUCCESS) {
INSIST(unixresult == 0);
}
return (result);
}