sysconf(3) extensions.

Pawel Jakub Dawidek pjd at FreeBSD.org
Wed Nov 1 20:27:17 UTC 2006


On Wed, Nov 01, 2006 at 01:59:52PM -0600, Brooks Davis wrote:
> 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.
> > > > 
> > > > 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.
> > > > 
> > > > The patch is here:
> > > > 
> > > > 	http://people.freebsd.org/~pjd/patches/sysconf.patch
> > > > 
> > > > Can someone review it? Thanks.
> > > 
> > > 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.
> 
> OK.  I'd be somewhat inclined to leave _SC_AVPHYS_PAGES out in that
> case, but I don't feel strongly about it.

I've no opinion, I can remove it.

> > > +Note that it is possible for the product of this value and the value of
> > > +.Li _SC_PAGE_SIZE
> > > +to overflow.
> > > 
> > > 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?
> 
> 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
> .Li _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.

Sounds good.

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20061101/a86ab5bd/attachment.pgp


More information about the freebsd-arch mailing list