Win32 Error descriptions + config

Started by Magnus Naeslund(f)over 24 years ago7 messagespatches
Jump to latest

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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Attachments:

pgsql.win32.winsockerr.1.diffapplication/octet-stream; name=pgsql.win32.winsockerr.1.diffDownload+187-49
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Naeslund(f) (#1)
Re: Win32 Error descriptions + config

"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 last 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

In reply to: Magnus Naeslund(f) (#1)
Re: Win32 Error descriptions + config

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 as last 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 MUCH worse.
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 will catch 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", but then 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
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

In reply to: Magnus Naeslund(f) (#1)
Re: Win32 Error descriptions + config

Just checking,
will my patch be applied, and if not, why?

Magnus

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

#5Bruce Momjian
bruce@momjian.us
In reply to: Magnus Naeslund(f) (#4)
Re: Win32 Error descriptions + config

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
#6Bruce Momjian
bruce@momjian.us
In reply to: Magnus Naeslund(f) (#1)
Re: Win32 Error descriptions + config

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 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
#7Bruce Momjian
bruce@momjian.us
In reply to: Magnus Naeslund(f) (#1)
Re: Win32 Error descriptions + config

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