From a267c88d3b6f27ae8d273f0a9d297ee3115c34c5 Mon Sep 17 00:00:00 2001 From: Bruce Momjian <bruce@momjian.us> Date: Wed, 24 May 2000 00:14:26 +0000 Subject: [PATCH] Make setproctitle update for every query. --- src/backend/postmaster/postmaster.c | 4 +++- src/include/utils/ps_status.h | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 7bf3c3b3f1c..25f06bb060e 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.141 2000/05/23 22:16:27 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.142 2000/05/24 00:14:25 momjian Exp $ * * NOTES * @@ -380,6 +380,7 @@ PostmasterMain(int argc, char *argv[]) *original_extraoptions = '\0'; +#ifndef HAVE_SETPROCTITLE /* * We need four params so we can display status. If we don't get * them from the user, let's make them ourselves. @@ -410,6 +411,7 @@ PostmasterMain(int argc, char *argv[]) fprintf(stderr, "PostmasterMain execv failed on %s\n", argv[0]); exit(1); } +#endif progname = argv[0]; real_argv = argv; diff --git a/src/include/utils/ps_status.h b/src/include/utils/ps_status.h index 1c31e0257eb..46ef3ff8c4a 100644 --- a/src/include/utils/ps_status.h +++ b/src/include/utils/ps_status.h @@ -19,15 +19,14 @@ extern char Ps_status_buffer[]; #define PS_INIT_STATUS(argc, argv, execname, username, hostname, dbname) \ do { \ - Assert(argc >= 5); \ - setproctitle("%s %s %s %s %s", execname, hostname, username, dbname, Ps_status_buffer); \ + sprintf(Ps_status_buffer, "%s %s %s %s", execname, hostname, username, dbname); \ } while (0) #define PS_CLEAR_STATUS() \ - do { /*Ps_status_buffer[0] = '\0';*/ } while (0) + do { setproctitle("%s", Ps_status_buffer); } while (0) #define PS_SET_STATUS(status) \ - do { /*strcpy(Ps_status_buffer, (status));*/ } while (0) + do { setproctitle("%s %s", Ps_status_buffer, (status)); } while (0) #define PS_STATUS (Ps_status_buffer) -- GitLab