mirror of
https://github.com/postgres/postgres.git
synced 2025-05-13 01:13:08 -04: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:
parent
ca1e85513e
commit
bdb657edd6
2
configure
vendored
2
configure
vendored
@ -16039,7 +16039,7 @@ fi
|
|||||||
LIBS_including_readline="$LIBS"
|
LIBS_including_readline="$LIBS"
|
||||||
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
|
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
|
||||||
|
|
||||||
for ac_func in backtrace_symbols clock_gettime copyfile fdatasync getifaddrs getpeerucred getrlimit inet_pton kqueue mbstowcs_l memset_s poll posix_fallocate ppoll pthread_is_threaded_np readlink readv setproctitle setproctitle_fast setsid shm_open strchrnul strsignal symlink syncfs sync_file_range uselocale wcstombs_l writev
|
for ac_func in backtrace_symbols clock_gettime copyfile fdatasync getifaddrs getpeerucred inet_pton kqueue mbstowcs_l memset_s poll posix_fallocate ppoll pthread_is_threaded_np readlink readv setproctitle setproctitle_fast setsid shm_open strchrnul strsignal symlink syncfs sync_file_range uselocale wcstombs_l writev
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
@ -1797,7 +1797,6 @@ AC_CHECK_FUNCS(m4_normalize([
|
|||||||
fdatasync
|
fdatasync
|
||||||
getifaddrs
|
getifaddrs
|
||||||
getpeerucred
|
getpeerucred
|
||||||
getrlimit
|
|
||||||
inet_pton
|
inet_pton
|
||||||
kqueue
|
kqueue
|
||||||
mbstowcs_l
|
mbstowcs_l
|
||||||
|
@ -895,11 +895,7 @@ count_usable_fds(int max_to_probe, int *usable_fds, int *already_open)
|
|||||||
fd = (int *) palloc(size * sizeof(int));
|
fd = (int *) palloc(size * sizeof(int));
|
||||||
|
|
||||||
#ifdef HAVE_GETRLIMIT
|
#ifdef HAVE_GETRLIMIT
|
||||||
#ifdef RLIMIT_NOFILE /* most platforms use RLIMIT_NOFILE */
|
|
||||||
getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim);
|
getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim);
|
||||||
#else /* but BSD doesn't ... */
|
|
||||||
getrlimit_status = getrlimit(RLIMIT_OFILE, &rlim);
|
|
||||||
#endif /* RLIMIT_NOFILE */
|
|
||||||
if (getrlimit_status != 0)
|
if (getrlimit_status != 0)
|
||||||
ereport(WARNING, (errmsg("getrlimit failed: %m")));
|
ereport(WARNING, (errmsg("getrlimit failed: %m")));
|
||||||
#endif /* HAVE_GETRLIMIT */
|
#endif /* HAVE_GETRLIMIT */
|
||||||
|
@ -4770,7 +4770,7 @@ forbidden_in_wal_sender(char firstchar)
|
|||||||
long
|
long
|
||||||
get_stack_depth_rlimit(void)
|
get_stack_depth_rlimit(void)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_STACK)
|
#if defined(HAVE_GETRLIMIT)
|
||||||
static long val = 0;
|
static long val = 0;
|
||||||
|
|
||||||
/* This won't change after process launch, so check just once */
|
/* This won't change after process launch, so check just once */
|
||||||
@ -4789,13 +4789,9 @@ get_stack_depth_rlimit(void)
|
|||||||
val = rlim.rlim_cur;
|
val = rlim.rlim_cur;
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
#else /* no getrlimit */
|
#else
|
||||||
#if defined(WIN32) || defined(__CYGWIN__)
|
|
||||||
/* On Windows we set the backend stack size in src/backend/Makefile */
|
/* On Windows we set the backend stack size in src/backend/Makefile */
|
||||||
return WIN32_STACK_RLIMIT;
|
return WIN32_STACK_RLIMIT;
|
||||||
#else /* not windows ... give up */
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ static bool wait_for_postmaster_stop(void);
|
|||||||
static bool wait_for_postmaster_promote(void);
|
static bool wait_for_postmaster_promote(void);
|
||||||
static bool postmaster_is_alive(pid_t pid);
|
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);
|
static void unlimit_core_size(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -776,7 +776,7 @@ wait_for_postmaster_promote(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE)
|
#if defined(HAVE_GETRLIMIT)
|
||||||
static void
|
static void
|
||||||
unlimit_core_size(void)
|
unlimit_core_size(void)
|
||||||
{
|
{
|
||||||
@ -949,7 +949,7 @@ do_start(void)
|
|||||||
if (exec_path == NULL)
|
if (exec_path == NULL)
|
||||||
exec_path = find_other_exec_or_die(argv0, "postgres", PG_BACKEND_VERSIONSTR);
|
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)
|
if (allow_core_files)
|
||||||
unlimit_core_size();
|
unlimit_core_size();
|
||||||
#endif
|
#endif
|
||||||
@ -2069,7 +2069,7 @@ do_help(void)
|
|||||||
printf(_("If the -D option is omitted, the environment variable PGDATA is used.\n"));
|
printf(_("If the -D option is omitted, the environment variable PGDATA is used.\n"));
|
||||||
|
|
||||||
printf(_("\nOptions for start or restart:\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"));
|
printf(_(" -c, --core-files allow postgres to produce core files\n"));
|
||||||
#else
|
#else
|
||||||
printf(_(" -c, --core-files not applicable on this platform\n"));
|
printf(_(" -c, --core-files not applicable on this platform\n"));
|
||||||
|
@ -6662,11 +6662,7 @@ main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_GETRLIMIT
|
#ifdef HAVE_GETRLIMIT
|
||||||
#ifdef RLIMIT_NOFILE /* most platforms use RLIMIT_NOFILE */
|
|
||||||
if (getrlimit(RLIMIT_NOFILE, &rlim) == -1)
|
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");
|
pg_fatal("getrlimit failed: %m");
|
||||||
if (rlim.rlim_cur < nclients + 3)
|
if (rlim.rlim_cur < nclients + 3)
|
||||||
{
|
{
|
||||||
|
@ -229,9 +229,6 @@
|
|||||||
/* Define to 1 if you have the `getpeerucred' function. */
|
/* Define to 1 if you have the `getpeerucred' function. */
|
||||||
#undef HAVE_GETPEERUCRED
|
#undef HAVE_GETPEERUCRED
|
||||||
|
|
||||||
/* Define to 1 if you have the `getrlimit' function. */
|
|
||||||
#undef HAVE_GETRLIMIT
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `gettimeofday' function. */
|
/* Define to 1 if you have the `gettimeofday' function. */
|
||||||
#undef HAVE_GETTIMEOFDAY
|
#undef HAVE_GETTIMEOFDAY
|
||||||
|
|
||||||
|
@ -519,4 +519,12 @@ extern char *wait_result_to_str(int exit_status);
|
|||||||
extern bool wait_result_is_signal(int exit_status, int signum);
|
extern bool wait_result_is_signal(int exit_status, int signum);
|
||||||
extern bool wait_result_is_any_signal(int exit_status, bool include_command_not_found);
|
extern bool wait_result_is_any_signal(int exit_status, bool include_command_not_found);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Interfaces that we assume all Unix system have. We retain individual macros
|
||||||
|
* for better documentation.
|
||||||
|
*/
|
||||||
|
#ifndef WIN32
|
||||||
|
#define HAVE_GETRLIMIT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* PG_PORT_H */
|
#endif /* PG_PORT_H */
|
||||||
|
@ -129,7 +129,7 @@ static void psql_end_command(StringInfo buf, const char *database);
|
|||||||
/*
|
/*
|
||||||
* allow core files if possible.
|
* allow core files if possible.
|
||||||
*/
|
*/
|
||||||
#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE)
|
#if defined(HAVE_GETRLIMIT)
|
||||||
static void
|
static void
|
||||||
unlimit_core_size(void)
|
unlimit_core_size(void)
|
||||||
{
|
{
|
||||||
@ -2229,7 +2229,7 @@ regression_main(int argc, char *argv[],
|
|||||||
|
|
||||||
initialize_environment();
|
initialize_environment();
|
||||||
|
|
||||||
#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE)
|
#if defined(HAVE_GETRLIMIT)
|
||||||
unlimit_core_size();
|
unlimit_core_size();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -271,7 +271,6 @@ sub GenerateFiles
|
|||||||
HAVE_GETOPT_LONG => undef,
|
HAVE_GETOPT_LONG => undef,
|
||||||
HAVE_GETPEEREID => undef,
|
HAVE_GETPEEREID => undef,
|
||||||
HAVE_GETPEERUCRED => undef,
|
HAVE_GETPEERUCRED => undef,
|
||||||
HAVE_GETRLIMIT => undef,
|
|
||||||
HAVE_GETTIMEOFDAY => undef,
|
HAVE_GETTIMEOFDAY => undef,
|
||||||
HAVE_GSSAPI_GSSAPI_H => undef,
|
HAVE_GSSAPI_GSSAPI_H => undef,
|
||||||
HAVE_GSSAPI_H => undef,
|
HAVE_GSSAPI_H => undef,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user