Index: backend/utils/misc/ps_status.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/misc/ps_status.c,v
retrieving revision 1.21
diff -c -r1.21 ps_status.c
*** backend/utils/misc/ps_status.c	29 Aug 2004 05:06:51 -0000	1.21
--- backend/utils/misc/ps_status.c	11 Nov 2004 21:03:53 -0000
***************
*** 65,70 ****
--- 65,72 ----
  #define PS_USE_CHANGE_ARGV
  #elif defined(__linux__) || defined(_AIX) || defined(__sgi) || (defined(sun) && !defined(BSD)) || defined(ultrix) || defined(__ksr__) || defined(__osf__) || defined(__QNX__) || defined(__svr4__) || defined(__svr5__) || defined(__darwin__)
  #define PS_USE_CLOBBER_ARGV
+ #elif defined (WIN32)
+ #define PS_USE_WIN32
  #else
  #define PS_USE_NONE
  #endif
***************
*** 95,100 ****
--- 97,124 ----
  static int	save_argc;
  static char **save_argv;

+ #ifdef WIN32
+ 	/*
+ 	 * Win32 does not support showing any changed arguments. To make it
+ 	 * at all possible to track which backend is doing what, we create
+ 	 * a named object that can be viewed with for example Process Explorer
+ 	 */
+ static HANDLE ident_handle = INVALID_HANDLE_VALUE;
+ static void pgwin32_update_ident(char *ident)
+ {
+ 	char name[PS_BUFFER_SIZE+32];
+
+ 	if (ident_handle != INVALID_HANDLE_VALUE)
+ 		CloseHandle(ident_handle);
+
+ 	sprintf(name,"pgident: %s",ident);
+
+ 	ident_handle = CreateEvent(NULL,
+ 							   TRUE,
+ 							   FALSE,
+ 							   name);
+ }
+ #endif

  /*
   * Call this early in startup to save the original argc/argv values.
***************
*** 267,272 ****
--- 291,301 ----
  #endif

  	ps_buffer_fixed_size = strlen(ps_buffer);
+
+ #ifdef WIN32
+ 	pgwin32_update_ident(ps_buffer);
+ #endif
+
  #endif   /* not PS_USE_NONE */
  }

***************
*** 327,332 ****
--- 356,366 ----
  		MemSet(ps_buffer + buflen, PS_PADDING, ps_buffer_size - buflen);
  	}
  #endif   /* PS_USE_CLOBBER_ARGV */
+
+ #ifdef WIN32
+ 	pgwin32_update_ident(ps_buffer);
+ #endif
+
  #endif   /* not PS_USE_NONE */
  }
  
