lkml.org 
[lkml]   [2011]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: 2.6.36/2.6.37: broken compatibility with userspace input-utils ?
On Wed, Jan 26, 2011 at 7:01 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> BTW, another issue is that evdev's ioctl returns -EINVAL for unknown
> ioctls so applications would have hard time figuring out whether error
> returned because of kernel being too old or because they are trying to
> retrieve/establish invalid mapping if they had to go only by the error
> code.

So that's just another evdev interface bug.

> As far as I can see EINVAL is a proper error for unknown ioctls:
>
> [dtor@hammer work]$ man 2 ioctl | grep EINVAL
>       EINVAL Request or argp is not valid.

Yeah, there's some confusion there.

The "unknown ioctl" error code is (for traditional reasons) ENOTTY,
but yes, the EINVAL thing admittedly has a lot of legacy use too.

Inside the kernel, the preferred way to say "I don't recognize that
ioctl number" is actually ENOIOCTLCMD. That's exactly so that various
nested ioctl handlers can then tell the difference between "I didn't
recognize that ioctl" and "I understand what you asked me to do, but
your arguments were crap".

vfs_ioctl() will then turn ENOIOCTLCMD to EINVAL to return to user space.

Linus
--
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/

\
 
 \ /
  Last update: 2011-01-25 22:23    [W:1.979 / U:0.448 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site