Improve comments around startup_hacks() code.

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.
This commit is contained in:
Tom Lane 2010-12-16 17:57:57 -05:00
parent 61b53695fb
commit 14ed7735f5

View File

@ -4,8 +4,9 @@
* Stub main() routine for the postgres executable. * Stub main() routine for the postgres executable.
* *
* This does some essential startup tasks for any incarnation of postgres * This does some essential startup tasks for any incarnation of postgres
* (postmaster, standalone backend, or standalone bootstrap mode) and then * (postmaster, standalone backend, standalone bootstrap process, or a
* dispatches to the proper FooMain() routine for the incarnation. * 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 * 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); static char *get_current_username(const char *progname);
/*
* Any Postgres server process begins execution here.
*/
int int
main(int argc, char *argv[]) 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 platform-specific startup hacks here. This is the right
* place to put code that must be executed early in launch of either a * place to put code that must be executed early in the launch of any new
* postmaster, a standalone backend, or a standalone bootstrap run. * server process. Note that this code will NOT be executed when a backend
* Note that this code will NOT be executed when a backend or * or sub-bootstrap process is forked, unless we are in a fork/exec
* sub-bootstrap run is forked by the server. * environment (ie EXEC_BACKEND is defined).
* *
* XXX The need for code here is proof that the platform in question * XXX The need for code here is proof that the platform in question
* is too brain-dead to provide a standard C execution environment * is too brain-dead to provide a standard C execution environment
@ -204,17 +207,10 @@ main(int argc, char *argv[])
static void static void
startup_hacks(const char *progname) 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; * On some platforms, unaligned memory accesses result in a kernel trap;
* the default kernel behavior is to emulate the memory access, but this * 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 * make such unaligned memory accesses, so this code disables the kernel
* emulation: unaligned accesses will result in SIGBUS instead. * emulation: unaligned accesses will result in SIGBUS instead.
*/ */
@ -225,14 +221,21 @@ startup_hacks(const char *progname)
#endif #endif
#if defined(__alpha) /* no __alpha__ ? */ #if defined(__alpha) /* no __alpha__ ? */
if (setsysinfo(SSI_NVPAIRS, buffer, 1, (caddr_t) NULL, {
(unsigned long) NULL) < 0) int buffer[] = {SSIN_UACPROC, UAC_SIGBUS | UAC_NOPRINT};
write_stderr("%s: setsysinfo failed: %s\n",
progname, strerror(errno)); if (setsysinfo(SSI_NVPAIRS, buffer, 1, (caddr_t) NULL,
#endif (unsigned long) NULL) < 0)
write_stderr("%s: setsysinfo failed: %s\n",
progname, strerror(errno));
}
#endif /* __alpha */
#endif /* NOFIXADE */ #endif /* NOFIXADE */
/*
* Windows-specific execution environment hacking.
*/
#ifdef WIN32 #ifdef WIN32
{ {
WSADATA wsaData; WSADATA wsaData;