Re: postmaster.pid

"Dave Page" <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.win32
Message-ID <E7F85A1B5FF8D44C8A1AF6885BC9A0E41A7870@ratbert.vale-housing.co.uk>
 

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf 
> Of Dave Page
> Sent: 24 August 2004 15:55
> To: Andrew Dunstan
> Cc: Barry Lind; [email protected]; Max Dunn
> Subject: Re: [pgsql-hackers-win32] postmaster.pid
> 
>  
> 
> 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;

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.