That variable is not static, so in kernel space you should be able to simply writeliuwang said:Or how to refer "int hz" defined in subr_param.h in C?
extern int hz;
//'hz' is globally defined in /usr/src/sys/kern/subr_param.c
...
83 int hz;
...
//It is refered in /usr/src/sys/sys/kernel.h
...
61 extern int hz; /* system clock's frequency */
...
//And is refered in /usr/src/sys/netinet/cc/cc_cubic.h
...
74 extern int hz;
...
//But when it is refered in mycode.h
...
extern int hz;
...
//and in mycode.c
...
m = hz / 1000;
...
//It reports error:
...
mycode.c:54:5: error: "hz" is not defined
...
liuwang said:How to refer "kern.hz" in C