Skip to content

Commit 14ed773

Browse files
committed
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.
1 parent 61b5369 commit 14ed773

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

src/backend/main/main.c

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
* Stub main() routine for the postgres executable.
55
*
66
* 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.
910
*
1011
*
1112
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
@@ -54,7 +55,9 @@ static void check_root(const char *progname);
5455
static char *get_current_username(const char *progname);
5556

5657

57-
58+
/*
59+
* Any Postgres server process begins execution here.
60+
*/
5861
int
5962
main(int argc, char *argv[])
6063
{
@@ -192,10 +195,10 @@ main(int argc, char *argv[])
192195

193196
/*
194197
* 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).
199202
*
200203
* XXX The need for code here is proof that the platform in question
201204
* is too brain-dead to provide a standard C execution environment
@@ -204,17 +207,10 @@ main(int argc, char *argv[])
204207
static void
205208
startup_hacks(const char *progname)
206209
{
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-
214210
/*
215211
* On some platforms, unaligned memory accesses result in a kernel trap;
216212
* 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
218214
* make such unaligned memory accesses, so this code disables the kernel
219215
* emulation: unaligned accesses will result in SIGBUS instead.
220216
*/
@@ -225,14 +221,21 @@ startup_hacks(const char *progname)
225221
#endif
226222

227223
#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};
234226

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 */
235233

234+
#endif /* NOFIXADE */
235+
236+
/*
237+
* Windows-specific execution environment hacking.
238+
*/
236239
#ifdef WIN32
237240
{
238241
WSADATA wsaData;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy