Re: [PATCH] livepatch: core: Return ENOTSUPP instead of ENOSYS

From: Josh Poimboeuf
Date: Wed Jan 30 2019 - 08:10:59 EST


On Wed, Jan 30, 2019 at 01:41:56PM +0100, Petr Mladek wrote:
> Hmm, the error code is passed to the syscall, for example:
>
> + SYSCALL_DEFINE3(init_module
> + load_module()
> + do_init_module()
> + do_one_initcall(mod->init);
>
> I am not sure if we are allowed to return -ENOTSUPP (-524).
> It is defined in the internal include/linux/errno.h. There
> is the following commnent:
>
> /*
> * These should never be seen by user programs...
>
>
>
> I tried to find a better alternative and found:
>
> #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
>
>
> There is the following note in 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.)
>
> And it looks that -EOPNOTSUPP is used widely in many subsystes (not
> only network).

Yes, you are right. It's confusing that ENOTSUPP and ENOTSUP are not
the same thing. EOPNOTSUPP sounds good.

--
Josh