Load/unload modules programatically

Load/unload modules programatically

Post by Chri » Sat, 09 Sep 2000 02:23:26



Is there a way to load and unload kernel modules from within a user
application? I am currently using a shell script consisting of insmod,
search /proc/devices for major number, mknod. Then another script using
rmmod to unload the module when the app closes.

What I really want is to have the application manage the loading and
unloading of the module without having to rely on the shell.

Has anyone figured this one out?

Chris

 
 
 

Load/unload modules programatically

Post by Karl Heye » Sat, 09 Sep 2000 09:41:47




> Is there a way to load and unload kernel modules from within a user
> application? I am currently using a shell script consisting of insmod, search
> /proc/devices for major number, mknod. Then another script using rmmod to
> unload the module when the app closes.

> What I really want is to have the application manage the loading and
> unloading of the module without having to rely on the shell.

The loading of modules is a root only task, you don't want normal users
iniitiating module loading directly.  kmod is created which exec modprobe then
in turn insmod.  

The above script could be done but it needs root, there maybe capabilities
provided by 2.4 for this sort of task

karl.