git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 840b3b5)
Move extern declarations for EXEC_BACKEND to header files
2024年7月23日 12:58:30 +0000 (14:58 +0200)
2024年7月23日 13:07:10 +0000 (15:07 +0200)
This fixes warnings from -Wmissing-variable-declarations (not yet part
of the standard warning options) under EXEC_BACKEND. The
NON_EXEC_STATIC variables need a suitable declaration in a header file
under EXEC_BACKEND.

Also fix the inconsistent application of the volatile qualifier for
PMSignalState, which was revealed by this change.

Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e0a62134-83da-4ba4-8cdb-ceb0111c95ce@eisentraut.org


diff --git a/src/backend/postmaster/launch_backend.c b/src/backend/postmaster/launch_backend.c
index f9b24b7989913b14183eb05f67a003f7932d3a1c..e9fc9827878b751e06d86d53a762331526e9d19d 100644 (file)
--- a/src/backend/postmaster/launch_backend.c
+++ b/src/backend/postmaster/launch_backend.c
@@ -114,7 +114,7 @@ typedef struct
PROC_HDR *ProcGlobal;
PGPROC *AuxiliaryProcs;
PGPROC *PreparedXactProcs;
- PMSignalData *PMSignalState;
+ volatile PMSignalData *PMSignalState;
pid_t PostmasterPid;
TimestampTz PgStartTime;
TimestampTz PgReloadTime;
@@ -668,16 +668,6 @@ SubPostmasterMain(int argc, char *argv[])
pg_unreachable(); /* main_fn never returns */
}
-/*
- * 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 *ProcStructLock;
-extern PGPROC *AuxiliaryProcs;
-extern PMSignalData *PMSignalState;
-extern pg_time_t first_syslogger_file_time;
-extern struct bkend *ShmemBackendArray;
-
#ifndef WIN32
#define write_inheritable_socket(dest, src, childpid) ((*(dest) = (src)), true)
#define read_inheritable_socket(dest, src) (*(dest) = *(src))
diff --git a/src/include/postmaster/postmaster.h b/src/include/postmaster/postmaster.h
index 9feb2e4de14d6645f31574e4512585149cc736b4..d19e103937dc4df243ddcb2b2c6d197614482f70 100644 (file)
--- a/src/include/postmaster/postmaster.h
+++ b/src/include/postmaster/postmaster.h
@@ -36,6 +36,10 @@ extern PGDLLIMPORT bool remove_temp_files_after_crash;
extern PGDLLIMPORT bool send_abort_for_crash;
extern PGDLLIMPORT bool send_abort_for_kill;
+#ifdef EXEC_BACKEND
+extern struct bkend *ShmemBackendArray;
+#endif
+
#ifdef WIN32
extern PGDLLIMPORT HANDLE PostmasterHandle;
#else
diff --git a/src/include/postmaster/syslogger.h b/src/include/postmaster/syslogger.h
index 0f28ebcba55154576d3760b131097942575e67b0..b5fc239ba9ca51e774ce2d0967a4b28d470f48f6 100644 (file)
--- a/src/include/postmaster/syslogger.h
+++ b/src/include/postmaster/syslogger.h
@@ -75,6 +75,10 @@ extern PGDLLIMPORT char *Log_filename;
extern PGDLLIMPORT bool Log_truncate_on_rotation;
extern PGDLLIMPORT int Log_file_mode;
+#ifdef EXEC_BACKEND
+extern pg_time_t first_syslogger_file_time;
+#endif
+
#ifndef WIN32
extern PGDLLIMPORT int syslogPipe[2];
#else
diff --git a/src/include/storage/pmsignal.h b/src/include/storage/pmsignal.h
index 029b7201093b37120044916cf79d712601840d56..0c9a7e32a8acb4188ed6fcd4539e8b5ada29417c 100644 (file)
--- a/src/include/storage/pmsignal.h
+++ b/src/include/storage/pmsignal.h
@@ -57,6 +57,10 @@ typedef enum
/* PMSignalData is an opaque struct, details known only within pmsignal.c */
typedef struct PMSignalData PMSignalData;
+#ifdef EXEC_BACKEND
+extern volatile PMSignalData *PMSignalState;
+#endif
+
/*
* prototypes for functions in pmsignal.c
*/
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index 7d3fc2bfa605ab17b316124a549dad0966b4af14..bbd893a544e80bb23c245ddf39b9cc64f6165bd8 100644 (file)
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -453,6 +453,11 @@ extern PGDLLIMPORT int TransactionTimeout;
extern PGDLLIMPORT int IdleSessionTimeout;
extern PGDLLIMPORT bool log_lock_waits;
+#ifdef EXEC_BACKEND
+extern slock_t *ProcStructLock;
+extern PGPROC *AuxiliaryProcs;
+#endif
+
/*
* Function Prototypes
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /