37
37
*
38
38
*
39
39
* 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 $
41
41
*
42
42
* NOTES
43
43
*
@@ -269,12 +269,11 @@ static void dummy_handler(SIGNAL_ARGS);
269
269
static void CleanupProc (int pid , int exitstatus );
270
270
static void LogChildExit (int lev , const char * procname ,
271
271
int pid , int exitstatus );
272
- static int BackendFinalize (Port * port );
272
+ static int BackendFork (Port * port );
273
273
void ExitPostmaster (int status );
274
274
static void usage (const char * );
275
275
static int ServerLoop (void );
276
276
static int BackendStartup (Port * port );
277
- static void BackendFork (Port * port , Backend * bn );
278
277
static int ProcessStartupPacket (Port * port , bool SSLdone );
279
278
static void processCancelRequest (Port * port , void * pkt );
280
279
static int initMasks (fd_set * rmask , fd_set * wmask );
@@ -1240,7 +1239,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)
1240
1239
* Now fetch parameters out of startup packet and save them into the
1241
1240
* Port structure. All data structures attached to the Port struct
1242
1241
* 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
1244
1243
* about leaking this storage on failure, since we aren't in the postmaster
1245
1244
* process anymore.
1246
1245
*/
@@ -2080,7 +2079,25 @@ BackendStartup(Port *port)
2080
2079
pid = fork ();
2081
2080
2082
2081
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
+ }
2084
2101
2085
2102
/* in parent, error */
2086
2103
if (pid < 0 )
@@ -2113,32 +2130,6 @@ BackendStartup(Port *port)
2113
2130
return STATUS_OK ;
2114
2131
}
2115
2132
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
-
2142
2133
/*
2143
2134
* Try to report backend fork() failure to client before we close the
2144
2135
* connection. Since we do not care to risk blocking the postmaster on
@@ -2195,7 +2186,7 @@ split_opts(char **argv, int *argcp, char *s)
2195
2186
}
2196
2187
2197
2188
/*
2198
- * BackendFinalize -- perform authentication, and if successful, set up the
2189
+ * BackendFork -- perform authentication, and if successful, set up the
2199
2190
* backend's argument list and invoke backend main().
2200
2191
*
2201
2192
* 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)
2206
2197
* If PostgresMain() fails, return status.
2207
2198
*/
2208
2199
static int
2209
- BackendFinalize (Port * port )
2200
+ BackendFork (Port * port )
2210
2201
{
2211
2202
char * remote_host ;
2212
2203
char * * av ;
@@ -2343,7 +2334,7 @@ BackendFinalize(Port *port)
2343
2334
* indefinitely. PreAuthDelay doesn't count against the time limit.
2344
2335
*/
2345
2336
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" );
2347
2338
2348
2339
/*
2349
2340
* Receive the startup packet (which might turn out to be a cancel
@@ -2372,7 +2363,7 @@ BackendFinalize(Port *port)
2372
2363
* SIGTERM/SIGQUIT again until backend startup is complete.
2373
2364
*/
2374
2365
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" );
2376
2367
PG_SETMASK (& BlockSig );
2377
2368
2378
2369
if (Log_connections )
0 commit comments