ps_strings

I cannot fully understand how struct ps_strings is used. As far as I understand it is used to keep a pointer to argv, envp of a process at a fixed location (the top of the user process stack) so that it is always possible to get the pointers from outside of the process.

Despite the name, I cannot find any reference to ps_strings in the ps(1) implementation, and even the kvm_getargv(3) does not seem to me is bound to ps_strings. Can someone point me to an example of using ps_strings?
 
The only uses I can find quickly are in /usr/src/sys/kern/kern_exec.c and /usr/src/sys/kern/kern_proc.c.
 
fonz said:
The only uses I can find quickly are in /usr/src/sys/kern/kern_exec.c and /usr/src/sys/kern/kern_proc.c.

Yes I know, but that is not related to ps(1) or similar commands, as far as I understand. So what is the purpose of ps_strings now?
 
Have you considered the possibility that in this case the ps_ part is just short for "process" and might very well have absolutely nothing to do with ps(1)?

As far as I can tell it's just a kernel data structure that makes the housekeeping required by the implementation of calls such as execve(2) a little easier.
 
cpu82 said:
See ps_strings(5) from BSDi man pages. Also you could request to add this manual page to FreeBSD.

Thanks but that does not explain how ps_strings is used, and in fact it has the same information that you can find in the sources.
 
Back
Top