From owner-freebsd-arch@FreeBSD.ORG Wed Nov 1 19:59:57 2006 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5DFE416A415; Wed, 1 Nov 2006 19:59:57 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from sccmmhc91.asp.att.net (sccmmhc91.asp.att.net [204.127.203.211]) by mx1.FreeBSD.org (Postfix) with ESMTP id 25E5D43D5E; Wed, 1 Nov 2006 19:59:56 +0000 (GMT) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net ([12.207.12.9]) by sccmmhc91.asp.att.net (sccmmhc91) with ESMTP id <20061101195955m9100elm07e>; Wed, 1 Nov 2006 19:59:55 +0000 Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.13.8/8.13.8) with ESMTP id kA1Jxrdt057892; Wed, 1 Nov 2006 13:59:53 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.13.8/8.13.8/Submit) id kA1JxqQK057891; Wed, 1 Nov 2006 13:59:52 -0600 (CST) (envelope-from brooks) Date: Wed, 1 Nov 2006 13:59:52 -0600 From: Brooks Davis To: Pawel Jakub Dawidek Message-ID: <20061101195952.GB56970@lor.one-eyed-alien.net> References: <20061101190606.GQ15861@garage.freebsd.pl> <20061101192457.GA56970@lor.one-eyed-alien.net> <20061101194618.GT15861@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TakKZr9L6Hm6aLOc" Content-Disposition: inline In-Reply-To: <20061101194618.GT15861@garage.freebsd.pl> User-Agent: Mutt/1.5.11 Cc: freebsd-arch@FreeBSD.org Subject: Re: sysconf(3) extensions. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Nov 2006 19:59:57 -0000 --TakKZr9L6Hm6aLOc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 01, 2006 at 08:46:18PM +0100, Pawel Jakub Dawidek wrote: > On Wed, Nov 01, 2006 at 01:24:57PM -0600, Brooks Davis wrote: > > On Wed, Nov 01, 2006 at 08:06:06PM +0100, Pawel Jakub Dawidek wrote: > > > Hi. > > >=20 > > > I'd like to add two non-standard value to the sysconf(3) functions, > > > which can be found in both Solaris and Linux: _SC_PHYS_PAGES and > > > _SC_AVPHYS_PAGES. > > >=20 > > > The patch is here: > > >=20 > > > http://people.freebsd.org/~pjd/patches/sysconf.patch > > >=20 > > > Can someone review it? Thanks. > >=20 > > What are they for? My concern is that _SC_AVPHYS_PAGES isn't going to > > semantically match other platforms since in a steady state the free cou= nt > > is small on FreeBSD, but on other systems it swings quite a bit based on > > load. >=20 > _SC_PHYS_PAGES is used by libzpool (a part of the ZFS file system). > _SC_AVPHYS_PAGES I used more for completness. OK. I'd be somewhat inclined to leave _SC_AVPHYS_PAGES out in that case, but I don't feel strongly about it. > > +Note that it is possible for the product of this value and the value of > > +.Li _SC_PAGE_SIZE > > +to overflow. > >=20 > > This would be more clear if it said what was expected to overflow and > > when. >=20 > The sysconf(3) functions return 'long' and on 32bit machine long is also > 32bit. If we have more than 4GB of memory (PAE) and want to calculate > physical memory in bytes doing _SC_PHYS_PAGES * _SC_PAGE_SIZE will > overflow. But I'm not sure if I want to put this into manual page... > Maybe as an example if there are or may be in the future other cases > when this is possible? That's the problem I expected. Actually since it's a long not a u_long, it would overflow at >2GB. Maybe something like: Note that it is possible that the product of this value and the value of =2ELi _SC_PAGE_SIZE will overflow a long in some configurations on a 32bit machine. My worry is that your original phrasing may be unnecessarily subtle. -- Brooks --TakKZr9L6Hm6aLOc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFSPy4XY6L6fI4GtQRAiGgAJ9jTNNmmmZ8YgYaJ9hHCsF/vUcVoQCfch4R en/4i4J+WLhajQmV9um7fZE= =UiNh -----END PGP SIGNATURE----- --TakKZr9L6Hm6aLOc--