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

  • From: Jérôme Duval <korli@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 3 Mar 2011 10:44:51 +0100

2011/3/2 Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>:
> 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.

Well I wasn't sure too. These error codes look the same for me, some
are a bit more specific to the hook like B_DEV_INVALID_IOCTL.
B_NOT_SUPPORTED is more generic.
We can well assume the same meaning for both.

>> +     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?

Well I asked, and Ingo suggested to keep this mapping in the kernel
because ioctl() can be called kernel side too.

> Also, POSIX fcntl() states: returns EINVAL if "cmd" is invalid (the
> same is true for setsockopt(), btw).

I wasn't aware of these uses of ioctl().

> 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?

It's possible to do this in fact. ioctl() can also be used kernel land though.


Other related posts: