Re: [HACKERS] Re: WIN32 errno patch

From: Mikhail Terekhov <terekhov(at)emc(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [HACKERS] Re: WIN32 errno patch
Date: 2001-08-17 18:51:59
Message-ID: 3B7D67CF.37578368@emc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers pgsql-patches

Tom Lane wrote:
>
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > I will try to apply it within the next 48 hours.
>
> This isn't the right patch to apply, since Mikhail didn't fix the
> strerror problem. I have some code from Magnus Naeslund that purports
> to handle the strerror issue, and will work it up into a patch real soon
> now.
>
> >> I've implemented the SOCK_ERRNO macro only because
> >> both strerror and FormatMessage functions know nothing
> >> about sockets errors.
>
> FWIW, Magnus says this works:
>
> #define SOCK_STRERROR my_sock_strerror
>
> const char* my_sock_strerror(unsigned long eno){
> static char buf[512]; // i know, not threadsafe
> if (!FormatMessage(
> FORMAT_MESSAGE_FROM_SYSTEM |
> FORMAT_MESSAGE_IGNORE_INSERTS,
> 0,eno,
> MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
> buf,sizeof(buf)-1,
> 0
> )){
> sprintf(buf,"Unknown socket error(%u)",eno);
> }
> buf[sizeof(buf)-1]='\0';
> return buf;
> }
>
> Anyone have any objections to it?
>

On my system (NT4 sp.6, VC6.0) the FormatMessage function always
returns 0 for errno in the [10000 - 10100] range (winsock errors).
That's why i've wrote that this function knows nothing about
sockets errors. Using this function looks very impressive but the
net result is null. If Magnus could get some meaningfull messages
for winsock errors from FormatMessage I'd be glad to know what is
missing from my setup.

Regards,
Mikhail Terekhov

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Mikhail Terekhov 2001-08-17 19:21:48 Re: [HACKERS] Re: WIN32 errno patch
Previous Message Marc G. Fournier 2001-08-17 17:10:17 pgsql/ChangeLogs Tag: REL7_1_STABLE ChangeLog- ...

Browse pgsql-hackers by date

  From Date Subject
Next Message Mikhail Terekhov 2001-08-17 19:21:48 Re: [HACKERS] Re: WIN32 errno patch
Previous Message Mikheev, Vadim 2001-08-17 18:48:49 User locks code

Browse pgsql-patches by date

  From Date Subject
Next Message Mikhail Terekhov 2001-08-17 19:21:48 Re: [HACKERS] Re: WIN32 errno patch
Previous Message Barry Lind 2001-08-17 17:37:18 Re: encoding names