lkml.org 
[lkml]   [2005]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Use enum to declare errno values
Date
On Wednesday 23 November 2005 16:19, linux-os (Dick Johnson) wrote:
> > 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.

?!!

enum {
one,
two,
ten = 10
};

--
vda
-
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:27    [W:0.158 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site