]> granicus.if.org Git - postgresql/commitdiff
Improve comments around startup_hacks() code.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 16 Dec 2010 22:57:57 +0000 (17:57 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 16 Dec 2010 22:57:57 +0000 (17:57 -0500)
These comments were not updated when we added the EXEC_BACKEND
mechanism for Windows, even though it rendered them inaccurate.

Also unify two unnecessarily-separate #ifdef __alpha code blocks.

src/backend/main/main.c

index 6cb70f2d045fe71ef9724175f69f2c6deef9d9d0..cad78d6d665b5ee41554c49faa083de3506e234b 100644 (file)
@@ -4,8 +4,9 @@
  *       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
@@ -54,7 +55,9 @@ static void check_root(const char *progname);
 static char *get_current_username(const char *progname);
 
 
-
+/*
+ * Any Postgres server process begins execution here.
+ */
 int
 main(int argc, char *argv[])
 {
@@ -192,10 +195,10 @@ 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
@@ -204,17 +207,10 @@ main(int argc, char *argv[])
 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.
         */
@@ -225,14 +221,21 @@ startup_hacks(const char *progname)
 #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;