Return value for "impossible" situations
arequipeno at gmail.com
Mon Jul 26 00:18:01 EDT 2021
On 7/25/21 6:15 PM, Valdis Klētnieks wrote:
> The *proper* thing to do is, instead of deciding to return -EHIT_A_BUG, do a
> WARN(), or BUG(), so that the dmesg has something that's at least potentially
> useful. Then use that information to fix the issue.
The question is, after the WARN_ON, what code does one return to user-
space? What is the "kernel bug; go look at dmesg" return value?
(Obviously, there isn't an obvious one for this situation. Thus my
original question about whether there was any convention. Sadly, it
seems that there really isn't one, which means that I'm basically forced
to return a garbage error code that is likely to confuse a system
administrator or cause them to waste time chasing the wrong issue.)
In Soviet Russia, Google searches you!
More information about the Kernelnewbies