Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Aug 2013 10:44:52 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Chris Torek <torek@torek.net>
Cc:        freebsd-hackers@freebsd.org, Carlos Jacobo Puga Medina <cjpugmed@gmail.com>
Subject:   Re: ps_strings
Message-ID:  <20130819074452.GW4972@kib.kiev.ua>
In-Reply-To: <201308182205.r7IM5BQR062114@elf.torek.net>
References:  <CAHHLbRNz5TMdz67fXfFk9pLD8UFiRg%2B0G_oD1GXP23Fo4B72Bw@mail.gmail.com> <201308182205.r7IM5BQR062114@elf.torek.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--hPP31ZHTUnLyawCy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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.

--hPP31ZHTUnLyawCy
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (FreeBSD)

iQIcBAEBAgAGBQJSEczzAAoJEJDCuSvBvK1BU14P/A9dlLpY0sNwitz40JNLSElX
ms7AY1e1+1ajWSdlMm0MWgqVbL4MPzCWojG1rRsKyCynHUQKw3yTlEYZLdYP1hvN
l98DcVELcRKjYLUzCfl8aZsiNrd9wiyOIBQZym67Im044QsNeT2PHwxMh3qsZN+C
kT79R4/QLnad0xBlb8FN2raEowwrT9mBLCoyRmOxVXP+a1PK8wgkAhT6hVqz3SWk
GRyWn0bx0QEJ9cpSm3QqNoKNSGe5QT5b2dLAuwOFF/vybWXcHq9G1Hc1bBuvuEEY
u6th4YkWoI7Rcogr7kwvTWudHYHtnyRg362pKss9KmS7CuEE7Qp1Zh5+Z2/+t/mN
a5ZoIZuHgWF2BJZL8NduyYtLWWCQWPC/oimhIUbEgNpadP5P6ow63Ck8UBgyNwA6
/x3fgYbRsrirv5XgFs140U+4MwFEs62kYbuWr3iLz2qVbgr7i7X8hEvBK4EineKE
rPtcWVx9a18mEGOzD90GGCh30eBjCzKSUetCnn56jCzadg0O/HdXXeXTgFITJMNp
mSIgP7Kyj/m4Jq8DhB0pPUSEhhkZDCg20kSzygsgcKMXzyVRUxGy6WO/iTK5vgz0
2VzzjWu9j2zKWFuBfRu5PQKj+2N9U9NyWH0LSJRIR+tDiISntTraF0pJxGVSvpJv
OgrGnUBY3FHnA1kGfJeG
=cG7c
-----END PGP SIGNATURE-----

--hPP31ZHTUnLyawCy--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130819074452.GW4972>