Skip to content

Commit d2ea2d3

Browse files
committed
Remove obsolete platforms from ps_status.c.
Time to remove various code, comments and configure/meson probes relating to ancient BSD, SunOS, GNU/Hurd, IRIX, NeXT and Unixware. Reviewed-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/CA%2BhUKGJMNGUAqf27WbckYFrM-Mavy0RKJvocfJU%3DJ2XcAZyv%2Bw%40mail.gmail.com
1 parent a0fa18c commit d2ea2d3

File tree

6 files changed

+9
-115
lines changed

6 files changed

+9
-115
lines changed

configure

-35
Original file line numberDiff line numberDiff line change
@@ -16278,41 +16278,6 @@ cat >>confdefs.h <<_ACEOF
1627816278
_ACEOF
1627916279

1628016280

16281-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PS_STRINGS" >&5
16282-
$as_echo_n "checking for PS_STRINGS... " >&6; }
16283-
if ${pgac_cv_var_PS_STRINGS+:} false; then :
16284-
$as_echo_n "(cached) " >&6
16285-
else
16286-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
16287-
/* end confdefs.h. */
16288-
#include <machine/vmparam.h>
16289-
#include <sys/exec.h>
16290-
16291-
int
16292-
main ()
16293-
{
16294-
PS_STRINGS->ps_nargvstr = 1;
16295-
PS_STRINGS->ps_argvstr = "foo";
16296-
;
16297-
return 0;
16298-
}
16299-
_ACEOF
16300-
if ac_fn_c_try_link "$LINENO"; then :
16301-
pgac_cv_var_PS_STRINGS=yes
16302-
else
16303-
pgac_cv_var_PS_STRINGS=no
16304-
fi
16305-
rm -f core conftest.err conftest.$ac_objext \
16306-
conftest$ac_exeext conftest.$ac_ext
16307-
fi
16308-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_var_PS_STRINGS" >&5
16309-
$as_echo "$pgac_cv_var_PS_STRINGS" >&6; }
16310-
if test "$pgac_cv_var_PS_STRINGS" = yes ; then
16311-
16312-
$as_echo "#define HAVE_PS_STRINGS 1" >>confdefs.h
16313-
16314-
fi
16315-
1631616281
ac_fn_c_check_func "$LINENO" "explicit_bzero" "ac_cv_func_explicit_bzero"
1631716282
if test "x$ac_cv_func_explicit_bzero" = xyes; then :
1631816283
$as_echo "#define HAVE_EXPLICIT_BZERO 1" >>confdefs.h

configure.ac

-13
Original file line numberDiff line numberDiff line change
@@ -1849,19 +1849,6 @@ AC_CHECK_DECLS([pwritev], [], [AC_LIBOBJ(pwritev)], [#include <sys/uio.h>])
18491849
# This is probably only present on macOS, but may as well check always
18501850
AC_CHECK_DECLS(F_FULLFSYNC, [], [], [#include <fcntl.h>])
18511851

1852-
AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
1853-
[AC_LINK_IFELSE([AC_LANG_PROGRAM(
1854-
[#include <machine/vmparam.h>
1855-
#include <sys/exec.h>
1856-
],
1857-
[PS_STRINGS->ps_nargvstr = 1;
1858-
PS_STRINGS->ps_argvstr = "foo";])],
1859-
[pgac_cv_var_PS_STRINGS=yes],
1860-
[pgac_cv_var_PS_STRINGS=no])])
1861-
if test "$pgac_cv_var_PS_STRINGS" = yes ; then
1862-
AC_DEFINE([HAVE_PS_STRINGS], 1, [Define to 1 if the PS_STRINGS thing exists.])
1863-
fi
1864-
18651852
AC_REPLACE_FUNCS(m4_normalize([
18661853
explicit_bzero
18671854
getopt

meson.build

-17
Original file line numberDiff line numberDiff line change
@@ -2293,23 +2293,6 @@ endif
22932293
cdata.set('pg_restrict', '__restrict')
22942294

22952295

2296-
if cc.links('''
2297-
#include <machine/vmparam.h>
2298-
#include <sys/exec.h>
2299-
2300-
int main(void)
2301-
{
2302-
PS_STRINGS->ps_nargvstr = 1;
2303-
PS_STRINGS->ps_argvstr = "foo";
2304-
}
2305-
''',
2306-
name: 'PS_STRINGS', args: test_c_args)
2307-
cdata.set('HAVE_PS_STRINGS', 1)
2308-
else
2309-
cdata.set('HAVE_PS_STRINGS', false)
2310-
endif
2311-
2312-
23132296
# Most libraries are included only if they demonstrably provide a function we
23142297
# need, but libm is an exception: always include it, because there are too
23152298
# many compilers that play cute optimization games that will break probes for

src/backend/utils/misc/ps_status.c

+9-46
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
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)

src/include/pg_config.h.in

-3
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,6 @@
334334
/* Define to 1 if you have the `ppoll' function. */
335335
#undef HAVE_PPOLL
336336

337-
/* Define to 1 if the PS_STRINGS thing exists. */
338-
#undef HAVE_PS_STRINGS
339-
340337
/* Define if you have POSIX threads libraries and header files. */
341338
#undef HAVE_PTHREAD
342339

src/tools/msvc/Solution.pm

-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ sub GenerateFiles
308308
HAVE_POSIX_FADVISE => undef,
309309
HAVE_POSIX_FALLOCATE => undef,
310310
HAVE_PPOLL => undef,
311-
HAVE_PS_STRINGS => undef,
312311
HAVE_PTHREAD => undef,
313312
HAVE_PTHREAD_BARRIER_WAIT => undef,
314313
HAVE_PTHREAD_IS_THREADED_NP => undef,

0 commit comments

Comments
 (0)