Skip to contentSkip to conversation

Communication between two kernel modules

DISCUSSION Michael Zhu 4 participants 4 messages Feb 18, 2002 – Feb 25, 2003

lore
Share & tools
lore
#0 lore raw

Hi, how can I call some kind of APIs from kernel mode, such as open, ioctl and close? Because I need to use some services of another kernel module from my kernel module and I have no source code of the module which provides the services. Now I can only access the module in user space using the open, ioctl and close APIs. Can I do the same thing in my kernel module? Thanks.

Michael

______________________________________________________________________
Web-hosting solutions for home and business! http://website.yahoo.ca

#1 lore raw

Hello Michael!

Quoted 8 lines · Michael Zhu

Hi, how can I call some kind of APIs from kernel mode, such as open, ioctl and close? Because I need to use some services of another kernel module from my kernel module and I have no source code of the module which provides the services. Now I can only access the module in user space using the open, ioctl and close APIs. Can I do the same thing in my kernel module? Thanks.

Create a user-space app that will ioctl into your driver and wait for requests. When your module needs to call the other module it delivers request to the user-space app wich in turn calls the other module and returns results via another ioctl call.

Take care not to deadlock.. In user space app use fork() or threads and handle module requests async...

Be ready to handle an event when your user-space app unexpectedly dies.

Signature · 2 lines
best regards,
Rok Papež.
#2 lore raw
In reply to Michael Zhu
Quoted 12 lines
Quoted 7 lines

Hi, how can I call some kind of APIs from kernel mode, such as open, ioctl and close? Because I need to use some services of another kernel module from my kernel module and I have no source code of the module which provides the services. Now I can only access the module in user space using the open, ioctl and close APIs. Can I do the same thing in my kernel module?

Create a user-space app that will ioctl into your driver and wait for requests. When your module needs to call the other module it delivers request to the user-space app wich in turn calls the other module and returns results via another ioctl call.

Quoted 4 lines

Take care not to deadlock.. In user space app use fork() or threads and handle module requests async...

Be ready to handle an event when your user-space app unexpectedly dies.

Seems way too complicated to me. You can do everything from kernel. You probably shouldn't use file handles in kernel, but you can use file structure. Just open via filp_open, ioctl via ->f_op->ioctl and close via filp_close (it will fput the structure).

You have to be in process context, either your ioctl handler or kernel thread would do.

--------------------------------------------------------------------------------
- Jan Hudec `Bulb' <[email protected]>

#3 lore raw

Problem kernel 2.2.23

Estimated gurus.

I have updated my PC from 2.2.14 to 2.2.23 -owing to SYN Cookies Problemm-

Since I have updated to 2.2.23, -one month ago-, my PC has reset 4 times, and there is no error in log files.

This kernel has any problem with memory ??

Is there any patch for this problem ??

Even, in apache files appears "mmap_handler: mmap failed"

Thank you !!!!