Messages in this thread | | | From | Andy Lutomirski <> | Date | Mon, 25 Aug 2014 11:38:28 -0700 | Subject | Re: [PATCH v2] checkpatch.pl: New instances of ENOSYS are errors |
| |
On Aug 25, 2014 3:29 AM, "Pavel Machek" <pavel@ucw.cz> 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
| |