From owner-cvs-src@FreeBSD.ORG Tue Nov 9 01:34:10 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 832D116A4D3; Tue, 9 Nov 2004 01:34:10 +0000 (GMT) Received: from daintree.corp.yahoo.com (daintree.corp.yahoo.com [216.145.52.172]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5EC1143D2D; Tue, 9 Nov 2004 01:34:10 +0000 (GMT) (envelope-from peter@wemm.org) Received: by daintree.corp.yahoo.com (Postfix, from userid 2154) id 59A5319770; Mon, 8 Nov 2004 17:34:10 -0800 (PST) From: Peter Wemm To: Dag-Erling Smorgrav Date: Mon, 8 Nov 2004 17:34:09 -0800 User-Agent: KMail/1.7 References: <200411081805.iA8I5hVK038813@repoman.freebsd.org> <200411081728.10575.peter@wemm.org> In-Reply-To: <200411081728.10575.peter@wemm.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200411081734.10062.peter@wemm.org> cc: cvs-src@freebsd.org cc: src-committers@freebsd.org cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/sys _types.h resource.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2004 01:34:10 -0000 On Monday 08 November 2004 05:28 pm, Peter Wemm wrote: > On Monday 08 November 2004 10:05 am, Dag-Erling Smorgrav wrote: > > des 2004-11-08 18:05:43 UTC > > > > FreeBSD src repository > > > > Modified files: > > sys/sys _types.h resource.h > > Log: > > 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 > > Is this yours? > > ../../../kern/init_main.c: In function `proc0_init': > ../../../kern/init_main.c:418: warning: integer overflow in > expression ../../../kern/init_main.c:427: warning: integer overflow > in expression for (i = 0; i < RLIM_NLIMITS; i++) > p->p_limit->pl_rlimit[i].rlim_cur = > 418 p->p_limit->pl_rlimit[i].rlim_max = RLIM_INFINITY; > 427 p->p_cpulimit = RLIM_INFINITY; > > kern_resource.c: > newlim->pl_rlimit[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; > > ../../../kern/kern_resource.c:564: warning: integer overflow in > expression > ../../../kern/kern_resource.c:566: warning: integer overflow in > expression > > etc etc etc. Yes, it is: 1.26 (des 09-Nov-04): #define RLIM_INFINITY ((rlim_t)(((int64_t)1 << 63) - 1)) This is impossible. 1<<63 will not fit in an int64_t. You're shifting into the sign bit. You probably want uint64_t and then cast it back to the signed type. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5