Completing syscall operations on module exit

From: selvakumar nagendran
Date: Thu Jan 06 2005 - 04:34:58 EST


Hello kernelexperts,
I am intercepting system calls in kernel 2.4.28. I
have implemented it as a kernel module. In my pipe
syscall implementation, I am storing the file
descriptors created in a linked list structure using
kernel linked list interface. (<linux/list.h>) and I
am printing the list in the exit module portion.
Now, It stores all descriptors created in the linked
list. While unloading, my module will restore the
original syscall pointer.
But if I rmmod the module, the last entry is
missing. It is not added into the list. What could be
the problem?
I think while my syscall is executing, rmmod stops it
and redirects it to the original sycall. How can I
rewrite my exit module to ensure that it will also
record the last descriptor created?

Regards,
selva

void __exit exit_sched(void)
{
extern long sys_call_table[];
//struct my_process *temp = NULL, *freetemp = NULL;
struct my_process *my;
struct list_head *p;

/* better put back the real sys call !*/
sys_call_table[__NR_pipe] = (unsigned
long)sys_pipe_saved;
sys_call_table[__NR_close] = (unsigned long)
sys_close_saved;
printk("\n Writing Pipe Access Details for every
process..");
printk("\n ProcessID,ReadEnd,WriteEnd");

list_for_each(p,&proinit.list) {
my = list_entry(p, struct my_process, list);
printk("\n%ld,", my -> pid);
printk("%d,", my -> pipe_read_end);
printk("%d", my -> pipe_write_end);
}

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/