PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
globals.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * globals.c
4  * global variable declarations
5  *
6  * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  * src/backend/utils/init/globals.c
12  *
13  * NOTES
14  * Globals used all over the place should be declared here and not
15  * in other modules.
16  *
17  *-------------------------------------------------------------------------
18  */
19 #include "postgres.h"
20 
21 #include "libpq/libpq-be.h"
22 #include "libpq/pqcomm.h"
23 #include "miscadmin.h"
24 #include "storage/backendid.h"
25 
26 
28 
29 volatile bool InterruptPending = false;
30 volatile bool QueryCancelPending = false;
31 volatile bool ProcDiePending = false;
32 volatile bool ClientConnectionLost = false;
35 volatile uint32 CritSectionCount = 0;
36 
39 struct Port *MyProcPort;
42 
43 /*
44  * MyLatch points to the latch that should be used for signal handling by the
45  * current process. It will either point to a process local latch if the
46  * current process does not have a PGPROC entry in that moment, or to
47  * PGPROC->procLatch if it has. Thus it can always be used in signal handlers,
48  * without checking for its existence.
49  */
50 struct Latch *MyLatch;
51 
52 /*
53  * DataDir is the absolute path to the top level of the PGDATA directory tree.
54  * Except during early startup, this is also the server's working directory;
55  * most code therefore can simply use relative paths and not reference DataDir
56  * explicitly.
57  */
58 char *DataDir = NULL;
59 
60 char OutputFileName[MAXPGPATH]; /* debugging output file */
61 
62 char my_exec_path[MAXPGPATH]; /* full path to my executable */
63 char pkglib_path[MAXPGPATH]; /* full path to lib directory */
64 
65 #ifdef EXEC_BACKEND
66 char postgres_exec_path[MAXPGPATH]; /* full path to backend */
67 
68 /* note: currently this is not valid in backend processes */
69 #endif
70 
72 
74 
76 
77 /*
78  * DatabasePath is the path (relative to DataDir) of my database's
79  * primary directory, ie, its directory in the default tablespace.
80  */
82 
83 pid_t PostmasterPid = 0;
84 
85 /*
86  * IsPostmasterEnvironment is true in a postmaster process and any postmaster
87  * child process; it is false in a standalone process (bootstrap or
88  * standalone backend). IsUnderPostmaster is true in postmaster child
89  * processes. Note that "child process" includes all children, not only
90  * regular backends. These should be set correctly as early as possible
91  * in the execution of a process, so that error handling will do the right
92  * things if an error should occur during process initialization.
93  *
94  * These are initialized for the bootstrap/standalone case.
95  */
97 bool IsUnderPostmaster = false;
98 bool IsBinaryUpgrade = false;
99 bool IsBackgroundWorker = false;
100 
101 bool ExitOnAnyError = false;
102 
106 
107 bool enableFsync = true;
108 bool allowSystemTableMods = false;
109 int work_mem = 1024;
111 
112 /*
113  * Primary determinants of sizes of shared-memory structures.
114  *
115  * MaxBackends is computed by PostmasterMain after modules have had a chance to
116  * register background workers.
117  */
118 int NBuffers = 1000;
119 int MaxConnections = 90;
121 int MaxBackends = 0;
122 
123 int VacuumCostPageHit = 1; /* GUC parameters for vacuum */
126 int VacuumCostLimit = 200;
128 
132 
133 int VacuumCostBalance = 0; /* working state for vacuum */
134 bool VacuumCostActive = false;