Re: Not a typewriter
Jonathan Lundell (jlundell@pobox.com)
Thu, 10 May 2001 19:01:16 -0700
At 8:07 PM -0400 2001-05-10, Alexander Viro wrote:
>On Thu, 10 May 2001, Jonathan Lundell wrote:
>
>> ENOTTY is used by several non-serial devices (or file systems) to
>> object to an unrecognized ioctl command. There's also ENOIOCTLCMD
>> (apparently supposed to be a non-user errno, but i don't see where it
>> gets changed to something else) and EINVAL. I'm not sure what the
>> rationale is for choosing among them; perhaps someone would elucidate?
>
>ENOIOCTLCMD is something I've never met in the kernel. Normal reaction
>to unrecognized ioctl() is ENOTTY, for a lot of reasons, starting with
>the fact that ioctls are last-ditch API to be used when you just can't
>think of better one and historically TTY had the earliest (and largest)
>infestation. IOW, "not a tty" used to mean "WTF are you using ioctls here?"
>OTOH, EINVAL is a catch-all thing for "something is wrong with arguments".
That's pretty much what I would have said a couple of hours ago
before grepping the kernel. Try it, though. ENOTTY is rarely used.
ENOIOCTLCMD is all over the damned place, though its comment in
errno.h warns that a user shouldn't see it. And if you browse a bunch
of random ioctl handlers, you'll see EINVAL used for a bad command
much more often than ENOTTY.
FWIW, the comment in errno.h under Solaris 2.6 is "Inappropriate
ioctl for device". I believe that's the POSIX interpretation.
--
/Jonathan Lundell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/