NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Why are there physmem and physmem64?

On Fri, Feb 17, 2017 at 11:22:06PM +0900, Miwa Susumu wrote:
> 2017-02-17 23:06 GMT+09:00 Martin Husemann <>:
> > On Fri, Feb 17, 2017 at 11:00:10PM +0900, Miwa Susumu wrote:
> >> If change it, sysctl work correctly.
> >
> > Unless you have more than 4 GB.
> of course.
> > So why bother changing it at all? Just ignore the old value.
> That's right.
> but I said earlier, Memory will not be negaive value. why sysctl use
> singned int?

Because the sysctl MIB is a public API (and ABI) and it was a signed int
in 4.4BSD.  Applicattions are entitled to make assumptions about the
possible range of the returned value, and we are not entitled to invalidate
those assumptions.  That's what "compatibility" means.  Sometimes you are
stuck with mistakes people made decades ago.

We did consider making exactly this change about 20 years ago, and concluded
the safe thing to do was to create hw.physmem64 instead.


Home | Main Index | Thread Index | Old Index