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
1 changed files with 24 additions and 21 deletions

View 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
{
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;