lkml.org 
[lkml]   [1998]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Some ideas for the kernel wishlist
From
Date
Ulrich Drepper <drepper@cygnus.com> writes:

> 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

\
 
 \ /
  Last update: 2005-03-22 13:42    [W:0.070 / U:0.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site