Click to See Complete Forum and Search --> : Modules & Linux prompt
majidpics
11-27-2002, 04:39 PM
How to access the kernel module dynamically from linux command prompt. As it happens in the case of "cp" command, i need the same behaviour with my linux module. Module should be able to accept parameters after being loaded.
The syntax should be
like this
<root@localhost /> insmod module_name.o
<root@localhost /> module_name <parameter list>
not like this :
<root@localhost /> insmod module_name.o <parameter list>
mnsharif
11-28-2002, 04:18 AM
there can be other ways to do this, but i m not sure that what majidpics wants is really possible, any expert may have his/her comments about this
any other solution can be like using configuration files
e.g. NFS - The configuration for allowed hosts and denied hosts and exported directories are all stored in some files (/etc/hosts.allow and so on) and when NFS starts, it read those files and get itself configured accordingly. When some user wants to make some change, he/she usually just edit one of those files and asks NFS to restart (if its already started), the NFS simply reads again those files and again re-configure itself.
So this method can be used, for ur module!!!!!!!!!
when ur module is loaded, no parameter is required, and hence no configuration. But code ur module such that whenever it performs some action (the action for which this module is loaded), it first checks the configuration file for some parameters and then start its work. This might seem horribly slow, but there can be other workarounds, like ummmm, maybe periodically checking the configuration file, or may be only read the configuration file again if the file has been changed since the last timestamp
hope this helps!!!!:cool:
bwkaz
12-02-2002, 03:09 PM
You can't make modules work like cp in that respect.
Period.
When modules are loaded, they become part of the kernel. They are not another program, so they never get unloaded when they're "done" -- they're never "done". The user can unload them manually, but that's it.
What are you trying to do with a module that it needs the parameter later? Why can't you pass the parameter on the insmod (or modprobe) command line? Or as a option in /etc/modules.conf (option modulename params will do that -- run depmod -a after you change modules.conf, to avoid a warning) -- but to do that, you need to use modprobe rather than insmod.