Re: sed not working on /proc files

Stephen C. Tweedie (sct@redhat.com)
Tue, 4 May 1999 21:22:56 +0100 (BST)


Hi,

On Tue, 4 May 1999 17:43:22 +0200, Andi Kleen <ak@muc.de> said:

> What sysctl doesn't do (yet) is to manage dynamic lists of things (like
> sockets). If that could be added I believe most of /proc/net could be
> moved to sysctls, with the old /proc/net generated by a table driven
> compatibility layer.

I wrote sysctl in a way which deliberately left the door open for that
sort of thing. It has been munged mightily since then, but the basic
mechanism is still there --- each parse of one part of the sysctl name
is passed a "void **context". The context is initially NULL, but any
part of the parsing can set up the context to point to a locally
allocated data structure which records the results of the parsing to
date.

For example, you might have a sysctl [SYS_PROC, SYS_PID, pid,
SYS_STATUS], and the parsing of the <pid> element could use the context
to record which pid we are talking about. The parser which selects the
process by pid does not have to know which interrogation sysctls are in
use below that: we could have open-file queries, mem-map queries or
general status queries within the [PROC,PID,pid] namespace using the
same pid parser; we could also have different selectors like
[PROC,UID,uid] which select processes based on different criteria but
which have the same queries underneath.

--Stephen

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/