>>>> (BTW, there was some discussion around this point while
>you were gone.
>>>> Dunno if you've caught up on the list traffic yet.)
>> Ok. I think I'm caught up now, and I don't find anything directly
>> related to this. Could be because there was so much mail
>that I skimmed
>> some of it a bit too quickly... Could you provide me with a pointer?
>It took some digging, but here is the thread I had in mind:
>Life does get simpler if we can just do "errno = GetLastError()" but
>I strongly suspect we're gonna end up wanting to do some mapping.
Arrgh. I did see that one, just didn't connect. I guess the brain gets
mushy after about 2500 mails.. Sorry about that one.
Looking around a bit on the net, I see tons and tons of examples of
people just doing the "errno=GetLastError()" codepath. And I find no
evidence anywhere that this should not be safe. For winsock, look at for
states "For compatibility with BSD, an application may choose to include
a line of the form: #define errno WSAGetLastError". And
WSAGetLastError() is equivalent to GetLastError() in any windows these
Based on this, I think we're quite safe doing errno=GetLastError() in
any places where we need it.
What we might need to do is change the useful_strerror() function to use
the FormatMessage function for all messages on win32, and not as now is
done just for winsock functions. I'm not 100% sure this is needed - it's
possible it handles all the standard messages and just not winsock. But
it should not report *incorrect* error messages, it would just not know
the text for the error message.
In order to be future safe we ight want to do something like put a macro
in win32.h doing
#define Win32ErrorToErrno(i) i
and then use
In case we ever need a mapping, we can just change that macro into a
function call, without needing to revisit all the code. Not sure if it's
worth it, though?
pgsql-hackers-win32 by date
|Next:||From: Tom Lane||Date: 2004-08-16 22:32:07|
|Subject: Re: REPOST: InitDB Failure on install |
|Previous:||From: Bruce Momjian||Date: 2004-08-16 19:44:27|
|Subject: Re: our friend the win32 system timer.|