Date: Mon, 15 Nov 1999 21:25:59 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Mark Murray <mark@grondar.za> Cc: Peter Wemm <peter@netplex.com.au>, Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, Kazutaka YOKOTA <yokota@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/syscons scmouse.c src/sys/i386/conf options.i386 src/sys/alpha/conf options.alpha Message-ID: <Pine.BSF.4.10.9911152043350.24876-100000@alphplex.bde.org> In-Reply-To: <199911150828.KAA32612@gratis.grondar.za>
next in thread | previous in thread | raw e-mail | index | archive | help
> > > I would think a sysctl option would be better still as that's easily > > > changed at runtime.. > > > > This should be an ioctl. > > Yukk! "ioctls are the garbage cans of system calls" - Kirk McKusick On the same scale, sysctls are the sewers of system calls :-). > > sysctl(8) and sysctlbyname(3) are not suitable for device control since > > the interface that makes them easy to use for one-off things makes them > > hard to use for arrays of things. > > In order to use an ioctl, you need to write nasty looking code, and in Similarly for sysctls, except the code is so much nastier that we have a special program to support them in userland and special macros to hide the details in the kernel. > cases like this, that ends up being horrors like rndcontrol(8). One > of the nice things about UNIX is its extremely general-purpose tools, > and these one-off ioctl-drivers break that. What's horrible about it? $ rndcontrol rndcontrol: interrupts in use: 11 $ rndcontrol -s 14 rndcontrol: setting irq 14 rndcontrol: interrupts in use: 11 14 is preferable to: $ sysctl dev.random.irqs 0x2000 $ sysctl -w $(($((1 << 14)) | $(sysctl -n dev.random.irqs))) 0x6000 except for its misspelling of "rand" as "rnd". Sysctls are more natural for devices like /dev/random that only have one minor, but one of the nice things about unix is that all devices are controlled in the same way :-). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9911152043350.24876-100000>