Re: [HACKERS] Win32 WEXITSTATUS too

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Takayuki Tsunakawa <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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 16:22:59
Message-ID: 200701231622.l0NGMxd17453@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


I worked with Magnus and it seems pulling message text from ntdll.dll
doesn't work for all cases, so we are left just suggesting
/include/ntstatus.h, which is what we have now. Magnus concurs.

---------------------------------------------------------------------------

Magnus Hagander wrote:
> On Tue, Jan 23, 2007 at 10:40:40AM -0500, Bruce Momjian wrote:
> > >
> > > Depends on what you mean with OS.
> > > There are a *lot* of tools that will return exitcodes >0x100 that are
> > > part of the OS. As a relevant example, Windows installer will return
> > > exitcode 3010 means "needs to reboot but didn't reboot". MSI is a part
> > > of the OS, but it's not kernel... Same thing for things like the service
> > > control manager (trying to operate on a service that has been removed
> > > gives you error 1060).
> >
> > Is there a portable way to get the _exception_ value from system(),
> > rather than the error code? We could go with just > 0xC0000000 values
> > as exceptions. (This is clearly showing the mess that is the WIN32
> > API.)
>
> AFAIK, the way to do that is to use SEH. But this is not supported by
> MingW.
>
> > > > > would break that assumption. (And yes, it works)
> > > > > exit() takes a 32-bit signed integer, and that's what comes out to the
> > > > > calling program (verified both with console and standalone program)
> > > > >
> > > > > The MSDN link referes to the DDK which has to do with driver
> > > > > development, not userspace. AFAIK, that list is not relevant here, and
> > > > > I've seen no actual reference so far that it should be used to look up
> > > > > exit codes.
> > > > >
> > > > > 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 should be very clear about that in our comment then, and the current
> > > comment is not. And the part referring to the DDK should just be
> > > removed, because it's simply incorrect.
> > >
> > > For example, don't we call cmd for PITR scripts? If we're using any of
> > > these macros on the return value from there we are *NOT* certain of what
> > > it will be, and then need to document that as a requirement on those
> > > scripts.
> >
> > The major place we use it is for backend termination checking, and we
> > know the return values there. The other place is for the return value
> > of pipe().
>
> I assume you mean popen()/pclose()? Because pipe() is implemented using
> sockets in our win32 ports layer.
>
> //Magnus

--
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

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2007-01-23 17:07:10 Re: Updateable cursors
Previous Message Stefan Kaltenbrunner 2007-01-23 16:20:32 "tupdesc reference is not owned by resource owner Portal" issue in 8.2 and -HEAD

Browse pgsql-patches by date

  From Date Subject
Next Message Chuck McDevitt 2007-01-23 17:55:33 Re: [HACKERS] Win32 WEXITSTATUS too
Previous Message Alvaro Herrera 2007-01-23 15:44:25 Re: vcbuild fmgrtab.c