Re: Dumping Large Binary Buffer Through Sysctl
In message <5D267A3F22FD854F8F48B3D2B52381933936483700@IRVEXCHCCR01.corp.ad.bro
adcom.com>, "David Christensen" writes:[color=blue][color=green][color=darkred]
>> >I'm looking for a way to dump a large binary debug buffer=3D20
>> >in a driver to a file. I've currently implemented this
>> >with SYSCTL_ADD_OPAQUE() and it works fine but running the
>> >"sysctl -a" command causes this buffer to be dumped which
>> >is something of a pain. Is there a better way to do this?[/color]
>> Much better idea: memory map it, that way your driver does
>> not even discover that userland peeks over its shoulder.[/color]
>I found the CTLFLAG_SKIP attribute which hides the sysctl and=20
>makes things a lot better. How do I "memory map" the buffer?
>Can you give me a function name or point to an example where=20
>this is done so I can look into it further?[/color]
You implemente a cdevsw->mmap() function that tells the kernel
where it is, then in userland, you open the device and
See sys/kern/subr_devstat.c for an example.
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
[email]phk@FreeBSD.ORG[/email] | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
[email]firstname.lastname@example.org[/email] mailing list
To unsubscribe, send any mail to "email@example.com"