|
experimenting with kernel module programming
while experimenting with developing kernel modules:
Instead of implementing a device driver using a kernel module, i have tried to implement a simple code as a module.
This code has the functionality as:
It reads data from a file and collects it in the data structures declared in ".h" file.
I also have data structures to store process id, process name and instances and then compare the data with data read from file.
I have not defined or used data structures used by a device driver such as struct file_operations, struct task_struct etc.
I have used system calls such as read, open to deal with files.
kmalloc - to allocate kernel memory, printk - to log messages.
my problem:
i inserted the module from one terminal.
i changed to some user(not superuser).
i was allowed to execute processes from the same terminal, i.e. to open xpdf , i had to type "xpdf abc.pdf" on terminal instead of using GUI.
problem-->
If i use GUI to open xpdf or
if i open another terminal, the computer hanged.
I was not able to figure out the problem.
Is it necessary to use the data structures and functions used in kernel code to avoid such a problem?
Is there a need to define structures as file_operations, if i perform file opearations?
Please help me and guide me in this new world of kernel modules.
Thanks in advance
|