bug-gnulib
[Top][All Lists]
Advanced

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

Re: Error handling in Win32 + gnulib


From: Paolo Bonzini
Subject: Re: Error handling in Win32 + gnulib
Date: Sat, 28 Nov 2009 09:49:38 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20090922 Fedora/3.0-3.9.b4.fc12 Lightning/1.0pre Thunderbird/3.0b4

On 11/27/2009 04:57 PM, Richard W.M. Jones wrote:
(b) A call to a Winsock socket function that gnulib hasn't replaced:
errno won't have any meaningful value and I must call WSAGetLastError.

We can add replacements for these.

(c) A call to a non-socket Win32 function that gnulib has replaced: I
have to go and check Gnulib to see if it sets errno (some do, some
don't, some do only along some paths).  I need to then consider errno
and/or GetLastError.  I have to keep checking this with every revision
of Gnulib because it might change.

These are bugs, please report them.

In addition, it turns out that error codes aren't compatible.
Although Gnulib tries to define its own error numbers which are
compatible with Win32 ones (eg. EINPROGRESS == 10036 ==
WSAEINPROGRESS), it also uses some from the MinGW header files which
are just plain wrong (eg. ENOMEM == 12 == ERROR_INVALID_ACCESS, MinGW
gets this wrong, it should be ENOMEM 14 == ERROR_OUTOFMEMORY).

These errno numbers of the second kind are compatible with Unix error codes, not with Win32 error codes. The socket ones were recycled just because Microsoft defined them to 10000 + the Unix error code, so it simplifies set_winsock_errno (I think I had even done WSAGetLastError () - 10000 in the first version but Bruno didn't like that).

Paolo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]