Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 331747 | Differences between
and this patch

Collapse All | Expand All

(-)thttpd-2.25b.orig/configure (-11 / +59 lines)
Lines 2299-2311 Link Here
2299
	;;
2299
	;;
2300
esac
2300
esac
2301
2301
2302
echo $ac_n "checking for clock_gettime in -lrt""... $ac_c" 1>&6
2303
echo "configure:2304: checking for clock_gettime in -lrt" >&5
2304
ac_lib_var=`echo rt'_'clock_gettime | sed 'y%./+-%__p_%'`
2305
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
2306
  echo $ac_n "(cached) $ac_c" 1>&6
2307
else
2308
  ac_save_LIBS="$LIBS"
2309
LIBS="-lrt  $LIBS"
2310
cat > conftest.$ac_ext <<EOF
2311
#line 2312 "configure"
2312
#include "confdefs.h"
2313
/* Override any gcc2 internal prototype to avoid an error.  */
2314
/* We use char because int might match the return type of a gcc2
2315
    builtin and then its argument prototype would still apply.  */
2316
char clock_gettime();
2317
2318
int main() {
2319
clock_gettime()
2320
; return 0; }
2321
EOF
2322
if { (eval echo configure:2323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
2323
  rm -rf conftest*
2324
  eval "ac_cv_lib_$ac_lib_var=yes"
2325
else
2326
  echo "configure: failed program was:" >&5
2327
  cat conftest.$ac_ext >&5
2328
  rm -rf conftest*
2329
  eval "ac_cv_lib_$ac_lib_var=no"
2330
fi
2331
rm -f conftest*
2332
LIBS="$ac_save_LIBS"
2333
2334
fi
2335
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
2336
  echo "$ac_t""yes" 1>&6
2337
    ac_tr_lib=HAVE_LIB`echo rt | sed -e 's/[^a-zA-Z0-9_]/_/g' \
2338
    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
2339
  cat >> confdefs.h <<EOF
2340
#define $ac_tr_lib 1
2341
EOF
2342
2343
  LIBS="-lrt $LIBS"
2344
2345
else
2346
  echo "$ac_t""no" 1>&6
2347
fi
2348
2349
2302
echo $ac_n "checking if struct tm has tm_gmtoff member""... $ac_c" 1>&6
2350
echo $ac_n "checking if struct tm has tm_gmtoff member""... $ac_c" 1>&6
2303
echo "configure:2304: checking if struct tm has tm_gmtoff member" >&5
2351
echo "configure:2352: checking if struct tm has tm_gmtoff member" >&5
2304
    if eval "test \"`echo '$''{'ac_cv_acme_tm_has_tm_gmtoff'+set}'`\" = set"; then
2352
    if eval "test \"`echo '$''{'ac_cv_acme_tm_has_tm_gmtoff'+set}'`\" = set"; then
2305
  echo $ac_n "(cached) $ac_c" 1>&6
2353
  echo $ac_n "(cached) $ac_c" 1>&6
2306
else
2354
else
2307
  cat > conftest.$ac_ext <<EOF
2355
  cat > conftest.$ac_ext <<EOF
2308
#line 2309 "configure"
2356
#line 2357 "configure"
2309
#include "confdefs.h"
2357
#include "confdefs.h"
2310
2358
2311
#	include <sys/types.h>
2359
#	include <sys/types.h>
Lines 2314-2320 Link Here
2314
u_int i = sizeof(((struct tm *)0)->tm_gmtoff)
2362
u_int i = sizeof(((struct tm *)0)->tm_gmtoff)
2315
; return 0; }
2363
; return 0; }
2316
EOF
2364
EOF
2317
if { (eval echo configure:2318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2365
if { (eval echo configure:2366: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2318
  rm -rf conftest*
2366
  rm -rf conftest*
2319
  ac_cv_acme_tm_has_tm_gmtoff=yes
2367
  ac_cv_acme_tm_has_tm_gmtoff=yes
2320
else
2368
else
Lines 2334-2345 Link Here
2334
2382
2335
    fi
2383
    fi
2336
echo $ac_n "checking if int64_t exists""... $ac_c" 1>&6
2384
echo $ac_n "checking if int64_t exists""... $ac_c" 1>&6
2337
echo "configure:2338: checking if int64_t exists" >&5
2385
echo "configure:2386: checking if int64_t exists" >&5
2338
    if eval "test \"`echo '$''{'ac_cv_acme_int64_t'+set}'`\" = set"; then
2386
    if eval "test \"`echo '$''{'ac_cv_acme_int64_t'+set}'`\" = set"; then
2339
  echo $ac_n "(cached) $ac_c" 1>&6
2387
  echo $ac_n "(cached) $ac_c" 1>&6
2340
else
2388
else
2341
  cat > conftest.$ac_ext <<EOF
2389
  cat > conftest.$ac_ext <<EOF
2342
#line 2343 "configure"
2390
#line 2391 "configure"
2343
#include "confdefs.h"
2391
#include "confdefs.h"
2344
2392
2345
#	include <sys/types.h>
2393
#	include <sys/types.h>
Lines 2347-2353 Link Here
2347
int64_t i64
2395
int64_t i64
2348
; return 0; }
2396
; return 0; }
2349
EOF
2397
EOF
2350
if { (eval echo configure:2351: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2398
if { (eval echo configure:2399: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2351
  rm -rf conftest*
2399
  rm -rf conftest*
2352
  ac_cv_acme_int64_t=yes
2400
  ac_cv_acme_int64_t=yes
2353
else
2401
else
Lines 2367-2378 Link Here
2367
2415
2368
    fi
2416
    fi
2369
echo $ac_n "checking if socklen_t exists""... $ac_c" 1>&6
2417
echo $ac_n "checking if socklen_t exists""... $ac_c" 1>&6
2370
echo "configure:2371: checking if socklen_t exists" >&5
2418
echo "configure:2419: checking if socklen_t exists" >&5
2371
    if eval "test \"`echo '$''{'ac_cv_acme_socklen_t'+set}'`\" = set"; then
2419
    if eval "test \"`echo '$''{'ac_cv_acme_socklen_t'+set}'`\" = set"; then
2372
  echo $ac_n "(cached) $ac_c" 1>&6
2420
  echo $ac_n "(cached) $ac_c" 1>&6
2373
else
2421
else
2374
  cat > conftest.$ac_ext <<EOF
2422
  cat > conftest.$ac_ext <<EOF
2375
#line 2376 "configure"
2423
#line 2424 "configure"
2376
#include "confdefs.h"
2424
#include "confdefs.h"
2377
2425
2378
#	include <sys/types.h>
2426
#	include <sys/types.h>
Lines 2381-2387 Link Here
2381
socklen_t slen
2429
socklen_t slen
2382
; return 0; }
2430
; return 0; }
2383
EOF
2431
EOF
2384
if { (eval echo configure:2385: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2432
if { (eval echo configure:2433: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
2385
  rm -rf conftest*
2433
  rm -rf conftest*
2386
  ac_cv_acme_socklen_t=yes
2434
  ac_cv_acme_socklen_t=yes
2387
else
2435
else
Lines 2402-2408 Link Here
2402
    fi
2450
    fi
2403
2451
2404
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
2452
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
2405
echo "configure:2406: checking whether ${MAKE-make} sets \${MAKE}" >&5
2453
echo "configure:2454: checking whether ${MAKE-make} sets \${MAKE}" >&5
2406
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
2454
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
2407
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
2455
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
2408
  echo $ac_n "(cached) $ac_c" 1>&6
2456
  echo $ac_n "(cached) $ac_c" 1>&6
Lines 2440-2446 Link Here
2440
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
2488
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
2441
# ./install, which can be erroneously created by make from ./install.sh.
2489
# ./install, which can be erroneously created by make from ./install.sh.
2442
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
2490
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
2443
echo "configure:2444: checking for a BSD compatible install" >&5
2491
echo "configure:2492: checking for a BSD compatible install" >&5
2444
if test -z "$INSTALL"; then
2492
if test -z "$INSTALL"; then
2445
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
2493
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
2446
  echo $ac_n "(cached) $ac_c" 1>&6
2494
  echo $ac_n "(cached) $ac_c" 1>&6
(-)thttpd-2.25b.orig/configure.in (+2 lines)
Lines 123-128 Link Here
123
	;;
123
	;;
124
esac
124
esac
125
125
126
AC_CHECK_LIB(rt, clock_gettime)
127
126
AC_ACME_TM_GMTOFF
128
AC_ACME_TM_GMTOFF
127
AC_ACME_INT64T
129
AC_ACME_INT64T
128
AC_ACME_SOCKLENT
130
AC_ACME_SOCKLENT
(-)thttpd-2.25b.orig/thttpd.c (-2 / +2 lines)
Lines 742-748 Link Here
742
	}
742
	}
743
743
744
    /* Main loop. */
744
    /* Main loop. */
745
    (void) gettimeofday( &tv, (struct timezone*) 0 );
745
    tmr_prepare_timeval( &tv );
746
    while ( ( ! terminate ) || num_connects > 0 )
746
    while ( ( ! terminate ) || num_connects > 0 )
747
	{
747
	{
748
	/* Do we need to re-open the log file? */
748
	/* Do we need to re-open the log file? */
Lines 761-767 Link Here
761
	    syslog( LOG_ERR, "fdwatch - %m" );
761
	    syslog( LOG_ERR, "fdwatch - %m" );
762
	    exit( 1 );
762
	    exit( 1 );
763
	    }
763
	    }
764
	(void) gettimeofday( &tv, (struct timezone*) 0 );
764
	tmr_prepare_timeval( &tv );
765
765
766
	if ( num_ready == 0 )
766
	if ( num_ready == 0 )
767
	    {
767
	    {
(-)thttpd-2.25b.orig/timers.c (-2 / +52 lines)
Lines 41-47 Link Here
41
41
42
ClientData JunkClientData;
42
ClientData JunkClientData;
43
43
44
44
#undef HAVE_LIBRT_MONO
45
#if defined(HAVE_LIBRT) && defined(CLOCK_MONOTONIC)
46
#define HAVE_LIBRT_MONO
47
#include <time.h>
48
static int use_monotonic = 0;		/* monotonic clock runtime availability flag */
49
static struct timeval tv_diff;		/* system time - monotonic difference at start */
50
#endif
45
51
46
static unsigned int
52
static unsigned int
47
hash( Timer* t )
53
hash( Timer* t )
Lines 145-150 Link Here
145
	timers[h] = (Timer*) 0;
151
	timers[h] = (Timer*) 0;
146
    free_timers = (Timer*) 0;
152
    free_timers = (Timer*) 0;
147
    alloc_count = active_count = free_count = 0;
153
    alloc_count = active_count = free_count = 0;
154
155
    /* Check for monotonic clock availability */
156
#ifdef HAVE_LIBRT_MONO
157
    struct timespec ts;
158
    struct timeval tv_start, tv;
159
    
160
    /* Try to get monotonic clock time */
161
    if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
162
	use_monotonic = 1;
163
164
	/* Get current system time */
165
	(void) gettimeofday( &tv_start , (struct timezone*) 0 );
166
	tv.tv_sec = ts.tv_sec;
167
	tv.tv_usec = ts.tv_nsec / 1000L;
168
	/* Calculate and save the difference: tv_start is since the Epoch, so tv_start > ts
169
	    tv_diff = tv_start - tv	*/
170
	timersub( &tv_start, &tv, &tv_diff );
171
    }
172
#endif
173
148
    }
174
    }
149
175
150
176
Lines 176-182 Link Here
176
    if ( nowP != (struct timeval*) 0 )
202
    if ( nowP != (struct timeval*) 0 )
177
	t->time = *nowP;
203
	t->time = *nowP;
178
    else
204
    else
179
	(void) gettimeofday( &t->time, (struct timezone*) 0 );
205
	tmr_prepare_timeval( &t->time );
180
    t->time.tv_sec += msecs / 1000L;
206
    t->time.tv_sec += msecs / 1000L;
181
    t->time.tv_usec += ( msecs % 1000L ) * 1000L;
207
    t->time.tv_usec += ( msecs % 1000L ) * 1000L;
182
    if ( t->time.tv_usec >= 1000000L )
208
    if ( t->time.tv_usec >= 1000000L )
Lines 349-351 Link Here
349
    if ( active_count + free_count != alloc_count )
375
    if ( active_count + free_count != alloc_count )
350
	syslog( LOG_ERR, "timer counts don't add up!" );
376
	syslog( LOG_ERR, "timer counts don't add up!" );
351
    }
377
    }
378
379
/* Fill timeval structure for further usage by the package. */
380
void
381
tmr_prepare_timeval( struct timeval *tv )
382
{
383
#ifdef HAVE_LIBRT_MONO
384
    struct timespec ts;
385
    struct timeval tv0;
386
387
    if (use_monotonic) {	/* use monotonic clock source ? */
388
	if (clock_gettime(CLOCK_MONOTONIC,&ts) < 0) {
389
	    perror("clock_gettime"); return;
390
	}
391
	tv0.tv_sec = ts.tv_sec;
392
	tv0.tv_usec = ts.tv_nsec / 1000L;
393
	/* Return system time value like it was running accurately */
394
	timeradd( &tv_diff, &tv0, tv );
395
    } else {
396
#endif
397
	(void) gettimeofday( tv , (struct timezone*) 0 );
398
#ifdef HAVE_LIBRT_MONO
399
    }
400
#endif
401
}
(-)thttpd-2.25b.orig/timers.h (+3 lines)
Lines 106-109 Link Here
106
/* Generate debugging statistics syslog message. */
106
/* Generate debugging statistics syslog message. */
107
extern void tmr_logstats( long secs );
107
extern void tmr_logstats( long secs );
108
108
109
/* Fill timeval structure for further usage by the package. */
110
extern void tmr_prepare_timeval( struct timeval *tv );
111
109
#endif /* _TIMERS_H_ */
112
#endif /* _TIMERS_H_ */

Return to bug 331747