On Sun, Aug 18, 2013 at 04:05:11PM -0600, Chris Torek wrote: > FreeBSD now, however, uses a per-process p_args field in the > "proc" structure, with sysctl()s to set and get p_args. (I had > nothing to do with this new code, but I approve, as if anyone > cares. :-) ) This removes the fixed-virtual-address limitation. > The cost is a bit more kernel code (for the sysctl()s) and this > per-process data, but there is no more messing-about with "where > is ps_strings in this memory-layout / emulation" etc. (Meanwhile > libkvm still retrieves the arguments. It just does it now with > sysctl().)
Yes, p_args caches the arguments, but not always. Right now, kernel does not cache arguments if the string is longer than 256 bytes. Look for ps_arg_cache_limit in kern_exec.c. setproctitle() always informs the kernel with sysctl and sets the pointers in ps_strings. kern.proc.args sysctl first tries the p_args, and falls back to reading ps_strings and following the pointers if p_args is NULL.
pgpfNuTdP710t.pgp
Description: PGP signature