From 8f8bcb88833eecfffbbb0d048ff0b6c33e64f7ce Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 2 Jul 2024 06:55:56 +0200 Subject: Improve some global variable declarations We have in launch_backend.c: /* * The following need to be available to the save/restore_backend_variables * functions. They are marked NON_EXEC_STATIC in their home modules. */ extern slock_t *ShmemLock; extern slock_t *ProcStructLock; extern PGPROC *AuxiliaryProcs; extern PMSignalData *PMSignalState; extern pg_time_t first_syslogger_file_time; extern struct bkend *ShmemBackendArray; extern bool redirection_done; That comment is not completely true: ShmemLock, ShmemBackendArray, and redirection_done are not in fact NON_EXEC_STATIC. ShmemLock once was, but was then needed elsewhere. ShmemBackendArray was static inside postmaster.c before launch_backend.c was created. redirection_done was never static. This patch moves the declaration of ShmemLock and redirection_done to a header file. ShmemBackendArray gets a NON_EXEC_STATIC. This doesn't make a difference, since it only exists if EXEC_BACKEND anyway, but it makes it consistent. After that, the comment is now correct. Reviewed-by: Andres Freund Discussion: https://www.postgresql.org/message-id/flat/e0a62134-83da-4ba4-8cdb-ceb0111c95ce@eisentraut.org --- src/include/storage/shmem.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/include/storage') diff --git a/src/include/storage/shmem.h b/src/include/storage/shmem.h index 3b0cc9d3800..842989111c3 100644 --- a/src/include/storage/shmem.h +++ b/src/include/storage/shmem.h @@ -21,10 +21,12 @@ #ifndef SHMEM_H #define SHMEM_H +#include "storage/spin.h" #include "utils/hsearch.h" /* shmem.c */ +extern PGDLLIMPORT slock_t *ShmemLock; extern void InitShmemAccess(void *seghdr); extern void InitShmemAllocation(void); extern void *ShmemAlloc(Size size); -- cgit v1.2.3