> Martin Mares <mj@atrey.karlin.mff.cuni.cz> writes:
>
> > Making it a sysctl is not good as lots of constants would become
> > variables. On the other hand, changing HZ and just re-compiling
> > the kernel should be sufficient.
>
> But then there must be a sysctl to obtain the currently selected
> value. So far, the libc has to guess and uses a constant value.
Just make the sysctl read-only, and use the variable only for the sysctl
interface (and the constant in the rest of the code).
Something like:
#include <linux/sysctl.h>
const int hz_const = HZ;
struct ctl_table cnt_tbl[] = {
{ KCONST_HZ, "hz", &hz_const, sizeof(int), 0555 },
{ 0 }
};
struct ctl_table const_table[] = {
{ KERN_CONST, "constants", NULL, 0, 0555, cnt_tbl },
{0}
};
... init ...
register_proc_table(const_table, &proc_sys_root);
-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu