Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite71e02d

Browse files
committed
Minor code cleanup: make the WIN32 case less gratuitously different from
the other platform-specific cases in ps_status.
1 parente2e2a9d commite71e02d

File tree

1 file changed

+24
-33
lines changed

1 file changed

+24
-33
lines changed

‎src/backend/utils/misc/ps_status.c

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* to contain some useful information. Mechanism differs wildly across
66
* platforms.
77
*
8-
* $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.29 2006/03/05 15:58:49momjian Exp $
8+
* $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.30 2006/06/12 02:39:49tgl Exp $
99
*
1010
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
1111
* various details abducted from various places
@@ -33,7 +33,7 @@
3333
externchar**environ;
3434

3535

36-
/*------
36+
/*
3737
* Alternative ways of updating ps display:
3838
*
3939
* PS_USE_SETPROCTITLE
@@ -51,6 +51,8 @@ extern char **environ;
5151
* PS_USE_CLOBBER_ARGV
5252
* write over the argv and environment area
5353
* (most SysV-like systems)
54+
* PS_USE_WIN32
55+
* push the string out as the name of a Windows event
5456
* PS_USE_NONE
5557
* don't update ps display
5658
* (This is the default, as it is safest.)
@@ -65,7 +67,7 @@ extern char **environ;
6567
#definePS_USE_CHANGE_ARGV
6668
#elif defined(__linux__)|| defined(_AIX)|| defined(__sgi)|| (defined(sun)&& !defined(BSD))|| defined(ultrix)|| defined(__ksr__)|| defined(__osf__)|| defined(__svr4__)|| defined(__svr5__)|| defined(__darwin__)
6769
#definePS_USE_CLOBBER_ARGV
68-
#elif defined(WIN32)
70+
#elif defined(WIN32)
6971
#definePS_USE_WIN32
7072
#else
7173
#definePS_USE_NONE
@@ -96,30 +98,6 @@ static size_t ps_buffer_fixed_size;/* size of the constant prefix */
9698
staticintsave_argc;
9799
staticchar**save_argv;
98100

99-
#ifdefWIN32
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-
staticHANDLEident_handle=INVALID_HANDLE_VALUE;
107-
staticvoid
108-
pgwin32_update_ident(char*ident)
109-
{
110-
charname[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
123101

124102
/*
125103
* 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,
292270

293271
ps_buffer_fixed_size=strlen(ps_buffer);
294272

295-
#ifdefWIN32
296-
pgwin32_update_ident(ps_buffer);
297-
#endif
298273
#endif/* not PS_USE_NONE */
299274
}
300275

@@ -352,9 +327,25 @@ set_ps_display(const char *activity)
352327
}
353328
#endif/* PS_USE_CLOBBER_ARGV */
354329

355-
#ifdefWIN32
356-
pgwin32_update_ident(ps_buffer);
357-
#endif
330+
#ifdefPS_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+
staticHANDLEident_handle=INVALID_HANDLE_VALUE;
338+
charname[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+
358349
#endif/* not PS_USE_NONE */
359350
}
360351

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp