]> granicus.if.org Git - postgresql/commitdiff
this fixes the bug where setting the entry in he process table no longer works
authorMarc G. Fournier <scrappy@hub.org>
Fri, 12 May 2000 14:33:08 +0000 (14:33 +0000)
committerMarc G. Fournier <scrappy@hub.org>
Fri, 12 May 2000 14:33:08 +0000 (14:33 +0000)
under FreeBSD ... basically, if setproctitle() exists, use it ...

the draw back right now is the PS_SET_STATUS stuff doesn't work, but am looking
into that one right now ... at lesat now you can see who is connecting where
and from where ...

src/include/utils/ps_status.h

index 8bc28e5d63bdb2be8d3e27e7eae3be0bf16d2e13..b786c5415ade3b17676576c5193b97d656b4da2f 100644 (file)
 #ifndef PS_STATUS_H
 #define PS_STATUS_H
 
-#ifdef linux
+#ifdef HAVE_SETPROCTITLE
+
+extern char Ps_status_buffer[];
+
+#undef PS_DEFINE_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); \
+        } while (0)
+
+#define PS_CLEAR_STATUS() \
+        do { Ps_status_buffer[0] = '\0'; } while (0)
+
+#define PS_SET_STATUS(status) \
+        do { strcpy(Ps_status_buffer, (status)); } while (0)
+
+#define PS_STATUS (Ps_status_buffer)
+
+#elif defined(linux)
 
 #include <string.h>