4
4
* Stub main() routine for the postgres executable.
5
5
*
6
6
* This does some essential startup tasks for any incarnation of postgres
7
- * (postmaster, standalone backend, or standalone bootstrap mode) and then
8
- * dispatches to the proper FooMain() routine for the incarnation.
7
+ * (postmaster, standalone backend, standalone bootstrap process, or a
8
+ * separately exec'd child of a postmaster) and then dispatches to the
9
+ * proper FooMain() routine for the incarnation.
9
10
*
10
11
*
11
12
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
@@ -54,7 +55,9 @@ static void check_root(const char *progname);
54
55
static char * get_current_username (const char * progname );
55
56
56
57
57
-
58
+ /*
59
+ * Any Postgres server process begins execution here.
60
+ */
58
61
int
59
62
main (int argc , char * argv [])
60
63
{
@@ -192,10 +195,10 @@ main(int argc, char *argv[])
192
195
193
196
/*
194
197
* Place platform-specific startup hacks here. This is the right
195
- * place to put code that must be executed early in launch of either a
196
- * postmaster, a standalone backend, or a standalone bootstrap run.
197
- * Note that this code will NOT be executed when a backend or
198
- * sub-bootstrap run is forked by the server .
198
+ * place to put code that must be executed early in the launch of any new
199
+ * server process. Note that this code will NOT be executed when a backend
200
+ * or sub-bootstrap process is forked, unless we are in a fork/exec
201
+ * environment (ie EXEC_BACKEND is defined) .
199
202
*
200
203
* XXX The need for code here is proof that the platform in question
201
204
* is too brain-dead to provide a standard C execution environment
@@ -204,17 +207,10 @@ main(int argc, char *argv[])
204
207
static void
205
208
startup_hacks (const char * progname )
206
209
{
207
- #if defined(__alpha ) /* no __alpha__ ? */
208
- #ifdef NOFIXADE
209
- int buffer [] = {SSIN_UACPROC , UAC_SIGBUS | UAC_NOPRINT };
210
- #endif
211
- #endif /* __alpha */
212
-
213
-
214
210
/*
215
211
* On some platforms, unaligned memory accesses result in a kernel trap;
216
212
* the default kernel behavior is to emulate the memory access, but this
217
- * results in a significant performance penalty. We ought to fix PG not to
213
+ * results in a significant performance penalty. We want PG never to
218
214
* make such unaligned memory accesses, so this code disables the kernel
219
215
* emulation: unaligned accesses will result in SIGBUS instead.
220
216
*/
@@ -225,14 +221,21 @@ startup_hacks(const char *progname)
225
221
#endif
226
222
227
223
#if defined(__alpha ) /* no __alpha__ ? */
228
- if (setsysinfo (SSI_NVPAIRS , buffer , 1 , (caddr_t ) NULL ,
229
- (unsigned long ) NULL ) < 0 )
230
- write_stderr ("%s: setsysinfo failed: %s\n" ,
231
- progname , strerror (errno ));
232
- #endif
233
- #endif /* NOFIXADE */
224
+ {
225
+ int buffer [] = {SSIN_UACPROC , UAC_SIGBUS | UAC_NOPRINT };
234
226
227
+ if (setsysinfo (SSI_NVPAIRS , buffer , 1 , (caddr_t ) NULL ,
228
+ (unsigned long ) NULL ) < 0 )
229
+ write_stderr ("%s: setsysinfo failed: %s\n" ,
230
+ progname , strerror (errno ));
231
+ }
232
+ #endif /* __alpha */
235
233
234
+ #endif /* NOFIXADE */
235
+
236
+ /*
237
+ * Windows-specific execution environment hacking.
238
+ */
236
239
#ifdef WIN32
237
240
{
238
241
WSADATA wsaData ;
0 commit comments