From 59cbe93f72d84866d77fe36d4fd2311b152566d0 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 11 Dec 2003 22:55:23 +0000 Subject: POSIX says rlim_t should be unsigned so make it u_quad_t. Also add POSIX-mandated RLIM_SAVED_MAX and RLIM_SAVED_CUR defines. On OpenBSD these are identical to RLIM_INFINITY as allowed by POSIX. OK deraadt@ --- share/man/man5/types.5 | 4 ++-- sys/kern/kern_resource.c | 5 +---- sys/sys/resource.h | 6 ++++-- sys/sys/types.h | 4 ++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/share/man/man5/types.5 b/share/man/man5/types.5 index 0a2a8fa8064..fbab7bc4b77 100644 --- a/share/man/man5/types.5 +++ b/share/man/man5/types.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: types.5,v 1.8 2003/06/02 23:30:14 millert Exp $ +.\" $OpenBSD: types.5,v 1.9 2003/12/11 22:55:22 millert Exp $ .\" $NetBSD: types.5,v 1.4 1997/07/10 06:56:38 mikel Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 @@ -80,7 +80,7 @@ typedef u_int16_t mode_t; /* permissions */ typedef u_int16_t nlink_t; /* link count */ typedef quad_t off_t; /* file offset */ typedef int32_t pid_t; /* process id */ -typedef quad_t rlim_t; /* resource limit */ +typedef u_quad_t rlim_t; /* resource limit */ typedef int32_t segsz_t; /* segment size */ typedef int32_t swblk_t; /* swap offset */ typedef u_int32_t uid_t; /* user id */ diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index f47644a55d0..1eab6bddb54 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource.c,v 1.24 2003/09/01 18:06:03 henning Exp $ */ +/* $OpenBSD: kern_resource.c,v 1.25 2003/12/11 22:55:22 millert Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /*- @@ -235,9 +235,6 @@ dosetrlimit(p, which, limp) if (which >= RLIM_NLIMITS) return (EINVAL); - if (limp->rlim_cur < 0 || limp->rlim_max < 0) - return (EINVAL); - alimp = &p->p_rlimit[which]; if (limp->rlim_cur > alimp->rlim_max || limp->rlim_max > alimp->rlim_max) diff --git a/sys/sys/resource.h b/sys/sys/resource.h index 6508db457ab..fc0ebbc226d 100644 --- a/sys/sys/resource.h +++ b/sys/sys/resource.h @@ -1,4 +1,4 @@ -/* $OpenBSD: resource.h,v 1.5 2003/06/02 23:28:21 millert Exp $ */ +/* $OpenBSD: resource.h,v 1.6 2003/12/11 22:55:22 millert Exp $ */ /* $NetBSD: resource.h,v 1.14 1996/02/09 18:25:27 christos Exp $ */ /* @@ -88,7 +88,9 @@ struct rusage { #define RLIM_NLIMITS 9 /* number of resource limits */ -#define RLIM_INFINITY (((u_quad_t)1 << 63) - 1) +#define RLIM_INFINITY (((rlim_t)1 << 63) - 1) +#define RLIM_SAVED_MAX RLIM_INFINITY +#define RLIM_SAVED_CUR RLIM_INFINITY struct orlimit { int32_t rlim_cur; /* current (soft) limit */ diff --git a/sys/sys/types.h b/sys/sys/types.h index bface2bde5a..12756d517ea 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: types.h,v 1.21 2003/08/19 23:42:46 millert Exp $ */ +/* $OpenBSD: types.h,v 1.22 2003/12/11 22:55:22 millert Exp $ */ /* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */ /*- @@ -72,7 +72,7 @@ typedef long key_t; /* IPC key (for Sys V IPC) */ typedef u_int16_t mode_t; /* permissions */ typedef u_int16_t nlink_t; /* link count */ typedef int32_t pid_t; /* process id */ -typedef quad_t rlim_t; /* resource limit */ +typedef u_quad_t rlim_t; /* resource limit */ typedef int32_t segsz_t; /* segment size */ typedef int32_t swblk_t; /* swap offset */ typedef u_int32_t uid_t; /* user id */ -- cgit v1.2.3