Re: set parameter from module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/11/06, Christian Boon <c.boon@xxxxxxxxxxxxxxxxxxxx> wrote:
Hi,

i know it is possible with an ioctl to change a value in a kernel module.
Is it possible to let a kernel module change a value in user space when
some kind of error occurs?
so that i dont need to check 'if' an error occured.

Christian.


Hi,

Checkout the function "call_usermodehelper" in kmod.c.

/**
* call_usermodehelper - start a usermode application
* @path: pathname for the application
* @argv: null-terminated argument list
* @envp: null-terminated environment list
* @wait: wait for the application to finish and return status.
*
* Runs a user-space application.  The application is started
* asynchronously if wait is not set, and runs as a child of keventd.
* (ie. it runs with full root capabilities).
*
* Must be called from process context.  Returns a negative error code
* if program was not execed successfully, or 0.
*/
int call_usermodehelper(char *path, char **argv, char **envp, int wait)

This function can be used to call a user space application from
kernel. So kernel won't be actually calling a "call back function" but
a "call back application". However, you can write this application to
perform whatever you want to do.

(This mechanism is actually used to call hot plug agent scripts when a
hot-plug event is detected by the kernel).

Hope that helps,

Rajat

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux