v1-move-stack-base-setting.patch
text/x-diff
Filename: v1-move-stack-base-setting.patch
Type: text/x-diff
Part: 0
Patch
Format: unified
Series: patch v1
| File | + | − |
|---|---|---|
| src/backend/main/main.c | 6 | 0 |
| src/backend/postmaster/postmaster.c | 0 | 5 |
| src/backend/tcop/postgres.c | 1 | 2 |
| src/backend/utils/init/miscinit.c | 0 | 7 |
diff --git a/src/backend/main/main.c b/src/backend/main/main.c index 2d98d97e8d..864714107c 100644 --- a/src/backend/main/main.c +++ b/src/backend/main/main.c @@ -113,6 +113,12 @@ main(int argc, char *argv[]) MyProcPid = getpid(); MemoryContextInit(); + /* + * Set reference point for stack-depth checking. (There's no point in + * enabling this before error reporting works.) + */ + (void) set_stack_base(); + /* * Set up locale information */ diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 6f37822c88..6f849ffbcb 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -985,11 +985,6 @@ PostmasterMain(int argc, char *argv[]) */ set_max_safe_fds(); - /* - * Set reference point for stack-depth checking. - */ - (void) set_stack_base(); - /* * Initialize pipe (or process handle on Windows) that allows children to * wake up from sleep on postmaster death. diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index e0a603f42b..eede65b567 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -128,8 +128,7 @@ typedef struct BindParamCbData static long max_stack_depth_bytes = 100 * 1024L; /* - * Stack base pointer -- initialized by PostmasterMain and inherited by - * subprocesses (but see also InitPostmasterChild). + * Stack base pointer -- initialized by main(). */ static char *stack_base_ptr = NULL; diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index 3b7b2ebec0..d24ac133fb 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -106,13 +106,6 @@ InitPostmasterChild(void) pgwin32_signal_initialize(); #endif - /* - * Set reference point for stack-depth checking. This might seem - * redundant in !EXEC_BACKEND builds, but it's better to keep the depth - * logic the same with and without that build option. - */ - (void) set_stack_base(); - InitProcessGlobals(); /*