From owner-freebsd-hackers Sun Sep 7 02:20:35 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id CAA10040 for hackers-outgoing; Sun, 7 Sep 1997 02:20:35 -0700 (PDT) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id CAA10020 for ; Sun, 7 Sep 1997 02:20:32 -0700 (PDT) Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id LAA15310 for freebsd-hackers@FreeBSD.ORG; Sun, 7 Sep 1997 11:20:30 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.8.7/8.8.5) id LAA06048; Sun, 7 Sep 1997 11:09:03 +0200 (MET DST) Message-ID: <19970907110903.WE07508@uriah.heep.sax.de> Date: Sun, 7 Sep 1997 11:09:03 +0200 From: j@uriah.heep.sax.de (J Wunsch) To: freebsd-hackers@FreeBSD.ORG Subject: Re: IOCTL Commands - Where is my mistake? References: <199709040519.PAA09446@ogre.dtir.qld.gov.au> X-Mailer: Mutt 0.60_p2-3,5,8-9 Mime-Version: 1.0 X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: ; from Simon Shapiro on Sep 4, 1997 01:29:00 -0700 Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk As Simon Shapiro wrote: > In SystemV, it would not have been luck, it would have been the way it > should be. One could argue that BSD's was of encoding three separate > arguments into one is not exactly a mark of engineering ellegance. Well, it offers two advantages: . It's failsafe. Change the size of the structure, and it will make it a different ioctl command. You can still support the old one if you want, if your kernel driver declares the old struct as `ofoo_ioctl_t'. Otherwise, an application will simply get an ENOTTY, as opposed to trashing arbitrary data in the kernel in the assumption the ioctl would be called from a matching userland program. . It concentrates the copyin/copyout at a single place, including all the EFAULT handling etc (that older SysV's IMHO didn't even provide for). When i first saw the BSD approach, i immediately thought: ``Hey, why hasn't it been this way all the time?'' The SysV approach where each driver does a boring copyin/copyout plain sucks. :) (...and is more prone to kernel programmer errors) -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)