Subject: Re: new sysctl(KERN_PROC, ...) interface (was: sysinfo(2))
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Eduardo Horvath <eeh@turbolinux.com>
List: tech-kern
Date: 04/17/2000 12:00:46
On Mon, 17 Apr 2000, Jonathan Stone wrote:

> In message <Pine.NEB.4.21.0004171144070.26218-100000@ehorvath>,
> Eduardo Horvath writes:
> >Oh, thanks for reminding me.  The PS_STRINGS of a process are at different
> >locations in a 32-bit and 64-bit process.  That has to be handled by ps,
> >too.
> 
> and even on a 32-bit cpu, a single static ps binary should be able to
> cope with , e.g., kernels compiled for a 2gig KVA space and 2gig UVA
> space, and with kernels compiled for a 1gig KVA and 3gig UVA.

It's a bit more complicated.  In the case of 32-bit UVA changes, the stack
base moves around but the ps_strings structure is always at a fixed offset
from the stack base.

Since the sizeof(char **) changes between a 32-bit and a 64-bit process,
the offset of the PS_STRINGS from the stack base address will also
change.

Eduardo Horvath