cvs commit: apachen/src/modules/standard mod_status.c
dgaudet 98/01/02 15:46:10 Modified:.STATUS src CHANGES src/modules/standard mod_status.c Log: - remove an unused buffer - mark a constant structure as const, and make it static, it's a waste to initialize it on every call - initialize the status flags once rather than on every call Reviewed by: Jim Jagielski Revision ChangesPath 1.46 +1 -4 apachen/STATUS Index: STATUS === RCS file: /export/home/cvs/apachen/STATUS,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- STATUS1998/01/02 23:44:42 1.45 +++ STATUS1998/01/02 23:46:06 1.46 @@ -64,6 +64,7 @@ * Dean's [PATCH] 1.3: DoS attack * Paul/Ben's [PATCH] 1.3: spaces in NT spawn* arguments * Dean's [PATCH] mod_info minor cleanups (take 2) +* Dean's [PATCH] mod_status cleanups Available Patches: @@ -75,10 +76,6 @@ * [PATCH] mod_digest/1599: proxy authentication using the digest auth scheme never succeeds (fwd) [EMAIL PROTECTED] - Status: Dean +1, Jim +1 - -* Dean's [PATCH] mod_status cleanups - [EMAIL PROTECTED] Status: Dean +1, Jim +1 * Martin's [PATCH] 36kB: Make apache compile run on an EBCDIC mainframe 1.555 +2 -0 apachen/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apachen/src/CHANGES,v retrieving revision 1.554 retrieving revision 1.555 diff -u -r1.554 -r1.555 --- CHANGES 1998/01/02 23:44:43 1.554 +++ CHANGES 1998/01/02 23:46:07 1.555 @@ -1,5 +1,7 @@ Changes with Apache 1.3b4 + *) A few cleanups in mod_status for efficiency. [Dean Gaudet] + *) A few cleanups in mod_info to make it thread-safe, and remove an off-by-5 bug that could hammer \0 on the stack. [Dean Gaudet] 1.69 +35 -33apachen/src/modules/standard/mod_status.c Index: mod_status.c === RCS file: /export/home/cvs/apachen/src/modules/standard/mod_status.c,v retrieving revision 1.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- mod_status.c 1997/12/20 10:21:59 1.68 +++ mod_status.c 1998/01/02 23:46:10 1.69 @@ -158,8 +158,6 @@ static void show_time(request_rec *r, time_t tsecs) { long days, hrs, mins, secs; -char buf[100]; -char *s; secs = tsecs % 60; tsecs /= 60; @@ -167,8 +165,6 @@ tsecs /= 60; hrs = tsecs % 24; days = tsecs / 24; -s = buf; -*s = '\0'; if (days) rprintf(r, %ld day%s, days, days == 1 ? : s); if (hrs) @@ -190,19 +186,22 @@ struct stat_opt { int id; -char *form_data_str; -char *hdr_out_str; +const char *form_data_str; +const char *hdr_out_str; }; +static const struct stat_opt status_options[] = /* see #defines above */ +{ +{STAT_OPT_REFRESH, refresh, Refresh}, +{STAT_OPT_NOTABLE, notable, NULL}, +{STAT_OPT_AUTO, auto, NULL}, +{STAT_OPT_END, NULL, NULL} +}; + +static char status_flags[SERVER_NUM_STATUS]; + static int status_handler(request_rec *r) { -struct stat_opt options[] = /* see #defines above */ -{ - {STAT_OPT_REFRESH, refresh, Refresh}, - {STAT_OPT_NOTABLE, notable, NULL}, - {STAT_OPT_AUTO, auto, NULL}, - {STAT_OPT_END, NULL, NULL} -}; char *loc; time_t nowtime = time(NULL); time_t up_time; @@ -228,22 +227,11 @@ server_rec *server = r-server; short_score score_record; parent_score ps_record; -char status[SERVER_NUM_STATUS]; char stat_buffer[HARD_SERVER_LIMIT]; clock_t tu, ts, tcu, tcs; tu = ts = tcu = tcs = 0; -status[SERVER_DEAD] = '.'; /* We don't want to assume these are in */ -status[SERVER_READY] = '_'; /* any particular order in scoreboard.h */ -status[SERVER_STARTING] = 'S'; -status[SERVER_BUSY_READ] = 'R'; -status[SERVER_BUSY_WRITE] = 'W'; -status[SERVER_BUSY_KEEPALIVE] = 'K'; -status[SERVER_BUSY_LOG] = 'L'; -status[SERVER_BUSY_DNS] = 'D'; -status[SERVER_GRACEFUL] = 'G'; - if (!exists_scoreboard_image()) { aplog_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r-server, Server status unavailable in inetd mode); @@ -261,15 +249,15 @@ if (r-args) { i = 0; - while (options[i].id != STAT_OPT_END) { - if ((loc = strstr(r-args, options[i].form_data_str)) != NULL) { - switch (options[i].id) { + while (status_options[i].id != STAT_OPT_END) { + if ((loc = strstr(r-args,
cvs commit: apachen/src/modules/standard mod_status.c
ben 97/12/14 06:26:13 Modified:src CHANGES src/modules/standard mod_status.c Log: Correct header for Win32. Revision ChangesPath 1.526 +2 -0 apachen/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apachen/src/CHANGES,v retrieving revision 1.525 retrieving revision 1.526 diff -u -r1.525 -r1.526 --- CHANGES 1997/12/12 08:09:17 1.525 +++ CHANGES 1997/12/14 14:26:11 1.526 @@ -1,5 +1,7 @@ Changes with Apache 1.3b4 + *) WIN32: mod_status display header didn't match fields. [Ben Laurie] + *) The pthread_mutex_* functions return an error code, and don't set errno. [Igor Tatarinov [EMAIL PROTECTED]] 1.67 +1 -1 apachen/src/modules/standard/mod_status.c Index: mod_status.c === RCS file: /export/home/cvs/apachen/src/modules/standard/mod_status.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- mod_status.c 1997/10/22 20:30:30 1.66 +++ mod_status.c 1997/12/14 14:26:13 1.67 @@ -429,7 +429,7 @@ if (no_table_report) rputs(phrh2Server Details/h2\n\n, r); else -#ifdef __EMX__ +#ifdef NO_TIMES /* Allow for OS/2 not having CPU stats */ rputs(p\n\ntable border=0trthSrvthPIDthAccthM\nthSSthReqthConnthChildthSlotthHostthVHostthRequest/tr\n\n, r); #else
cvs commit: apachen/src/modules/standard mod_status.c mod_unique_id.c
randy 97/08/31 19:49:48 Modified:src/modules/standard mod_status.c mod_unique_id.c Log: Complete src/modules/standard module conversion of log_*() to aplog_error. Revision ChangesPath 1.61 +2 -1 apachen/src/modules/standard/mod_status.c Index: mod_status.c === RCS file: /export/home/cvs/apachen/src/modules/standard/mod_status.c,v retrieving revision 1.60 retrieving revision 1.61 diff -u -r1.60 -r1.61 --- mod_status.c 1997/08/18 13:12:18 1.60 +++ mod_status.c 1997/09/01 02:49:44 1.61 @@ -240,7 +240,8 @@ status[SERVER_GRACEFUL]='G'; if (!exists_scoreboard_image()) { - log_printf(r-server, Server status unavailable in inetd mode); + aplog_error(APLOG_MARK, APLOG_ERR, r-server, + Server status unavailable in inetd mode); return HTTP_NOT_IMPLEMENTED; } r-allowed = (1 M_GET) | (1 M_TRACE); 1.2 +13 -7 apachen/src/modules/standard/mod_unique_id.c Index: mod_unique_id.c === RCS file: /export/home/cvs/apachen/src/modules/standard/mod_unique_id.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- mod_unique_id.c 1997/08/18 07:17:30 1.1 +++ mod_unique_id.c 1997/09/01 02:49:45 1.2 @@ -144,7 +144,10 @@ */ if (XtOffsetOf (unique_id_rec, counter) + sizeof (cur_unique_id.counter) != 14) { - log_error (mod_unique_id: sorry the size assumptions are wrong in mod_unique_id.c, please remove it from your server or fix the code!, s); + aplog_error(APLOG_MARK, APLOG_ALERT, s, + mod_unique_id: sorry the size assumptions are wrong + in mod_unique_id.c, please remove it from your server + or fix the code!); exit (1); } @@ -153,20 +156,22 @@ * to be unique as the physical address of the machine */ if (gethostname (str, sizeof (str) - 1) != 0) { - log_unixerr (gethostname, mod_unique_id, - mod_unique_id requires the hostname of the server, s); + aplog_error(APLOG_MARK, APLOG_ALERT, s, + gethostname: mod_unique_id requires the hostname of the server); exit (1); } if ((hent = gethostbyname (str)) == NULL) { - log_printf (s, mod_unique_id: unable to gethostbyname(\%s\), str); + aplog_error(APLOG_MARK, APLOG_ALERT, s, + mod_unique_id: unable to gethostbyname(\%s\), str); exit (1); } global_in_addr = ((struct in_addr *)hent-h_addr_list[0])-s_addr; -log_printf (s, mod_unique_id: using ip addr %s, - inet_ntoa (*(struct in_addr *)hent-h_addr_list[0])); +aplog_error(APLOG_MARK, APLOG_INFO, s, + mod_unique_id: using ip addr %s, + inet_ntoa (*(struct in_addr *)hent-h_addr_list[0])); /* If the server is pummelled with restart requests we could possibly * end up in a situation where we're starting again during the same @@ -219,7 +224,8 @@ * test this during global_init ... but oh well. */ if (cur_unique_id.pid != pid) { - log_error (mod_unique_id: oh no! pids are greater than 16-bits! I'm broken!, s); + aplog_error(APLOG_MARK, APLOG_DEBUG, s, + oh no! pids are greater than 16-bits! I'm broken!); } cur_unique_id.in_addr = global_in_addr;
cvs commit: apachen/src/modules/standard mod_status.c
pcs 97/07/26 14:44:41 Modified:src/modules/standard mod_status.c Log: Add info to get Configure to add -DSTATUS Revision ChangesPath 1.55 +16 -0 apachen/src/modules/standard/mod_status.c Index: mod_status.c === RCS file: /export/home/cvs/apachen/src/modules/standard/mod_status.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -r1.54 -r1.55 --- mod_status.c 1997/07/24 04:32:29 1.54 +++ mod_status.c 1997/07/26 21:44:40 1.55 @@ -87,6 +87,22 @@ * 21.5.96 Additional Status codes (DNS and LOGGING only enabled if extended STATUS is enabled) [George Burgyan/Jim J.] */ +/* + * Module definition information - the part between the -START and -END + * lines below is used by Configure. This could be stored in a separate + * instead. + * + * MODULE-DEFINITION-START + * Name: status_module + * ConfigStart +if [ $RULE_STATUS = yes ]; then + CFLAGS=$CFLAGS -DSTATUS +fi + * ConfigEnd + * MODULE-DEFINITION-END + */ + + #include httpd.h #include http_config.h #include http_core.h