lkml.org 
[lkml]   [1996]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: ioctls,verify_area,ENOTTY
Date
> I would like to bring to your attention that POSIX.1 expects
> certain errno values for certain situations. In the kernel source
>
> ENODEV is often used instead of ENXIO
> EINVAL is often used instead of ENOTTY

POSIX is broken.

> Here are quotes from POSIX.1 regarding the semantics:
>
> ENXIO (page 26):
> No such device or address
> Input or output on a special file referred to a device that did not
> exist, or made a request beyond the limits of the device. This
> error may also occur when, for example, a tape drive is not online
> or a disk pack is not loaded on a drive.
>
> ENODEV (page 25):
> No such device
> An attempt was made to apply an inappropriate function to a device;
> for example, trying to read a write-only device such as a printer.

"No such device" means there is no such device.

> ENOTTY (page 26):
> Inappropriate I/O control operation
> A control function was attempted for a file or a special file for
> which the operation was inappropriate.

If the operation is inappropriate, then EINVAL.

> EINVAL (page 25):
> Invalid argument
> Some invalid argument was supplied. [For example, specifying
> an undefined signal to a signal() or kill() function].
>
> In my point of view ENODEV has an unfortunate short description and
> is meant as 'this device exists, but is not such a type of device as
> would be necessary'.

Huh? It seems that "No such device" and "this device exists..."
are completely exclusive. They contradict each other!

> TODO:
> exchange get/put_user_long, etc. with get/put_user

No kidding. Ever notice memcpy_fromfs() and memcpy_tofs()?
They are relics from a time when Linux ran on the x86 only.
Hint: fs has _nothing_ to do with filesystem. That little gem
confused me for a year. Intel CPUs have an fs segment register.
It would be best to even get rid of the old #defines to make
sure to old code is truly gone.


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.030 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site