From de84c3d14f079d8deac042dddfc687e0072eb5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Mon, 8 Nov 2004 18:05:43 +0000 Subject: [PATCH] Document why rlim_t needs to be a signed type. Define RLIM_INFINITY as INT64_MAX instead of hand-rolling it. MFC after: 1 week --- sys/sys/_types.h | 4 +++- sys/sys/resource.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/sys/_types.h b/sys/sys/_types.h index c77f683fc53e..3047e985337b 100644 --- a/sys/sys/_types.h +++ b/sys/sys/_types.h @@ -49,7 +49,9 @@ typedef int __nl_item; typedef __uint16_t __nlink_t; /* link count */ typedef __int64_t __off_t; /* file offset */ typedef __int32_t __pid_t; /* process [group] */ -typedef __int64_t __rlim_t; /* resource limit (XXX not unsigned) */ +typedef __int64_t __rlim_t; /* resource limit - intentionally */ + /* signed, because of legacy code */ + /* that uses -1 for RLIM_INFINITY */ typedef __uint8_t __sa_family_t; typedef __uint32_t __socklen_t; typedef long __suseconds_t; /* microseconds (signed) */ diff --git a/sys/sys/resource.h b/sys/sys/resource.h index dbe99cf94322..f9e36ee184d3 100644 --- a/sys/sys/resource.h +++ b/sys/sys/resource.h @@ -98,7 +98,7 @@ struct rusage { #define RLIM_NLIMITS 11 /* number of resource limits */ -#define RLIM_INFINITY ((rlim_t)(((u_quad_t)1 << 63) - 1)) +#define RLIM_INFINITY ((rlim_t)INT64_MAX) /* XXX Missing: RLIM_SAVED_MAX, RLIM_SAVED_CUR */