----- Original Message ----- From: <aksingh@hss.hns.com> To: <kernelnewbies@nl.linux.org> Sent: Tuesday, June 08, 2004 11:07 PM Subject: functions in a single module > HI, > > I have 6 functions in a single module, some of those are netfilter hook > functions, others read/write etc functions for a char device, both type of > functions work closely.Plus, I have a couple of timer expiry functions > within my module. My doubt is : can functions within a single module > pre-empt each other, i use kenel 2.4.20-8, on a uniprocessor system. This depends on what context the functions are called in. > My read/write char device functions are used by a user level process, the > char device is used as a control interface between the module and the user > space process. So the user space process sets certain variables using > write() on the char device fd. The netfilter hook functions that reside in > the same module, use these variables(ones set in the char device driver's > write() function ). So as the write function(write()) writes to these > shared variable, can a packet come in and the netfilter hook function be > called, i.e basically the hook function pre-empts the write() function? I think it can't, because packet processing is done when tasklet runs. And tasklet don't run if kernel is in your write function (On a uniprocessor system). > Also, what happens when a timer expires, its expiry callback function is > called immediately while write() is in progress, or what exactly happens. Normally yes. And also timer expiry handler is called in interrupt context, so it can preempt other function execution. Regards Mohanlal -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/