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

From Bruce Momjian
Subject Re: [HACKERS] Win32 WEXITSTATUS too
Date
Msg-id 200701231534.l0NFYvR06950@momjian.us
Whole thread Raw
In response to Re: [HACKERS] Win32 WEXITSTATUS too  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
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?

Here are the values listed in ntstatus.h < 0x100:

 36 #define STATUS_WAIT_0                    ((NTSTATUS) 0x00000000)
 37 #define STATUS_WAIT_1                    ((NTSTATUS) 0x00000001)
 38 #define STATUS_WAIT_2                    ((NTSTATUS) 0x00000002)
 39 #define STATUS_WAIT_3                    ((NTSTATUS) 0x00000003)
 40 #define STATUS_WAIT_63                   ((NTSTATUS) 0x0000003f)
 41 #define STATUS_ABANDONED                 ((NTSTATUS) 0x00000080)
 42 #define STATUS_ABANDONED_WAIT_0          ((NTSTATUS) 0x00000080)
 43 #define STATUS_ABANDONED_WAIT_63         ((NTSTATUS) 0x000000BF)
 44 #define STATUS_USER_APC                  ((NTSTATUS) 0x000000C0)

> And to get back to the point, surely all this confusion proves the point
> about how the error message should NOT try to tell people how to
> interpret the number.

This all started because we as a community couldn't interpret the
number.  I don't see how pushing the interpetation to users helps us.
We need to nail this down.

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

pgsql-patches by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: [HACKERS] Win32 WEXITSTATUS too
Next
From: Magnus Hagander
Date:
Subject: Re: [HACKERS] Win32 WEXITSTATUS too