Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 May 2007 12:32:48 +0200
From:      des@des.no (Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?=)
To:        Lawrence Stewart <lstewart@room52.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Writing a plain text file to disk from kernel space
Message-ID:  <86646ugywf.fsf@dwp.des.no>
In-Reply-To: <4649349D.4060101@room52.net> (Lawrence Stewart's message of "Tue\, 15 May 2007 14\:18\:37 %2B1000")
References:  <4649349D.4060101@room52.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Lawrence Stewart <lstewart@room52.net> writes:
> I'm in the process of writing a kernel module to instrument some parts
> of the network stack in FreeBSD 6.2. Everything works perfectly,
> except that writing the logging info to syslog using printf is too
> inefficient for this particular task. Given that log messages need to
> be generated for each packet entering/leaving the network stack, my
> testing thus far has showed that syslog groans under the load and uses
> far too much CPU time.
>
> So, I'm looking for a way to manually open up a file from within
> kernel space and dump characters into it.

Look at the ktrace code.

Note that it opens the file in userland and passes it down to the
kernel.  You may want to consider a similar mechanism.

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no



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