5
5
* to contain some useful information. Mechanism differs wildly across
6
6
* platforms.
7
7
*
8
- * $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.29 2006/03/05 15:58 :49 momjian Exp $
8
+ * $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.30 2006/06/12 02:39 :49 tgl Exp $
9
9
*
10
10
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
11
11
* various details abducted from various places
33
33
extern char * * environ ;
34
34
35
35
36
- /*------
36
+ /*
37
37
* Alternative ways of updating ps display:
38
38
*
39
39
* PS_USE_SETPROCTITLE
@@ -51,6 +51,8 @@ extern char **environ;
51
51
* PS_USE_CLOBBER_ARGV
52
52
* write over the argv and environment area
53
53
* (most SysV-like systems)
54
+ * PS_USE_WIN32
55
+ * push the string out as the name of a Windows event
54
56
* PS_USE_NONE
55
57
* don't update ps display
56
58
* (This is the default, as it is safest.)
@@ -65,7 +67,7 @@ extern char **environ;
65
67
#define PS_USE_CHANGE_ARGV
66
68
#elif defined(__linux__ ) || defined(_AIX ) || defined(__sgi ) || (defined(sun ) && !defined(BSD )) || defined(ultrix ) || defined(__ksr__ ) || defined(__osf__ ) || defined(__svr4__ ) || defined(__svr5__ ) || defined(__darwin__ )
67
69
#define PS_USE_CLOBBER_ARGV
68
- #elif defined (WIN32 )
70
+ #elif defined(WIN32 )
69
71
#define PS_USE_WIN32
70
72
#else
71
73
#define PS_USE_NONE
@@ -96,30 +98,6 @@ static size_t ps_buffer_fixed_size; /* size of the constant prefix */
96
98
static int save_argc ;
97
99
static char * * save_argv ;
98
100
99
- #ifdef WIN32
100
-
101
- /*
102
- * Win32 does not support showing any changed arguments. To make it at all
103
- * possible to track which backend is doing what, we create a named object
104
- * that can be viewed with for example Process Explorer
105
- */
106
- static HANDLE ident_handle = INVALID_HANDLE_VALUE ;
107
- static void
108
- pgwin32_update_ident (char * ident )
109
- {
110
- char name [PS_BUFFER_SIZE + 32 ];
111
-
112
- if (ident_handle != INVALID_HANDLE_VALUE )
113
- CloseHandle (ident_handle );
114
-
115
- sprintf (name , "pgident: %s" , ident );
116
-
117
- ident_handle = CreateEvent (NULL ,
118
- TRUE,
119
- FALSE,
120
- name );
121
- }
122
- #endif
123
101
124
102
/*
125
103
* Call this early in startup to save the original argc/argv values.
@@ -292,9 +270,6 @@ init_ps_display(const char *username, const char *dbname,
292
270
293
271
ps_buffer_fixed_size = strlen (ps_buffer );
294
272
295
- #ifdef WIN32
296
- pgwin32_update_ident (ps_buffer );
297
- #endif
298
273
#endif /* not PS_USE_NONE */
299
274
}
300
275
@@ -352,9 +327,25 @@ set_ps_display(const char *activity)
352
327
}
353
328
#endif /* PS_USE_CLOBBER_ARGV */
354
329
355
- #ifdef WIN32
356
- pgwin32_update_ident (ps_buffer );
357
- #endif
330
+ #ifdef PS_USE_WIN32
331
+ {
332
+ /*
333
+ * Win32 does not support showing any changed arguments. To make it
334
+ * at all possible to track which backend is doing what, we create a
335
+ * named object that can be viewed with for example Process Explorer.
336
+ */
337
+ static HANDLE ident_handle = INVALID_HANDLE_VALUE ;
338
+ char name [PS_BUFFER_SIZE + 32 ];
339
+
340
+ if (ident_handle != INVALID_HANDLE_VALUE )
341
+ CloseHandle (ident_handle );
342
+
343
+ sprintf (name , "pgident: %s" , ps_buffer );
344
+
345
+ ident_handle = CreateEvent (NULL , TRUE, FALSE, name );
346
+ }
347
+ #endif /* PS_USE_WIN32 */
348
+
358
349
#endif /* not PS_USE_NONE */
359
350
}
360
351
0 commit comments