* Tzahi Fadida <[EMAIL PROTECTED]> [070221 02:38]: > Hi, > Is it possible to replace a function in the kernel (using a module) without > recompiling. This function is an exported function. Basically i wish to > extend a functionality of a function (without asking for a stub at this > point). Specifically the function void submit_bio(int rw, struct bio *bio) > in /block/ll_rw_blk.c > Not that i can't recompile the kernel, it is just that i want to create a > module that would be able to be distributed with more convenience. > > The idea, of course, is to call the submit_bio using the new function but > also > do other stuff afterward. > > Basically i wish to extend the functionallity of block_dump (for fun and > study > purposes) to be centralized in some /proc entry with some stats.
I'm not aware of a way to do what you ask (redirect the function to you and be able to call it), you can however look at kprobe which is part of the kernel. kprobe allows you to stick trap points into the kernel and be called at that point, I don't remember the exact name but they have a method to stick the probe at the end of the function (and also at the beginning or arbitrary location). I've used this method to trace methods and it's fairly expensive since it uses int3 trap points to do its work but if performance is not critical for you it should be fine. Baruch ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]