Re: [PATCH v5 04/13] xen/pvcalls: implement socket command and handle events

From: Boris Ostrovsky
Date: Fri Oct 20 2017 - 10:23:01 EST


On 10/19/2017 09:26 PM, Stefano Stabellini wrote:
> On Tue, 17 Oct 2017, Boris Ostrovsky wrote:
>> On 10/06/2017 08:30 PM, Stefano Stabellini wrote:

>> with one question:
>>
>>> + /*
>>> + * PVCalls only supports domain AF_INET,
>>> + * type SOCK_STREAM and protocol 0 sockets for now.
>>> + *
>>> + * Check socket type here, AF_INET and protocol checks are done
>>> + * by the caller.
>>> + */
>>> + if (sock->type != SOCK_STREAM)
>>> + return -ENOTSUPP;
>>> +
>>
>>
>> Is this ENOTSUPP or EOPNOTSUPP? I didn't know the former even existed
>> and include/linux/errno.h suggests that this is NFSv3-specific.
>
> The PVCalls spec says that unimplemented commands return ENOTSUPP,
> defined as -524. I guess that is why I used ENOTSUPP, but, actually,
> this is the return value to the caller, which has nothing to do with the
> PVCalls protocol return value. In fact, it could be something entirely
> different.
>
> In this case, I think you are correct, it is best to use EOPNOTSUPP.
> I'll make the change and retain your Reviewed-by, if that's OK for you.
>

Of course.

This all is somewhat convoluted:

man errno:

ENOTSUP Operation not supported (POSIX.1)
EOPNOTSUPP Operation not supported on socket (POSIX.1)
(ENOTSUP and EOPNOTSUPP have the same value on Linux, but
according to POSIX.1 these error values should be
distinct.)

/usr/include/bits/errno.h:
/* Linux has no ENOTSUP error code. */
# define ENOTSUP EOPNOTSUPP


Linux kernel:
include/linux/errno.h:
/* Defined for the NFSv3 protocol */
...
#define ENOTSUPP 524 /* Operation is not supported */


include/uapi/asm-generic/errno.h:
#define EOPNOTSUPP 95 /* Operation not supported on transport
endpoint */


ENOTSUP is not generally defined in Linux kernel.


Clear as mud.


-boris