Kernel module function call

kernelkernel-modules

I write a kernel module which has initialize and end function. I want one more function and want to call it from the user space process at any time i want.

Is it applicable ? If so, how ?

I am working on CentOS 5.2 and custom kernel, patched from linux 2.6.18.

EDIT:
To make clear, I want to write a function into kernel module and call this function from the regular source.c file.

Best Answer

Doing a kernel module that can use the /proc filesystem sounds like it might work for you. IBM developerWorks has an article on that topic. I worked through the code a few years ago, and it worked back then. The article is dated 2006, and seems to apply to Linux 2.6 kernels.

The problem I can foresee with using "files" in the /proc filesystem to get your module to do its work is that an open/read/close style API probably doesn't match what you want to do. You might have to use an open() on a /proc file to mean "execute WBINVD" or something unobvious like that.

Related Question