Re: [HACKERS] Win32 WEXITSTATUS too

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Takayuki Tsunakawa <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Subject: Re: [HACKERS] Win32 WEXITSTATUS too
Date: 2007-01-23 15:34:57
Message-ID: 200701231534.l0NFYvR06950@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)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(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tino Wildenhain 2007-01-23 15:37:05 Re: STOP all user access except for admin for a few minutes?
Previous Message Magnus Hagander 2007-01-23 15:33:16 Re: [HACKERS] Win32 WEXITSTATUS too

Browse pgsql-patches by date

  From Date Subject
Next Message Magnus Hagander 2007-01-23 15:40:33 Re: [HACKERS] Win32 WEXITSTATUS too
Previous Message Magnus Hagander 2007-01-23 15:33:16 Re: [HACKERS] Win32 WEXITSTATUS too