LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (http://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   add custom sysctl key (http://www.linuxquestions.org/questions/linux-kernel-70/add-custom-sysctl-key-681308/)

ibaniski 11-05-2008 11:16 AM

add custom sysctl key
 
Hi.

I am writing a module, and I need an easy way to set parameters to it. Using sysctl seems to be an easy and convenient way of doing ti. The only problem: I can't do it :).

Say I want to add a length parameter to /proc/sys/net/mymod/length of value 10. When I execute
PHP Code:

sysctl -w net.mymod.length=10 

I get the following error "net.mymod.length is an unknown key".

So my question is whether it is at all possible to use sysctl to set certain parameters for my module? If so, what do I have to do to create a custom key? If not, what would be a good alternative?

Thanks,
i.b.

unSpawn 11-09-2008 05:24 AM

Quote:

Originally Posted by ibaniski (Post 3332504)
possible to use sysctl to set certain parameters for my module? If so, what do I have to do to create a custom key?

Basically just research. With that I mean that if you take one known sysctl key, say DEV_SCSI_LOGGING_LEVEL and follow where it gets referenced in the kernel you should get the idea. It's not like there's no LKM's that use sysctl to accept values. First external one comes to mind that introduces its own sysctl values is the Wireless Tools but there's hundreds you could take as example.


All times are GMT -5. The time now is 01:23 AM.