1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-17 17:02:08 +03:00

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
This commit is contained in:
Thomas Munro
2022-08-05 09:18:34 +12:00
parent ca1e85513e
commit bdb657edd6
10 changed files with 17 additions and 26 deletions

View File

@ -4770,7 +4770,7 @@ forbidden_in_wal_sender(char firstchar)
long
get_stack_depth_rlimit(void)
{
#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_STACK)
#if defined(HAVE_GETRLIMIT)
static long val = 0;
/* This won't change after process launch, so check just once */
@ -4789,13 +4789,9 @@ get_stack_depth_rlimit(void)
val = rlim.rlim_cur;
}
return val;
#else /* no getrlimit */
#if defined(WIN32) || defined(__CYGWIN__)
#else
/* On Windows we set the backend stack size in src/backend/Makefile */
return WIN32_STACK_RLIMIT;
#else /* not windows ... give up */
return -1;
#endif
#endif
}