jack wrote: > I am writing a kernel driver and need to open a file and write data to it > from inside the kernel module. > > I know that on forums and on google, everybody says that it is "NOT > RECOMMENDED" to do File I/O from a kernel driver. But, still I need to do it > for my project. > > Wherever I try to pass the file name to be opened to open() sys call from my > kernel driver, the address of file name string is not recognized by sys call > returning EFAULT (i.e. bad address). > > For this, in Linux, get_fs() and set_fs() do help to do such File I/O from > kernel driver. > But, I couldn't find anything like these in solaris. :(
The address you're giving that function is a kernel address, but it's expecting a user address. That's how you get EFAULT. You're probably better off rethinking your application. But if you insist, you might want to have a look at usr/src/uts/common/os/core.c, and the do_core() function in particular. It does what you're asking -- opening a file from within the kernel and writing to it. -- James Carlson 42.703N 71.076W <carls...@workingcode.com> _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code