Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Mar 2005 02:47:10 -0800
From:      ARY <ary834@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Collecting data in userland from kernel
Message-ID:  <4226EB2E.7080507@gmail.com>

next in thread | raw e-mail | index | archive | help
Hello hackers,

I am new to FreeBSD but I am familiar with Unix like systems 
in general and Linux in particular.

I am doing a project where-in I need to manipulate a few 
things in the mbuf's of network stack (mainly in TCP) and 
capture per packet statistics. Then the collated data has to 
be passed on to userspace. I have two queries regarding this.

First one is in general abt the method to be followed, I 
have the following ideas Please provide your suggestion on 
them also if you consider some other approach would be 
better then please do suggest.

1. Writing to a virtual device: This looks a very good 
option for me because it is light weight and should be 
straight forward to implement

2. A ring buffer in kernel: Something like libpcap does. 
should be good.

3. Writing to syslogger: not very attractive to me because 
it is mainly a common place for all modules and I dont have 
complete control over it.

4. Writing to a file: I dont think this is feasible because 
it is not appropriate to do costly I/O in kernel mode and 
also it is a cumbersome task.

Your say on the above ???
Any other approach(s) ???? Plzz let me know.

Second, as I said I am a newbie for FreeBSD, can somebody 
please point me to resources/docs for writing a virtual 
device. I read the chapter 13 in the Handbook, but it would 
be helpful if a document provide some info about interacting 
with a device from the kernel.

TIA,

Best Regards,
Amit



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