Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Dec 2008 19:44:45 +1100
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        Gerry Weaver <gerryw@compvia.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: How to access kernel memory from user space
Message-ID:  <20081224084445.GA1081@server.vk2pj.dyndns.org>
In-Reply-To: <20081223000534.f740ca8a@mail01.compvia.com>
References:  <20081223000534.f740ca8a@mail01.compvia.com>

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

--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 <gerryw@compvia.com> 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--



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