Skip site navigation (1)Skip section navigation (2)
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?
Message-ID:  <19970907110903.WE07508@uriah.heep.sax.de>
In-Reply-To: <XFMail.970904012900.Shimon@i-Connect.Net>; from Simon Shapiro on Sep 4, 1997 01:29:00 -0700
References:  <199709040519.PAA09446@ogre.dtir.qld.gov.au> <XFMail.970904012900.Shimon@i-Connect.Net>

next in thread | previous in thread | raw e-mail | index | archive | help
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. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970907110903.WE07508>