* error value for "internal error" @ 2017-05-02 14:03 Miklos Szeredi [not found] ` <CAJfpegv3xS_MEVVeAnd4JUvjxoJd9PQdbsEzCPXNpUeex4SxHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Miklos Szeredi @ 2017-05-02 14:03 UTC (permalink / raw) To: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Linux API, Linus Torvalds 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. There's no "software error" or "internal error" type return code. Would it make sense to introduce one? Rule would be to always add more detail to dmesg (such as done by WARN_ON) when such a code is returned. Thanks, Miklos ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <CAJfpegv3xS_MEVVeAnd4JUvjxoJd9PQdbsEzCPXNpUeex4SxHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: error value for "internal error" [not found] ` <CAJfpegv3xS_MEVVeAnd4JUvjxoJd9PQdbsEzCPXNpUeex4SxHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-05-02 18:37 ` Linus Torvalds [not found] ` <CA+55aFxScO3nZPoj8HbHsyuwT1WA6BuT9Hi=A3AD+1LF3JsVCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Linus Torvalds @ 2017-05-02 18:37 UTC (permalink / raw) To: Miklos Szeredi; +Cc: Linux Kernel Mailing List, Linux API On Tue, May 2, 2017 at 7:03 AM, Miklos Szeredi <miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org> 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. (Ambiguous error numbers are much more annoying when something goes wrong, but you can't tell which of 48 different cases it was that triggered that error number). Linus ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <CA+55aFxScO3nZPoj8HbHsyuwT1WA6BuT9Hi=A3AD+1LF3JsVCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: error value for "internal error" [not found] ` <CA+55aFxScO3nZPoj8HbHsyuwT1WA6BuT9Hi=A3AD+1LF3JsVCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2017-05-03 9:10 ` Miklos Szeredi 0 siblings, 0 replies; 3+ messages in thread From: Miklos Szeredi @ 2017-05-03 9:10 UTC (permalink / raw) To: Linus Torvalds; +Cc: Linux Kernel Mailing List, Linux API On Tue, May 2, 2017 at 8:37 PM, Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> wrote: > On Tue, May 2, 2017 at 7:03 AM, Miklos Szeredi <miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org> 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-03 9:10 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-05-02 14:03 error value for "internal error" Miklos Szeredi [not found] ` <CAJfpegv3xS_MEVVeAnd4JUvjxoJd9PQdbsEzCPXNpUeex4SxHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2017-05-02 18:37 ` Linus Torvalds [not found] ` <CA+55aFxScO3nZPoj8HbHsyuwT1WA6BuT9Hi=A3AD+1LF3JsVCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2017-05-03 9:10 ` Miklos Szeredi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).