From owner-freebsd-arch@FreeBSD.ORG Tue Jul 15 13:18:11 2008 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AA2C106564A; Tue, 15 Jul 2008 13:18:11 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id E68578FC20; Tue, 15 Jul 2008 13:18:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m6FDI1FQ080666 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 15 Jul 2008 16:18:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m6FDI1jY082764; Tue, 15 Jul 2008 16:18:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m6FDI1jx082763; Tue, 15 Jul 2008 16:18:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 15 Jul 2008 16:18:01 +0300 From: Kostik Belousov To: Stacey Son Message-ID: <20080715131801.GS17123@deviant.kiev.zoral.com.ua> References: <4875A5D2.8030902@freebsd.org> <20080711155232.A96384@grasshopper.cs.duke.edu> <48780661.5050002@freebsd.org> <20080712045837.GD17123@deviant.kiev.zoral.com.ua> <487AD49F.6040304@freebsd.org> <20080715093402.GO17123@deviant.kiev.zoral.com.ua> <487CA2B4.7070604@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kR01/VAbwQaE53Z3" Content-Disposition: inline In-Reply-To: <487CA2B4.7070604@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.4 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on skuns.kiev.zoral.com.ua Cc: Andrew Gallatin , freebsd-arch@freebsd.org Subject: Re: ksyms pseudo driver X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jul 2008 13:18:11 -0000 --kR01/VAbwQaE53Z3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 15, 2008 at 08:14:28AM -0500, Stacey Son wrote: > Kostik Belousov wrote: > >>The snapshot of the consolidated symbol table is made when /dev/ksyms is > >>opened. The storage for the snapshot is allocated in the memory map of > >>the calling process. No kernel address space is used for the snapshot. > >> =20 > >Again, why this is done this way ? Why not creating snapshot when the > >user process issues ioctl that supplies neccessary usermode memory > >to the driver ? > > =20 >=20 > The main reason it is written as a pseudo driver is so it can be used=20 > with standard command-line utilities. For example, see the ksyms=20 > example in the dtrace manual=20 > (http://wikis.sun.com/display/DTrace/Structs+and+Unions). I guess it=20 > could still be possible to do in the way you are suggesting but it would= =20 > require a special 'cat', or something, to allocate the user space buffer= =20 > and then pass that in driver before it starts reading the symbol table. = =20 > You could then pipe the output of the "special ksyms cat" to the actual= =20 > command-line program you wanted to use. Of course, if you had to use= =20 > a "special ksyms cat" then there would be no reason to make this a=20 > pseudo driver. You could simply make it a system call and eliminate a= =20 > lot of code and calls into the kernel. Would dd bs=3D work as the "special cat" ? procfs' /proc/pid/map has the similar problem, and there was a procmap program in ports. I believe dd is enough. --kR01/VAbwQaE53Z3 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkh8o4gACgkQC3+MBN1Mb4gk6wCgudTjZWHagF5Xyr8kkJhDno0l iKAAoLZCuZpw2ZNArz/qAyNzHZeh6Ryg =10Cr -----END PGP SIGNATURE----- --kR01/VAbwQaE53Z3--