kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
To: Ian Pilcher <arequipeno@gmail.com>
Cc: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>,
	kernelnewbies@kernelnewbies.org
Subject: Re: Return value for "impossible" situations
Date: Mon, 26 Jul 2021 13:08:21 +0200	[thread overview]
Message-ID: <f63bdc71-c527-83d9-8aec-0dc61717491a@petrovitsch.priv.at> (raw)
In-Reply-To: <78e287df-7b88-6b3b-9ea6-d529f0707522@gmail.com>

On 26/07/2021 06:18, Ian Pilcher wrote:
> 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?

You handle the bug gracefully in the kernel and be done. Or return some
"good" errno value.
There is no "go look into dmesg output" error or even the need for it.

> (Obviously, there isn't an obvious one for this situation.  Thus my
> original question about whether there was any convention.  Sadly, it

There is no convention as these errors do not exist for userspace
applications - the typical person in front or the application can't do
anything about 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.)

The error in userspace is usually seen by mere users and not some
admin/root/kernel hacker so it makes no sense to bug them with it -
let alone look into dmesg output and try to learn something from it.

MfG,
	Bernd
-- 
Bernd Petrovitsch                  Email : bernd@petrovitsch.priv.at
     There is NO CLOUD, just other people's computers. - FSFE
                     LUGA : http://www.luga.at

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

      parent reply	other threads:[~2021-07-26 11:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-25 18:07 Return value for "impossible" situations Ian Pilcher
2021-07-25 18:59 ` Bernd Petrovitsch
2021-07-25 19:13   ` Ian Pilcher
2021-07-25 23:15 ` Valdis Klētnieks
2021-07-26  4:18   ` Ian Pilcher
2021-07-26 10:42     ` Bernd Petrovitsch
2021-07-26 11:08     ` Bernd Petrovitsch [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f63bdc71-c527-83d9-8aec-0dc61717491a@petrovitsch.priv.at \
    --to=bernd@petrovitsch.priv.at \
    --cc=arequipeno@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=valdis.kletnieks@vt.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).