[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reading a file from a module
Your module is a part of the kernel. Your system call always takes a user
space string. when you supply a kernel space string your sys call will
reject it.
try using
fs = get_fs(); // fs is of type mm_segment_t
set_fs(get_ds())
/* your code here*/
set_fs(fs);
That is, let the sys call consider the kernel space to be a valid source of
input. Also look at filp_open if you really want to open a file in kernel
space.
Regards,
Mohit Kalra
"It is a capital mistake to theorize before one has data.
Insensibly one begins to twist facts to suit theories, instead of theories
to suit facts."
I am not using the systemcall open(). I am using the sys_open().
I create a function pointer of the type sys_open say my_open
and do
my_open = syscall[__NR_OPEN];
and then use it to open the file...
But when i do this, i am getting an errno of -14
which is I suppose illegal operation. So what more do i need to open the
file from my module.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/