Thread: Win32 Error descriptions + config

Win32 Error descriptions + config

From
"Magnus Naeslund(f)"
Date:
Hello!

I'm at the win32 error messages once more.
The DLL load thingy doesn't work on all win9x machines, so i made it go thru a lookup table instead, using the DLL as
lastresort. 
 
I also moved this out of the fe-misc.c file because of the size of the lookup table.
Who knows, we might add more other win32 specific code there in the future.

I also fixed a small typo in the pg_config.h.win32 that made the compiler complain about the gnu snprintf declaration.

I tried to make this patch with psql coding style.
I've successfully tested this on win2k and win98 and it works fine (i.e. the message shows on win98 too, it didn't with
theold implementation).
 

Let me know if there's anything you want me to change or if you won't accept the patch for any reason.

Regards

Magnus Naeslund

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Programmer/Networker [|] Magnus Naeslund
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Attachment

Re: Win32 Error descriptions + config

From
Tom Lane
Date:
"Magnus Naeslund(f)" <mag@fbab.net> writes:
> The DLL load thingy doesn't work on all win9x machines, so i made it go thru a lookup table instead, using the DLL as
lastresort.  

Is Windows really so lame that this information is not available from
the system?  I do not like having to maintain our own error-message
list.

            regards, tom lane

Re: Win32 Error descriptions + config

From
"Magnus Naeslund(f)"
Date:
From: "Tom Lane" <tgl@sss.pgh.pa.us>
> "Magnus Naeslund(f)" <mag@fbab.net> writes:
> > The DLL load thingy doesn't work on all win9x machines, so i made it go thru a lookup table instead, using the DLL
aslast resort. 
 
> 
> Is Windows really so lame that this information is not available from
> the system?  I do not like having to maintain our own error-message
> list.
> 
> regards, tom lane
> 

Sorry to say, yes.
The thing here is that if you build it on Win2k (as we do with our app(s)) and all is fine there, it will not work on
win9x,returning a "Unknown socket error (0xNUMBER)" message (with our old code) because the DLL thing fails, and that's
MUCHworse.
 
My rationale here is: This list is up-to-date with nt4 and if m$ add anything after that (win2k, XP) the DLL load thing
willcatch that.
 
It's a minor optimization even to just linearly scan the LUT compared to load a DLL (yeah i know it doesn't matter
:)).

It's very common in the Microsoft world that they mess up the first releases of a API, and the after makes it "right",
butthen it's too late.
 
Often you can check the version of the kernel/system but not in this case.
I've looked around quite a lot, and would be a darn happy penguin if anyone could prove me wrong.

Cheers

Magnus Naeslund

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Programmer/Networker [|] Magnus Naeslund
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Re: Win32 Error descriptions + config

From
"Magnus Naeslund(f)"
Date:
Just checking,
will my patch be applied, and if not, why?

Magnus

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Programmer/Networker [|] Magnus Naeslund
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


Re: Win32 Error descriptions + config

From
Bruce Momjian
Date:
Magnus Naeslund(f) wrote:
> Just checking,
> will my patch be applied, and if not, why?

I am working my way through my email backlog to your patch.  I hope to
get there tonight.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Win32 Error descriptions + config

From
Bruce Momjian
Date:
Your patch has been added to the PostgreSQL unapplied patches list at:

    http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Magnus Naeslund(f) wrote:
> Hello!
>
> I'm at the win32 error messages once more.
> The DLL load thingy doesn't work on all win9x machines, so i made it go thru a lookup table instead, using the DLL as
lastresort.  
> I also moved this out of the fe-misc.c file because of the size of the lookup table.
> Who knows, we might add more other win32 specific code there in the future.
>
> I also fixed a small typo in the pg_config.h.win32 that made the compiler complain about the gnu snprintf
declaration.
>
> I tried to make this patch with psql coding style.
> I've successfully tested this on win2k and win98 and it works fine (i.e. the message shows on win98 too, it didn't
withthe old implementation). 
>
> Let me know if there's anything you want me to change or if you won't accept the patch for any reason.
>
> Regards
>
> Magnus Naeslund
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>  Programmer/Networker [|] Magnus Naeslund
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Win32 Error descriptions + config

From
Bruce Momjian
Date:
Patch applied.  Thanks.

---------------------------------------------------------------------------


Magnus Naeslund(f) wrote:
> Hello!
>
> I'm at the win32 error messages once more.  The DLL load thingy
> doesn't work on all win9x machines, so i made it go thru a lookup
> table instead, using the DLL as last resort.  I also moved this
> out of the fe-misc.c file because of the size of the lookup
> table.  Who knows, we might add more other win32 specific code
> there in the future.
>
> I also fixed a small typo in the pg_config.h.win32 that made
> the compiler complain about the gnu snprintf declaration.
>
> I tried to make this patch with psql coding style.  I've
> successfully tested this on win2k and win98 and it works fine
> (i.e. the message shows on win98 too, it didn't with the old
> implementation).
>
> Let me know if there's anything you want me to change or if you
> won't accept the patch for any reason.
>
> Regards
>
> Magnus Naeslund
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>  Programmer/Networker [|] Magnus Naeslund
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026