Re: REPOST: InitDB Failure on install - Mailing list pgsql-hackers-win32

From Magnus Hagander
Subject Re: REPOST: InitDB Failure on install
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCE4569D2@algol.sollentuna.se
Whole thread Raw
Responses Re: REPOST: InitDB Failure on install  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers-win32
>> In order to be future safe we ight want to do something like
>put a macro
>> in win32.h doing
>> #define Win32ErrorToErrno(i) i
>
>That was what I was gonna suggest, just in case.

Ok. I've investigated this further, and it seems we can *not* get away
this easy. There are conflicting codes, and a lot of them. We can only
get away with it if we *never* need the actual errno values - meanin if
we use *only* Win32 API calls. Which we clearly don't.

What I think we need to do in this case is map the error codes at any
"API emulation function" to always return a valid errno value, and not a
Win32 error code. This can only be done at the actual function, since it
has to be different depending on situation.

From what I can tell, only two places have this problem now. shmget()
and shmat() in backend/port/win32/shmem.c, and
backend/postmaster/syslogger.c where pipeThread() uses %m withoit
setting errno. shmget() already does the mapping, it just fails to
handle the default case.

Therefor, I propose we fix both these by adding ereport() calls in the
emulation routine (as is done in the rest of the win32 specific code),
and just returning EINVAL (or is there another better fallback).

Thoughts on this?

//Magnus

pgsql-hackers-win32 by date:

Previous
From: Justin Wyer
Date:
Subject: Re: [BUGS] postgresql 8.0b1 Win32 observations
Next
From: Tom Lane
Date:
Subject: Re: REPOST: InitDB Failure on install