1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-19 17:02:53 +03:00

Apply PGDLLIMPORT markings broadly.

Up until now, we've had a policy of only marking certain variables
in the PostgreSQL header files with PGDLLIMPORT, but now we've
decided to mark them all. This means that extensions running on
Windows should no longer operate at a disadvantage as compared to
extensions running on Linux: if the variable is present in a header
file, it should be accessible.

Discussion: http://postgr.es/m/CA+TgmoYanc1_FSfimhgiWSqVyP5KKmh5NP2BWNwDhO8Pg2vGYQ@mail.gmail.com
This commit is contained in:
Robert Haas
2022-04-08 08:16:38 -04:00
parent 80900d4690
commit 8ec569479f
100 changed files with 430 additions and 425 deletions

View File

@@ -279,7 +279,7 @@ extern PGDLLIMPORT BufferDescPadded *BufferDescriptors;
extern PGDLLIMPORT WritebackContext BackendWritebackContext;
/* in localbuf.c */
extern BufferDesc *LocalBufferDescriptors;
extern PGDLLIMPORT BufferDesc *LocalBufferDescriptors;
/* in bufmgr.c */
@@ -298,7 +298,7 @@ typedef struct CkptSortItem
int buf_id;
} CkptSortItem;
extern CkptSortItem *CkptBufferIds;
extern PGDLLIMPORT CkptSortItem *CkptBufferIds;
/*
* Internal buffer management routines

View File

@@ -65,16 +65,16 @@ struct SMgrRelationData;
extern PGDLLIMPORT int NBuffers;
/* in bufmgr.c */
extern bool zero_damaged_pages;
extern int bgwriter_lru_maxpages;
extern double bgwriter_lru_multiplier;
extern bool track_io_timing;
extern int effective_io_concurrency;
extern int maintenance_io_concurrency;
extern PGDLLIMPORT bool zero_damaged_pages;
extern PGDLLIMPORT int bgwriter_lru_maxpages;
extern PGDLLIMPORT double bgwriter_lru_multiplier;
extern PGDLLIMPORT bool track_io_timing;
extern PGDLLIMPORT int effective_io_concurrency;
extern PGDLLIMPORT int maintenance_io_concurrency;
extern int checkpoint_flush_after;
extern int backend_flush_after;
extern int bgwriter_flush_after;
extern PGDLLIMPORT int checkpoint_flush_after;
extern PGDLLIMPORT int backend_flush_after;
extern PGDLLIMPORT int bgwriter_flush_after;
/* in buf_init.c */
extern PGDLLIMPORT char *BufferBlocks;

View File

@@ -39,8 +39,8 @@
#endif
/* GUC. */
extern int dynamic_shared_memory_type;
extern int min_dynamic_shared_memory;
extern PGDLLIMPORT int dynamic_shared_memory_type;
extern PGDLLIMPORT int min_dynamic_shared_memory;
/*
* Directory for on-disk state.

View File

@@ -59,12 +59,12 @@ typedef int File;
/* GUC parameter */
extern PGDLLIMPORT int max_files_per_process;
extern PGDLLIMPORT bool data_sync_retry;
extern int recovery_init_sync_method;
extern PGDLLIMPORT int recovery_init_sync_method;
/*
* This is private to fd.c, but exported for save/restore_backend_variables()
*/
extern int max_safe_fds;
extern PGDLLIMPORT int max_safe_fds;
/*
* On Windows, we have to interpret EACCES as possibly meaning the same as

View File

@@ -79,7 +79,7 @@ typedef struct LargeObjectDesc
/*
* GUC: backwards-compatibility flag to suppress LO permission checks
*/
extern bool lo_compat_privileges;
extern PGDLLIMPORT bool lo_compat_privileges;
/*
* Function definitions...

View File

@@ -34,14 +34,14 @@ typedef struct PROC_QUEUE
} PROC_QUEUE;
/* GUC variables */
extern int max_locks_per_xact;
extern PGDLLIMPORT int max_locks_per_xact;
#ifdef LOCK_DEBUG
extern int Trace_lock_oidmin;
extern bool Trace_locks;
extern bool Trace_userlocks;
extern int Trace_lock_table;
extern bool Debug_deadlocks;
extern PGDLLIMPORT int Trace_lock_oidmin;
extern PGDLLIMPORT bool Trace_locks;
extern PGDLLIMPORT bool Trace_userlocks;
extern PGDLLIMPORT int Trace_lock_table;
extern PGDLLIMPORT bool Debug_deadlocks;
#endif /* LOCK_DEBUG */
@@ -154,7 +154,7 @@ typedef enum LockTagType
#define LOCKTAG_LAST_TYPE LOCKTAG_ADVISORY
extern const char *const LockTagTypeNames[];
extern PGDLLIMPORT const char *const LockTagTypeNames[];
/*
* The LOCKTAG struct is defined with malice aforethought to fit into 16

View File

@@ -110,7 +110,7 @@ typedef enum LWLockMode
#ifdef LOCK_DEBUG
extern bool Trace_lwlocks;
extern PGDLLIMPORT bool Trace_lwlocks;
#endif
extern bool LWLockAcquire(LWLock *lock, LWLockMode mode);
@@ -121,7 +121,7 @@ extern void LWLockReleaseClearVar(LWLock *lock, uint64 *valptr, uint64 val);
extern void LWLockReleaseAll(void);
extern bool LWLockHeldByMe(LWLock *lock);
extern bool LWLockHeldByMeInMode(LWLock *lock, LWLockMode mode);
extern int LWLockHeldCount(void);
extern int LWLockHeldCount(void);
extern bool LWLockWaitForVar(LWLock *lock, uint64 *valptr, uint64 oldval, uint64 *newval);
extern void LWLockUpdateVar(LWLock *lock, uint64 *valptr, uint64 value);

View File

@@ -42,9 +42,9 @@ typedef struct PGShmemHeader /* standard header for all Postgres shmem */
} PGShmemHeader;
/* GUC variables */
extern int shared_memory_type;
extern int huge_pages;
extern int huge_page_size;
extern PGDLLIMPORT int shared_memory_type;
extern PGDLLIMPORT int huge_pages;
extern PGDLLIMPORT int huge_page_size;
/* Possible values for huge_pages */
typedef enum
@@ -63,12 +63,12 @@ typedef enum
} PGShmemType;
#ifndef WIN32
extern unsigned long UsedShmemSegID;
extern PGDLLIMPORT unsigned long UsedShmemSegID;
#else
extern HANDLE UsedShmemSegID;
extern void *ShmemProtectiveRegion;
extern PGDLLIMPORT HANDLE UsedShmemSegID;
extern PGDLLIMPORT void *ShmemProtectiveRegion;
#endif
extern void *UsedShmemSegAddr;
extern PGDLLIMPORT void *UsedShmemSegAddr;
#if !defined(WIN32) && !defined(EXEC_BACKEND)
#define DEFAULT_SHARED_MEMORY_TYPE SHMEM_TYPE_MMAP

View File

@@ -89,7 +89,7 @@ extern void PostmasterDeathSignalInit(void);
#endif
#ifdef USE_POSTMASTER_DEATH_SIGNAL
extern volatile sig_atomic_t postmaster_possibly_dead;
extern PGDLLIMPORT volatile sig_atomic_t postmaster_possibly_dead;
static inline bool
PostmasterIsAlive(void)

View File

@@ -22,9 +22,9 @@
/*
* GUC variables
*/
extern int max_predicate_locks_per_xact;
extern int max_predicate_locks_per_relation;
extern int max_predicate_locks_per_page;
extern PGDLLIMPORT int max_predicate_locks_per_xact;
extern PGDLLIMPORT int max_predicate_locks_per_relation;
extern PGDLLIMPORT int max_predicate_locks_per_page;
/* Number of SLRU buffers to use for Serial SLRU */

View File

@@ -400,7 +400,7 @@ typedef struct PROC_HDR
extern PGDLLIMPORT PROC_HDR *ProcGlobal;
extern PGPROC *PreparedXactProcs;
extern PGDLLIMPORT PGPROC *PreparedXactProcs;
/* Accessor for PGPROC given a pgprocno. */
#define GetPGProcByNumber(n) (&ProcGlobal->allProcs[(n)])
@@ -421,7 +421,7 @@ extern PGDLLIMPORT int StatementTimeout;
extern PGDLLIMPORT int LockTimeout;
extern PGDLLIMPORT int IdleInTransactionSessionTimeout;
extern PGDLLIMPORT int IdleSessionTimeout;
extern bool log_lock_waits;
extern PGDLLIMPORT bool log_lock_waits;
/*

View File

@@ -1042,7 +1042,7 @@ extern int tas(volatile slock_t *lock); /* in port/.../tas.s, or
#define TAS_SPIN(lock) TAS(lock)
#endif /* TAS_SPIN */
extern slock_t dummy_spinlock;
extern PGDLLIMPORT slock_t dummy_spinlock;
/*
* Platform-independent out-of-line support routines

View File

@@ -123,9 +123,9 @@ typedef union
/* Counter of messages processed; don't worry about overflow. */
extern uint64 SharedInvalidMessageCounter;
extern PGDLLIMPORT uint64 SharedInvalidMessageCounter;
extern volatile sig_atomic_t catchupInterruptPending;
extern PGDLLIMPORT volatile sig_atomic_t catchupInterruptPending;
extern void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs,
int n);

View File

@@ -71,7 +71,7 @@ extern Size SpinlockSemaSize(void);
#ifndef HAVE_SPINLOCKS
extern void SpinlockSemaInit(void);
extern PGSemaphore *SpinlockSemaArray;
extern PGDLLIMPORT PGSemaphore *SpinlockSemaArray;
#endif
#endif /* SPIN_H */

View File

@@ -21,10 +21,10 @@
#include "storage/standbydefs.h"
/* User-settable GUC parameters */
extern int vacuum_defer_cleanup_age;
extern int max_standby_archive_delay;
extern int max_standby_streaming_delay;
extern bool log_recovery_conflict_waits;
extern PGDLLIMPORT int vacuum_defer_cleanup_age;
extern PGDLLIMPORT int max_standby_archive_delay;
extern PGDLLIMPORT int max_standby_streaming_delay;
extern PGDLLIMPORT bool log_recovery_conflict_waits;
extern void InitRecoveryTransactionEnvironment(void);
extern void ShutdownRecoveryTransactionEnvironment(void);