Re: Return value for "impossible" situations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 : bernd@xxxxxxxxxxxxxxxxxxx
     There is NO CLOUD, just other people's computers. - FSFE
                     LUGA : http://www.luga.at

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



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux