From: Bill Stoddard Date: Wed, 27 Feb 2002 18:57:26 +0000 (+0000) Subject: De-tabify... X-Git-Tag: 2.0.33~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02d9c8800b18c181411ec05a33d4f5e150528c2d;p=thirdparty%2Fapache%2Fhttpd.git De-tabify... git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93603 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/generators/mod_status.c b/modules/generators/mod_status.c index 81a813ff782..aeadad0857b 100644 --- a/modules/generators/mod_status.c +++ b/modules/generators/mod_status.c @@ -269,13 +269,13 @@ static int status_handler(request_rec *r) tu = ts = tcu = tcs = 0; if (!ap_exists_scoreboard_image()) { - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, - "Server status unavailable in inetd mode"); - return HTTP_INTERNAL_SERVER_ERROR; + ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, + "Server status unavailable in inetd mode"); + return HTTP_INTERNAL_SERVER_ERROR; } r->allowed = (AP_METHOD_BIT << M_GET); if (r->method_number != M_GET) - return DECLINED; + return DECLINED; r->content_type = "text/html"; @@ -284,106 +284,105 @@ static int status_handler(request_rec *r) */ if (r->args) { - i = 0; - while (status_options[i].id != STAT_OPT_END) { - if ((loc = ap_strstr_c(r->args, status_options[i].form_data_str)) != NULL) { - switch (status_options[i].id) { - case STAT_OPT_REFRESH: - if (*(loc + strlen(status_options[i].form_data_str)) == '=' + i = 0; + while (status_options[i].id != STAT_OPT_END) { + if ((loc = ap_strstr_c(r->args, status_options[i].form_data_str)) != NULL) { + switch (status_options[i].id) { + case STAT_OPT_REFRESH: + if (*(loc + strlen(status_options[i].form_data_str)) == '=' && atol(loc + strlen(status_options[i].form_data_str) - + 1) > 0) - apr_table_set(r->headers_out, - status_options[i].hdr_out_str, - loc + strlen(status_options[i].hdr_out_str) + 1); - else - apr_table_set(r->headers_out, - status_options[i].hdr_out_str, "1"); - break; - case STAT_OPT_NOTABLE: - no_table_report = 1; - break; - case STAT_OPT_AUTO: - r->content_type = "text/plain"; - short_report = 1; - break; - } - } - i++; - } + + 1) > 0) + apr_table_set(r->headers_out, + status_options[i].hdr_out_str, + loc + strlen(status_options[i].hdr_out_str) + 1); + else + apr_table_set(r->headers_out, + status_options[i].hdr_out_str, "1"); + break; + case STAT_OPT_NOTABLE: + no_table_report = 1; + break; + case STAT_OPT_AUTO: + r->content_type = "text/plain"; + short_report = 1; + break; + } + } + i++; + } } if (r->header_only) - return 0; + return 0; -/* ap_sync_scoreboard_image(); */ for (i = 0; i < server_limit; ++i) { for (j = 0; j < thread_limit; ++j) { int indx = (i * thread_limit) + j; - ws_record = ap_scoreboard_image->servers[i][j]; - ps_record = ap_scoreboard_image->parent[i]; - res = ws_record.status; - stat_buffer[indx] = status_flags[res]; + ws_record = ap_scoreboard_image->servers[i][j]; + ps_record = ap_scoreboard_image->parent[i]; + res = ws_record.status; + stat_buffer[indx] = status_flags[res]; if (!ps_record.quiescing && - ps_record.generation == ap_my_generation && - ps_record.pid) { - if (res == SERVER_READY) - ready++; - else if (res != SERVER_DEAD && res != SERVER_IDLE_KILL) - busy++; + ps_record.generation == ap_my_generation && + ps_record.pid) { + if (res == SERVER_READY) + ready++; + else if (res != SERVER_DEAD && res != SERVER_IDLE_KILL) + busy++; } /* XXX what about the counters for quiescing/seg faulted * processes? should they be counted or not? GLA */ - if (ap_extended_status) { - lres = ws_record.access_count; - bytes = ws_record.bytes_served; - if (lres != 0 || (res != SERVER_READY && res != SERVER_DEAD)) { + if (ap_extended_status) { + lres = ws_record.access_count; + bytes = ws_record.bytes_served; + if (lres != 0 || (res != SERVER_READY && res != SERVER_DEAD)) { #ifdef HAVE_TIMES - tu += ws_record.times.tms_utime; - ts += ws_record.times.tms_stime; - tcu += ws_record.times.tms_cutime; - tcs += ws_record.times.tms_cstime; + tu += ws_record.times.tms_utime; + ts += ws_record.times.tms_stime; + tcu += ws_record.times.tms_cutime; + tcs += ws_record.times.tms_cstime; #endif /* HAVE_TIMES */ - count += lres; - bcount += bytes; - if (bcount >= KBYTE) { - kbcount += (bcount >> 10); - bcount = bcount & 0x3ff; - } - } - } + count += lres; + bcount += bytes; + if (bcount >= KBYTE) { + kbcount += (bcount >> 10); + bcount = bcount & 0x3ff; + } + } + } } - pid_buffer[i] = ps_record.pid; + pid_buffer[i] = ps_record.pid; } /* up_time in seconds */ up_time = (apr_uint32_t) ((nowtime - ap_scoreboard_image->global->restart_time)/APR_USEC_PER_SEC); if (!short_report) { - ap_rputs(DOCTYPE_HTML_3_2 - "\nApache Status\n\n", - r); - ap_rputs("

Apache Server Status for ", r); - ap_rvputs(r, ap_get_server_name(r), "

\n\n", NULL); - ap_rvputs(r, "
Server Version: ", - ap_get_server_version(), "
\n", NULL); - ap_rvputs(r, "
Server Built: ", - ap_get_server_built(), "\n

\n", NULL); - ap_rvputs(r, "
Current Time: ", - ap_ht_time(r->pool, nowtime, DEFAULT_TIME_FORMAT, 0), "
\n", NULL); - ap_rvputs(r, "
Restart Time: ", - ap_ht_time(r->pool, ap_scoreboard_image->global->restart_time, DEFAULT_TIME_FORMAT, 0), - "
\n", NULL); - ap_rprintf(r, "
Parent Server Generation: %d
\n", (int) ap_my_generation); - ap_rputs("
Server uptime: ", r); - show_time(r, up_time); - ap_rputs("
\n", r); + ap_rputs(DOCTYPE_HTML_3_2 + "\nApache Status\n\n", + r); + ap_rputs("

Apache Server Status for ", r); + ap_rvputs(r, ap_get_server_name(r), "

\n\n", NULL); + ap_rvputs(r, "
Server Version: ", + ap_get_server_version(), "
\n", NULL); + ap_rvputs(r, "
Server Built: ", + ap_get_server_built(), "\n

\n", NULL); + ap_rvputs(r, "
Current Time: ", + ap_ht_time(r->pool, nowtime, DEFAULT_TIME_FORMAT, 0), "
\n", NULL); + ap_rvputs(r, "
Restart Time: ", + ap_ht_time(r->pool, ap_scoreboard_image->global->restart_time, DEFAULT_TIME_FORMAT, 0), + "
\n", NULL); + ap_rprintf(r, "
Parent Server Generation: %d
\n", (int) ap_my_generation); + ap_rputs("
Server uptime: ", r); + show_time(r, up_time); + ap_rputs("
\n", r); } if (ap_extended_status) { - if (short_report) { - ap_rprintf(r, "Total Accesses: %lu\nTotal kBytes: %" + if (short_report) { + ap_rprintf(r, "Total Accesses: %lu\nTotal kBytes: %" APR_OFF_T_FMT "\n", count, kbcount); @@ -394,124 +393,123 @@ static int status_handler(request_rec *r) (tu + ts + tcu + tcs) / tick / up_time * 100.); #endif - ap_rprintf(r, "Uptime: %ld\n", (long) (up_time)); - if (up_time > 0) - ap_rprintf(r, "ReqPerSec: %g\n", - (float) count / (float) up_time); + ap_rprintf(r, "Uptime: %ld\n", (long) (up_time)); + if (up_time > 0) + ap_rprintf(r, "ReqPerSec: %g\n", + (float) count / (float) up_time); - if (up_time > 0) - ap_rprintf(r, "BytesPerSec: %g\n", - KBYTE * (float) kbcount / (float) up_time); + if (up_time > 0) + ap_rprintf(r, "BytesPerSec: %g\n", + KBYTE * (float) kbcount / (float) up_time); - if (count > 0) - ap_rprintf(r, "BytesPerReq: %g\n", - KBYTE * (float) kbcount / (float) count); - } - else { /* !short_report */ - ap_rprintf(r, "
Total accesses: %lu - Total Traffic: ", count); - format_kbyte_out(r, kbcount); - ap_rputs("
\n", r); + if (count > 0) + ap_rprintf(r, "BytesPerReq: %g\n", + KBYTE * (float) kbcount / (float) count); + } + else { /* !short_report */ + ap_rprintf(r, "
Total accesses: %lu - Total Traffic: ", count); + format_kbyte_out(r, kbcount); + ap_rputs("
\n", r); #ifdef HAVE_TIMES - /* Allow for OS/2 not having CPU stats */ - ap_rprintf(r, "
CPU Usage: u%g s%g cu%g cs%g", - tu / tick, ts / tick, tcu / tick, tcs / tick); + /* Allow for OS/2 not having CPU stats */ + ap_rprintf(r, "
CPU Usage: u%g s%g cu%g cs%g", + tu / tick, ts / tick, tcu / tick, tcs / tick); - if (ts || tu || tcu || tcs) - ap_rprintf(r, " - %.3g%% CPU load
\n", - (tu + ts + tcu + tcs) / tick / up_time * 100.); + if (ts || tu || tcu || tcs) + ap_rprintf(r, " - %.3g%% CPU load\n", + (tu + ts + tcu + tcs) / tick / up_time * 100.); #endif - if (up_time > 0) - ap_rprintf(r, "
%.3g requests/sec - ", - (float) count / (float) up_time); + if (up_time > 0) + ap_rprintf(r, "
%.3g requests/sec - ", + (float) count / (float) up_time); - if (up_time > 0) { - format_byte_out(r, (unsigned long)(KBYTE * (float) kbcount - / (float) up_time)); - ap_rputs("/second - ", r); - } + if (up_time > 0) { + format_byte_out(r, (unsigned long)(KBYTE * (float) kbcount + / (float) up_time)); + ap_rputs("/second - ", r); + } - if (count > 0) { - format_byte_out(r, (unsigned long)(KBYTE * (float) kbcount - / (float) count)); - ap_rputs("/request", r); - } + if (count > 0) { + format_byte_out(r, (unsigned long)(KBYTE * (float) kbcount + / (float) count)); + ap_rputs("/request", r); + } - ap_rputs("
\n", r); - } /* short_report */ + ap_rputs("\n", r); + } /* short_report */ } /* ap_extended_status */ if (!short_report) - ap_rprintf(r, "
%d requests currently being processed, %d idle workers
\n" - ,busy, ready); + ap_rprintf(r, "
%d requests currently being processed, %d idle workers
\n" + ,busy, ready); else - ap_rprintf(r, "BusyWorkers: %d\nIdleWorkers: %d\n", busy, ready); + ap_rprintf(r, "BusyWorkers: %d\nIdleWorkers: %d\n", busy, ready); /* send the scoreboard 'table' out */ - if (!short_report) - ap_rputs("
", r);
+        ap_rputs("
", r);
     else
-	ap_rputs("Scoreboard: ", r);
+        ap_rputs("Scoreboard: ", r);
 
     for (i = 0; i < server_limit; ++i) {
         for (j = 0; j < thread_limit; ++j) {
             int indx = (i * thread_limit) + j;
-	    ap_rputc(stat_buffer[indx], r);
-	    if ((indx % STATUS_MAXLINE == (STATUS_MAXLINE - 1)) && !short_report)
-	        ap_rputs("\n", r);
+            ap_rputc(stat_buffer[indx], r);
+            if ((indx % STATUS_MAXLINE == (STATUS_MAXLINE - 1)) && !short_report)
+                ap_rputs("\n", r);
         }
     }
 
     if (short_report)
-	ap_rputs("\n", r);
+        ap_rputs("\n", r);
     else {
-	ap_rputs("
\n", r); - ap_rputs("

Scoreboard Key:
\n", r); - ap_rputs("\"_\" Waiting for Connection, \n", r); - ap_rputs("\"S\" Starting up, \n", r); - ap_rputs("\"R\" Reading Request,
\n", r); - ap_rputs("\"W\" Sending Reply, \n", r); - ap_rputs("\"K\" Keepalive (read), \n", r); - ap_rputs("\"D\" DNS Lookup,
\n", r); - ap_rputs("\"C\" Closing connection, \n", r); - ap_rputs("\"L\" Logging, \n", r); - ap_rputs("\"G\" Gracefully finishing,
\n", r); + ap_rputs("\n", r); + ap_rputs("

Scoreboard Key:
\n", r); + ap_rputs("\"_\" Waiting for Connection, \n", r); + ap_rputs("\"S\" Starting up, \n", r); + ap_rputs("\"R\" Reading Request,
\n", r); + ap_rputs("\"W\" Sending Reply, \n", r); + ap_rputs("\"K\" Keepalive (read), \n", r); + ap_rputs("\"D\" DNS Lookup,
\n", r); + ap_rputs("\"C\" Closing connection, \n", r); + ap_rputs("\"L\" Logging, \n", r); + ap_rputs("\"G\" Gracefully finishing,
\n", r); ap_rputs("\"I\" Idle cleanup of worker, \n", r); - ap_rputs("\".\" Open slot with no current process

\n", r); - ap_rputs("

\n", r); - if (!ap_extended_status) { - int j; + ap_rputs("\".\" Open slot with no current process

\n", r); + ap_rputs("

\n", r); + if (!ap_extended_status) { + int j; int k = 0; - ap_rputs("PID Key:
\n", r); - ap_rputs("

\n", r);
-	    for (i = 0; i < server_limit; ++i) {
+            ap_rputs("PID Key: 
\n", r); + ap_rputs("
\n", r);
+            for (i = 0; i < server_limit; ++i) {
                 for (j = 0; j < thread_limit; ++j) {
                     int indx = (i * thread_limit) + j;
 
-		    if (stat_buffer[indx] != '.') {
-		        ap_rprintf(r, "   %" APR_OS_PROC_T_FMT 
+                    if (stat_buffer[indx] != '.') {
+                        ap_rprintf(r, "   %" APR_OS_PROC_T_FMT 
                                    " in state: %c ", pid_buffer[i],
                                    stat_buffer[indx]);
-		        if (++k >= 3) {
-		    	    ap_rputs("\n", r);
-			    k = 0;
-		        } else
-		    	    ap_rputs(",", r);
-		    }
+                        if (++k >= 3) {
+                            ap_rputs("\n", r);
+                            k = 0;
+                        } else
+                            ap_rputs(",", r);
+                    }
                 }
-	    }
-	    ap_rputs("\n", r);
-	    ap_rputs("
\n", r); - } + } + ap_rputs("\n", r); + ap_rputs("
\n", r); + } } if (ap_extended_status) { - if (!short_report) { - if (no_table_report) - ap_rputs("

Server Details

\n\n", r); - else + if (!short_report) { + if (no_table_report) + ap_rputs("

Server Details

\n\n", r); + else #ifndef HAVE_TIMES /* Allow for OS/2 not having CPU stats */ ap_rputs("\n\n\n\n", r);
SrvPIDAccM\nSSReqConnChildSlotClientVHostRequest