[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <18581.1892.930044.26645@harpo.it.uu.se>
Date: Sun, 3 Aug 2008 03:18:28 +0200
From: Mikael Pettersson <mikpe@...uu.se>
To: Brian Beattie <beattie@...ttie-home.net>
Cc: linux-kernel@...r.kernel.org
Subject: Re: ioctl's suck?
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.)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists