Skip to content

Commit a267c88

Browse files
committed
Make setproctitle update for every query.
1 parent 962c258 commit a267c88

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.141 2000/05/23 22:16:27 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.142 2000/05/24 00:14:25 momjian Exp $
1515
*
1616
* NOTES
1717
*
@@ -380,6 +380,7 @@ PostmasterMain(int argc, char *argv[])
380380

381381
*original_extraoptions = '\0';
382382

383+
#ifndef HAVE_SETPROCTITLE
383384
/*
384385
* We need four params so we can display status. If we don't get
385386
* them from the user, let's make them ourselves.
@@ -410,6 +411,7 @@ PostmasterMain(int argc, char *argv[])
410411
fprintf(stderr, "PostmasterMain execv failed on %s\n", argv[0]);
411412
exit(1);
412413
}
414+
#endif
413415

414416
progname = argv[0];
415417
real_argv = argv;

src/include/utils/ps_status.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ extern char Ps_status_buffer[];
1919

2020
#define PS_INIT_STATUS(argc, argv, execname, username, hostname, dbname) \
2121
do { \
22-
Assert(argc >= 5); \
23-
setproctitle("%s %s %s %s %s", execname, hostname, username, dbname, Ps_status_buffer); \
22+
sprintf(Ps_status_buffer, "%s %s %s %s", execname, hostname, username, dbname); \
2423
} while (0)
2524

2625
#define PS_CLEAR_STATUS() \
27-
do { /*Ps_status_buffer[0] = '\0';*/ } while (0)
26+
do { setproctitle("%s", Ps_status_buffer); } while (0)
2827

2928
#define PS_SET_STATUS(status) \
30-
do { /*strcpy(Ps_status_buffer, (status));*/ } while (0)
29+
do { setproctitle("%s %s", Ps_status_buffer, (status)); } while (0)
3130

3231
#define PS_STATUS (Ps_status_buffer)
3332

0 commit comments

Comments
 (0)