Hi all!

On 25/07/2021 20:07, Ian Pilcher wrote:
[...]
> For kernel code, I can use pr_err, dump_stack, WARN_ON, etc. to report
> the issue in the log, but I often also need to return some sort of error
> code (negative errno value).

This value goes up to userspace (otherwise it makes no real sense to use
errno-values).

> Is there any sort of convention around what to return in the case of an
> error in the logic of the code itself, something that will make it as
> obvious as possible that the problem is a bug.

That depends on the situation/sys-call/....
You habe to choose the value (the list and short explanation is in `man
errno`) which leads the userspace application and it's user in the best
direction.
And no, you can't invent new values.

MfG,
        Bernd
-- 
Bernd Petrovitsch                  Email : [email protected]
     There is NO CLOUD, just other people's computers. - FSFE
                     LUGA : http://www.luga.at

_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to