[haiku-commits] Re: r40787 - haiku/trunk/src/system/kernel/fs

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 02 Mar 2011 23:39:32 +0100

korli@xxxxxxxxxxxxxxxx wrote:
> +++ haiku/trunk/src/system/kernel/fs/fd.cpp   2011-03-02 18:58:14 UTC 
> (rev 40787)
> @@ -518,8 +518,11 @@
>       if (descriptor->ops->fd_ioctl)
>               status = descriptor->ops->fd_ioctl(descriptor, op, buffer, 
> length);
>       else
> -             status = B_NOT_SUPPORTED;
> +             status = B_DEV_INVALID_IOCTL;

Not sure this should be replaced, too. At least I think it's not so 
nice to lose the expressiveness of our error codes because of some 
poorly documented POSIX functions.

> +     if (status == B_DEV_INVALID_IOCTL)
> +             status = ENOTTY;

Isn't that a bit too central? Where is the difference to returning 
ENOTTY directly this way?
Also, POSIX fcntl() states: returns EINVAL if "cmd" is invalid (the 
same is true for setsockopt(), btw).
The POSIX definition of ioctl() is rather useless, I'm afraid, but also 
states EINVAL for this error case. And since we don't differentiate 
between ioctl/fcntl on that level, maybe we should move the error code 
to libroot instead?

Bye,
   Axel.


Other related posts: