I can not find online detailed steps on how to add a system variable, so I tried to improvise and I stuck.
I'll add my detailed steps, for future reference
Step1:
open /sys/sys/sysctl.h and add the following lines
and in the define CTL_USER_NAMES section of the same file I add the following line
(added that coma and backslash just to follow the existent pattern)
Step2:
open /usr/src/sys/kern/kern_mib.c and add the following line:
Step3:
Recompile the kernel
Step4:
write the following on the command line
and in the output I can not find just added variable
I took already existent variable from the "USER" parent node and checked what files contain it and based on this I tried to do for a new variable. I have a feeling that the index from the Step1 which is 20 has to be included somewhere.
Can anyone point me at my mistake or indicate what step I am missing.
Thank you
I'll add my detailed steps, for future reference
Step1:
open /sys/sys/sysctl.h and add the following lines
Code:
#define USER_TEST_VAR 22 /*test var*/
and in the define CTL_USER_NAMES section of the same file I add the following line
Code:
{ "test_var", CTLTYPE_INT }, \
Step2:
open /usr/src/sys/kern/kern_mib.c and add the following line:
Code:
SYSCTL_INT(_user, USER_TEST_VAR, test_var, CTLFLAG_RD, 0, 0, "test Var");
Step3:
Recompile the kernel
Step4:
write the following on the command line
Code:
sysctl -A
I took already existent variable from the "USER" parent node and checked what files contain it and based on this I tried to do for a new variable. I have a feeling that the index from the Step1 which is 20 has to be included somewhere.
Can anyone point me at my mistake or indicate what step I am missing.
Thank you