diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2011-07-09 16:42:26 +0200 |
---|---|---|
committer | Jonas ABERG <jonas.aberg@stericsson.com> | 2011-10-28 11:07:35 +0200 |
commit | 57f940efb37ed42262b3511e34cf45e9c7cb7a98 (patch) | |
tree | 360fbbd3e3587adb5da1a8f911e4f8457b2a315c /kernel/res_counter.c | |
parent | bfc1b635030ec7fd1845a59b1a9b0cb16ab4dd55 (diff) |
firewire: cdev: return -ENOTTY for unimplemented ioctls, not -EINVAL
commit d873d794235efa590ab3c94d5ee22bb1fab19ac4 upstream.
On Jun 27 Linus Torvalds wrote:
> The correct error code for "I don't understand this ioctl" is ENOTTY.
> The naming may be odd, but you should think of that error value as a
> "unrecognized ioctl number, you're feeding me random numbers that I
> don't understand and I assume for historical reasons that you tried to
> do some tty operation on me".
[...]
> The EINVAL thing goes way back, and is a disaster. It predates Linux
> itself, as far as I can tell. You'll find lots of man-pages that have
> this line in it:
>
> EINVAL Request or argp is not valid.
>
> and it shows up in POSIX etc. And sadly, it generally shows up
> _before_ the line that says
>
> ENOTTY The specified request does not apply to the kind of object
> that the descriptor d references.
>
> so a lot of people get to the EINVAL, and never even notice the ENOTTY.
[...]
> At least glibc (and hopefully other C libraries) use a _string_ that
> makes much more sense: strerror(ENOTTY) is "Inappropriate ioctl for
> device"
So let's correct this in the <linux/firewire-cdev.h> ABI while it is
still young, relative to distributor adoption.
Side note: We return -ENOTTY not only on _IOC_TYPE or _IOC_NR mismatch,
but also on _IOC_SIZE mismatch. An ioctl with an unsupported size of
argument structure can be seen as an unsupported version of that ioctl.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Change-Id: I9f0f4399a939bae2d5127ad5f76461660b711619
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/35608
Tested-by: Per VAHLNE <per.xx.vahlne@stericsson.com>
Reviewed-by: QABUILD
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'kernel/res_counter.c')
0 files changed, 0 insertions, 0 deletions