akosut 97/09/11 12:32:52
Modified: src/main conf.h http_main.c scoreboard.h
src/modules/standard mod_status.c mod_usertrack.c
Log:
Cause Windows to compile again, with full STATUS reports turned on.
This involves removing a bit of status data, since Windows supports
neither times() nor gettimeofday().
Revision Changes Path
1.133 +3 -0 apachen/src/main/conf.h
Index: conf.h
===================================================================
RCS file: /export/home/cvs/apachen/src/main/conf.h,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -r1.132 -r1.133
--- conf.h 1997/09/09 22:33:55 1.132
+++ conf.h 1997/09/11 19:32:40 1.133
@@ -532,6 +532,7 @@
#define NEED_STRCASECMP
#define NEED_STRNCASECMP
#define NO_SETSID
+#define NO_TIMES
/* Add some drive name support */
#define chdir _chdir2
#include <sys/time.h>
@@ -641,6 +642,8 @@
#define NO_WRITEV
#define NO_SETSID
#define NO_USE_SIGACTION
+#define NO_TIMES
+#define NO_GETTIMEOFDAY
#define NEED_PROCESS_H
#define USE_LONGJMP
#define HAVE_MMAP
1.217 +7 -1 apachen/src/main/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
retrieving revision 1.216
retrieving revision 1.217
diff -u -r1.216 -r1.217
--- http_main.c 1997/09/10 17:43:22 1.216
+++ http_main.c 1997/09/11 19:32:43 1.217
@@ -1523,7 +1523,7 @@
void time_process_request (int child_num, int status)
{
short_score *ss;
-#if defined(NO_GETTIMEOFDAY)
+#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES)
struct tms tms_blk;
#endif
@@ -1535,7 +1535,9 @@
if (status == START_PREQUEST) {
#if defined(NO_GETTIMEOFDAY)
+#ifndef NO_TIMES
if ((ss->start_time = times(&tms_blk)) == -1)
+#endif /* NO_TIMES */
ss->start_time = (clock_t)0;
#else
if (gettimeofday(&ss->start_time, (struct timezone *)0) < 0)
@@ -1545,7 +1547,9 @@
}
else if (status == STOP_PREQUEST) {
#if defined(NO_GETTIMEOFDAY)
+#ifndef NO_TIMES
if ((ss->stop_time = times(&tms_blk)) == -1)
+#endif
ss->stop_time = ss->start_time = (clock_t)0;
#else
if (gettimeofday(&ss->stop_time, (struct timezone *)0) < 0)
@@ -1571,7 +1575,9 @@
if (r->sent_bodyct)
bgetopt(r->connection->client, BO_BYTECT, &bs);
+#ifndef NO_TIMES
times(&ss->times);
+#endif
ss->access_count ++;
ss->my_access_count ++;
ss->conn_count ++;
1.29 +2 -0 apachen/src/main/scoreboard.h
Index: scoreboard.h
===================================================================
RCS file: /export/home/cvs/apachen/src/main/scoreboard.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- scoreboard.h 1997/08/17 11:40:14 1.28
+++ scoreboard.h 1997/09/11 19:32:44 1.29
@@ -116,7 +116,9 @@
struct timeval start_time;
struct timeval stop_time;
#endif
+#ifndef NO_TIMES
struct tms times;
+#endif
time_t last_used;
char client[32]; /* Keep 'em small... */
char request[64]; /* We just want an idea... */
1.62 +12 -6 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.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- mod_status.c 1997/09/01 02:49:44 1.61
+++ mod_status.c 1997/09/11 19:32:49 1.62
@@ -213,9 +213,9 @@
unsigned long bcount=0;
unsigned long kbcount=0;
long req_time;
-#ifdef NEXT
+#if defined(NEXT)
float tick=HZ;
-#else
+#elif !defined(WIN32)
float tick=sysconf(_SC_CLK_TCK);
#endif
#endif /* STATUS */
@@ -303,10 +303,12 @@
if (lres!=0 || (score_record.status != SERVER_READY
&& score_record.status != SERVER_DEAD))
{
+#ifndef NO_TIMES
tu+=score_record.times.tms_utime;
ts+=score_record.times.tms_stime;
tcu+=score_record.times.tms_cutime;
tcs+=score_record.times.tms_cstime;
+#endif /* NO_TIMES */
count+=lres;
bcount+=bytes;
if (bcount>=KBYTE) {
@@ -339,7 +341,7 @@
{
rprintf(r,"Total Accesses: %lu\nTotal kBytes: %lu\n",count,kbcount);
-#ifndef __EMX__
+#ifndef NO_TIMES
/* Allow for OS/2 not having CPU stats */
if(ts || tu || tcu || tcs)
rprintf(r,"CPULoad: %g\n",(tu+ts+tcu+tcs)/tick/up_time*100.);
@@ -359,7 +361,7 @@
rprintf(r,"Total accesses: %lu - Total Traffic: ", count);
format_kbyte_out(r,kbcount);
-#ifndef __EMX__
+#ifndef NO_TIMES
/* Allow for OS/2 not having CPU stats */
rputs("<br>\n",r);
rprintf(r,"CPU Usage: u%g s%g cu%g cs%g",
@@ -445,12 +447,16 @@
score_record=get_scoreboard_info(i);
#if defined(NO_GETTIMEOFDAY)
+#ifndef NO_TIMES
if (score_record.start_time == (clock_t)0)
+#endif /* NO_TIMES */
req_time = 0L;
+#ifndef NO_TIMES
else {
req_time = score_record.stop_time - score_record.start_time;
req_time = (req_time*1000)/(int)tick;
}
+#endif /* NO_TIMES */
#else
if (score_record.start_time.tv_sec == 0L &&
score_record.start_time.tv_usec == 0L)
@@ -516,7 +522,7 @@
rputs("?STATE?",r);
break;
}
-#ifdef __EMX__
+#ifdef NO_TIMES
/* Allow for OS/2 not having CPU stats */
rprintf(r,"]\n %.0f %ld (",
#else
@@ -581,7 +587,7 @@
rputs("<td>?",r);
break;
}
-#ifdef __EMX__
+#ifdef NO_TIMES
/* Allow for OS/2 not having CPU stats */
rprintf(r,"\n<td>%.0f<td>%ld",
#else
1.18 +2 -2 apachen/src/modules/standard/mod_usertrack.c
Index: mod_usertrack.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_usertrack.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- mod_usertrack.c 1997/08/18 13:12:18 1.17
+++ mod_usertrack.c 1997/09/11 19:32:50 1.18
@@ -126,7 +126,7 @@
{
cookie_log_state *cls = get_module_config (r->server->module_config,
&usertrack_module);
-#if defined(NO_GETTIMEOFDAY)
+#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES)
clock_t mpe_times;
struct tms mpe_tms;
#elif !defined(WIN32)
@@ -143,7 +143,7 @@
if ((dot = strchr(rname,'.'))) *dot='\0'; /* First bit of
hostname */
-#if defined(NO_GETTIMEOFDAY)
+#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES)
/* We lack gettimeofday(), so we must use time() to obtain the epoch
seconds, and then times() to obtain CPU clock ticks (milliseconds).
Combine this together to obtain a hopefully unique cookie ID. */