rbb 99/11/18 15:08:09
Modified: src/include http_log.h src/main http_config.c http_core.c http_log.c http_main.c util.c src/modules/mpm/dexter Makefile.tmpl dexter.c scoreboard.c Log: First step in removing the fprintf(stderr problem from Apache. Basically, I defined APLOG_STARTUP, which refrains from printing the date string and the log level information in log_error_core. I then changed all the fprintf(stderr calls to ap_log_error, and used APLOG_STARTUP. log_error_core on Unix takes care of creating a log file and directing it to stderr if a log file isn't already active. I will continue to make these changes tomorrow. Currently, the main code and the dexter mpm have been modified. Revision Changes Path 1.7 +3 -0 apache-2.0/src/include/http_log.h Index: http_log.h =================================================================== RCS file: /home/cvs/apache-2.0/src/include/http_log.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- http_log.h 1999/10/20 12:49:53 1.6 +++ http_log.h 1999/11/18 23:06:59 1.7 @@ -98,6 +98,9 @@ #define APLOG_WIN32ERROR ((APLOG_LEVELMASK+1) * 2) #endif +/* normal but significant condition on startup, usually printed to stderr */ +#define APLOG_STARTUP ((APLOG_LEVELMASK + 1) * 4) + #ifndef DEFAULT_LOGLEVEL #define DEFAULT_LOGLEVEL APLOG_WARNING #endif 1.19 +24 -15 apache-2.0/src/main/http_config.c Index: http_config.c =================================================================== RCS file: /home/cvs/apache-2.0/src/main/http_config.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- http_config.c 1999/11/16 18:30:32 1.18 +++ http_config.c 1999/11/18 23:07:11 1.19 @@ -385,9 +385,10 @@ */ if (m->version != MODULE_MAGIC_NUMBER_MAJOR) { - fprintf(stderr, "%s: module \"%s\" is not compatible with this " - "version of Apache.\n", ap_server_argv0, m->name); - fprintf(stderr, "Please contact the vendor for the correct version.\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: module \"%s\" is not compatible with this " + "version of Apache.", ap_server_argv0, m->name); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Please contact the vendor for the correct version."); exit(1); } @@ -400,10 +401,12 @@ dynamic_modules++; if (dynamic_modules > DYNAMIC_MODULE_LIMIT) { - fprintf(stderr, "%s: module \"%s\" could not be loaded, because" - " the dynamic\n", ap_server_argv0, m->name); - fprintf(stderr, "module limit was reached. Please increase " - "DYNAMIC_MODULE_LIMIT and recompile.\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: module \"%s\" could not be loaded, because" + " the dynamic", ap_server_argv0, m->name); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "module limit was reached. Please increase " + "DYNAMIC_MODULE_LIMIT and recompile."); exit(1); } } @@ -544,7 +547,8 @@ ap_loaded_modules = (module **)ap_palloc(process->pool, sizeof(module *)*(total_modules+DYNAMIC_MODULE_LIMIT+1)); if (ap_loaded_modules == NULL) { - fprintf(stderr, "Ouch! Out of memory in ap_setup_prelinked_modules()!\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "Ouch! Out of memory in ap_setup_prelinked_modules()!"); } for (m = ap_preloaded_modules, m2 = ap_loaded_modules; *m != NULL; ) *m2++ = *m++; @@ -1004,7 +1008,8 @@ errmsg = ap_srm_command_loop(&parms, s->lookup_defaults); if (errmsg) { - fprintf(stderr, "Syntax error in -C/-c directive:\n%s\n", errmsg); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "Syntax error in -C/-c directive:\n%s", errmsg); exit(1); } @@ -1041,17 +1046,20 @@ parms.override = (RSRC_CONF | OR_ALL) & ~(OR_AUTHCFG | OR_LIMIT); if (ap_pcfg_openfile(&parms.config_file, p, fname) != APR_SUCCESS) { - fprintf(stderr, "%s: could not open document config file %s\n", - ap_server_argv0, fname); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: could not open document config file %s", + ap_server_argv0, fname); exit(1); } errmsg = ap_srm_command_loop(&parms, s->lookup_defaults); if (errmsg) { - fprintf(stderr, "Syntax error on line %d of %s:\n", - parms.config_file->line_number, parms.config_file->name); - fprintf(stderr, "%s\n", errmsg); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "Syntax error on line %d of %s:", + parms.config_file->line_number, parms.config_file->name); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s", errmsg); exit(1); } @@ -1149,7 +1157,8 @@ limits.rlim_cur += 2; if (setrlimit(RLIMIT_NOFILE, &limits) < 0) { perror("setrlimit(RLIMIT_NOFILE)"); - fprintf(stderr, "Cannot exceed hard limit for open files"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "Cannot exceed hard limit for open files"); } } #endif 1.24 +3 -2 apache-2.0/src/main/http_core.c Index: http_core.c =================================================================== RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- http_core.c 1999/11/16 18:30:37 1.23 +++ http_core.c 1999/11/18 23:07:15 1.24 @@ -1012,8 +1012,9 @@ arg = ap_os_canonical_filename(cmd->pool, arg); if (/* TODO: ap_configtestonly && ap_docrootcheck && */ !ap_is_directory(arg)) { if (cmd->server->is_virtual) { - fprintf(stderr, "Warning: DocumentRoot [%s] does not exist\n", - arg); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "Warning: DocumentRoot [%s] does not exist", + arg); } else { return "DocumentRoot must be a directory"; 1.17 +28 -19 apache-2.0/src/main/http_log.c Index: http_log.c =================================================================== RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- http_log.c 1999/11/08 06:05:50 1.16 +++ http_log.c 1999/11/18 23:07:18 1.17 @@ -229,8 +229,9 @@ rc = log_child (p, s->error_fname+1, NULL, &dummy, NULL); if (rc != APR_SUCCESS) { perror("ap_spawn_child"); - fprintf(stderr, "Couldn't fork child for ErrorLog process\n"); - exit(1); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "Couldn't fork child for ErrorLog process"); + exit(1); } s->error_log = dummy; @@ -263,8 +264,9 @@ if (ap_open(&s->error_log, fname, APR_APPEND | APR_READ | APR_WRITE | APR_CREATE, APR_OS_DEFAULT, p) != APR_SUCCESS) { perror("fopen"); - fprintf(stderr, "%s: could not open error log file %s.\n", - ap_server_argv0, fname); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: could not open error log file %s.", + ap_server_argv0, fname); exit(1); } } @@ -342,14 +344,18 @@ if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) && ((level & APLOG_LEVELMASK) > DEFAULT_LOGLEVEL)) return; +#ifdef WIN32 + /* This is where the different ap_put_os_file's belong */ +#else ap_put_os_file(&logf, &errfileno, NULL); +#endif } else if (s->error_log) { /* * If we are doing normal logging, don't log messages that are * above the server log level unless it is a startup/shutdown notice */ - if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) && + if (((level & APLOG_LEVELMASK) != APLOG_NOTICE) && ((level & APLOG_LEVELMASK) > s->loglevel)) return; logf = s->error_log; @@ -376,15 +382,16 @@ logf = NULL; } - if (logf) { + if (logf && ((level & APLOG_STARTUP) != APLOG_STARTUP)) { len = ap_snprintf(errstr, MAX_STRING_LEN, "[%s] ", ap_get_time()); } else { len = 0; } - - len += ap_snprintf(errstr + len, MAX_STRING_LEN - len, - "[%s] ", priorities[level & APLOG_LEVELMASK].t_name); + if ((level & APLOG_STARTUP) != APLOG_STARTUP) { + len += ap_snprintf(errstr + len, MAX_STRING_LEN - len, + "[%s] ", priorities[level & APLOG_LEVELMASK].t_name); + } #ifndef TPF if (file && (level & APLOG_LEVELMASK) == APLOG_DEBUG) { #ifdef _OSD_POSIX @@ -557,8 +564,9 @@ if(ap_open(&pid_file, fname, APR_WRITE | APR_CREATE, APR_OS_DEFAULT, p) != APR_SUCCESS) { perror("fopen"); - fprintf(stderr, "%s: could not log pid to file %s\n", - ap_server_argv0, fname); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: could not log pid to file %s", + ap_server_argv0, fname); exit(1); } ap_fprintf(pid_file, "%ld\n", (long)mypid); @@ -597,9 +605,9 @@ API_EXPORT(void) ap_log_assert(const char *szExp, const char *szFile, int nLine) { - /* Use AP funcs to output message and abort program. */ - fprintf(stderr, "[%s] file %s, line %d, assertion \"%s\" failed\n", - ap_get_time(), szFile, nLine, szExp); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "[%s] file %s, line %d, assertion \"%s\" failed", + ap_get_time(), szFile, nLine, szExp); #ifndef WIN32 /* unix assert does an abort leading to a core dump */ abort(); @@ -633,8 +641,8 @@ (ap_setprocattr_dir(procattr, pl->program) != APR_SUCCESS) || (ap_set_childin(procattr, pl->fds[0], pl->fds[1]) != APR_SUCCESS)) { /* Something bad happened, give up and go away. */ - fprintf(stderr, - "piped_log_spawn: unable to exec %s -c '%s': %s\n", + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "piped_log_spawn: unable to exec %s -c '%s': %s", SHELL_PATH, pl->program, strerror (errno)); rc = -1; } @@ -672,8 +680,8 @@ if (piped_log_spawn(pl) != APR_SUCCESS) { /* what can we do? This could be the error log we're having * problems opening up... */ - fprintf(stderr, - "piped_log_maintenance: unable to respawn '%s': %s\n", + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "piped_log_maintenance: unable to respawn '%s': %s", pl->program, strerror(errno)); } break; @@ -760,7 +768,8 @@ rc = log_child(p, program, NULL, &dummy, NULL); if (rc != APR_SUCCESS) { perror("ap_spawn_child"); - fprintf(stderr, "Couldn't fork child for piped log process\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "Couldn't fork child for piped log process"); exit (1); } 1.20 +21 -20 apache-2.0/src/main/http_main.c Index: http_main.c =================================================================== RCS file: /home/cvs/apache-2.0/src/main/http_main.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- http_main.c 1999/11/08 18:53:55 1.19 +++ http_main.c 1999/11/18 23:07:21 1.20 @@ -58,6 +58,7 @@ #define CORE_PRIVATE #include "httpd.h" #include "http_main.h" +#include "http_log.h" #include "http_config.h" #include "util_uri.h" #include "ap_mpm.h" @@ -229,30 +230,30 @@ pad[i] = ' '; pad[i] = '\0'; #ifdef SHARED_CORE - fprintf(stderr, "Usage: %s [-R directory] [-D name] [-d directory] [-f file]\n", bin); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0,NULL , "Usage: %s [-R directory] [-D name] [-d directory] [-f file]", bin); #else - fprintf(stderr, "Usage: %s [-D name] [-d directory] [-f file]\n", bin); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Usage: %s [-D name] [-d directory] [-f file]", bin); #endif - fprintf(stderr, " %s [-C \"directive\"] [-c \"directive\"]\n", pad); - fprintf(stderr, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]\n", pad); - fprintf(stderr, "Options:\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-C \"directive\"] [-c \"directive\"]", pad); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " %s [-v] [-V] [-h] [-l] [-L] [-S] [-t] [-T]", pad); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Options:"); #ifdef SHARED_CORE - fprintf(stderr, " -R directory : specify an alternate location for shared object files\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -R directory : specify an alternate location for shared object files"); #endif - fprintf(stderr, " -D name : define a name for use in <IfDefine name> directives\n"); - fprintf(stderr, " -d directory : specify an alternate initial ServerRoot\n"); - fprintf(stderr, " -f file : specify an alternate ServerConfigFile\n"); - fprintf(stderr, " -C \"directive\" : process directive before reading config files\n"); - fprintf(stderr, " -c \"directive\" : process directive after reading config files\n"); - fprintf(stderr, " -v : show version number\n"); - fprintf(stderr, " -V : show compile settings\n"); - fprintf(stderr, " -h : list available command line options (this page)\n"); - fprintf(stderr, " -l : list compiled in modules\n"); - fprintf(stderr, " -L : list available configuration directives\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -D name : define a name for use in <IfDefine name> directives"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -d directory : specify an alternate initial ServerRoot"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -f file : specify an alternate ServerConfigFile"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -C \"directive\" : process directive before reading config files"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -c \"directive\" : process directive after reading config files"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -v : show version number"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -V : show compile settings"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -h : list available command line options (this page)"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -l : list compiled in modules"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -L : list available configuration directives"); /* TODOC: -S has been replaced by '-t -D DUMP_VHOSTS' */ - /* fprintf(stderr, " -S : show parsed settings (currently only vhost settings)\n"); */ - fprintf(stderr, " -t : run syntax check for config files (with docroot check)\n"); - fprintf(stderr, " -T : run syntax check for config files (without docroot check)\n"); + /* ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -S : show parsed settings (currently only vhost settings)"); */ + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -t : run syntax check for config files (with docroot check)"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, " -T : run syntax check for config files (without docroot check)"); /* TODOC: -X goes away, expect MPMs to use -D options */ destroy_and_exit_process(process, 1); } @@ -348,7 +349,7 @@ ap_run_pre_config(pconf, plog, ptemp); server_conf = ap_read_config(process, ptemp, confname); if (configtestonly) { - fprintf(stderr, "Syntax OK\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Syntax OK\n"); destroy_and_exit_process(process, 0); } ap_clear_pool(plog); 1.18 +11 -9 apache-2.0/src/main/util.c Index: util.c =================================================================== RCS file: /home/cvs/apache-2.0/src/main/util.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- util.c 1999/11/16 18:30:47 1.17 +++ util.c 1999/11/18 23:07:24 1.18 @@ -1706,7 +1706,7 @@ char *sdup; if (!(sdup = (char *) malloc(strlen(str) + 1))) { - fprintf(stderr, "Ouch! Out of memory in our strdup()!\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Ouch! Out of memory in our strdup()!"); return NULL; } sdup = strcpy(sdup, str); @@ -1877,7 +1877,7 @@ return (atoi(&name[1])); if (!(ent = getpwnam(name))) { - fprintf(stderr, "%s: bad user name %s\n", ap_server_argv0, name); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "%s: bad user name %s", ap_server_argv0, name); exit(1); } return (ent->pw_uid); @@ -1895,7 +1895,7 @@ return (atoi(&name[1])); if (!(ent = getgrnam(name))) { - fprintf(stderr, "%s: bad group name %s\n", ap_server_argv0, name); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "%s: bad group name %s", ap_server_argv0, name); exit(1); } return (ent->gr_gid); @@ -1938,14 +1938,14 @@ hep = gethostbyname(w); if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) { - fprintf(stderr, "Cannot resolve host name %s --- exiting!\n", w); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Cannot resolve host name %s --- exiting!", w); exit(1); } if (hep->h_addr_list[1]) { - fprintf(stderr, "Host %s has multiple addresses ---\n", w); - fprintf(stderr, "you must choose one explicitly for use as\n"); - fprintf(stderr, "a virtual host. Exiting!!!\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "Host %s has multiple addresses ---", w); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "you must choose one explicitly for use as"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "a virtual host. Exiting!!!"); exit(1); } @@ -1991,9 +1991,11 @@ } str[MAXHOSTNAMELEN] = '\0'; if ((!(p = gethostbyname(str))) || (!(server_hostname = find_fqdn(a, p)))) { - fprintf(stderr, "%s: cannot determine local host name.\n", + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: cannot determine local host name.", ap_server_argv0); - fprintf(stderr, "Use the ServerName directive to set it manually.\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "Use the ServerName directive to set it manually."); exit(1); } 1.8 +2 -2 apache-2.0/src/modules/mpm/dexter/Makefile.tmpl Index: Makefile.tmpl =================================================================== RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/Makefile.tmpl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Makefile.tmpl 1999/11/15 21:22:42 1.7 +++ Makefile.tmpl 1999/11/18 23:07:44 1.8 @@ -70,7 +70,7 @@ $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ $(INCDIR)/hsregex.h ../../../lib/apr/include/apr_lib.h \ $(INCDIR)/buff.h $(INCDIR)/ap_iol.h \ - $(INCDIR)/ap.h $(INCDIR)/apr.h \ + $(INCDIR)/ap.h \ $(INCDIR)/util_uri.h $(INCDIR)/http_main.h \ $(INCDIR)/http_log.h $(INCDIR)/http_config.h \ $(INCDIR)/ap_hooks.h $(INCDIR)/http_core.h \ @@ -88,7 +88,7 @@ ../../../lib/apr/include/apr_lib.h \ ../../../lib/apr/include/apr_file_io.h $(INCDIR)/buff.h \ $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ - $(INCDIR)/apr.h $(INCDIR)/util_uri.h \ + $(INCDIR)/util_uri.h \ $(INCDIR)/http_log.h $(INCDIR)/http_main.h \ $(INCDIR)/http_core.h $(INCDIR)/http_config.h \ $(INCDIR)/ap_hooks.h $(OSDIR)/unixd.h \ 1.57 +35 -20 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c =================================================================== RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- dexter.c 1999/11/16 18:31:18 1.56 +++ dexter.c 1999/11/18 23:07:49 1.57 @@ -1536,15 +1536,19 @@ num_daemons = atoi(arg); if (num_daemons > HARD_SERVER_LIMIT) { - fprintf(stderr, "WARNING: NumServers of %d exceeds compile time limit " - "of %d servers,\n", num_daemons, HARD_SERVER_LIMIT); - fprintf(stderr, " lowering NumServers to %d. To increase, please " - "see the\n", HARD_SERVER_LIMIT); - fprintf(stderr, " HARD_SERVER_LIMIT define in src/include/httpd.h.\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "WARNING: NumServers of %d exceeds compile time limit " + "of %d servers,", num_daemons, HARD_SERVER_LIMIT); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + " lowering NumServers to %d. To increase, please " + "see the", HARD_SERVER_LIMIT); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + " HARD_SERVER_LIMIT define in src/include/httpd.h."); num_daemons = HARD_SERVER_LIMIT; } else if (num_daemons < 1) { - fprintf(stderr, "WARNING: Require NumServers > 0, setting to 1\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "WARNING: Require NumServers > 0, setting to 1"); num_daemons = 1; } return NULL; @@ -1559,15 +1563,19 @@ threads_to_start = atoi(arg); if (threads_to_start > HARD_THREAD_LIMIT) { - fprintf(stderr, "WARNING: StartThreads of %d exceeds compile time" - "limit of %d threads,\n", threads_to_start, - HARD_THREAD_LIMIT); - fprintf(stderr, " lowering StartThreads to %d. To increase, please" - "see the\n", HARD_THREAD_LIMIT); - fprintf(stderr, " HARD_THREAD_LIMIT define in src/include/httpd.h.\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "WARNING: StartThreads of %d exceeds compile time" + "limit of %d threads,", threads_to_start, + HARD_THREAD_LIMIT); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "lowering StartThreads to %d. To increase, please" + "see the", HARD_THREAD_LIMIT); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "HARD_THREAD_LIMIT define in src/include/httpd.h."); } else if (threads_to_start < 1) { - fprintf(stderr, "WARNING: Require StartThreads > 0, setting to 1\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "WARNING: Require StartThreads > 0, setting to 1"); threads_to_start = 1; } return NULL; @@ -1582,9 +1590,12 @@ min_spare_threads = atoi(arg); if (min_spare_threads <= 0) { - fprintf(stderr, "WARNING: detected MinSpareThreads set to non-positive.\n"); - fprintf(stderr, "Resetting to 1 to avoid almost certain Apache failure.\n"); - fprintf(stderr, "Please read the documentation.\n"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "WARNING: detected MinSpareThreads set to non-positive."); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "Resetting to 1 to avoid almost certain Apache failure."); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "Please read the documentation."); min_spare_threads = 1; } @@ -1600,8 +1611,10 @@ max_spare_threads = atoi(arg); if (max_spare_threads >= HARD_THREAD_LIMIT) { - fprintf(stderr, "WARNING: detected MinSpareThreads set higher than\n"); - fprintf(stderr, "HARD_THREAD_LIMIT. Resetting to %d\n", HARD_THREAD_LIMIT); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "WARNING: detected MinSpareThreads set higher than"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "HARD_THREAD_LIMIT. Resetting to %d", HARD_THREAD_LIMIT); max_spare_threads = HARD_THREAD_LIMIT; } return NULL; @@ -1616,8 +1629,10 @@ max_threads = atoi(arg); if (max_threads > HARD_THREAD_LIMIT) { - fprintf(stderr, "WARNING: detected MaxThreadsPerChild set higher than\n"); - fprintf(stderr, "HARD_THREAD_LIMIT. Resetting to %d\n", HARD_THREAD_LIMIT); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "WARNING: detected MaxThreadsPerChild set higher than"); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "HARD_THREAD_LIMIT. Resetting to %d", HARD_THREAD_LIMIT); max_threads = HARD_THREAD_LIMIT; } return NULL; 1.9 +17 -10 apache-2.0/src/modules/mpm/dexter/scoreboard.c Index: scoreboard.c =================================================================== RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/scoreboard.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- scoreboard.c 1999/10/20 19:07:49 1.8 +++ scoreboard.c 1999/11/18 23:07:53 1.9 @@ -145,15 +145,16 @@ m = (caddr_t) create_shared_heap("\\SHAREMEM\\SCOREBOARD", SCOREBOARD_SIZE); if (m == 0) { - fprintf(stderr, "%s: Could not create OS/2 Shared memory pool.\n", - ap_server_argv0); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: Could not create OS/2 Shared memory pool.", + ap_server_argv0); exit(APEXIT_INIT); } rc = _uopen((Heap_t) m); if (rc != 0) { - fprintf(stderr, - "%s: Could not uopen() newly created OS/2 Shared memory pool.\n", + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: Could not uopen() newly created OS/2 Shared memory pool.", ap_server_argv0); } ap_scoreboard_image = (scoreboard *) m; @@ -166,7 +167,8 @@ m = (caddr_t) get_shared_heap("\\SHAREMEM\\SCOREBOARD"); if (m == 0) { - fprintf(stderr, "%s: Could not find existing OS/2 Shared memory pool.\n", + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: Could not find existing OS/2 Shared memory pool.", ap_server_argv0); exit(APEXIT_INIT); } @@ -280,14 +282,16 @@ int fd = mkstemp(mfile); if (fd == -1) { perror("open"); - fprintf(stderr, "%s: Could not open %s\n", ap_server_argv0, mfile); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: Could not open %s", ap_server_argv0, mfile); exit(APEXIT_INIT); } m = mmap((caddr_t) 0, SCOREBOARD_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (m == (caddr_t) - 1) { perror("mmap"); - fprintf(stderr, "%s: Could not mmap %s\n", ap_server_argv0, mfile); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: Could not mmap %s", ap_server_argv0, mfile); exit(APEXIT_INIT); } close(fd); @@ -299,7 +303,8 @@ #endif if (m == (caddr_t) - 1) { perror("mmap"); - fprintf(stderr, "%s: Could not mmap memory\n", ap_server_argv0); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: Could not mmap memory", ap_server_argv0); exit(APEXIT_INIT); } #else @@ -309,14 +314,16 @@ fd = open("/dev/zero", O_RDWR); if (fd == -1) { perror("open"); - fprintf(stderr, "%s: Could not open /dev/zero\n", ap_server_argv0); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: Could not open /dev/zero", ap_server_argv0); exit(APEXIT_INIT); } m = mmap((caddr_t) 0, SCOREBOARD_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (m == (caddr_t) - 1) { perror("mmap"); - fprintf(stderr, "%s: Could not mmap /dev/zero\n", ap_server_argv0); + ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, + "%s: Could not mmap /dev/zero", ap_server_argv0); exit(APEXIT_INIT); } close(fd);