From 71a6f8b85b9f748dc7f33c1212c4474e8beb901a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 7 Oct 2006 19:25:29 +0000 Subject: On platforms that have getrlimit(RLIMIT_STACK), use it to ensure that max_stack_depth is not set to an unsafe value. This commit also provides configure-time checking for , and cleans up some perhaps-unportable code associated with use of that include file and getrlimit(). --- src/include/tcop/tcopprot.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/include/tcop') diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h index e6637edeb7f..2006b7c6828 100644 --- a/src/include/tcop/tcopprot.h +++ b/src/include/tcop/tcopprot.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.84 2006/10/04 00:30:10 momjian Exp $ + * $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.85 2006/10/07 19:25:29 tgl Exp $ * * OLD COMMENTS * This file was created so that other c files could get the two @@ -23,6 +23,9 @@ #include "utils/guc.h" +/* Required daylight between max_stack_depth and the kernel limit, in bytes */ +#define STACK_DEPTH_SLOP (512 * 1024L) + extern CommandDest whereToSendOutput; extern DLLIMPORT const char *debug_query_string; extern int max_stack_depth; @@ -62,6 +65,7 @@ extern void FloatExceptionHandler(SIGNAL_ARGS); extern void prepare_for_client_read(void); extern void client_read_ended(void); extern int PostgresMain(int argc, char *argv[], const char *username); +extern long get_stack_depth_rlimit(void); extern void ResetUsage(void); extern void ShowUsage(const char *title); extern int check_log_duration(char *msec_str, bool was_logged); -- cgit v1.2.3