lkml.org 
[lkml]   [2005]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Use enum to declare errno values
Date
From

On Wed, 23 Nov 2005, moreau francis wrote:

> Hi,
>
> I'm just wondering why not declaring errno values using enumaration ?
> It is just more convenient when debuging the kernel.
>
> Thanks

There is an attempt to keep kernel errno values similar to
user-mode errno values. This simplifies the user-kernel
interface where the kernel will return -ERRNO and the user-mode
code negates it and puts it into the user errno then sets the
return value to -1 (a Unix convention).

The user-mode errno's therefore must correspond. You can't
expect the 'C' runtime libraries to be rebuilt and/or all the
programs recompiled just because the kernel got changed so
the errno's are hard-coded. 0 will always mean "no error" and
1 will always be EPERM, etc. There are error-codes that are
the same number also, EWOULDBLOCK and EAGAIN are examples.

So, you can't just auto-enumerate. If auto-enumeration isn't
possible, then you might just as well use #define, which is
what is done.


Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.55 BogoMips).
Warning : 98.36% of all statistics are fiction.
.

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-11-23 15:22    [W:0.358 / U:0.672 seconds]
©2003-2014 Jasper Spaans. Advertise on this site