Re: REPOST: InitDB Failure on install

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>, <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: REPOST: InitDB Failure on install
Date: 2004-08-23 17:49:21
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE4569D2@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Tom Lane 2004-08-23 18:20:03 Re: REPOST: InitDB Failure on install
Previous Message Justin Wyer 2004-08-23 08:35:24 Re: [BUGS] postgresql 8.0b1 Win32 observations