Re: About reading a text-file from kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi,
I need to open a text-file from kernel itself, and read the contents
from that file, and close that file.

I tried using sys_open system call, but I was getting error saying
"bad address"

The better way to get data from a file into kernel is -
1) Create a service script (/etc/init.d/foobar)
2) From this script, load your kernel modules
3) From this script, run a user program (say prog1)
4) Let 'prog1' read the rules from the file and make  'ioctl' calls to your module and submit these rules via them.
5) # chkconfig <your-script> on

Regards,
- Ratnadeep
 

After playing around for some time, I felt that this system calls
assume that all data sent to them is from userspace, and even the
output that
they will be giving should go to userspace.

One more problem is that, this "sys_open" and "sys_read" system call
use file-discripter which is stored in tast_struct of current process.
I would also like to avoid this.

Is there any way by which I can read the contents of the file from the
kernel itself ?
Are there any example in kernel, which will help me in understanding
how to read from textfile.

Thank you for help
--
Pravin Shinde

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux