1515#include "postgres.h"
1616
1717#include <unistd.h>
18- #ifdef HAVE_PS_STRINGS
19- #include <machine/vmparam.h> /* for old BSD */
20- #include <sys/exec.h>
21- #endif
2218#if defined(__darwin__ )
2319#include <crt_externs.h>
2420#endif
@@ -39,16 +35,10 @@ bool update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;
3935 *
4036 * PS_USE_SETPROCTITLE_FAST
4137 * use the function setproctitle_fast(const char *, ...)
42- * (newer FreeBSD systems )
38+ * (FreeBSD)
4339 * PS_USE_SETPROCTITLE
4440 * use the function setproctitle(const char *, ...)
45- * (newer BSD systems)
46- * PS_USE_PS_STRINGS
47- * assign PS_STRINGS->ps_argvstr = "string"
48- * (some BSD systems)
49- * PS_USE_CHANGE_ARGV
50- * assign argv[0] = "string"
51- * (some other BSD systems)
41+ * (other BSDs)
5242 * PS_USE_CLOBBER_ARGV
5343 * write over the argv and environment area
5444 * (Linux and most SysV-like systems)
@@ -62,11 +52,7 @@ bool update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;
6252#define PS_USE_SETPROCTITLE_FAST
6353#elif defined(HAVE_SETPROCTITLE )
6454#define PS_USE_SETPROCTITLE
65- #elif defined(HAVE_PS_STRINGS )
66- #define PS_USE_PS_STRINGS
67- #elif (defined(BSD ) || defined(__hurd__ )) && !defined(__darwin__ )
68- #define PS_USE_CHANGE_ARGV
69- #elif defined(__linux__ ) || defined(_AIX ) || defined(__sgi ) || (defined(sun ) && !defined(BSD )) || defined(__svr5__ ) || defined(__darwin__ )
55+ #elif defined(__linux__ ) || defined(_AIX ) || defined(__sun ) || defined(__darwin__ )
7056#define PS_USE_CLOBBER_ARGV
7157#elif defined(WIN32 )
7258#define PS_USE_WIN32
@@ -186,9 +172,6 @@ save_ps_display_args(int argc, char **argv)
186172 new_environ [i ] = NULL ;
187173 environ = new_environ ;
188174 }
189- #endif /* PS_USE_CLOBBER_ARGV */
190-
191- #if defined(PS_USE_CHANGE_ARGV ) || defined(PS_USE_CLOBBER_ARGV )
192175
193176 /*
194177 * If we're going to change the original argv[] then make a copy for
@@ -226,15 +209,15 @@ save_ps_display_args(int argc, char **argv)
226209#if defined(__darwin__ )
227210
228211 /*
229- * macOS (and perhaps other NeXT-derived platforms?) has a static copy
230- * of the argv pointer, which we may fix like so:
212+ * macOS has a static copy of the argv pointer, which we may fix like
213+ * so:
231214 */
232215 * _NSGetArgv () = new_argv ;
233216#endif
234217
235218 argv = new_argv ;
236219 }
237- #endif /* PS_USE_CHANGE_ARGV or PS_USE_CLOBBER_ARGV */
220+ #endif /* PS_USE_CLOBBER_ARGV */
238221
239222 return argv ;
240223}
@@ -271,25 +254,10 @@ init_ps_display(const char *fixed_part)
271254 /* If ps_buffer is a pointer, it might still be null */
272255 if (!ps_buffer )
273256 return ;
274- #endif
275-
276- /*
277- * Overwrite argv[] to point at appropriate space, if needed
278- */
279257
280- #ifdef PS_USE_CHANGE_ARGV
281- save_argv [0 ] = ps_buffer ;
282- save_argv [1 ] = NULL ;
283- #endif /* PS_USE_CHANGE_ARGV */
284-
285- #ifdef PS_USE_CLOBBER_ARGV
286- {
287- int i ;
288-
289- /* make extra argv slots point at end_of_area (a NUL) */
290- for (i = 1 ; i < save_argc ; i ++ )
291- save_argv [i ] = ps_buffer + ps_buffer_size ;
292- }
258+ /* make extra argv slots point at end_of_area (a NUL) */
259+ for (int i = 1 ; i < save_argc ; i ++ )
260+ save_argv [i ] = ps_buffer + ps_buffer_size ;
293261#endif /* PS_USE_CLOBBER_ARGV */
294262
295263 /*
@@ -369,11 +337,6 @@ set_ps_display(const char *activity)
369337 setproctitle_fast ("%s" , ps_buffer );
370338#endif
371339
372- #ifdef PS_USE_PS_STRINGS
373- PS_STRINGS -> ps_nargvstr = 1 ;
374- PS_STRINGS -> ps_argvstr = ps_buffer ;
375- #endif /* PS_USE_PS_STRINGS */
376-
377340#ifdef PS_USE_CLOBBER_ARGV
378341 /* pad unused memory; need only clobber remainder of old status string */
379342 if (last_status_len > ps_buffer_cur_len )
0 commit comments