PostgreSQL Source Code  git master
miscadmin.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * miscadmin.h
4  * This file contains general postgres administration and initialization
5  * stuff that used to be spread out between the following files:
6  * globals.h global variables
7  * pdir.h directory path crud
8  * pinit.h postgres initialization
9  * pmod.h processing modes
10  * Over time, this has also become the preferred place for widely known
11  * resource-limitation stuff, such as work_mem and check_stack_depth().
12  *
13  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
14  * Portions Copyright (c) 1994, Regents of the University of California
15  *
16  * src/include/miscadmin.h
17  *
18  * NOTES
19  * some of the information in this file should be moved to other files.
20  *
21  *-------------------------------------------------------------------------
22  */
23 #ifndef MISCADMIN_H
24 #define MISCADMIN_H
25 
26 #include <signal.h>
27 
28 #include "datatype/timestamp.h" /* for TimestampTz */
29 #include "pgtime.h" /* for pg_time_t */
30 
31 
32 #define InvalidPid (-1)
33 
34 
35 /*****************************************************************************
36  * System interrupt and critical section handling
37  *
38  * There are two types of interrupts that a running backend needs to accept
39  * without messing up its state: QueryCancel (SIGINT) and ProcDie (SIGTERM).
40  * In both cases, we need to be able to clean up the current transaction
41  * gracefully, so we can't respond to the interrupt instantaneously ---
42  * there's no guarantee that internal data structures would be self-consistent
43  * if the code is interrupted at an arbitrary instant. Instead, the signal
44  * handlers set flags that are checked periodically during execution.
45  *
46  * The CHECK_FOR_INTERRUPTS() macro is called at strategically located spots
47  * where it is normally safe to accept a cancel or die interrupt. In some
48  * cases, we invoke CHECK_FOR_INTERRUPTS() inside low-level subroutines that
49  * might sometimes be called in contexts that do *not* want to allow a cancel
50  * or die interrupt. The HOLD_INTERRUPTS() and RESUME_INTERRUPTS() macros
51  * allow code to ensure that no cancel or die interrupt will be accepted,
52  * even if CHECK_FOR_INTERRUPTS() gets called in a subroutine. The interrupt
53  * will be held off until CHECK_FOR_INTERRUPTS() is done outside any
54  * HOLD_INTERRUPTS() ... RESUME_INTERRUPTS() section.
55  *
56  * There is also a mechanism to prevent query cancel interrupts, while still
57  * allowing die interrupts: HOLD_CANCEL_INTERRUPTS() and
58  * RESUME_CANCEL_INTERRUPTS().
59  *
60  * Note that ProcessInterrupts() has also acquired a number of tasks that
61  * do not necessarily cause a query-cancel-or-die response. Hence, it's
62  * possible that it will just clear InterruptPending and return.
63  *
64  * INTERRUPTS_PENDING_CONDITION() can be checked to see whether an
65  * interrupt needs to be serviced, without trying to do so immediately.
66  * Some callers are also interested in INTERRUPTS_CAN_BE_PROCESSED(),
67  * which tells whether ProcessInterrupts is sure to clear the interrupt.
68  *
69  * Special mechanisms are used to let an interrupt be accepted when we are
70  * waiting for a lock or when we are waiting for command input (but, of
71  * course, only if the interrupt holdoff counter is zero). See the
72  * related code for details.
73  *
74  * A lost connection is handled similarly, although the loss of connection
75  * does not raise a signal, but is detected when we fail to write to the
76  * socket. If there was a signal for a broken connection, we could make use of
77  * it by setting ClientConnectionLost in the signal handler.
78  *
79  * A related, but conceptually distinct, mechanism is the "critical section"
80  * mechanism. A critical section not only holds off cancel/die interrupts,
81  * but causes any ereport(ERROR) or ereport(FATAL) to become ereport(PANIC)
82  * --- that is, a system-wide reset is forced. Needless to say, only really
83  * *critical* code should be marked as a critical section! Currently, this
84  * mechanism is only used for XLOG-related code.
85  *
86  *****************************************************************************/
87 
88 /* in globals.c */
89 /* these are marked volatile because they are set by signal handlers: */
90 extern PGDLLIMPORT volatile sig_atomic_t InterruptPending;
91 extern PGDLLIMPORT volatile sig_atomic_t QueryCancelPending;
92 extern PGDLLIMPORT volatile sig_atomic_t ProcDiePending;
93 extern PGDLLIMPORT volatile sig_atomic_t IdleInTransactionSessionTimeoutPending;
94 extern PGDLLIMPORT volatile sig_atomic_t TransactionTimeoutPending;
95 extern PGDLLIMPORT volatile sig_atomic_t IdleSessionTimeoutPending;
96 extern PGDLLIMPORT volatile sig_atomic_t ProcSignalBarrierPending;
97 extern PGDLLIMPORT volatile sig_atomic_t LogMemoryContextPending;
98 extern PGDLLIMPORT volatile sig_atomic_t IdleStatsUpdateTimeoutPending;
99 
100 extern PGDLLIMPORT volatile sig_atomic_t CheckClientConnectionPending;
101 extern PGDLLIMPORT volatile sig_atomic_t ClientConnectionLost;
102 
103 /* these are marked volatile because they are examined by signal handlers: */
106 extern PGDLLIMPORT volatile uint32 CritSectionCount;
107 
108 /* in tcop/postgres.c */
109 extern void ProcessInterrupts(void);
110 
111 /* Test whether an interrupt is pending */
112 #ifndef WIN32
113 #define INTERRUPTS_PENDING_CONDITION() \
114  (unlikely(InterruptPending))
115 #else
116 #define INTERRUPTS_PENDING_CONDITION() \
117  (unlikely(UNBLOCKED_SIGNAL_QUEUE()) ? pgwin32_dispatch_queued_signals() : 0, \
118  unlikely(InterruptPending))
119 #endif
120 
121 /* Service interrupt, if one is pending and it's safe to service it now */
122 #define CHECK_FOR_INTERRUPTS() \
123 do { \
124  if (INTERRUPTS_PENDING_CONDITION()) \
125  ProcessInterrupts(); \
126 } while(0)
127 
128 /* Is ProcessInterrupts() guaranteed to clear InterruptPending? */
129 #define INTERRUPTS_CAN_BE_PROCESSED() \
130  (InterruptHoldoffCount == 0 && CritSectionCount == 0 && \
131  QueryCancelHoldoffCount == 0)
132 
133 #define HOLD_INTERRUPTS() (InterruptHoldoffCount++)
134 
135 #define RESUME_INTERRUPTS() \
136 do { \
137  Assert(InterruptHoldoffCount > 0); \
138  InterruptHoldoffCount--; \
139 } while(0)
140 
141 #define HOLD_CANCEL_INTERRUPTS() (QueryCancelHoldoffCount++)
142 
143 #define RESUME_CANCEL_INTERRUPTS() \
144 do { \
145  Assert(QueryCancelHoldoffCount > 0); \
146  QueryCancelHoldoffCount--; \
147 } while(0)
148 
149 #define START_CRIT_SECTION() (CritSectionCount++)
150 
151 #define END_CRIT_SECTION() \
152 do { \
153  Assert(CritSectionCount > 0); \
154  CritSectionCount--; \
155 } while(0)
156 
157 
158 /*****************************************************************************
159  * globals.h -- *
160  *****************************************************************************/
161 
162 /*
163  * from utils/init/globals.c
164  */
165 extern PGDLLIMPORT pid_t PostmasterPid;
167 extern PGDLLIMPORT bool IsUnderPostmaster;
168 extern PGDLLIMPORT bool IsBackgroundWorker;
169 extern PGDLLIMPORT bool IsBinaryUpgrade;
170 
171 extern PGDLLIMPORT bool ExitOnAnyError;
172 
173 extern PGDLLIMPORT char *DataDir;
175 
176 extern PGDLLIMPORT int NBuffers;
177 extern PGDLLIMPORT int MaxBackends;
178 extern PGDLLIMPORT int MaxConnections;
181 
182 extern PGDLLIMPORT int MyProcPid;
185 extern PGDLLIMPORT struct Port *MyProcPort;
186 extern PGDLLIMPORT struct Latch *MyLatch;
188 extern PGDLLIMPORT int MyPMChildSlot;
189 
190 extern PGDLLIMPORT char OutputFileName[];
191 extern PGDLLIMPORT char my_exec_path[];
192 extern PGDLLIMPORT char pkglib_path[];
193 
194 #ifdef EXEC_BACKEND
195 extern PGDLLIMPORT char postgres_exec_path[];
196 #endif
197 
198 /*
199  * done in storage/backendid.h for now.
200  *
201  * extern BackendId MyBackendId;
202  */
204 
206 
208 
209 /*
210  * Date/Time Configuration
211  *
212  * DateStyle defines the output formatting choice for date/time types:
213  * USE_POSTGRES_DATES specifies traditional Postgres format
214  * USE_ISO_DATES specifies ISO-compliant format
215  * USE_SQL_DATES specifies Oracle/Ingres-compliant format
216  * USE_GERMAN_DATES specifies German-style dd.mm/yyyy
217  *
218  * DateOrder defines the field order to be assumed when reading an
219  * ambiguous date (anything not in YYYY-MM-DD format, with a four-digit
220  * year field first, is taken to be ambiguous):
221  * DATEORDER_YMD specifies field order yy-mm-dd
222  * DATEORDER_DMY specifies field order dd-mm-yy ("European" convention)
223  * DATEORDER_MDY specifies field order mm-dd-yy ("US" convention)
224  *
225  * In the Postgres and SQL DateStyles, DateOrder also selects output field
226  * order: day comes before month in DMY style, else month comes before day.
227  *
228  * The user-visible "DateStyle" run-time parameter subsumes both of these.
229  */
230 
231 /* valid DateStyle values */
232 #define USE_POSTGRES_DATES 0
233 #define USE_ISO_DATES 1
234 #define USE_SQL_DATES 2
235 #define USE_GERMAN_DATES 3
236 #define USE_XSD_DATES 4
237 
238 /* valid DateOrder values */
239 #define DATEORDER_YMD 0
240 #define DATEORDER_DMY 1
241 #define DATEORDER_MDY 2
242 
243 extern PGDLLIMPORT int DateStyle;
244 extern PGDLLIMPORT int DateOrder;
245 
246 /*
247  * IntervalStyles
248  * INTSTYLE_POSTGRES Like Postgres < 8.4 when DateStyle = 'iso'
249  * INTSTYLE_POSTGRES_VERBOSE Like Postgres < 8.4 when DateStyle != 'iso'
250  * INTSTYLE_SQL_STANDARD SQL standard interval literals
251  * INTSTYLE_ISO_8601 ISO-8601-basic formatted intervals
252  */
253 #define INTSTYLE_POSTGRES 0
254 #define INTSTYLE_POSTGRES_VERBOSE 1
255 #define INTSTYLE_SQL_STANDARD 2
256 #define INTSTYLE_ISO_8601 3
257 
258 extern PGDLLIMPORT int IntervalStyle;
259 
260 #define MAXTZLEN 10 /* max TZ name len, not counting tr. null */
261 
262 extern PGDLLIMPORT bool enableFsync;
264 extern PGDLLIMPORT int work_mem;
265 extern PGDLLIMPORT double hash_mem_multiplier;
268 
269 /*
270  * Upper and lower hard limits for the buffer access strategy ring size
271  * specified by the VacuumBufferUsageLimit GUC and BUFFER_USAGE_LIMIT option
272  * to VACUUM and ANALYZE.
273  */
274 #define MIN_BAS_VAC_RING_SIZE_KB 128
275 #define MAX_BAS_VAC_RING_SIZE_KB (16 * 1024 * 1024)
276 
278 extern PGDLLIMPORT int VacuumCostPageHit;
281 extern PGDLLIMPORT int VacuumCostLimit;
282 extern PGDLLIMPORT double VacuumCostDelay;
283 
284 extern PGDLLIMPORT int64 VacuumPageHit;
285 extern PGDLLIMPORT int64 VacuumPageMiss;
286 extern PGDLLIMPORT int64 VacuumPageDirty;
287 
288 extern PGDLLIMPORT int VacuumCostBalance;
289 extern PGDLLIMPORT bool VacuumCostActive;
290 
291 
292 /* in tcop/postgres.c */
293 
294 typedef char *pg_stack_base_t;
295 
296 extern pg_stack_base_t set_stack_base(void);
297 extern void restore_stack_base(pg_stack_base_t base);
298 extern void check_stack_depth(void);
299 extern bool stack_is_too_deep(void);
300 
301 /* in tcop/utility.c */
302 extern void PreventCommandIfReadOnly(const char *cmdname);
303 extern void PreventCommandIfParallelMode(const char *cmdname);
304 extern void PreventCommandDuringRecovery(const char *cmdname);
305 
306 /*****************************************************************************
307  * pdir.h -- *
308  * POSTGRES directory path definitions. *
309  *****************************************************************************/
310 
311 /* flags to be OR'd to form sec_context */
312 #define SECURITY_LOCAL_USERID_CHANGE 0x0001
313 #define SECURITY_RESTRICTED_OPERATION 0x0002
314 #define SECURITY_NOFORCE_RLS 0x0004
315 
316 extern PGDLLIMPORT char *DatabasePath;
317 
318 /* now in utils/init/miscinit.c */
319 extern void InitPostmasterChild(void);
320 extern void InitStandaloneProcess(const char *argv0);
321 extern void InitProcessLocalLatch(void);
322 extern void SwitchToSharedLatch(void);
323 extern void SwitchBackToLocalLatch(void);
324 
325 typedef enum BackendType
326 {
343 
344 #define BACKEND_NUM_TYPES (B_WAL_WRITER + 1)
345 
347 
348 extern const char *GetBackendTypeDesc(BackendType backendType);
349 
350 extern void SetDatabasePath(const char *path);
351 extern void checkDataDir(void);
352 extern void SetDataDir(const char *dir);
353 extern void ChangeToDataDir(void);
354 
355 extern char *GetUserNameFromId(Oid roleid, bool noerr);
356 extern Oid GetUserId(void);
357 extern Oid GetOuterUserId(void);
358 extern Oid GetSessionUserId(void);
359 extern Oid GetAuthenticatedUserId(void);
360 extern void GetUserIdAndSecContext(Oid *userid, int *sec_context);
361 extern void SetUserIdAndSecContext(Oid userid, int sec_context);
362 extern bool InLocalUserIdChange(void);
363 extern bool InSecurityRestrictedOperation(void);
364 extern bool InNoForceRLSOperation(void);
365 extern void GetUserIdAndContext(Oid *userid, bool *sec_def_context);
366 extern void SetUserIdAndContext(Oid userid, bool sec_def_context);
367 extern void InitializeSessionUserId(const char *rolename, Oid roleid,
368  bool bypass_login_check);
369 extern void InitializeSessionUserIdStandalone(void);
370 extern void SetSessionAuthorization(Oid userid, bool is_superuser);
371 extern Oid GetCurrentRoleId(void);
372 extern void SetCurrentRoleId(Oid roleid, bool is_superuser);
373 extern void InitializeSystemUser(const char *authn_id,
374  const char *auth_method);
375 extern const char *GetSystemUser(void);
376 
377 /* in utils/misc/superuser.c */
378 extern bool superuser(void); /* current user is superuser */
379 extern bool superuser_arg(Oid roleid); /* given user is superuser */
380 
381 
382 /*****************************************************************************
383  * pmod.h -- *
384  * POSTGRES processing mode definitions. *
385  *****************************************************************************/
386 
387 /*
388  * Description:
389  * There are three processing modes in POSTGRES. They are
390  * BootstrapProcessing or "bootstrap," InitProcessing or
391  * "initialization," and NormalProcessing or "normal."
392  *
393  * The first two processing modes are used during special times. When the
394  * system state indicates bootstrap processing, transactions are all given
395  * transaction id "one" and are consequently guaranteed to commit. This mode
396  * is used during the initial generation of template databases.
397  *
398  * Initialization mode: used while starting a backend, until all normal
399  * initialization is complete. Some code behaves differently when executed
400  * in this mode to enable system bootstrapping.
401  *
402  * If a POSTGRES backend process is in normal mode, then all code may be
403  * executed normally.
404  */
405 
406 typedef enum ProcessingMode
407 {
408  BootstrapProcessing, /* bootstrap creation of template database */
409  InitProcessing, /* initializing system */
410  NormalProcessing, /* normal processing */
412 
414 
415 #define IsBootstrapProcessingMode() (Mode == BootstrapProcessing)
416 #define IsInitProcessingMode() (Mode == InitProcessing)
417 #define IsNormalProcessingMode() (Mode == NormalProcessing)
418 
419 #define GetProcessingMode() Mode
420 
421 #define SetProcessingMode(mode) \
422  do { \
423  Assert((mode) == BootstrapProcessing || \
424  (mode) == InitProcessing || \
425  (mode) == NormalProcessing); \
426  Mode = (mode); \
427  } while(0)
428 
429 
430 /*
431  * Auxiliary-process type identifiers. These used to be in bootstrap.h
432  * but it seems saner to have them here, with the ProcessingMode stuff.
433  * The MyAuxProcType global is defined and set in auxprocess.c.
434  *
435  * Make sure to list in the glossary any items you add here.
436  */
437 
438 typedef enum
439 {
448 
449  NUM_AUXPROCTYPES /* Must be last! */
451 
453 
454 #define AmStartupProcess() (MyAuxProcType == StartupProcess)
455 #define AmBackgroundWriterProcess() (MyAuxProcType == BgWriterProcess)
456 #define AmArchiverProcess() (MyAuxProcType == ArchiverProcess)
457 #define AmCheckpointerProcess() (MyAuxProcType == CheckpointerProcess)
458 #define AmWalWriterProcess() (MyAuxProcType == WalWriterProcess)
459 #define AmWalReceiverProcess() (MyAuxProcType == WalReceiverProcess)
460 #define AmWalSummarizerProcess() (MyAuxProcType == WalSummarizerProcess)
461 
462 
463 /*****************************************************************************
464  * pinit.h -- *
465  * POSTGRES initialization and cleanup definitions. *
466  *****************************************************************************/
467 
468 /* in utils/init/postinit.c */
469 /* flags for InitPostgres() */
470 #define INIT_PG_LOAD_SESSION_LIBS 0x0001
471 #define INIT_PG_OVERRIDE_ALLOW_CONNS 0x0002
472 #define INIT_PG_OVERRIDE_ROLE_LOGIN 0x0004
473 extern void pg_split_opts(char **argv, int *argcp, const char *optstr);
474 extern void InitializeMaxBackends(void);
475 extern void InitPostgres(const char *in_dbname, Oid dboid,
476  const char *username, Oid useroid,
477  bits32 flags,
478  char *out_dbname);
479 extern void BaseInit(void);
480 
481 /* in utils/init/miscinit.c */
482 extern PGDLLIMPORT bool IgnoreSystemIndexes;
489 
490 extern void CreateDataDirLockFile(bool amPostmaster);
491 extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster,
492  const char *socketDir);
493 extern void TouchSocketLockFiles(void);
494 extern void AddToDataDirLockFile(int target_line, const char *str);
495 extern bool RecheckDataDirLockFile(void);
496 extern void ValidatePgVersion(const char *path);
497 extern void process_shared_preload_libraries(void);
498 extern void process_session_preload_libraries(void);
499 extern void process_shmem_requests(void);
500 extern void pg_bindtextdomain(const char *domain);
501 extern bool has_rolreplication(Oid roleid);
502 
503 typedef void (*shmem_request_hook_type) (void);
505 
507 extern void SerializeClientConnectionInfo(Size maxsize, char *start_address);
508 extern void RestoreClientConnectionInfo(char *conninfo);
509 
510 /* in executor/nodeHash.c */
511 extern size_t get_hash_memory_limit(void);
512 
513 #endif /* MISCADMIN_H */
unsigned int uint32
Definition: c.h:495
#define PGDLLIMPORT
Definition: c.h:1305
signed int int32
Definition: c.h:483
uint32 bits32
Definition: c.h:504
size_t Size
Definition: c.h:594
int64 TimestampTz
Definition: timestamp.h:39
PGDLLIMPORT int IntervalStyle
Definition: globals.c:124
PGDLLIMPORT shmem_request_hook_type shmem_request_hook
Definition: miscinit.c:1777
PGDLLIMPORT double VacuumCostDelay
Definition: globals.c:152
void ChangeToDataDir(void)
Definition: miscinit.c:451
char * GetUserNameFromId(Oid roleid, bool noerr)
Definition: miscinit.c:976
PGDLLIMPORT bool IsPostmasterEnvironment
Definition: globals.c:115
Oid GetOuterUserId(void)
Definition: miscinit.c:522
void process_shmem_requests(void)
Definition: miscinit.c:1867
PGDLLIMPORT struct Port * MyProcPort
Definition: globals.c:48
void restore_stack_base(pg_stack_base_t base)
Definition: postgres.c:3506
void InitializeMaxBackends(void)
Definition: postinit.c:560
void PreventCommandIfReadOnly(const char *cmdname)
Definition: utility.c:411
PGDLLIMPORT volatile uint32 InterruptHoldoffCount
Definition: globals.c:41
ProcessingMode
Definition: miscadmin.h:407
@ NormalProcessing
Definition: miscadmin.h:410
@ InitProcessing
Definition: miscadmin.h:409
@ BootstrapProcessing
Definition: miscadmin.h:408
void pg_split_opts(char **argv, int *argcp, const char *optstr)
Definition: postinit.c:502
void InitializeSessionUserId(const char *rolename, Oid roleid, bool bypass_login_check)
Definition: miscinit.c:730
void InitStandaloneProcess(const char *argv0)
Definition: miscinit.c:181
void SerializeClientConnectionInfo(Size maxsize, char *start_address)
Definition: miscinit.c:1039
void PreventCommandIfParallelMode(const char *cmdname)
Definition: utility.c:429
PGDLLIMPORT bool IsUnderPostmaster
Definition: globals.c:116
void InitializeSystemUser(const char *authn_id, const char *auth_method)
Definition: miscinit.c:863
PGDLLIMPORT int VacuumCostBalance
Definition: globals.c:158
PGDLLIMPORT Oid MyDatabaseTableSpace
Definition: globals.c:92
void InitializeSessionUserIdStandalone(void)
Definition: miscinit.c:834
void AddToDataDirLockFile(int target_line, const char *str)
Definition: miscinit.c:1507
void InitProcessLocalLatch(void)
Definition: miscinit.c:241
void BaseInit(void)
Definition: postinit.c:630
PGDLLIMPORT int maintenance_work_mem
Definition: globals.c:130
void GetUserIdAndSecContext(Oid *userid, int *sec_context)
Definition: miscinit.c:632
void SetSessionAuthorization(Oid userid, bool is_superuser)
Definition: miscinit.c:904
void process_session_preload_libraries(void)
Definition: miscinit.c:1853
PGDLLIMPORT bool enableFsync
Definition: globals.c:126
PGDLLIMPORT bool ExitOnAnyError
Definition: globals.c:120
PGDLLIMPORT volatile sig_atomic_t IdleInTransactionSessionTimeoutPending
Definition: globals.c:35
bool InSecurityRestrictedOperation(void)
Definition: miscinit.c:659
PGDLLIMPORT char * shared_preload_libraries_string
Definition: miscinit.c:1770
Oid GetUserId(void)
Definition: miscinit.c:511
PGDLLIMPORT AuxProcType MyAuxProcType
Definition: auxprocess.c:46
PGDLLIMPORT bool allowSystemTableMods
Definition: globals.c:127
PGDLLIMPORT bool IsBinaryUpgrade
Definition: globals.c:117
Size EstimateClientConnectionInfoSpace(void)
Definition: miscinit.c:1023
PGDLLIMPORT volatile sig_atomic_t LogMemoryContextPending
Definition: globals.c:39
const char * GetSystemUser(void)
Definition: miscinit.c:571
PGDLLIMPORT int VacuumCostPageDirty
Definition: globals.c:150
PGDLLIMPORT int data_directory_mode
Definition: globals.c:73
Oid GetSessionUserId(void)
Definition: miscinit.c:545
void SetCurrentRoleId(Oid roleid, bool is_superuser)
Definition: miscinit.c:941
PGDLLIMPORT bool VacuumCostActive
Definition: globals.c:159
PGDLLIMPORT volatile sig_atomic_t InterruptPending
Definition: globals.c:30
PGDLLIMPORT bool IgnoreSystemIndexes
Definition: miscinit.c:80
Oid GetAuthenticatedUserId(void)
Definition: miscinit.c:580
PGDLLIMPORT int VacuumCostLimit
Definition: globals.c:151
PGDLLIMPORT bool MyDatabaseHasLoginEventTriggers
Definition: globals.c:94
PGDLLIMPORT volatile sig_atomic_t ProcSignalBarrierPending
Definition: globals.c:38
PGDLLIMPORT int MaxConnections
Definition: globals.c:140
PGDLLIMPORT int NBuffers
Definition: globals.c:139
bool InLocalUserIdChange(void)
Definition: miscinit.c:650
PGDLLIMPORT int VacuumCostPageHit
Definition: globals.c:148
PGDLLIMPORT bool process_shmem_requests_in_progress
Definition: miscinit.c:1778
void SetDatabasePath(const char *path)
Definition: miscinit.c:325
void InitPostmasterChild(void)
Definition: miscinit.c:95
void process_shared_preload_libraries(void)
Definition: miscinit.c:1839
PGDLLIMPORT volatile sig_atomic_t IdleStatsUpdateTimeoutPending
Definition: globals.c:40
PGDLLIMPORT bool process_shared_preload_libraries_in_progress
Definition: miscinit.c:1774
PGDLLIMPORT struct Latch * MyLatch
Definition: globals.c:59
PGDLLIMPORT TimestampTz MyStartTimestamp
Definition: globals.c:47
PGDLLIMPORT char * DatabasePath
Definition: globals.c:100
const char * GetBackendTypeDesc(BackendType backendType)
Definition: miscinit.c:263
PGDLLIMPORT int MyPMChildSlot
Definition: globals.c:50
void TouchSocketLockFiles(void)
Definition: miscinit.c:1478
PGDLLIMPORT double hash_mem_multiplier
Definition: globals.c:129
size_t get_hash_memory_limit(void)
Definition: nodeHash.c:3596
PGDLLIMPORT volatile sig_atomic_t ClientConnectionLost
Definition: globals.c:34
void RestoreClientConnectionInfo(char *conninfo)
Definition: miscinit.c:1071
PGDLLIMPORT int DateOrder
Definition: globals.c:123
PGDLLIMPORT bool IsBackgroundWorker
Definition: globals.c:118
PGDLLIMPORT int64 VacuumPageDirty
Definition: globals.c:156
PGDLLIMPORT int max_parallel_maintenance_workers
Definition: globals.c:131
PGDLLIMPORT char * local_preload_libraries_string
Definition: miscinit.c:1771
PGDLLIMPORT BackendType MyBackendType
Definition: miscinit.c:63
bool InNoForceRLSOperation(void)
Definition: miscinit.c:668
PGDLLIMPORT volatile sig_atomic_t QueryCancelPending
Definition: globals.c:31
bool superuser_arg(Oid roleid)
Definition: superuser.c:56
PGDLLIMPORT char * session_preload_libraries_string
Definition: miscinit.c:1769
void PreventCommandDuringRecovery(const char *cmdname)
Definition: utility.c:448
PGDLLIMPORT volatile sig_atomic_t CheckClientConnectionPending
Definition: globals.c:33
void InitPostgres(const char *in_dbname, Oid dboid, const char *username, Oid useroid, bits32 flags, char *out_dbname)
Definition: postinit.c:721
bool stack_is_too_deep(void)
Definition: postgres.c:3537
PGDLLIMPORT pg_time_t MyStartTime
Definition: globals.c:46
PGDLLIMPORT volatile sig_atomic_t ProcDiePending
Definition: globals.c:32
void ProcessInterrupts(void)
Definition: postgres.c:3243
PGDLLIMPORT int VacuumBufferUsageLimit
Definition: globals.c:146
PGDLLIMPORT char pkglib_path[]
Definition: globals.c:78
PGDLLIMPORT char my_exec_path[]
Definition: globals.c:77
Oid GetCurrentRoleId(void)
Definition: miscinit.c:920
void checkDataDir(void)
Definition: miscinit.c:338
bool superuser(void)
Definition: superuser.c:46
PGDLLIMPORT pid_t PostmasterPid
Definition: globals.c:102
PGDLLIMPORT int32 MyCancelKey
Definition: globals.c:49
PGDLLIMPORT int VacuumCostPageMiss
Definition: globals.c:149
PGDLLIMPORT volatile uint32 QueryCancelHoldoffCount
Definition: globals.c:42
PGDLLIMPORT int64 VacuumPageMiss
Definition: globals.c:155
PGDLLIMPORT int work_mem
Definition: globals.c:128
void SwitchToSharedLatch(void)
Definition: miscinit.c:221
PGDLLIMPORT int DateStyle
Definition: globals.c:122
void GetUserIdAndContext(Oid *userid, bool *sec_def_context)
Definition: miscinit.c:681
BackendType
Definition: miscadmin.h:326
@ B_WAL_SUMMARIZER
Definition: miscadmin.h:340
@ B_WAL_WRITER
Definition: miscadmin.h:341
@ B_WAL_RECEIVER
Definition: miscadmin.h:338
@ B_CHECKPOINTER
Definition: miscadmin.h:334
@ B_WAL_SENDER
Definition: miscadmin.h:339
@ B_LOGGER
Definition: miscadmin.h:335
@ B_STARTUP
Definition: miscadmin.h:337
@ B_BG_WORKER
Definition: miscadmin.h:332
@ B_INVALID
Definition: miscadmin.h:327
@ B_STANDALONE_BACKEND
Definition: miscadmin.h:336
@ B_BG_WRITER
Definition: miscadmin.h:333
@ B_BACKEND
Definition: miscadmin.h:331
@ B_ARCHIVER
Definition: miscadmin.h:328
@ B_AUTOVAC_LAUNCHER
Definition: miscadmin.h:329
@ B_AUTOVAC_WORKER
Definition: miscadmin.h:330
void SetDataDir(const char *dir)
Definition: miscinit.c:431
PGDLLIMPORT volatile sig_atomic_t IdleSessionTimeoutPending
Definition: globals.c:37
PGDLLIMPORT Oid MyDatabaseId
Definition: globals.c:90
void SetUserIdAndContext(Oid userid, bool sec_def_context)
Definition: miscinit.c:688
PGDLLIMPORT char OutputFileName[]
Definition: globals.c:75
PGDLLIMPORT int max_worker_processes
Definition: globals.c:141
PGDLLIMPORT ProcessingMode Mode
Definition: miscinit.c:61
PGDLLIMPORT int64 VacuumPageHit
Definition: globals.c:154
void(* shmem_request_hook_type)(void)
Definition: miscadmin.h:503
void pg_bindtextdomain(const char *domain)
Definition: miscinit.c:1876
bool has_rolreplication(Oid roleid)
Definition: miscinit.c:708
PGDLLIMPORT char * DataDir
Definition: globals.c:67
PGDLLIMPORT int MaxBackends
Definition: globals.c:143
char * pg_stack_base_t
Definition: miscadmin.h:294
PGDLLIMPORT bool process_shared_preload_libraries_done
Definition: miscinit.c:1775
void ValidatePgVersion(const char *path)
Definition: miscinit.c:1706
PGDLLIMPORT volatile uint32 CritSectionCount
Definition: globals.c:43
void SetUserIdAndSecContext(Oid userid, int sec_context)
Definition: miscinit.c:639
bool RecheckDataDirLockFile(void)
Definition: miscinit.c:1634
void check_stack_depth(void)
Definition: postgres.c:3523
pg_stack_base_t set_stack_base(void)
Definition: postgres.c:3473
void CreateDataDirLockFile(bool amPostmaster)
Definition: miscinit.c:1451
AuxProcType
Definition: miscadmin.h:439
@ BgWriterProcess
Definition: miscadmin.h:442
@ StartupProcess
Definition: miscadmin.h:441
@ NUM_AUXPROCTYPES
Definition: miscadmin.h:449
@ NotAnAuxProcess
Definition: miscadmin.h:440
@ ArchiverProcess
Definition: miscadmin.h:443
@ WalWriterProcess
Definition: miscadmin.h:445
@ WalReceiverProcess
Definition: miscadmin.h:446
@ WalSummarizerProcess
Definition: miscadmin.h:447
@ CheckpointerProcess
Definition: miscadmin.h:444
void SwitchBackToLocalLatch(void)
Definition: miscinit.c:248
void CreateSocketLockFile(const char *socketfile, bool amPostmaster, const char *socketDir)
Definition: miscinit.c:1460
PGDLLIMPORT volatile sig_atomic_t TransactionTimeoutPending
Definition: globals.c:36
PGDLLIMPORT int max_parallel_workers
Definition: globals.c:142
PGDLLIMPORT int MyProcPid
Definition: globals.c:45
static char * argv0
Definition: pg_ctl.c:92
static bool is_superuser(Archive *fout)
Definition: pg_dump.c:4605
const char * username
Definition: pgbench.c:296
int64 pg_time_t
Definition: pgtime.h:23
unsigned int Oid
Definition: postgres_ext.h:31
Definition: latch.h:113
Definition: libpq-be.h:147