From owner-svn-src-all@FreeBSD.ORG Fri Feb 13 14:54:26 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1CDFEE95; Fri, 13 Feb 2015 14:54:26 +0000 (UTC) Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by mx1.freebsd.org (Postfix) with ESMTP id CE2B3A83; Fri, 13 Feb 2015 14:54:25 +0000 (UTC) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 88D04D43936; Sat, 14 Feb 2015 01:54:18 +1100 (AEDT) Date: Sat, 14 Feb 2015 01:54:17 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans Subject: Re: svn commit: r278634 - head/lib/libc/gen In-Reply-To: <20150214005543.X2210@besplex.bde.org> Message-ID: <20150214015036.Y2552@besplex.bde.org> References: <201502122107.t1CL7gaO004041@svn.freebsd.org> <54DD2A87.2050008@FreeBSD.org> <9A683D99-C1E9-4736-982C-69F583D3A40D@FreeBSD.org> <20150213172738.C1007@besplex.bde.org> <54DDABF2.9000201@freebsd.org> <54DDAEF6.3060900@freebsd.org> <20150214005543.X2210@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=baJSDo/B c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=OUp92IgwhtU7bb92HiYA:9 a=CjuIK1q_8ugA:10 Cc: "Bjoern A. Zeeb" , src-committers@freebsd.org, Andrey Chernov , svn-src-all@freebsd.org, Pedro Giffuni , svn-src-head@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Feb 2015 14:54:26 -0000 On Sat, 14 Feb 2015, Bruce Evans wrote: > ... > However, I don't like using rlim_t for the scaled value that is not > an rlimit. > > An incomplete fix with handling of negative values restored is something > like: > > intmax_t targ; > > targ = arg; > if (targ > RLIM_INFINITY / 512) > targ = RLIM_INFINITY / 512; > limit.rlim_max = limit.rlim_cur = targ * 512 > > This is still incomplete. The comparison is still obviously tautologous > when intmax_t == rlim_t (the amd64 case). If intmax_t is larger than > long (the i386 case) or even rlim_t (the notyet case), then it is slightly > less obviously tautologous. This can be fixed by sprinkling volatiles, > e.g. for targ. Oops, I forgot to restore handling of negatives. Also with volatile: volatile intmax_t targ; targ = arg; if (targ > RLIM_INFINITY / 512 || targ < 0) targ = RLIM_INFINITY / 512; limit.rlim_max = limit.rlim_cur = targ * 512; This has not been tested. Bruce