Move extern declarations for EXEC_BACKEND to header files

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
This commit is contained in:
Peter Eisentraut 2024-07-23 14:58:30 +02:00
parent 840b3b5b4e
commit d3cc5ffe81
5 changed files with 18 additions and 11 deletions

View File

@ -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))

View File

@ -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

View File

@ -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

View File

@ -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
*/

View File

@ -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