José Luis Tallón wrote:
> Yannick Lecaillez wrote:
>> Hi all,
>>
>> On Tue, Oct 03, 2006 at 10:19:30AM -0300, Avi Alkalay wrote:
>>   
>>> My proposition is to map Elektra error codes to POSIX error codes as
>>> much as possible in a coherent way, and to use error numbers greater
>>> than, say, 1000 for Elektra-specific errors.
>>>     
> Beware of such assumptions, Avi.

Indeed. Though I'm not 100% certain about the "supported" error codes, 
Linux is most definitely *not* POSIX. The likely outcome of such a 
mapping is that you will end up with incompatibilities, even on UNIXish 
systems simply because some error codes will exist on some systems and 
not on others.

>> Could you, please, point me main arguments for mapping elektra error
>> code to POSIX ? I never understood this point. Why not simply use our
>> own errno stored in the KDBHandle struct ?
>>   
> Two different matters, two answers:
> 
> * One, use POSIX errno values for Elektra errors: YES, since then the
> standard strerror() (possibly localized) can be used -- no need to waste
> effort here

Here's a solution to that problem:

Have a specific error code in Elektra (ELEKTRA_ERROR_SYSTEM) which means 
(tada!) "there was a system/libc error; look in errno". Heck, the errno 
value in question could even be added the the Elektra handle as an extra 
field, to avoid any risk of accidental contamination by subsequent 
system calls.

Even if we do map error codes to POSIX you're still going to need some 
kind of check at print-time to deal with Elektra-specific error codes, 
so it basically gives us absolutely _nothing_ over just using 
Elektra-specific error codes for every error "generated" by Elektra 
itself, and having a ELEKTRA_ERROR_SYSTEM to "announce" errors from 
system calls.

It's basically a non-issue.

> 
> * Two: use Elektra's own errno (stored in the 'handle') vs. the system's
> regular errno: so that system calls made inside Elektra won't mess with
> its error codes, so that the code is kept re-entrant as much as
> possible, so that everything is encapsulated, so that portability to
> say, Windows, is still feasible (errno is not writable on Win, since it
> is normally mapped to NT's GetLastError() )

While it's not sufficient for full reentrancy, errno is usually 
thread-local, meaning that it _is_ thread-safe to use errno. I've argued 
in support of a specific Elektra errno (at length IIRC) before... let's 
hope we get all the way to full reentrancy :).

Cheers,

-- 
Bardur Arantsson
<[EMAIL PROTECTED]>

Linux does not solve all the problems, but we are working on it.
                                                          Alan Cox


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Registry-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/registry-list

Reply via email to