From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 19 07:44:58 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 644AF74C for ; Mon, 19 Aug 2013 07:44:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CBA9728B7 for ; Mon, 19 Aug 2013 07:44:57 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r7J7irL3018772; Mon, 19 Aug 2013 10:44:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r7J7irL3018772 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r7J7iq8v018771; Mon, 19 Aug 2013 10:44:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 19 Aug 2013 10:44:52 +0300 From: Konstantin Belousov To: Chris Torek Subject: Re: ps_strings Message-ID: <20130819074452.GW4972@kib.kiev.ua> References: <201308182205.r7IM5BQR062114@elf.torek.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hPP31ZHTUnLyawCy" Content-Disposition: inline In-Reply-To: <201308182205.r7IM5BQR062114@elf.torek.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-hackers@freebsd.org, Carlos Jacobo Puga Medina X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Aug 2013 07:44:58 -0000 --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--