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

Re: postmaster.pid

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>,"Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: postmaster.pid
Date: 2004-08-24 16:06:49
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE475B12@algol.sollentuna.se (view raw or flat)
Thread:
Lists: pgsql-hackers-win32
> > however I have an hour or so now so I'll take a quick look at the 
> > kill() issue.
> 
> OK, quick (untested) hack below. Open to suggestions if 
> anyone's got a better way to do it...
> 
> Regards, Dave
> 
> Index: kill.c
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/port/kill.c,v
> retrieving revision 1.2
> diff -u -r1.2 kill.c
> --- kill.c	24 Jun 2004 18:53:48 -0000	1.2
> +++ kill.c	24 Aug 2004 15:56:03 -0000
> @@ -25,8 +25,25 @@
>  	BYTE		sigData = sig;
>  	BYTE		sigRet = 0;
>  	DWORD		bytes;
> +	DWORD		handle;
>  
> -	if (sig >= PG_SIGNAL_COUNT || sig <= 0)
> +	/* Look, but don't touch... */
> +	if (sig == 0)
> +	{
> +		handle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE,
> pid);
> +		if (!handle)
> +		{
> +			errno = EINVAL;
> +			return -1;
> +		}
> +		else
> +		{
> +			CloseHandle(handle);
> +			return 0;
> +		}
> +	}
> +	
> +	/* Regular kill... */
> +	if (sig >= PG_SIGNAL_COUNT || sig < 0)
>  	{
>  		errno = EINVAL;
>  		return -1;
> 

I think it's better to call uor named pipe. That way we'll find out if
it's actually a postmaster of ours or a different process alltogether
there.
Just make sure the backend can deal with signal number = 0 and discard
that one (haven't got the code around to check right now, but it should
be a simple if-then-don't in the backend code, if it's not already
there. backend/port/win32/signal.c IIRC)

//Magnus

pgsql-hackers-win32 by date

Next:From: Tom LaneDate: 2004-08-24 16:11:00
Subject: Re: Postgresql 8.0 beta 1 - strange cpu usage statistics and slow vacuuming
Previous:From: Gaetano MendolaDate: 2004-08-24 16:02:17
Subject: Re: Postgresql 8.0 beta 1 - strange cpu usage statistics and slow

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