lkml.org 
[lkml]   [2008]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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.)


\
 
 \ /
  Last update: 2008-08-03 03:21    [W:0.030 / U:0.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site