Linux-kernel mailing list archive 2000-23,: Re: [PATCH] fix for sysinfo(2) in 2.4.0-test1

# Re: [PATCH] fix for sysinfo(2) in 2.4.0-test1

Erik Andersen (andersen@xmission.com)
Sun, 4 Jun 2000 11:37:07 -0600

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: kuznet@ms2.inr.ac.ru: "Re: [PATCH][CFT] dcache-ac6-D - dcache threading"
- Previous message: Alan Cox: "Re: open() on sockets (was: Linux 2.4.0-test1ac7)"
- In reply to: Alan Cox: "Re: [PATCH] fix for sysinfo(2) in 2.4.0-test1"

On Sun Jun 04, 2000 at 05:49:24PM +0100, Alan Cox wrote:
> > + /* These are in units of PAGE_SIZE, but this interface
> > + * has always returned bytes. Make it return bytes */
> > + val.totalram*=PAGE_SIZE;
> > + val.freeram*=PAGE_SIZE;
> > + val.sharedram*=PAGE_SIZE;
> > + val.bufferram*=PAGE_SIZE;
> > + val.totalswap*=PAGE_SIZE;
> > + val.freeswap*=PAGE_SIZE;
> > + val.totalhigh*=PAGE_SIZE;
> > + val.freehigh*=PAGE_SIZE;
>
> Each of these may overflow a 32bit value

Only on 32 bit platforms that have High Memory Support enabled.

The sysinfo change to accomodate the fringe (but clearly useful) case of having
64GiB on a 32bit platform breaks source code without making it obvious that the
source code has been broken (not even a compiler warning), and breaks existing
binaries such that the binaries do not notice they have been broken (just wierd
behavior). A segfault would be much more obvious.

How about this: for kernel/info.c I go through a cap each value at ULONG_MAX.
Then I implement kernel/info64.c that provides a new ``sysinfo64'' that returns
sizes in units of PAGE_SIZE. Those that use sysinfo and get ULONG_MAX back for
totalram and friends can then make use of the new ``sysinfo64''. Those wanting
the new behavior can explicitly ask for it (via sysinfo64). This way,
backwords compatability is retainedand nobody gets surprised.

Would this be agreeable?

-Erik

    --
    Erik B. Andersen   Web:    http://www.xmission.com/~andersen/
                       email:  andersee@debian.org
    --This message was written using 73% post-consumer electrons--

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

- Next message: kuznet@ms2.inr.ac.ru: "Re: [PATCH][CFT] dcache-ac6-D - dcache threading"
- Previous message: Alan Cox: "Re: open() on sockets (was: Linux 2.4.0-test1ac7)"
- In reply to: Alan Cox: "Re: [PATCH] fix for sysinfo(2) in 2.4.0-test1"