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-2023, 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 IdleSessionTimeoutPending;
95 extern PGDLLIMPORT volatile sig_atomic_t ProcSignalBarrierPending;
96 extern PGDLLIMPORT volatile sig_atomic_t LogMemoryContextPending;
97 extern PGDLLIMPORT volatile sig_atomic_t IdleStatsUpdateTimeoutPending;
98 
99 extern PGDLLIMPORT volatile sig_atomic_t CheckClientConnectionPending;
100 extern PGDLLIMPORT volatile sig_atomic_t ClientConnectionLost;
101 
102 /* these are marked volatile because they are examined by signal handlers: */
105 extern PGDLLIMPORT volatile uint32 CritSectionCount;
106 
107 /* in tcop/postgres.c */
108 extern void ProcessInterrupts(void);
109 
110 /* Test whether an interrupt is pending */
111 #ifndef WIN32
112 #define INTERRUPTS_PENDING_CONDITION() \
113  (unlikely(InterruptPending))
114 #else
115 #define INTERRUPTS_PENDING_CONDITION() \
116  (unlikely(UNBLOCKED_SIGNAL_QUEUE()) ? pgwin32_dispatch_queued_signals() : 0, \
117  unlikely(InterruptPending))
118 #endif
119 
120 /* Service interrupt, if one is pending and it's safe to service it now */
121 #define CHECK_FOR_INTERRUPTS() \
122 do { \
123  if (INTERRUPTS_PENDING_CONDITION()) \
124  ProcessInterrupts(); \
125 } while(0)
126 
127 /* Is ProcessInterrupts() guaranteed to clear InterruptPending? */
128 #define INTERRUPTS_CAN_BE_PROCESSED() \
129  (InterruptHoldoffCount == 0 && CritSectionCount == 0 && \
130  QueryCancelHoldoffCount == 0)
131 
132 #define HOLD_INTERRUPTS() (InterruptHoldoffCount++)
133 
134 #define RESUME_INTERRUPTS() \
135 do { \
136  Assert(InterruptHoldoffCount > 0); \
137  InterruptHoldoffCount--; \
138 } while(0)
139 
140 #define HOLD_CANCEL_INTERRUPTS() (QueryCancelHoldoffCount++)
141 
142 #define RESUME_CANCEL_INTERRUPTS() \
143 do { \
144  Assert(QueryCancelHoldoffCount > 0); \
145  QueryCancelHoldoffCount--; \
146 } while(0)
147 
148 #define START_CRIT_SECTION() (CritSectionCount++)
149 
150 #define END_CRIT_SECTION() \
151 do { \
152  Assert(CritSectionCount > 0); \
153  CritSectionCount--; \
154 } while(0)
155 
156 
157 /*****************************************************************************
158  * globals.h -- *
159  *****************************************************************************/
160 
161 /*
162  * from utils/init/globals.c
163  */
164 extern PGDLLIMPORT pid_t PostmasterPid;
166 extern PGDLLIMPORT bool IsUnderPostmaster;
167 extern PGDLLIMPORT bool IsBackgroundWorker;
168 extern PGDLLIMPORT bool IsBinaryUpgrade;
169 
170 extern PGDLLIMPORT bool ExitOnAnyError;
171 
172 extern PGDLLIMPORT char *DataDir;
174 
175 extern PGDLLIMPORT int NBuffers;
176 extern PGDLLIMPORT int MaxBackends;
177 extern PGDLLIMPORT int MaxConnections;
180 
181 extern PGDLLIMPORT int MyProcPid;
184 extern PGDLLIMPORT struct Port *MyProcPort;
185 extern PGDLLIMPORT struct Latch *MyLatch;
187 extern PGDLLIMPORT int MyPMChildSlot;
188 
189 extern PGDLLIMPORT char OutputFileName[];
190 extern PGDLLIMPORT char my_exec_path[];
191 extern PGDLLIMPORT char pkglib_path[];
192 
193 #ifdef EXEC_BACKEND
194 extern PGDLLIMPORT char postgres_exec_path[];
195 #endif
196 
197 /*
198  * done in storage/backendid.h for now.
199  *
200  * extern BackendId MyBackendId;
201  */
203 
205 
206 /*
207  * Date/Time Configuration
208  *
209  * DateStyle defines the output formatting choice for date/time types:
210  * USE_POSTGRES_DATES specifies traditional Postgres format
211  * USE_ISO_DATES specifies ISO-compliant format
212  * USE_SQL_DATES specifies Oracle/Ingres-compliant format
213  * USE_GERMAN_DATES specifies German-style dd.mm/yyyy
214  *
215  * DateOrder defines the field order to be assumed when reading an
216  * ambiguous date (anything not in YYYY-MM-DD format, with a four-digit
217  * year field first, is taken to be ambiguous):
218  * DATEORDER_YMD specifies field order yy-mm-dd
219  * DATEORDER_DMY specifies field order dd-mm-yy ("European" convention)
220  * DATEORDER_MDY specifies field order mm-dd-yy ("US" convention)
221  *
222  * In the Postgres and SQL DateStyles, DateOrder also selects output field
223  * order: day comes before month in DMY style, else month comes before day.
224  *
225  * The user-visible "DateStyle" run-time parameter subsumes both of these.
226  */
227 
228 /* valid DateStyle values */
229 #define USE_POSTGRES_DATES 0
230 #define USE_ISO_DATES 1
231 #define USE_SQL_DATES 2
232 #define USE_GERMAN_DATES 3
233 #define USE_XSD_DATES 4
234 
235 /* valid DateOrder values */
236 #define DATEORDER_YMD 0
237 #define DATEORDER_DMY 1
238 #define DATEORDER_MDY 2
239 
240 extern PGDLLIMPORT int DateStyle;
241 extern PGDLLIMPORT int DateOrder;
242 
243 /*
244  * IntervalStyles
245  * INTSTYLE_POSTGRES Like Postgres < 8.4 when DateStyle = 'iso'
246  * INTSTYLE_POSTGRES_VERBOSE Like Postgres < 8.4 when DateStyle != 'iso'
247  * INTSTYLE_SQL_STANDARD SQL standard interval literals
248  * INTSTYLE_ISO_8601 ISO-8601-basic formatted intervals
249  */
250 #define INTSTYLE_POSTGRES 0
251 #define INTSTYLE_POSTGRES_VERBOSE 1
252 #define INTSTYLE_SQL_STANDARD 2
253 #define INTSTYLE_ISO_8601 3
254 
255 extern PGDLLIMPORT int IntervalStyle;
256 
257 #define MAXTZLEN 10 /* max TZ name len, not counting tr. null */
258 
259 extern PGDLLIMPORT bool enableFsync;
261 extern PGDLLIMPORT int work_mem;
262 extern PGDLLIMPORT double hash_mem_multiplier;
265 
266 extern PGDLLIMPORT int VacuumCostPageHit;
269 extern PGDLLIMPORT int VacuumCostLimit;
270 extern PGDLLIMPORT double VacuumCostDelay;
271 
272 extern PGDLLIMPORT int64 VacuumPageHit;
273 extern PGDLLIMPORT int64 VacuumPageMiss;
274 extern PGDLLIMPORT int64 VacuumPageDirty;
275 
276 extern PGDLLIMPORT int VacuumCostBalance;
277 extern PGDLLIMPORT bool VacuumCostActive;
278 
279 
280 /* in tcop/postgres.c */
281 
282 typedef char *pg_stack_base_t;
283 
284 extern pg_stack_base_t set_stack_base(void);
285 extern void restore_stack_base(pg_stack_base_t base);
286 extern void check_stack_depth(void);
287 extern bool stack_is_too_deep(void);
288 
289 /* in tcop/utility.c */
290 extern void PreventCommandIfReadOnly(const char *cmdname);
291 extern void PreventCommandIfParallelMode(const char *cmdname);
292 extern void PreventCommandDuringRecovery(const char *cmdname);
293 
294 /* in utils/misc/guc_tables.c */
296 extern int trace_recovery(int trace_level);
297 
298 /*****************************************************************************
299  * pdir.h -- *
300  * POSTGRES directory path definitions. *
301  *****************************************************************************/
302 
303 /* flags to be OR'd to form sec_context */
304 #define SECURITY_LOCAL_USERID_CHANGE 0x0001
305 #define SECURITY_RESTRICTED_OPERATION 0x0002
306 #define SECURITY_NOFORCE_RLS 0x0004
307 
308 extern PGDLLIMPORT char *DatabasePath;
309 
310 /* now in utils/init/miscinit.c */
311 extern void InitPostmasterChild(void);
312 extern void InitStandaloneProcess(const char *argv0);
313 extern void InitProcessLocalLatch(void);
314 extern void SwitchToSharedLatch(void);
315 extern void SwitchBackToLocalLatch(void);
316 
317 typedef enum BackendType
318 {
334 
335 #define BACKEND_NUM_TYPES (B_WAL_WRITER + 1)
336 
338 
339 extern const char *GetBackendTypeDesc(BackendType backendType);
340 
341 extern void SetDatabasePath(const char *path);
342 extern void checkDataDir(void);
343 extern void SetDataDir(const char *dir);
344 extern void ChangeToDataDir(void);
345 
346 extern char *GetUserNameFromId(Oid roleid, bool noerr);
347 extern Oid GetUserId(void);
348 extern Oid GetOuterUserId(void);
349 extern Oid GetSessionUserId(void);
350 extern Oid GetAuthenticatedUserId(void);
351 extern void GetUserIdAndSecContext(Oid *userid, int *sec_context);
352 extern void SetUserIdAndSecContext(Oid userid, int sec_context);
353 extern bool InLocalUserIdChange(void);
354 extern bool InSecurityRestrictedOperation(void);
355 extern bool InNoForceRLSOperation(void);
356 extern void GetUserIdAndContext(Oid *userid, bool *sec_def_context);
357 extern void SetUserIdAndContext(Oid userid, bool sec_def_context);
358 extern void InitializeSessionUserId(const char *rolename, Oid roleid);
359 extern void InitializeSessionUserIdStandalone(void);
360 extern void SetSessionAuthorization(Oid userid, bool is_superuser);
361 extern Oid GetCurrentRoleId(void);
362 extern void SetCurrentRoleId(Oid roleid, bool is_superuser);
363 extern void InitializeSystemUser(const char *authn_id,
364  const char *auth_method);
365 extern const char *GetSystemUser(void);
366 
367 /* in utils/misc/superuser.c */
368 extern bool superuser(void); /* current user is superuser */
369 extern bool superuser_arg(Oid roleid); /* given user is superuser */
370 
371 
372 /*****************************************************************************
373  * pmod.h -- *
374  * POSTGRES processing mode definitions. *
375  *****************************************************************************/
376 
377 /*
378  * Description:
379  * There are three processing modes in POSTGRES. They are
380  * BootstrapProcessing or "bootstrap," InitProcessing or
381  * "initialization," and NormalProcessing or "normal."
382  *
383  * The first two processing modes are used during special times. When the
384  * system state indicates bootstrap processing, transactions are all given
385  * transaction id "one" and are consequently guaranteed to commit. This mode
386  * is used during the initial generation of template databases.
387  *
388  * Initialization mode: used while starting a backend, until all normal
389  * initialization is complete. Some code behaves differently when executed
390  * in this mode to enable system bootstrapping.
391  *
392  * If a POSTGRES backend process is in normal mode, then all code may be
393  * executed normally.
394  */
395 
396 typedef enum ProcessingMode
397 {
398  BootstrapProcessing, /* bootstrap creation of template database */
399  InitProcessing, /* initializing system */
400  NormalProcessing /* normal processing */
402 
404 
405 #define IsBootstrapProcessingMode() (Mode == BootstrapProcessing)
406 #define IsInitProcessingMode() (Mode == InitProcessing)
407 #define IsNormalProcessingMode() (Mode == NormalProcessing)
408 
409 #define GetProcessingMode() Mode
410 
411 #define SetProcessingMode(mode) \
412  do { \
413  Assert((mode) == BootstrapProcessing || \
414  (mode) == InitProcessing || \
415  (mode) == NormalProcessing); \
416  Mode = (mode); \
417  } while(0)
418 
419 
420 /*
421  * Auxiliary-process type identifiers. These used to be in bootstrap.h
422  * but it seems saner to have them here, with the ProcessingMode stuff.
423  * The MyAuxProcType global is defined and set in auxprocess.c.
424  *
425  * Make sure to list in the glossary any items you add here.
426  */
427 
428 typedef enum
429 {
437 
438  NUM_AUXPROCTYPES /* Must be last! */
440 
442 
443 #define AmStartupProcess() (MyAuxProcType == StartupProcess)
444 #define AmBackgroundWriterProcess() (MyAuxProcType == BgWriterProcess)
445 #define AmArchiverProcess() (MyAuxProcType == ArchiverProcess)
446 #define AmCheckpointerProcess() (MyAuxProcType == CheckpointerProcess)
447 #define AmWalWriterProcess() (MyAuxProcType == WalWriterProcess)
448 #define AmWalReceiverProcess() (MyAuxProcType == WalReceiverProcess)
449 
450 
451 /*****************************************************************************
452  * pinit.h -- *
453  * POSTGRES initialization and cleanup definitions. *
454  *****************************************************************************/
455 
456 /* in utils/init/postinit.c */
457 extern void pg_split_opts(char **argv, int *argcp, const char *optstr);
458 extern void InitializeMaxBackends(void);
459 extern void InitPostgres(const char *in_dbname, Oid dboid,
460  const char *username, Oid useroid,
461  bool load_session_libraries,
462  bool override_allow_connections,
463  char *out_dbname);
464 extern void BaseInit(void);
465 
466 /* in utils/init/miscinit.c */
467 extern PGDLLIMPORT bool IgnoreSystemIndexes;
474 
475 extern void CreateDataDirLockFile(bool amPostmaster);
476 extern void CreateSocketLockFile(const char *socketfile, bool amPostmaster,
477  const char *socketDir);
478 extern void TouchSocketLockFiles(void);
479 extern void AddToDataDirLockFile(int target_line, const char *str);
480 extern bool RecheckDataDirLockFile(void);
481 extern void ValidatePgVersion(const char *path);
482 extern void process_shared_preload_libraries(void);
483 extern void process_session_preload_libraries(void);
484 extern void process_shmem_requests(void);
485 extern void pg_bindtextdomain(const char *domain);
486 extern bool has_rolreplication(Oid roleid);
487 
488 typedef void (*shmem_request_hook_type) (void);
490 
492 extern void SerializeClientConnectionInfo(Size maxsize, char *start_address);
493 extern void RestoreClientConnectionInfo(char *conninfo);
494 
495 /* in executor/nodeHash.c */
496 extern size_t get_hash_memory_limit(void);
497 
498 #endif /* MISCADMIN_H */
unsigned int uint32
Definition: c.h:490
#define PGDLLIMPORT
Definition: c.h:1303
signed int int32
Definition: c.h:478
size_t Size
Definition: c.h:589
int64 TimestampTz
Definition: timestamp.h:39
PGDLLIMPORT int IntervalStyle
Definition: globals.c:121
PGDLLIMPORT shmem_request_hook_type shmem_request_hook
Definition: miscinit.c:1785
PGDLLIMPORT double VacuumCostDelay
Definition: globals.c:146
void ChangeToDataDir(void)
Definition: miscinit.c:449
char * GetUserNameFromId(Oid roleid, bool noerr)
Definition: miscinit.c:984
PGDLLIMPORT bool IsPostmasterEnvironment
Definition: globals.c:112
Oid GetOuterUserId(void)
Definition: miscinit.c:521
void process_shmem_requests(void)
Definition: miscinit.c:1875
PGDLLIMPORT struct Port * MyProcPort
Definition: globals.c:47
void restore_stack_base(pg_stack_base_t base)
Definition: postgres.c:3444
void InitializeMaxBackends(void)
Definition: postinit.c:563
void PreventCommandIfReadOnly(const char *cmdname)
Definition: utility.c:411
PGDLLIMPORT volatile uint32 InterruptHoldoffCount
Definition: globals.c:40
ProcessingMode
Definition: miscadmin.h:397
@ NormalProcessing
Definition: miscadmin.h:400
@ InitProcessing
Definition: miscadmin.h:399
@ BootstrapProcessing
Definition: miscadmin.h:398
void pg_split_opts(char **argv, int *argcp, const char *optstr)
Definition: postinit.c:505
void InitStandaloneProcess(const char *argv0)
Definition: miscinit.c:182
void SerializeClientConnectionInfo(Size maxsize, char *start_address)
Definition: miscinit.c:1047
void PreventCommandIfParallelMode(const char *cmdname)
Definition: utility.c:429
PGDLLIMPORT bool IsUnderPostmaster
Definition: globals.c:113
void InitializeSystemUser(const char *authn_id, const char *auth_method)
Definition: miscinit.c:855
PGDLLIMPORT int VacuumCostBalance
Definition: globals.c:152
PGDLLIMPORT Oid MyDatabaseTableSpace
Definition: globals.c:91
void InitializeSessionUserIdStandalone(void)
Definition: miscinit.c:832
void AddToDataDirLockFile(int target_line, const char *str)
Definition: miscinit.c:1515
void InitProcessLocalLatch(void)
Definition: miscinit.c:242
void BaseInit(void)
Definition: postinit.c:633
PGDLLIMPORT int maintenance_work_mem
Definition: globals.c:127
void GetUserIdAndSecContext(Oid *userid, int *sec_context)
Definition: miscinit.c:631
void SetSessionAuthorization(Oid userid, bool is_superuser)
Definition: miscinit.c:903
void process_session_preload_libraries(void)
Definition: miscinit.c:1861
PGDLLIMPORT bool enableFsync
Definition: globals.c:123
PGDLLIMPORT bool ExitOnAnyError
Definition: globals.c:117
PGDLLIMPORT volatile sig_atomic_t IdleInTransactionSessionTimeoutPending
Definition: globals.c:35
bool InSecurityRestrictedOperation(void)
Definition: miscinit.c:658
PGDLLIMPORT char * shared_preload_libraries_string
Definition: miscinit.c:1778
Oid GetUserId(void)
Definition: miscinit.c:510
PGDLLIMPORT AuxProcType MyAuxProcType
Definition: auxprocess.c:45
PGDLLIMPORT bool allowSystemTableMods
Definition: globals.c:124
PGDLLIMPORT bool IsBinaryUpgrade
Definition: globals.c:114
Size EstimateClientConnectionInfoSpace(void)
Definition: miscinit.c:1031
PGDLLIMPORT volatile sig_atomic_t LogMemoryContextPending
Definition: globals.c:38
const char * GetSystemUser(void)
Definition: miscinit.c:570
PGDLLIMPORT int VacuumCostPageDirty
Definition: globals.c:144
PGDLLIMPORT int data_directory_mode
Definition: globals.c:72
Oid GetSessionUserId(void)
Definition: miscinit.c:544
void SetCurrentRoleId(Oid roleid, bool is_superuser)
Definition: miscinit.c:949
PGDLLIMPORT bool VacuumCostActive
Definition: globals.c:153
PGDLLIMPORT volatile sig_atomic_t InterruptPending
Definition: globals.c:30
PGDLLIMPORT bool IgnoreSystemIndexes
Definition: miscinit.c:80
Oid GetAuthenticatedUserId(void)
Definition: miscinit.c:579
PGDLLIMPORT int VacuumCostLimit
Definition: globals.c:145
PGDLLIMPORT volatile sig_atomic_t ProcSignalBarrierPending
Definition: globals.c:37
PGDLLIMPORT int MaxConnections
Definition: globals.c:137
PGDLLIMPORT int NBuffers
Definition: globals.c:136
bool InLocalUserIdChange(void)
Definition: miscinit.c:649
PGDLLIMPORT int VacuumCostPageHit
Definition: globals.c:142
PGDLLIMPORT bool process_shmem_requests_in_progress
Definition: miscinit.c:1786
void SetDatabasePath(const char *path)
Definition: miscinit.c:323
void InitPostmasterChild(void)
Definition: miscinit.c:95
void InitializeSessionUserId(const char *rolename, Oid roleid)
Definition: miscinit.c:729
void process_shared_preload_libraries(void)
Definition: miscinit.c:1847
PGDLLIMPORT volatile sig_atomic_t IdleStatsUpdateTimeoutPending
Definition: globals.c:39
PGDLLIMPORT bool process_shared_preload_libraries_in_progress
Definition: miscinit.c:1782
PGDLLIMPORT struct Latch * MyLatch
Definition: globals.c:58
PGDLLIMPORT TimestampTz MyStartTimestamp
Definition: globals.c:46
PGDLLIMPORT char * DatabasePath
Definition: globals.c:97
const char * GetBackendTypeDesc(BackendType backendType)
Definition: miscinit.c:264
PGDLLIMPORT int MyPMChildSlot
Definition: globals.c:49
void TouchSocketLockFiles(void)
Definition: miscinit.c:1486
PGDLLIMPORT double hash_mem_multiplier
Definition: globals.c:126
size_t get_hash_memory_limit(void)
Definition: nodeHash.c:3407
PGDLLIMPORT volatile sig_atomic_t ClientConnectionLost
Definition: globals.c:34
void RestoreClientConnectionInfo(char *conninfo)
Definition: miscinit.c:1079
PGDLLIMPORT int DateOrder
Definition: globals.c:120
PGDLLIMPORT bool IsBackgroundWorker
Definition: globals.c:115
PGDLLIMPORT int64 VacuumPageDirty
Definition: globals.c:150
PGDLLIMPORT int max_parallel_maintenance_workers
Definition: globals.c:128
PGDLLIMPORT char * local_preload_libraries_string
Definition: miscinit.c:1779
PGDLLIMPORT BackendType MyBackendType
Definition: miscinit.c:63
bool InNoForceRLSOperation(void)
Definition: miscinit.c:667
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:1777
void PreventCommandDuringRecovery(const char *cmdname)
Definition: utility.c:448
PGDLLIMPORT volatile sig_atomic_t CheckClientConnectionPending
Definition: globals.c:33
bool stack_is_too_deep(void)
Definition: postgres.c:3475
PGDLLIMPORT pg_time_t MyStartTime
Definition: globals.c:45
PGDLLIMPORT volatile sig_atomic_t ProcDiePending
Definition: globals.c:32
void ProcessInterrupts(void)
Definition: postgres.c:3149
PGDLLIMPORT char pkglib_path[]
Definition: globals.c:77
PGDLLIMPORT char my_exec_path[]
Definition: globals.c:76
Oid GetCurrentRoleId(void)
Definition: miscinit.c:928
void checkDataDir(void)
Definition: miscinit.c:336
bool superuser(void)
Definition: superuser.c:46
PGDLLIMPORT pid_t PostmasterPid
Definition: globals.c:99
PGDLLIMPORT int32 MyCancelKey
Definition: globals.c:48
PGDLLIMPORT int VacuumCostPageMiss
Definition: globals.c:143
PGDLLIMPORT volatile uint32 QueryCancelHoldoffCount
Definition: globals.c:41
PGDLLIMPORT int trace_recovery_messages
Definition: guc_tables.c:520
PGDLLIMPORT int64 VacuumPageMiss
Definition: globals.c:149
PGDLLIMPORT int work_mem
Definition: globals.c:125
void SwitchToSharedLatch(void)
Definition: miscinit.c:222
PGDLLIMPORT int DateStyle
Definition: globals.c:119
void GetUserIdAndContext(Oid *userid, bool *sec_def_context)
Definition: miscinit.c:680
BackendType
Definition: miscadmin.h:318
@ B_WAL_WRITER
Definition: miscadmin.h:332
@ B_WAL_RECEIVER
Definition: miscadmin.h:330
@ B_CHECKPOINTER
Definition: miscadmin.h:326
@ B_WAL_SENDER
Definition: miscadmin.h:331
@ B_LOGGER
Definition: miscadmin.h:327
@ B_STARTUP
Definition: miscadmin.h:329
@ B_BG_WORKER
Definition: miscadmin.h:324
@ B_INVALID
Definition: miscadmin.h:319
@ B_STANDALONE_BACKEND
Definition: miscadmin.h:328
@ B_BG_WRITER
Definition: miscadmin.h:325
@ B_BACKEND
Definition: miscadmin.h:323
@ B_ARCHIVER
Definition: miscadmin.h:320
@ B_AUTOVAC_LAUNCHER
Definition: miscadmin.h:321
@ B_AUTOVAC_WORKER
Definition: miscadmin.h:322
void SetDataDir(const char *dir)
Definition: miscinit.c:429
PGDLLIMPORT volatile sig_atomic_t IdleSessionTimeoutPending
Definition: globals.c:36
PGDLLIMPORT Oid MyDatabaseId
Definition: globals.c:89
void SetUserIdAndContext(Oid userid, bool sec_def_context)
Definition: miscinit.c:687
PGDLLIMPORT char OutputFileName[]
Definition: globals.c:74
PGDLLIMPORT int max_worker_processes
Definition: globals.c:138
PGDLLIMPORT ProcessingMode Mode
Definition: miscinit.c:61
PGDLLIMPORT int64 VacuumPageHit
Definition: globals.c:148
void InitPostgres(const char *in_dbname, Oid dboid, const char *username, Oid useroid, bool load_session_libraries, bool override_allow_connections, char *out_dbname)
Definition: postinit.c:722
void(* shmem_request_hook_type)(void)
Definition: miscadmin.h:488
void pg_bindtextdomain(const char *domain)
Definition: miscinit.c:1884
bool has_rolreplication(Oid roleid)
Definition: miscinit.c:707
PGDLLIMPORT char * DataDir
Definition: globals.c:66
PGDLLIMPORT int MaxBackends
Definition: globals.c:140
char * pg_stack_base_t
Definition: miscadmin.h:282
PGDLLIMPORT bool process_shared_preload_libraries_done
Definition: miscinit.c:1783
void ValidatePgVersion(const char *path)
Definition: miscinit.c:1714
PGDLLIMPORT volatile uint32 CritSectionCount
Definition: globals.c:42
void SetUserIdAndSecContext(Oid userid, int sec_context)
Definition: miscinit.c:638
bool RecheckDataDirLockFile(void)
Definition: miscinit.c:1642
void check_stack_depth(void)
Definition: postgres.c:3461
pg_stack_base_t set_stack_base(void)
Definition: postgres.c:3411
void CreateDataDirLockFile(bool amPostmaster)
Definition: miscinit.c:1459
AuxProcType
Definition: miscadmin.h:429
@ BgWriterProcess
Definition: miscadmin.h:432
@ StartupProcess
Definition: miscadmin.h:431
@ NUM_AUXPROCTYPES
Definition: miscadmin.h:438
@ NotAnAuxProcess
Definition: miscadmin.h:430
@ ArchiverProcess
Definition: miscadmin.h:433
@ WalWriterProcess
Definition: miscadmin.h:435
@ WalReceiverProcess
Definition: miscadmin.h:436
@ CheckpointerProcess
Definition: miscadmin.h:434
int trace_recovery(int trace_level)
Definition: elog.c:3749
void SwitchBackToLocalLatch(void)
Definition: miscinit.c:249
void CreateSocketLockFile(const char *socketfile, bool amPostmaster, const char *socketDir)
Definition: miscinit.c:1468
PGDLLIMPORT int max_parallel_workers
Definition: globals.c:139
PGDLLIMPORT int MyProcPid
Definition: globals.c:44
static char * argv0
Definition: pg_ctl.c:92
static bool is_superuser(Archive *fout)
Definition: pg_dump.c:4574
const char * username
Definition: pgbench.c:306
int64 pg_time_t
Definition: pgtime.h:23
unsigned int Oid
Definition: postgres_ext.h:31
Definition: latch.h:111
Definition: libpq-be.h:146