From owner-freebsd-hackers@FreeBSD.ORG Wed Dec 24 08:45:20 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEBDD1065673 for ; Wed, 24 Dec 2008 08:45:20 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from mail36.syd.optusnet.com.au (mail36.syd.optusnet.com.au [211.29.133.76]) by mx1.freebsd.org (Postfix) with ESMTP id 4476F8FC19 for ; Wed, 24 Dec 2008 08:45:19 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (c122-106-215-175.belrs3.nsw.optusnet.com.au [122.106.215.175]) by mail36.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id mBO8ilRF015924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Dec 2008 19:44:49 +1100 X-Bogosity: Ham, spamicity=0.000000 Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by server.vk2pj.dyndns.org (8.14.3/8.14.3) with ESMTP id mBO8ikiE011831; Wed, 24 Dec 2008 19:44:46 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.14.3/8.14.3/Submit) id mBO8ijBB011830; Wed, 24 Dec 2008 19:44:45 +1100 (EST) (envelope-from peter) Date: Wed, 24 Dec 2008 19:44:45 +1100 From: Peter Jeremy To: Gerry Weaver Message-ID: <20081224084445.GA1081@server.vk2pj.dyndns.org> References: <20081223000534.f740ca8a@mail01.compvia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9amGYk9869ThD9tj" Content-Disposition: inline In-Reply-To: <20081223000534.f740ca8a@mail01.compvia.com> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.18 (2008-05-17) Cc: freebsd-hackers@freebsd.org Subject: Re: How to access kernel memory from user space X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Dec 2008 08:45:20 -0000 --9amGYk9869ThD9tj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2008-Dec-22 18:05:34 -0600, Gerry Weaver wrote: >I am working on a driver that collects various network statistics via >pfil. I have a simple array of structures that I use to store the >statistics. I also have a user space process that needs to collect >these statistics every second or so. The easiest (and hackiest) approach would be to kldsym(2) to locate the symbol in KVM and then mmap(2) the relevant part of /dev/kmem. The biggest downside is that the userland process needs to be group kmem. The other approach would be for your kernel driver to grow a character device node and directly support mmap. --=20 Peter Jeremy Please excuse any delays as the result of my ISP's inability to implement an MTA that is either RFC2821-compliant or matches their claimed behaviour. --9amGYk9869ThD9tj Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAklR9n0ACgkQ/opHv/APuIfvVACeKikYkOgVs+vGls74HULRkf7F Zr4An2WzaJ2MCYK8OS1qkxLYRGdY7dIh =l3vR -----END PGP SIGNATURE----- --9amGYk9869ThD9tj--