15
15
#include "postgres.h"
16
16
17
17
#include <unistd.h>
18
- #ifdef HAVE_PS_STRINGS
19
- #include <machine/vmparam.h> /* for old BSD */
20
- #include <sys/exec.h>
21
- #endif
22
18
#if defined(__darwin__ )
23
19
#include <crt_externs.h>
24
20
#endif
@@ -39,16 +35,10 @@ bool update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;
39
35
*
40
36
* PS_USE_SETPROCTITLE_FAST
41
37
* use the function setproctitle_fast(const char *, ...)
42
- * (newer FreeBSD systems )
38
+ * (FreeBSD)
43
39
* PS_USE_SETPROCTITLE
44
40
* 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)
52
42
* PS_USE_CLOBBER_ARGV
53
43
* write over the argv and environment area
54
44
* (Linux and most SysV-like systems)
@@ -62,11 +52,7 @@ bool update_process_title = DEFAULT_UPDATE_PROCESS_TITLE;
62
52
#define PS_USE_SETPROCTITLE_FAST
63
53
#elif defined(HAVE_SETPROCTITLE )
64
54
#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__ )
70
56
#define PS_USE_CLOBBER_ARGV
71
57
#elif defined(WIN32 )
72
58
#define PS_USE_WIN32
@@ -186,9 +172,6 @@ save_ps_display_args(int argc, char **argv)
186
172
new_environ [i ] = NULL ;
187
173
environ = new_environ ;
188
174
}
189
- #endif /* PS_USE_CLOBBER_ARGV */
190
-
191
- #if defined(PS_USE_CHANGE_ARGV ) || defined(PS_USE_CLOBBER_ARGV )
192
175
193
176
/*
194
177
* 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)
226
209
#if defined(__darwin__ )
227
210
228
211
/*
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:
231
214
*/
232
215
* _NSGetArgv () = new_argv ;
233
216
#endif
234
217
235
218
argv = new_argv ;
236
219
}
237
- #endif /* PS_USE_CHANGE_ARGV or PS_USE_CLOBBER_ARGV */
220
+ #endif /* PS_USE_CLOBBER_ARGV */
238
221
239
222
return argv ;
240
223
}
@@ -271,25 +254,10 @@ init_ps_display(const char *fixed_part)
271
254
/* If ps_buffer is a pointer, it might still be null */
272
255
if (!ps_buffer )
273
256
return ;
274
- #endif
275
-
276
- /*
277
- * Overwrite argv[] to point at appropriate space, if needed
278
- */
279
257
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 ;
293
261
#endif /* PS_USE_CLOBBER_ARGV */
294
262
295
263
/*
@@ -369,11 +337,6 @@ set_ps_display(const char *activity)
369
337
setproctitle_fast ("%s" , ps_buffer );
370
338
#endif
371
339
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
-
377
340
#ifdef PS_USE_CLOBBER_ARGV
378
341
/* pad unused memory; need only clobber remainder of old status string */
379
342
if (last_status_len > ps_buffer_cur_len )
0 commit comments