From owner-cvs-all Mon Nov 15 2:27: 3 1999 Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id BBB9414C15; Mon, 15 Nov 1999 02:26:54 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from p70-ts5.syd2.zeta.org.au (beefcake.zeta.org.au [203.26.10.12]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id VAA07165; Mon, 15 Nov 1999 21:32:39 +1100 Date: Mon, 15 Nov 1999 21:25:59 +1100 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Mark Murray Cc: Peter Wemm , Garrett Wollman , Kazutaka YOKOTA , 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 In-Reply-To: <199911150828.KAA32612@gratis.grondar.za> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk > > > 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