* Stub main() routine for the postgres executable.
*
* This does some essential startup tasks for any incarnation of postgres
- * (postmaster, standalone backend, or standalone bootstrap mode) and then
- * dispatches to the proper FooMain() routine for the incarnation.
+ * (postmaster, standalone backend, standalone bootstrap process, or a
+ * separately exec'd child of a postmaster) and then dispatches to the
+ * proper FooMain() routine for the incarnation.
*
*
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
static char *get_current_username(const char *progname);
-
+/*
+ * Any Postgres server process begins execution here.
+ */
int
main(int argc, char *argv[])
{
/*
* Place platform-specific startup hacks here. This is the right
- * place to put code that must be executed early in launch of either a
- * postmaster, a standalone backend, or a standalone bootstrap run.
- * Note that this code will NOT be executed when a backend or
- * sub-bootstrap run is forked by the server.
+ * place to put code that must be executed early in the launch of any new
+ * server process. Note that this code will NOT be executed when a backend
+ * or sub-bootstrap process is forked, unless we are in a fork/exec
+ * environment (ie EXEC_BACKEND is defined).
*
* XXX The need for code here is proof that the platform in question
* is too brain-dead to provide a standard C execution environment
static void
startup_hacks(const char *progname)
{
-#if defined(__alpha) /* no __alpha__ ? */
-#ifdef NOFIXADE
- int buffer[] = {SSIN_UACPROC, UAC_SIGBUS | UAC_NOPRINT};
-#endif
-#endif /* __alpha */
-
-
/*
* On some platforms, unaligned memory accesses result in a kernel trap;
* the default kernel behavior is to emulate the memory access, but this
- * results in a significant performance penalty. We ought to fix PG not to
+ * results in a significant performance penalty. We want PG never to
* make such unaligned memory accesses, so this code disables the kernel
* emulation: unaligned accesses will result in SIGBUS instead.
*/
#endif
#if defined(__alpha) /* no __alpha__ ? */
- if (setsysinfo(SSI_NVPAIRS, buffer, 1, (caddr_t) NULL,
- (unsigned long) NULL) < 0)
- write_stderr("%s: setsysinfo failed: %s\n",
- progname, strerror(errno));
-#endif
-#endif /* NOFIXADE */
+ {
+ int buffer[] = {SSIN_UACPROC, UAC_SIGBUS | UAC_NOPRINT};
+ if (setsysinfo(SSI_NVPAIRS, buffer, 1, (caddr_t) NULL,
+ (unsigned long) NULL) < 0)
+ write_stderr("%s: setsysinfo failed: %s\n",
+ progname, strerror(errno));
+ }
+#endif /* __alpha */
+#endif /* NOFIXADE */
+
+ /*
+ * Windows-specific execution environment hacking.
+ */
#ifdef WIN32
{
WSADATA wsaData;