Re: [HACKERS] Win32 WEXITSTATUS too - Mailing list pgsql-patches

From Chuck McDevitt
Subject Re: [HACKERS] Win32 WEXITSTATUS too
Date
Msg-id EB48EBF3B239E948AC1E3F3780CF8F880195E05C@MI8NYCMAIL02.Mi8.com
Whole thread Raw
In response to Re: [HACKERS] Win32 WEXITSTATUS too  (Bruce Momjian <bruce@momjian.us>)
Responses Re: [HACKERS] Win32 WEXITSTATUS too
Re: [HACKERS] Win32 WEXITSTATUS too
List pgsql-patches
Win32 exception codes start with a two-bit severity indication.
00 means "success", so nothing is wrong.
01 is an "informational" messages.
10 is a "warning" message.
11 is an "error".

That's why the common exception codes you see start with hex C0, as they
are "errors".

The rest of the top 16 bits are the "facility" that caused the error.
Often not filled in.

To Convert an NT exception code (ntstatus) to a Win32 error code, you
call this routine:

ULONG RtlNtStatusToDosError(
  NTSTATUS Status
);


Then you can pass it to FormatMessage and it will work.


-----Original Message-----
From: pgsql-patches-owner@postgresql.org
[mailto:pgsql-patches-owner@postgresql.org] On Behalf Of Bruce Momjian
Sent: Tuesday, January 23, 2007 7:35 AM
To: Tom Lane
Cc: Magnus Hagander; Takayuki Tsunakawa; PostgreSQL-patches; Alvaro
Herrera; ITAGAKI Takahiro
Subject: Re: [pgsql-patches] [HACKERS] Win32 WEXITSTATUS too

Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Magnus Hagander wrote:
> >> Now, if we're only caring about exit() from *postgresqls own
processes*,
> >> that might hold true. In which case I withdraw that objection as
long as
> >> the comment i updated to reflect this ;-) But if we're talking
about
> >> exit() in general of any process, then it's simply wrong.
>
> > Right, that code is only used by the backend and tools.
>
> We can reasonably assume that no Postgres code will exit() with a
value
> bigger than 255, because to do so would be unportable.
>
> I'm more concerned about the other direction: can we be sure that a
> status value less than 255 is from exit() rather than something that
> should be called an exception?



pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Win32 WEXITSTATUS too
Next
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] Win32 WEXITSTATUS too