From: Manoj Kasichainula Date: Tue, 30 Nov 1999 03:52:57 +0000 (+0000) Subject: Deal with times() properly in autoconf. This also changes NO_TIMES to X-Git-Tag: 1.3.10~141 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3cfe8158afab17cc2caa74d0874048127e1daf87;p=apache Deal with times() properly in autoconf. This also changes NO_TIMES to !HAVE_TIMES. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84193 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/configure.in b/configure.in index 8d5a58f8e9..c6d9fda73f 100644 --- a/configure.in +++ b/configure.in @@ -45,7 +45,6 @@ dnl directory, they should be moved (Comment #Spoon) AC_CHECK_HEADERS( \ unistd.h \ -sys/times.h \ sys/time.h \ ) diff --git a/include/ap_config.h b/include/ap_config.h index 82fc5dd67b..d4cf01e80a 100644 --- a/include/ap_config.h +++ b/include/ap_config.h @@ -1401,6 +1401,11 @@ long vfprintf(FILE *, const char *, va_list); #define HAVE_SETSID #endif +#if !defined(NO_TIMES) && !defined(HAVE_TIMES) +#define HAVE_TIMES +#define HAVE_SYS_TIMES_H +#endif + #endif /* HAVE_CONFIG_H */ /* The assumption is that when the functions are missing, diff --git a/modules/aaa/config.m4 b/modules/aaa/config.m4 index 9d069b51c7..afbeed66bd 100644 --- a/modules/aaa/config.m4 +++ b/modules/aaa/config.m4 @@ -1 +1,6 @@ + +dnl ## mod_usertrack.c +AC_CHECK_HEADERS(sys/times.h) +AC_CHECK_FUNCS(times) + APACHE_MODULE(standard) diff --git a/modules/metadata/mod_usertrack.c b/modules/metadata/mod_usertrack.c index 6e46bb89e1..4ded3a0aee 100644 --- a/modules/metadata/mod_usertrack.c +++ b/modules/metadata/mod_usertrack.c @@ -105,6 +105,9 @@ #if !defined(WIN32) && !defined(MPE) #include #endif +#ifdef HAVE_SYS_TIMES_H +#include +#endif module MODULE_VAR_EXPORT usertrack_module; @@ -132,7 +135,7 @@ static void make_cookie(request_rec *r) { cookie_log_state *cls = ap_get_module_config(r->server->module_config, &usertrack_module); -#if !defined(HAVE_GETTIMEOFDAY) && !defined(NO_TIMES) +#if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_TIMES) clock_t mpe_times; struct tms mpe_tms; #elif !defined(WIN32) @@ -148,7 +151,7 @@ static void make_cookie(request_rec *r) dcfg = ap_get_module_config(r->per_dir_config, &usertrack_module); -#if !defined(HAVE_GETTIMEOFDAY) && !defined(NO_TIMES) +#if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_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. */ diff --git a/os/win32/os.h b/os/win32/os.h index f0c5831253..ff3f2e0378 100644 --- a/os/win32/os.h +++ b/os/win32/os.h @@ -99,7 +99,7 @@ #define CASE_BLIND_FILESYSTEM #define NO_WRITEV #define NO_USE_SIGACTION -#define NO_TIMES +/* #undef HAVE_TIMES */ /* #undef HAVE_GETTIMEOFDAY */ #define USE_LONGJMP #define HAVE_MMAP diff --git a/server/mpm/mpmt_pthread/config.m4 b/server/mpm/mpmt_pthread/config.m4 index a60c6a5801..00636a151e 100644 --- a/server/mpm/mpmt_pthread/config.m4 +++ b/server/mpm/mpmt_pthread/config.m4 @@ -2,6 +2,11 @@ dnl ## XXX - Need a more thorough check of the proper flags to use if test "$MPM_NAME" = "mpmt_pthread" ; then APACHE_OUTPUT(modules/mpm/$MPM_NAME/Makefile) + APACHE_MPM_PTHREAD APACHE_MPM_CHECK_SHMEM + +dnl Obsolete scoreboard code uses this. + AC_CHECK_HEADERS(sys/times.h) + AC_CHECK_FUNCS(times) fi diff --git a/server/mpm/mpmt_pthread/scoreboard.c b/server/mpm/mpmt_pthread/scoreboard.c index 0e82e1838c..e1e5ebc4c4 100644 --- a/server/mpm/mpmt_pthread/scoreboard.c +++ b/server/mpm/mpmt_pthread/scoreboard.c @@ -560,7 +560,7 @@ void increment_counts(int child_num, int thread_num, request_rec *r) if (r->sent_bodyct) ap_bgetopt(r->connection->client, BO_BYTECT, &bs); -#ifndef NO_TIMES +#ifdef HAVE_TIMES times(&ss->times); #endif ss->access_count++; diff --git a/server/mpm/mpmt_pthread/scoreboard.h b/server/mpm/mpmt_pthread/scoreboard.h index c534350a76..dc69f5b64d 100644 --- a/server/mpm/mpmt_pthread/scoreboard.h +++ b/server/mpm/mpmt_pthread/scoreboard.h @@ -62,12 +62,10 @@ extern "C" { #endif -#ifndef WIN32 -#ifdef TPF -#include -#else +#ifdef HAVE_SYS_TIMES_H #include -#endif /* TPF */ +#elif defined(TPF) +#include #endif #include "mpm_default.h" /* For HARD_.*_LIMIT */ @@ -154,7 +152,7 @@ typedef struct { struct timeval start_time; struct timeval stop_time; #endif -#ifndef NO_TIMES +#ifdef HAVE_TIMES struct tms times; #endif #ifndef OPTIMIZE_TIMEOUTS diff --git a/server/mpm/prefork/config.m4 b/server/mpm/prefork/config.m4 index b4cfe38357..747b318d4d 100644 --- a/server/mpm/prefork/config.m4 +++ b/server/mpm/prefork/config.m4 @@ -2,4 +2,8 @@ if test "$MPM_NAME" = "prefork" ; then APACHE_OUTPUT(modules/mpm/$MPM_NAME/Makefile) APACHE_MPM_CHECK_SHMEM + +dnl Obsolete scoreboard code uses this. + AC_CHECK_HEADERS(sys/times.h) + AC_CHECK_FUNCS(times) fi diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 3f0f87d963..39e1efe5be 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -1474,7 +1474,7 @@ static void update_scoreboard_global(void) void ap_time_process_request(int child_num, int status) { short_score *ss; -#if !defined(HAVE_GETTIMEOFDAY) && !defined(NO_TIMES) +#if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_TIMES) struct tms tms_blk; #endif @@ -1486,9 +1486,9 @@ void ap_time_process_request(int child_num, int status) if (status == START_PREQUEST) { #if !defined(HAVE_GETTIMEOFDAY) -#ifndef NO_TIMES +#ifdef HAVE_TIMES if ((ss->start_time = times(&tms_blk)) == -1) -#endif /* NO_TIMES */ +#endif /* HAVE_TIMES */ ss->start_time = (clock_t) 0; #else if (gettimeofday(&ss->start_time, (struct timezone *) 0) < 0) @@ -1498,7 +1498,7 @@ void ap_time_process_request(int child_num, int status) } else if (status == STOP_PREQUEST) { #if !defined(HAVE_GETTIMEOFDAY) -#ifndef NO_TIMES +#ifdef HAVE_TIMES if ((ss->stop_time = times(&tms_blk)) == -1) #endif ss->stop_time = ss->start_time = (clock_t) 0; @@ -1527,7 +1527,7 @@ static void increment_counts(int child_num, request_rec *r) if (r->sent_bodyct) ap_bgetopt(r->connection->client, BO_BYTECT, &bs); -#ifndef NO_TIMES +#ifdef HAVE_TIMES times(&ss->times); #endif ss->access_count++; diff --git a/server/mpm/prefork/scoreboard.h b/server/mpm/prefork/scoreboard.h index 9c60a7f50d..a2d9f3accf 100644 --- a/server/mpm/prefork/scoreboard.h +++ b/server/mpm/prefork/scoreboard.h @@ -70,6 +70,10 @@ extern "C" { #endif /* TPF */ #endif +#ifdef HAVE_SYS_TIMES_H +#include +#endif + /* Scoreboard info on a process is, for now, kept very brief --- * just status value and pid (the latter so that the caretaker process * can properly update the scoreboard when a process dies). We may want @@ -149,7 +153,7 @@ typedef struct { struct timeval start_time; struct timeval stop_time; #endif -#ifndef NO_TIMES +#ifdef HAVE_TIMES struct tms times; #endif #ifndef OPTIMIZE_TIMEOUTS diff --git a/server/mpm/spmt_os2/scoreboard.h b/server/mpm/spmt_os2/scoreboard.h index 762c2ffc8b..a345766824 100644 --- a/server/mpm/spmt_os2/scoreboard.h +++ b/server/mpm/spmt_os2/scoreboard.h @@ -62,7 +62,9 @@ extern "C" { #endif +#ifdef HAVE_SYS_TIMES_H #include +#endif /* Scoreboard info on a thread is, for now, kept very brief --- * just status value and pid (the latter so that the caretaker thread @@ -143,7 +145,7 @@ typedef struct { struct timeval start_time; struct timeval stop_time; #endif -#ifndef NO_TIMES +#ifdef HAVE_TIMES struct tms times; #endif #ifndef OPTIMIZE_TIMEOUTS diff --git a/server/mpm/spmt_os2/spmt_os2.c b/server/mpm/spmt_os2/spmt_os2.c index 109dbb8ab6..09d305b386 100644 --- a/server/mpm/spmt_os2/spmt_os2.c +++ b/server/mpm/spmt_os2/spmt_os2.c @@ -429,7 +429,7 @@ int ap_update_child_status(int child_num, int status, request_rec *r) void ap_time_process_request(int child_num, int status) { short_score *ss; -#if !defined(HAVE_GETTIMEOFDAY) && !defined(NO_TIMES) +#if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_TIMES) struct tms tms_blk; #endif @@ -440,9 +440,9 @@ void ap_time_process_request(int child_num, int status) if (status == START_PREQUEST) { #if !defined(HAVE_GETTIMEOFDAY) -#ifndef NO_TIMES +#ifdef HAVE_TIMES if ((ss->start_time = times(&tms_blk)) == -1) -#endif /* NO_TIMES */ +#endif /* HAVE_TIMES */ ss->start_time = (clock_t) 0; #else if (gettimeofday(&ss->start_time, (struct timezone *) 0) < 0) @@ -452,7 +452,7 @@ void ap_time_process_request(int child_num, int status) } else if (status == STOP_PREQUEST) { #if !defined(HAVE_GETTIMEOFDAY) -#ifndef NO_TIMES +#ifdef HAVE_TIMES if ((ss->stop_time = times(&tms_blk)) == -1) #endif ss->stop_time = ss->start_time = (clock_t) 0; @@ -478,7 +478,7 @@ static void increment_counts(int child_num, request_rec *r) if (r->sent_bodyct) ap_bgetopt(r->connection->client, BO_BYTECT, &bs); -#ifndef NO_TIMES +#ifdef HAVE_TIMES times(&ss->times); #endif ss->access_count++;