Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit be4ae8f

Browse files
committed
this fixes the bug where setting the entry in he process table no longer works 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 ...
1 parent 3383e8b commit be4ae8f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/include/utils/ps_status.h

+21-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,27 @@
1111
#ifndef PS_STATUS_H
1212
#define PS_STATUS_H
1313

14-
#ifdef linux
14+
#ifdef HAVE_SETPROCTITLE
15+
16+
extern char Ps_status_buffer[];
17+
18+
#undef PS_DEFINE_BUFFER
19+
20+
#define PS_INIT_STATUS(argc, argv, execname, username, hostname, dbname) \
21+
do { \
22+
Assert(argc >= 5); \
23+
setproctitle("%s %s %s %s %s", execname, hostname, username, dbname, Ps_status_buffer); \
24+
} while (0)
25+
26+
#define PS_CLEAR_STATUS() \
27+
do { Ps_status_buffer[0] = '\0'; } while (0)
28+
29+
#define PS_SET_STATUS(status) \
30+
do { strcpy(Ps_status_buffer, (status)); } while (0)
31+
32+
#define PS_STATUS (Ps_status_buffer)
33+
34+
#elif defined(linux)
1535

1636
#include <string.h>
1737

0 commit comments

Comments
 (0)