File tree 2 files changed +11
-6
lines changed
2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.114 2001/10/28 06:25:50 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.115 2001/11/06 00:38:26 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -124,10 +124,13 @@ InitProcGlobal(int maxBackends)
124
124
125
125
/*
126
126
* Compute size for ProcGlobal structure. Note we need one more sema
127
- * besides those used for regular backends.
127
+ * besides those used for regular backends; this is accounted for in
128
+ * the PROC_SEM_MAP_ENTRIES macro. (We do it that way so that other
129
+ * modules that use PROC_SEM_MAP_ENTRIES(maxBackends) to size data
130
+ * structures don't have to know about this explicitly.)
128
131
*/
129
132
Assert (maxBackends > 0 );
130
- semMapEntries = PROC_SEM_MAP_ENTRIES (maxBackends + 1 );
133
+ semMapEntries = PROC_SEM_MAP_ENTRIES (maxBackends );
131
134
procGlobalSize = sizeof (PROC_HDR ) + (semMapEntries - 1 ) * sizeof (SEM_MAP_ENTRY );
132
135
133
136
/* Create or attach to the ProcGlobal shared structure */
Original file line number Diff line number Diff line change 7
7
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $Id: proc.h,v 1.53 2001/11/05 17:46:35 momjian Exp $
10
+ * $Id: proc.h,v 1.54 2001/11/06 00:38:26 tgl Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -93,10 +93,12 @@ extern PROC *MyProc;
93
93
* in each set for identification purposes.)
94
94
*
95
95
* PROC_SEM_MAP_ENTRIES is the number of semaphore sets we need to allocate
96
- * to keep track of up to maxBackends backends.
96
+ * to keep track of up to maxBackends backends. Note that we need one extra
97
+ * semaphore (see storage/lmgr/proc.c), so the computation may look wrong,
98
+ * but it's right.
97
99
*/
98
100
#define PROC_NSEMS_PER_SET 16
99
- #define PROC_SEM_MAP_ENTRIES (maxBackends ) ((( maxBackends)-1 )/PROC_NSEMS_PER_SET+1)
101
+ #define PROC_SEM_MAP_ENTRIES (maxBackends ) ((maxBackends)/PROC_NSEMS_PER_SET+1)
100
102
101
103
typedef struct
102
104
{
You can’t perform that action at this time.
0 commit comments