source
config.c
line
220 - 264
function
220 static process_rec *init_process(int *argc, const char * const * *argv)
221 {
222 process_rec *process;
223 apr_pool_t *cntx;
224 apr_status_t stat;
225 const char *failed = "apr_app_initialize()";
226
227 stat = apr_app_initialize(argc, argv, NULL);
228 if (stat == APR_SUCCESS) {
229 failed = "apr_pool_create()";
230 stat = apr_pool_create(&cntx, NULL);
231 }
232
233 if (stat != APR_SUCCESS) {
234 /* For all intents and purposes, this is impossibly unlikely,
235 * but APR doesn't exist yet, we can't use it for reporting
236 * these earliest two failures;
237 */
238 char ctimebuff[APR_CTIME_LEN];
239 apr_ctime(ctimebuff, apr_time_now());
240 fprintf(stderr, "[%s] [crit] (%d) %s: %s failed "
241 "to initial context, exiting\n",
242 ctimebuff, stat, (*argv)[0], failed);
243 apr_terminate();
244 exit(1);
245 }
246
247 apr_pool_tag(cntx, "process");
248 ap_open_stderr_log(cntx);
249
250 /* Now we have initialized apr and our logger, no more
251 * exceptional error reporting required for the lifetime
252 * of this server process.
253 */
254
255 process = apr_palloc(cntx, sizeof(process_rec));
256 process->pool = cntx;
257
258 apr_pool_create(&process->pconf, process->pool);
259 apr_pool_tag(process->pconf, "pconf");
260 process->argc = *argc;
261 process->argv = *argv;
262 process->short_name = apr_filepath_name_get((*argv)[0]);
263 return process;
264 }
最終更新:2009年02月08日 17:09