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-2014, 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;
33 volatile bool ImmediateInterruptOK = false;
35 volatile uint32 CritSectionCount = 0;
36 
39 struct Port *MyProcPort;
42 
43 /*
44  * DataDir is the absolute path to the top level of the PGDATA directory tree.
45  * Except during early startup, this is also the server's working directory;
46  * most code therefore can simply use relative paths and not reference DataDir
47  * explicitly.
48  */
49 char *DataDir = NULL;
50 
51 char OutputFileName[MAXPGPATH]; /* debugging output file */
52 
53 char my_exec_path[MAXPGPATH]; /* full path to my executable */
54 char pkglib_path[MAXPGPATH]; /* full path to lib directory */
55 
56 #ifdef EXEC_BACKEND
57 char postgres_exec_path[MAXPGPATH]; /* full path to backend */
58 
59 /* note: currently this is not valid in backend processes */
60 #endif
61 
63 
65 
67 
68 /*
69  * DatabasePath is the path (relative to DataDir) of my database's
70  * primary directory, ie, its directory in the default tablespace.
71  */
73 
74 pid_t PostmasterPid = 0;
75 
76 /*
77  * IsPostmasterEnvironment is true in a postmaster process and any postmaster
78  * child process; it is false in a standalone process (bootstrap or
79  * standalone backend). IsUnderPostmaster is true in postmaster child
80  * processes. Note that "child process" includes all children, not only
81  * regular backends. These should be set correctly as early as possible
82  * in the execution of a process, so that error handling will do the right
83  * things if an error should occur during process initialization.
84  *
85  * These are initialized for the bootstrap/standalone case.
86  */
88 bool IsUnderPostmaster = false;
89 bool IsBinaryUpgrade = false;
90 bool IsBackgroundWorker = false;
91 
92 bool ExitOnAnyError = false;
93 
97 
98 bool enableFsync = true;
99 bool allowSystemTableMods = false;
100 int work_mem = 1024;
102 
103 /*
104  * Primary determinants of sizes of shared-memory structures.
105  *
106  * MaxBackends is computed by PostmasterMain after modules have had a chance to
107  * register background workers.
108  */
109 int NBuffers = 1000;
110 int MaxConnections = 90;
112 int MaxBackends = 0;
113 
114 int VacuumCostPageHit = 1; /* GUC parameters for vacuum */
117 int VacuumCostLimit = 200;
119 
123 
124 int VacuumCostBalance = 0; /* working state for vacuum */
125 bool VacuumCostActive = false;