Subject: Re: file I/O from kernel
To: Lian Keng Lim <kengl+@andrew.cmu.edu>
From: Bill Studenmund <wrstuden@loki.stanford.edu>
List: tech-kern
Date: 04/16/1997 09:45:06
> 
> hello,
> I was wondering if anyone might have some idea on how I can do the following.
> 
> I am doing some netBSD 1.2 kernel hacking that requires a file to be
> read in.  Essentially, the file has parameters that the hacked kernel
> will read in.  Is there a way to do this?  I'd like to be able to do
> something like fscanf() from within the kernel.
> 
> thanks much for any help/suggestions.

Why? It's not common for the kernel to, of its own volition, open up a
file and read it.

Typically the way to feed in tuning parameters is to write a little
program which reads the parameter file, and then tells the kernel
what to do. In some cases, such as mounting, the program (mount_XXX
in this case) sends the file name to the kernel.

Since you don't say what you're doing, it's hard to comment further.

Look at any of the file system mount routines (in the kernel) to see
how they look up the file name fed in from userland.

Take care,

Bill