reading a file in kernelmode

Marc Lörner marc.loerner at hob.de
Thu Jul 17 06:56:51 UTC 2008


Hello David!

On Thursday 17 July 2008 01:46, David wrote:
> Hello,
>
>
>
> I'm developing a FreeBSD kernel module and I'm searching for a good
> solution to open/read/close a file.
>
> My goal is to generate a MD5-Hash of a given file (path).
>
>
>
> Open-Syscall  seems to be improper.
>
>
>
> Any ideas/solutions/examples?
>

Look at file kern/kern_ktrace.c at the use of vn_open in function 
ktrace(td, uap) and VOP_WRITE in function 
ktr_writerequest(struct thread *td, struct ktr_request *req)

I think reading is done quite analogue to writing in case above.

HTH,
Marc


More information about the freebsd-hackers mailing list