lkml.org 
[lkml]   [2011]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectSeed /proc nodes before they are created
Dear kernel people,

I've been trying to come up with sensible ways to control the
settings exposed via procfs for years. I have tried everything
between sysctl, systune, writing values directly wit hooks, and even
using puppet to manage the "content" of the procfs "files".

Unfortunately, none of the solutions are satisfactory, really. If
I run sysctl during boot, it either runs too early (some modules not
yet loaded, or some interfaces not yet available) or too late
(networking already set up). Using hooks and manually writing procfs
nodes just feels like a hack and it's prone to errors, and puppet
is a nightmare — and only runs at intervals, so it leaves periods of
time in which the system might be in indeterminate states.

It occured to me that there might be a very simple solution to the
problem: couldn't I "pre-write" procfs (and sysfs) nodes, i.e.
create the nodes and write a value to them, and then, as soon as the
kernel learns about a setting, it uses the pre-written value to
initialise its internal representation of the value?

With this in place,

- I could enable forwarding on certain interfaces long before they
are brought up;

- I could set RTC parameters before the module is loaded on
demand;

- I could disable rp_filter and enable e.g. IPv6 autoconf on my
PPP interface before I start pppd;

etc.

Obviously, I could also abuse this to store arbitrary content in the
kernel memory space, but a creative root can do that anyway, and
a size limitation on individual nodes would limit this.

The implementation is probably not even too hard, since I am
assuming (but I do not know), that procfs nodes are somehow
centrally managed in the kernel.

What do people think about his idea?

--
martin | http://madduck.net/ | http://two.sentenc.es/

"menschen, welche rasch feuer fangen,
werden schnell kalt und sind daher im ganzen unzuverlässig."
- friedrich nietzsche

spamtraps: madduck.bogus@madduck.net
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2011-09-10 10:21    [W:0.027 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site