diff options
author | Thomas Munro <tmunro@postgresql.org> | 2022-08-05 09:18:34 +1200 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2022-08-05 09:18:34 +1200 |
commit | bdb657edd6db1e471437d62f4642674a801ef32c (patch) | |
tree | 74ae928e3976d43b74af6c76f13255bd87a5e3ac /src/bin | |
parent | ca1e85513e1c92afb80a74935cbbb6f7e4a3ccf9 (diff) | |
download | postgresql-bdb657edd6db1e471437d62f4642674a801ef32c.tar.gz postgresql-bdb657edd6db1e471437d62f4642674a801ef32c.zip |
Remove configure probe and related tests for getrlimit.
getrlimit() is in SUSv2 and all targeted systems have it.
Windows doesn't have it. We could just use #ifndef WIN32, but for a
little more explanation about why we're making things conditional, let's
retain the HAVE_GETRLIMIT macro. It's defined in port.h for Unix systems.
On systems that have it, it's not necessary to test for RLIMIT_CORE,
RLIMIT_STACK or RLIMIT_NOFILE macros, since SUSv2 requires those and all
targeted systems have them. Also remove references to a pre-historic
alternative spelling of RLIMIT_NOFILE, and coding that seemed to believe
that Cygwin didn't have it.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/pg_ctl/pg_ctl.c | 8 | ||||
-rw-r--r-- | src/bin/pgbench/pgbench.c | 4 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index ef58883a5c2..2762e8590d0 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -160,7 +160,7 @@ static bool wait_for_postmaster_stop(void); static bool wait_for_postmaster_promote(void); static bool postmaster_is_alive(pid_t pid); -#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE) +#if defined(HAVE_GETRLIMIT) static void unlimit_core_size(void); #endif @@ -776,7 +776,7 @@ wait_for_postmaster_promote(void) } -#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE) +#if defined(HAVE_GETRLIMIT) static void unlimit_core_size(void) { @@ -949,7 +949,7 @@ do_start(void) if (exec_path == NULL) exec_path = find_other_exec_or_die(argv0, "postgres", PG_BACKEND_VERSIONSTR); -#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE) +#if defined(HAVE_GETRLIMIT) if (allow_core_files) unlimit_core_size(); #endif @@ -2069,7 +2069,7 @@ do_help(void) printf(_("If the -D option is omitted, the environment variable PGDATA is used.\n")); printf(_("\nOptions for start or restart:\n")); -#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE) +#if defined(HAVE_GETRLIMIT) printf(_(" -c, --core-files allow postgres to produce core files\n")); #else printf(_(" -c, --core-files not applicable on this platform\n")); diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index bcaea8f5ea2..0778656794a 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -6662,11 +6662,7 @@ main(int argc, char **argv) exit(1); } #ifdef HAVE_GETRLIMIT -#ifdef RLIMIT_NOFILE /* most platforms use RLIMIT_NOFILE */ if (getrlimit(RLIMIT_NOFILE, &rlim) == -1) -#else /* but BSD doesn't ... */ - if (getrlimit(RLIMIT_OFILE, &rlim) == -1) -#endif /* RLIMIT_NOFILE */ pg_fatal("getrlimit failed: %m"); if (rlim.rlim_cur < nclients + 3) { |