On Aug 25, 2014 3:29 AM, "Pavel Machek" <[email protected]> wrote:
>
> On Fri 2014-08-22 09:26:31, Andy Lutomirski wrote:
> > ENOSYS means that a nonexistent system call was called.  We have a
> > bad habit of using it for things like invalid operations on
> > otherwise valid syscalls.  We should avoid this in new code.
>
> Is it good idea? I mean, doing EINVAL for subcalls is pretty
> unhelpful.

EOPNOTSUPP?

The problem is that user code wants to do:

bool foo_wrapper(int op)
{
  if (foo_not_supported)
    return false

  if (foo(op) != 0) {
    if (errno == ENOSYS)
      foo_not_supported = true;
    return false;
  }

  return true;
}

foo_wrapper(FOO_OP_A);
foo_wrapper(FOO_OP_B);

If FOO_OP_A returns -ENOSYS but FOO_OP_B does not, then this doesn't work.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to