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/17/2000 11:46:12
On Mon, 17 Apr 2000, Simon Burge wrote:

> Hmm, one thing occurs to me - getting a process's argv is very much
> attached to the current vm machinery.  What would be nice here (and
> the opposite of what you probably are thinking!) is a nice little
> kernel interface to return the address in either physmem or swap of a
> given process' va.  Then kvm_proc.c:kvm_uread() could be as simple as
> (paraphrasing sysctl):
> 	
> 	sysctl(CTL_KERN, KERN_PROC_VA, pid, &type, &offset);
> 	pread(type == swap ? swapfd : memfd, buf, nbpg, offset);

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.

Eduardo Horvath