>
> Yes. But it is not easy. Look at code vfs_vnops.c. You can let a user
> process open a file and then push the file descriptor into kernel via a
> special system call. Search the mailing list archive and you will find
> discussions on how to add a new system call.
>
Well, if you aren't going to do intensive file i/o, this is possible
(especially on MOD_LOAD) with a very ugly, but working hack: you can
simulate that current process is doing the i/o. Take curproc, allocate
some memory in it's address space using mmap() (or, preferably, vm_mmap())
with MAP_ANON flag for i/o buffer and then call open(), read(), etc,
passing curproc and allocated buffer to them. Do note, however, that
you generally can't access the buffer directly with C operators; you
should rather use copyin()/copyout(), fubyte()/subyte() functions (see
the manual page for them for details). Of course this is no brilliant
solution, I'm currently looking for a better one, but this works for
me so far for reading a config file on load.
Regards,
Eugene
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message