Commit 86a733bc authored by Andreas Gustafsson's avatar Andreas Gustafsson

use ISC_PLATFORM_RLIMITTYPE unconditionally, eliminating

the need for the HAVE_RLIM_T macro
parent e576c735
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: acconfig.h,v 1.34 2001/07/04 00:34:40 bwelling Exp $ */
/* $Id: acconfig.h,v 1.35 2001/07/14 01:55:04 gson Exp $ */
/***
*** This file is not to be included by any public header files, because
......@@ -84,9 +84,6 @@
/* define if getc_unlocked() is available */
#undef HAVE_GETCUNLOCKED
/* define if rlim_t is defined via sys/types.h or sys/resource.h */
#undef HAVE_RLIM_T
/* Shut up warnings about sputaux in stdio.h on BSD/OS pre-4.1 */
#undef SHUTUP_SPUTAUX
#ifdef SHUTUP_SPUTAUX
......
......@@ -16,7 +16,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.h.in,v 1.43 2001/07/04 00:34:41 bwelling Exp $ */
/* $Id: config.h.in,v 1.44 2001/07/14 01:55:05 gson Exp $ */
/***
*** This file is not to be included by any public header files, because
......@@ -95,9 +95,6 @@
/* define if getc_unlocked() is available */
#undef HAVE_GETCUNLOCKED
/* define if rlim_t is defined via sys/types.h or sys/resource.h */
#undef HAVE_RLIM_T
/* Shut up warnings about sputaux in stdio.h on BSD/OS pre-4.1 */
#undef SHUTUP_SPUTAUX
#ifdef SHUTUP_SPUTAUX
......
......@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.277 $)
AC_REVISION($Revision: 1.278 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.13)
......@@ -1358,7 +1358,6 @@ AC_TRY_COMPILE([
#include <sys/resource.h>],
[rlim_t rl = 19671212; return (0);],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_RLIM_T)
ISC_PLATFORM_RLIMITTYPE="#define ISC_PLATFORM_RLIMITTYPE rlim_t"],
[AC_MSG_RESULT(no)
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resource.c,v 1.10 2001/01/23 06:00:11 marka Exp $ */
/* $Id: resource.c,v 1.11 2001/07/14 01:55:08 gson Exp $ */
#include <config.h>
......@@ -30,10 +30,6 @@
#include "errno2result.h"
#ifndef HAVE_RLIM_T
typedef ISC_PLATFORM_RLIMITTYPE rlim_t;
#endif
static isc_result_t
resource2rlim(isc_resource_t resource, int *rlim_resource) {
isc_result_t result = ISC_R_SUCCESS;
......@@ -100,7 +96,7 @@ resource2rlim(isc_resource_t resource, int *rlim_resource) {
isc_result_t
isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value) {
struct rlimit rl;
rlim_t rlim_value;
ISC_PLATFORM_RLIMITTYPE rlim_value;
int unixresult;
int unixresource;
isc_result_t result;
......@@ -117,17 +113,18 @@ isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value) {
* 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 value of rlim_t is not
* overflowed.
* range on Unix systems. Ensure the range of
* ISC_PLATFORM_RLIMITTYPE is not overflowed.
*/
isc_resourcevalue_t rlim_max;
isc_boolean_t rlim_t_is_signed =
ISC_TF(((double)(rlim_t)-1) < 0);
ISC_TF(((double)(ISC_PLATFORM_RLIMITTYPE)-1) < 0);
if (rlim_t_is_signed)
rlim_max = ~((rlim_t)1 << (sizeof(rlim_t) * 8 - 1));
rlim_max = ~((ISC_PLATFORM_RLIMITTYPE)1 <<
(sizeof(ISC_PLATFORM_RLIMITTYPE) * 8 - 1));
else
rlim_max = (rlim_t)-1;
rlim_max = (ISC_PLATFORM_RLIMITTYPE)-1;
if (value > rlim_max)
value = rlim_max;
......
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