Subject: Re: sysctl items defined at attach time
To: None <tech-kern@NetBSD.ORG>
From: der Mouse <mouse@Holo.Rodents.Montreal.QC.CA>
List: tech-kern
Date: 08/29/1996 11:31:02
> I'm interested in using sysctl to control some of the parameters of
> the mac's serial driver. I want to use sysctl to change a per-port
> parameter [...].
> [A]s far as I can tell, the sysctl program gets its name mib from
> grovveling in the sys include files.
I think that's right, at present.
> For items whose count is defined either at config time or at attach
> time, I don't see how sysctl could be used,
Well, sysctl(3) could probably be used, though sysctl(1) might need
some work. All you'd need to do would be to have one variable which
says, say, how many tty lines there are, so that (to put it into
strings instead of the small integers sysctl(3) uses), you'd have
kern.tty.count = 6 # six serial ports on this machine
kern.tty.line.1.name = ttya # first line is ttya
kern.tty.line.1.flow-type = ... # flow control setting, ttya
kern.tty.line.2.name = ttyb # second line is ttyb
kern.tty.line.2.flow-type = ... # flow control setting, ttyb
kern.tty.line.3.name = tty00 # third serial line: extra card, port 0
kern.tty.line.3.flow-type = ... # flow control setting, tty00
where the numbers might be something like
kern.tty.count = 1.29.1
kern.tty.line.1.name = 1.29.2.1.1
kern.tty.line.1.flow-type = 1.29.2.1.2
kern.tty.line.2.name = 1.29.2.2.1
...etc...
It might be desirable for sysctl(1) to present an interface more like
kern.tty.ttya.flow-type
kern.tty.ttyb.flow-type
kern.tty.tty00.flow-type
though I don't know what the reaction to having sysctl(1)'s interface
differ that much from the underlying sysctl(3)'s interface might be.
This is really a reason for, as someone else suggested, putting sysctl
into kernfs, so you can
cat /kern/sysctl/tty/ttya/flow-type
or
echo rtscts > /kern/sysctl/tty/tty00/flow-type
But then, I'm a wild-eyed dreamer. :-) (One reason I really want to
see sysctl moved into kernfs is that it eliminates one of the
proliferating namespaces. Used to be everything was a file - except
processes, which had a different namespace (process IDs). Then sockets
came along and introduced another namespace. And sysctl. And shmids.
And message queues...I'd really like to see these merged back into the
filesystem namespace, if only so that chroot() can cut them off. /proc
moves processes back into the filesystem; kernfs has promise for moving
sysctl there.
der Mouse
mouse@collatz.mcrcim.mcgill.edu
01 EE 31 F6 BB 0C 34 36 00 F3 7C 5A C1 A0 67 1D