Re: REPOST: InitDB Failure on install

Lists: pgsql-hackers-win32
From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Andreas Pflug" <pgadmin(at)pse-consulting(dot)de>, "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-24 08:19:55
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE34C072@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32

> > "Magnus Hagander" <mha(at)sollentuna(dot)net> writes:
> >
> >> /* Unable to get shared memory */
> >>+ errno = GetLastError();
> >
> >
> > Aren't you going to need a mapping function to convert
> Windows error
> > codes to errno numbers? Don't tell me Microsoft was smart
> enough to
> > make them the same ;-)
>
> How about the idea to set errno to a special value after all
> non-posix calls, which makes ereport examine/preserve
> GetLastError() instead?

We could do this, but that means we need to hack the whole error stack
handlign etc to save the value of GetLastError() as well as errno. But
yeah, we could do that.

Not sure if we need to do it after all calls though - probably enough to
do it only after the ones where there is actually a ereport() call with
%m nearby (or when we're emulating a unix function such as in shmget()).

Tom - which method do you think is best to go with?

//Magnus


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: "Andreas Pflug" <pgadmin(at)pse-consulting(dot)de>, "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-24 14:37:54
Message-ID: 3323.1093358274@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32

"Magnus Hagander" <mha(at)sollentuna(dot)net> writes:
> Tom - which method do you think is best to go with?

I dislike propagating #ifdef WIN32's into sections of the code that are
currently free of them. So I'd vote for the map-to-errno approach.
It's a judgment call though ...

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
Cc: Magnus Hagander <mha(at)sollentuna(dot)net>, 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-24 17:23:30
Message-ID: 5373.1093368210@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32

Andreas Pflug <pgadmin(at)pse-consulting(dot)de> writes:
> I understand your disliking of non-posix stuff. OTOH, GetLastError will
> give much more details than errno.

How much more, really? That mapping table gave me the impression that
the win32 error codes aren't all that much more detailed than errno...

regards, tom lane


From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Magnus Hagander <mha(at)sollentuna(dot)net>, 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-24 18:40:37
Message-ID: 412B8BA5.2050803@pse-consulting.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32

Tom Lane wrote:
> "Magnus Hagander" <mha(at)sollentuna(dot)net> writes:
>
>>Tom - which method do you think is best to go with?
>
>
> I dislike propagating #ifdef WIN32's into sections of the code that are
> currently free of them. So I'd vote for the map-to-errno approach.
> It's a judgment call though ...

I understand your disliking of non-posix stuff. OTOH, GetLastError will
give much more details than errno.

Regards,
Andreas