Skip site navigation (1) Skip section navigation (2)

Re: Win32 question: getppid() with no parent?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: "PgSql-Win32" <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: Win32 question: getppid() with no parent?
Date: 2004-05-27 18:30:28
Message-ID: 17608.1085682628@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers-win32
"Magnus Hagander" <mha(at)sollentuna(dot)net> writes:
>>> (If we can't rely on that variable, we could do a win32 specific hack
>>> that passes the HANDLE of the postmaster down to the child on exec, I
>>> guess.)
>> 
>> Is this just like passing a variable value, or is there some more
>> protection involved?

> It is passing a variable. *Before* you parse it, you have to make it
> inheritable by doing something along the line of:
> DuplicateHandle(GetCurrentProcess(), GetCurrentProcess(),
> GetCurrentProcess(), &targetHandle, 0, TRUE, DUPLICATE_SAME_ACCESS);

But you'd do that only once during postmaster start, right?  It's
probably marginally faster/safer to do that than to fabricate a new
handle in each child based on PostmasterPid.

			regards, tom lane

In response to

pgsql-hackers-win32 by date

Next:From: Magnus HaganderDate: 2004-05-27 18:32:28
Subject: Re: Win32 question: getppid() with no parent?
Previous:From: Magnus HaganderDate: 2004-05-27 18:29:17
Subject: Re: Primary Key results in endless loop

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group