From: Mikael Pettersson <mikpe@it.uu.se>
To: Brian Beattie <beattie@beattie-home.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: ioctl's suck?
Date: Sun, 3 Aug 2008 03:18:28 +0200 [thread overview]
Message-ID: <18581.1892.930044.26645@harpo.it.uu.se> (raw)
In-Reply-To: <1217714096.6280.35.camel@kokopelli>
Brian Beattie writes:
> The other day Linus (I think) made the statement, that I don't disagree
> with, that I will parapharse as "ioctl's suck". If I recall correctly
> and understand he was saying that a device that uses ioctls is broken.
...
> I could add a control device and pass ascii strings for status and OOB
> messages, would that be an improvement?
The problem is that the classical unix I/O abstraction really only handles
two cases well, viz. "read next chunk of data" and "write this data and
advance position". Anything else is seen as something strange.
ioctls() are the equivalent of device-specific RPCs (remote procedure
calls): you present some arguments and a call code, and you get some
results. Nothing wrong with that.
In practice however there are some pitfalls. For instance, ioctls()
are often abused for quick hacks with little concern for backwards
compatibility. So when someone changes an ioctl, and breaks user-space,
who gets the blame? ioctls in general! I would argue that that is
why, and the main reason why, some people put ioctls() down.
There may be something wrong with people abusing ioctls, but that
is not a problem with ioctls per se. (I can easily design broken
ABIs around read()/write()/open()-only interfaces.)
next prev parent reply other threads:[~2008-08-03 1:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-02 21:54 Brian Beattie
2008-08-03 1:18 ` Mikael Pettersson [this message]
2008-08-03 12:56 ` Alan Cox
2008-08-03 17:04 ` Brian Beattie
[not found] <fa.pDV0CxkUWw00OFrnybFqbUSeaQA@ifi.uio.no>
2008-08-03 1:36 ` Robert Hancock
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18581.1892.930044.26645@harpo.it.uu.se \
--to=mikpe@it.uu.se \
--cc=beattie@beattie-home.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®