Skip to content

Commit 0f3c68a

Browse files
committed
Fix breakage of LINUX_PROFILE code due to recent Windows changes.
1 parent 4df52b2 commit 0f3c68a

File tree

1 file changed

+26
-35
lines changed

1 file changed

+26
-35
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.330 2003/05/28 17:25:02 tgl Exp $
40+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.331 2003/05/28 19:36:28 tgl Exp $
4141
*
4242
* NOTES
4343
*
@@ -269,12 +269,11 @@ static void dummy_handler(SIGNAL_ARGS);
269269
static void CleanupProc(int pid, int exitstatus);
270270
static void LogChildExit(int lev, const char *procname,
271271
int pid, int exitstatus);
272-
static int BackendFinalize(Port *port);
272+
static int BackendFork(Port *port);
273273
void ExitPostmaster(int status);
274274
static void usage(const char *);
275275
static int ServerLoop(void);
276276
static int BackendStartup(Port *port);
277-
static void BackendFork(Port *port, Backend *bn);
278277
static int ProcessStartupPacket(Port *port, bool SSLdone);
279278
static void processCancelRequest(Port *port, void *pkt);
280279
static int initMasks(fd_set *rmask, fd_set *wmask);
@@ -1240,7 +1239,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)
12401239
* Now fetch parameters out of startup packet and save them into the
12411240
* Port structure. All data structures attached to the Port struct
12421241
* must be allocated in TopMemoryContext so that they won't disappear
1243-
* when we pass them to PostgresMain (see BackendFinalize). We need not worry
1242+
* when we pass them to PostgresMain (see BackendFork). We need not worry
12441243
* about leaking this storage on failure, since we aren't in the postmaster
12451244
* process anymore.
12461245
*/
@@ -2080,7 +2079,25 @@ BackendStartup(Port *port)
20802079
pid = fork();
20812080

20822081
if (pid == 0) /* child */
2083-
BackendFork(port, bn); /* never returns */
2082+
{
2083+
int status;
2084+
2085+
#ifdef LINUX_PROFILE
2086+
setitimer(ITIMER_PROF, &prof_itimer, NULL);
2087+
#endif
2088+
2089+
#ifdef __BEOS__
2090+
/* Specific beos backend startup actions */
2091+
beos_backend_startup();
2092+
#endif
2093+
free(bn);
2094+
2095+
status = BackendFork(port);
2096+
2097+
if (status != 0)
2098+
elog(LOG, "connection startup failed");
2099+
proc_exit(status);
2100+
}
20842101

20852102
/* in parent, error */
20862103
if (pid < 0)
@@ -2113,32 +2130,6 @@ BackendStartup(Port *port)
21132130
return STATUS_OK;
21142131
}
21152132

2116-
2117-
static void
2118-
BackendFork(Port *port, Backend *bn)
2119-
{
2120-
int status;
2121-
2122-
#ifdef LINUX_PROFILE
2123-
setitimer(ITIMER_PROF, &prof_itimer, NULL);
2124-
#endif
2125-
2126-
#ifdef __BEOS__
2127-
/* Specific beos backend startup actions */
2128-
beos_backend_startup();
2129-
#endif
2130-
free(bn);
2131-
2132-
status = BackendFinalize(port);
2133-
if (status != 0)
2134-
{
2135-
elog(LOG, "connection startup failed");
2136-
proc_exit(status);
2137-
}
2138-
else
2139-
proc_exit(0);
2140-
}
2141-
21422133
/*
21432134
* Try to report backend fork() failure to client before we close the
21442135
* connection. Since we do not care to risk blocking the postmaster on
@@ -2195,7 +2186,7 @@ split_opts(char **argv, int *argcp, char *s)
21952186
}
21962187

21972188
/*
2198-
* BackendFinalize -- perform authentication, and if successful, set up the
2189+
* BackendFork -- perform authentication, and if successful, set up the
21992190
* backend's argument list and invoke backend main().
22002191
*
22012192
* This used to perform an execv() but we no longer exec the backend;
@@ -2206,7 +2197,7 @@ split_opts(char **argv, int *argcp, char *s)
22062197
* If PostgresMain() fails, return status.
22072198
*/
22082199
static int
2209-
BackendFinalize(Port *port)
2200+
BackendFork(Port *port)
22102201
{
22112202
char *remote_host;
22122203
char **av;
@@ -2343,7 +2334,7 @@ BackendFinalize(Port *port)
23432334
* indefinitely. PreAuthDelay doesn't count against the time limit.
23442335
*/
23452336
if (!enable_sig_alarm(AuthenticationTimeout * 1000, false))
2346-
elog(FATAL, "BackendFinalize: Unable to set timer for auth timeout");
2337+
elog(FATAL, "BackendFork: Unable to set timer for auth timeout");
23472338

23482339
/*
23492340
* Receive the startup packet (which might turn out to be a cancel
@@ -2372,7 +2363,7 @@ BackendFinalize(Port *port)
23722363
* SIGTERM/SIGQUIT again until backend startup is complete.
23732364
*/
23742365
if (!disable_sig_alarm(false))
2375-
elog(FATAL, "BackendFinalize: Unable to disable timer for auth timeout");
2366+
elog(FATAL, "BackendFork: Unable to disable timer for auth timeout");
23762367
PG_SETMASK(&BlockSig);
23772368

23782369
if (Log_connections)

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