Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1634824

Re: error value for "internal error"

From Miklos Szeredi <miklos@szeredi.hu>
Newsgroups linux.kernel
Subject Re: error value for "internal error"
Date 2017-05-03 11:20 +0200
Message-ID <tCYBY-3bN-25@gated-at.bofh.it> (permalink)
References <tCGF3-7GU-7@gated-at.bofh.it> <tCKSm-1R1-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, May 2, 2017 at 8:37 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Tue, May 2, 2017 at 7:03 AM, Miklos Szeredi <miklos@szeredi.hu> wrote:
>> I've been wondering what to return for soft asserts like this:
>>
>>         if (WARN_ON(something unexpected))
>>                 return -E????;
>>
>> EINVAL doesn't fit because it means the input from userspace was
>> wrong.  EIO means something went bad with the hardware.
>
> I think we've traditionally just used EIO for "something went wrong".
> It's not necessarily hardware that went wrong.
>
> That's particularly true when there is a WARN_ON() that then gives
> more details of where this actually happened in the system logs - at
> that point the error number really doesn't matter all that much.

Still, wouldn't it make sense to differentiate between

 a) something went wrong with the hardware

 b) the kernel is buggy

which are completely different things?

The only reason to use a traditional errno like EIO, is that userspace
may be able to handle it instead of just throwing up its hands and
exiting.   In case of a kernel internal error, it's unlikely that
userspace will be able to work around it, while hardware errors are
more promising.  But maybe I'm wrong about this one...

Thanks,
Miklos

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

error value for "internal error" Miklos Szeredi <miklos@szeredi.hu> - 2017-05-02 16:10 +0200
  Re: error value for "internal error" Linus Torvalds <torvalds@linux-foundation.org> - 2017-05-02 20:40 +0200
    Re: error value for "internal error" Miklos Szeredi <miklos@szeredi.hu> - 2017-05-03 11:20 +0200

csiph-web