Subject: Re: Using the kernel to get argv for a process.
To: Giles Lean <firstname.lastname@example.org>
From: Simon Burge <email@example.com>
Date: 04/29/2000 17:12:56
Giles Lean wrote:
> On Fri, 28 Apr 2000 00:24:25 +1000 Simon Burge wrote:
> > So, is there any reasons not to add the equivalent of
> > sysctl(CTL_KERN, KERN_PROC_ARGV, pid, buf, len)
> > and
> > sysctl(CTL_KERN, KERN_PROC_ENVP, pid, buf, len)
> > and completely drop sgid from ps (and probably top and w/uptime as
> > well)?
> What effect will this have on processes that (try to) adjust argv?
There'll be no change to how things are currently done with ps(1). All
I was thinking of was moving from having ps chase vm page maps and argv
vectors to having the kernel do that. It'll still start from each
> How this is done and if it is possible seems to vary from OS to OS;
> the NetBSD magic incantation appears to involve __ps_strings as known
> to setproctitle(3), but I've not looked at the kernel code.
All the kernel does is set up the initial argv/envp and __ps_strings in
the exec() handler. As long as the argv pointer in __ps_strings is kept
up to date (as setproctitle(3) does) everything will be ok.
> Personally I don't care if the feature goes away -- a non-setuid ps is
> preferred -- but sendmail administrators might miss the feature.
There will be no user-visible changes, except that the setgid bit will
disappear and an old ps will work on a new kernel without a "proc size
mismatch" error. These are not bad things :-)