Uses usleep and not sleep, which allows microsecond waits.

GETADDRINFO
Stephane Bortzmeyer 24 years ago
parent 695d18b66b
commit c7ee796329

@ -1,3 +1,5 @@
* Support for microsecond wait (uses usleep)
* New option (-p) to set socket priority
* New option (-P) to set IP Type of Service octet

@ -30,6 +30,9 @@
/* Define if you have the socket function. */
#undef HAVE_SOCKET
/* Define if you have the usleep function. */
#undef HAVE_USLEEP
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H

96
SRC/configure vendored

@ -703,7 +703,7 @@ fi
PACKAGE=echoping
VERSION=4.1.0
VERSION=4.2.0-BETA
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
{ echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
@ -1920,11 +1920,66 @@ else
fi
done
for ac_func in usleep
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1927: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1932 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif
; return 0; }
EOF
if { (eval echo configure:1955: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
if test "$OPENSSL" = "1"; then
echo $ac_n "checking for SSL_CTX_new in -lssl""... $ac_c" 1>&6
echo "configure:1928: checking for SSL_CTX_new in -lssl" >&5
echo "configure:1983: checking for SSL_CTX_new in -lssl" >&5
ac_lib_var=`echo ssl'_'SSL_CTX_new | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1933,7 +1988,7 @@ else
LIBS="-lssl -lcrypto
$LIBS"
cat > conftest.$ac_ext <<EOF
#line 1937 "configure"
#line 1992 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1944,7 +1999,7 @@ int main() {
SSL_CTX_new()
; return 0; }
EOF
if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1968,9 +2023,9 @@ fi
fi
echo $ac_n "checking T/TCP""... $ac_c" 1>&6
echo "configure:1972: checking T/TCP" >&5
echo "configure:2027: checking T/TCP" >&5
cat > conftest.$ac_ext <<EOF
#line 1974 "configure"
#line 2029 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
@ -1979,7 +2034,7 @@ int main() {
int foobar = MSG_EOF;
; return 0; }
EOF
if { (eval echo configure:1983: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2038: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define TTCP 1
@ -2020,9 +2075,9 @@ fi
echo $ac_n "checking Type Of Service""... $ac_c" 1>&6
echo "configure:2024: checking Type Of Service" >&5
echo "configure:2079: checking Type Of Service" >&5
cat > conftest.$ac_ext <<EOF
#line 2026 "configure"
#line 2081 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
@ -2031,7 +2086,7 @@ int main() {
int foobar = SO_PRIORITY;
; return 0; }
EOF
if { (eval echo configure:2035: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2090: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define TOS 1
@ -2055,6 +2110,7 @@ if test "${enable_tos+set}" = set; then
#define HAVE_TOS 1
EOF
TOS=1
else
echo "configure: warning: No TOS support on this system, request ignored" 1>&2
fi
@ -2065,6 +2121,7 @@ else
#define HAVE_TOS 1
EOF
TOS=1
fi
fi
@ -2446,7 +2503,7 @@ echo "Configuration of echoping:"
echo $ac_n "checking HTTP""... $ac_c" 1>&6
echo "configure:2450: checking HTTP" >&5
echo "configure:2507: checking HTTP" >&5
if eval 'test "$HTTP" = "1"' > /dev/null; then
echo "$ac_t""enabled" 1>&6
else
@ -2455,7 +2512,7 @@ fi
echo $ac_n "checking ICP""... $ac_c" 1>&6
echo "configure:2459: checking ICP" >&5
echo "configure:2516: checking ICP" >&5
if eval 'test "$ICP" = "1"' > /dev/null; then
echo "$ac_t""enabled" 1>&6
else
@ -2464,7 +2521,7 @@ fi
echo $ac_n "checking OPENSSL""... $ac_c" 1>&6
echo "configure:2468: checking OPENSSL" >&5
echo "configure:2525: checking OPENSSL" >&5
if eval 'test "$OPENSSL" = "1"' > /dev/null; then
echo "$ac_t""enabled" 1>&6
else
@ -2473,7 +2530,7 @@ fi
echo $ac_n "checking SMTP""... $ac_c" 1>&6
echo "configure:2477: checking SMTP" >&5
echo "configure:2534: checking SMTP" >&5
if eval 'test "$SMTP" = "1"' > /dev/null; then
echo "$ac_t""enabled" 1>&6
else
@ -2482,7 +2539,7 @@ fi
echo $ac_n "checking TTCP""... $ac_c" 1>&6
echo "configure:2486: checking TTCP" >&5
echo "configure:2543: checking TTCP" >&5
if eval 'test "$TTCP" = "1"' > /dev/null; then
echo "$ac_t""enabled" 1>&6
else
@ -2490,6 +2547,15 @@ else
fi
echo $ac_n "checking TOS""... $ac_c" 1>&6
echo "configure:2552: checking TOS" >&5
if eval 'test "$TOS" = "1"' > /dev/null; then
echo "$ac_t""enabled" 1>&6
else
echo "$ac_t""disabled" 1>&6
fi

@ -68,6 +68,7 @@ CF_LIB_NSL
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gettimeofday socket gethostbyname sigaction, , AC_MSG_ERROR(Missing mandatory function))
AC_CHECK_FUNCS(usleep)
if test "$OPENSSL" = "1"; then
CF_LIB_OPENSSL

@ -55,7 +55,9 @@ and the other half is above. When you measure highly variables values, like
it is often the case on the whole Internet, median is better than average
to avoid "extreme" values.
.IP -w\ nnn
Number of seconds to wait between two tests (default is one)
Number of seconds to wait between two tests (default is one). On
systems which have usleep(), you can write it as a fractional number,
such as 3.14. Otherwise, use integers.
.IP -t\ nnn
Number of seconds to wait a reply before giving up. For TCP, this is the
maximum number of seconds for the whole connection (setup and data exchange).

@ -74,7 +74,11 @@ main (argc, argv)
struct timeval newtv, oldtv;
void printstats ();
#ifdef HAVE_USLEEP
double wait = 1.0;
#else
unsigned int wait = 1;
#endif
unsigned char fill = ' ';
unsigned short fill_requested = 0;
unsigned int i = 0;
@ -254,7 +258,11 @@ main (argc, argv)
}
break;
case 'w':
#ifdef HAVE_USLEEP
wait = atof (optarg);
#else
wait = atoi (optarg);
#endif
if (wait <= 0)
/* atoi returns zero when there is an error. So we cannot use
'-w 0' to specify no waiting. */
@ -997,7 +1005,11 @@ main (argc, argv)
SSL_free (sslh);
}
#endif
#ifdef HAVE_USLEEP
usleep (wait * 1000000);
#else
sleep (wait);
#endif
}
}
printstats ();

Loading…
Cancel
Save