Subject: Re: new sysctl(KERN_PROC, ...) interface (was: sysinfo(2))
To: Simon Burge <simonb@netbsd.org>
From: Eduardo Horvath <eeh@turbolinux.com>
List: tech-kern
Date: 04/19/2000 08:06:01
On Wed, 19 Apr 2000, Simon Burge wrote:
> Subject: Re: new sysctl(KERN_PROC, ...) interface (was: sysinfo(2))
>
> Eduardo Horvath wrote:
>
> > On Tue, 18 Apr 2000, Simon Burge wrote:
> >
> > > 3) Need the size of "char **" for same reasons as 2).
> > >
> > > Is there an easy way to tell if a process is a 32 or 64 bit process?
> >
> > No. But I added a P_32 flag to the proc struct to indicate that a process
> > is running under 32-bit emulation.
>
> So for the 32 bit emul case, you'd need to know the possibility that
> you might be running under emulation, which isn't really possible (eg,
> mips ps today, with mips64 maybe occuring one day). But if we stored
> the kernel's idea of the pointer size and looking at P_32 if the pointer
> size is 8 bytes then we should be able to cover all possibilities...
>
> sysctl HW_KERNPTRSIZE ?
The P_32 flag wasn't really designed for use by the program running under
32-bit emulation. It was designed to allow the kernel to detect that a
data structure needs to be converted before copyout.
As you said, if it's a 32-bit binary then either it needs to take into
account that it may be running under a 64-bit kernel and handle things
appropriately, or that needs to be hiddend from the program through a
combination of kernel emulation routines and libkvm wrappers.
Eduardo Horvath