Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Nov 2006 20:46:18 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: sysconf(3) extensions.
Message-ID:  <20061101194618.GT15861@garage.freebsd.pl>
In-Reply-To: <20061101192457.GA56970@lor.one-eyed-alien.net>
References:  <20061101190606.GQ15861@garage.freebsd.pl> <20061101192457.GA56970@lor.one-eyed-alien.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--Ma2pZxZcUUd0eybH
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 count
> is small on FreeBSD, but on other systems it swings quite a bit based on
> load.

_SC_PHYS_PAGES is used by libzpool (a part of the ZFS file system).
_SC_AVPHYS_PAGES I used more for completness.

> +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.

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?

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--Ma2pZxZcUUd0eybH
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (FreeBSD)

iD8DBQFFSPmKForvXbEpPzQRAtXaAJ46QiEx9yofNBNcH7lvdBpCkDFBFwCfWeqY
G3tpwTPUEpg9oOiEt6ycHog=
=kE7o
-----END PGP SIGNATURE-----

--Ma2pZxZcUUd0eybH--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061101194618.GT15861>