enhanced cfq free list management a bit

This commit is contained in:
hyung-hwan 2019-01-16 04:37:53 +00:00
parent d0583e95c8
commit af20b13e04
7 changed files with 617 additions and 27 deletions

407
mio/configure vendored
View File

@ -20136,6 +20136,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
# The cast to long int works around a bug in the HP C Compiler # The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@ -20172,7 +20173,6 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
if test ${ac_cv_sizeof_socklen_t} -gt 0 if test ${ac_cv_sizeof_socklen_t} -gt 0
then then
@ -20215,6 +20215,104 @@ $as_echo "#define MIO_SOCKLEN_T_IS_SIGNED 1" >>confdefs.h
fi fi
fi fi
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of sa_family_t" >&5
$as_echo_n "checking size of sa_family_t... " >&6; }
if ${ac_cv_sizeof_sa_family_t+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (sa_family_t))" "ac_cv_sizeof_sa_family_t" "
#include <winsock2.h>
#include <ws2tcpip.h>
"; then :
else
if test "$ac_cv_type_sa_family_t" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (sa_family_t)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_sa_family_t=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_sa_family_t" >&5
$as_echo "$ac_cv_sizeof_sa_family_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_SA_FAMILY_T $ac_cv_sizeof_sa_family_t
_ACEOF
if test ${ac_cv_sizeof_sa_family_t} -gt 0
then
typename=`echo sa_family_t | sed "s/[^a-zA-Z0-9_]/_/g"`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sa_family_t is signed" >&5
$as_echo_n "checking whether sa_family_t is signed... " >&6; }
if eval \${ax_cv_decl_${typename}_signed+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <winsock2.h>
#include <ws2tcpip.h>
int
main ()
{
int foo [ 1 - 2 * !(((sa_family_t) -1) < 0) ]
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "ax_cv_decl_${typename}_signed=\"yes\""
else
eval "ax_cv_decl_${typename}_signed=\"no\""
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$ax_cv_decl_${typename}_signed
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
symbolname=`echo sa_family_t | sed "s/[^a-zA-Z0-9_]/_/g" | tr "a-z" "A-Z"`
if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then
$as_echo "#define MIO_SA_FAMILY_T_IS_SIGNED 1" >>confdefs.h
elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then
$as_echo_n ""
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking offset of sa_family in struct sockaddr" >&5
$as_echo_n "checking offset of sa_family in struct sockaddr... " >&6; }
if ac_fn_c_compute_int "$LINENO" "offsetof(struct sockaddr, sa_family)" "ac_cv_offsetof_sa_family" "#include <stddef.h>
#include <winsock2.h>
#include <ws2tcpip.h>"; then :
else
ac_cv_offsteof_sa_family=0
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_offsetof_sa_family" >&5
$as_echo "$ac_cv_offsetof_sa_family" >&6; }
cat >>confdefs.h <<_ACEOF
#define MIO_OFFSETOF_SA_FAMILY ${ac_cv_offsetof_sa_family}
_ACEOF
else else
# The cast to long int works around a bug in the HP C Compiler # The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
@ -20226,6 +20324,7 @@ if ${ac_cv_sizeof_struct_sockaddr_in+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_in))" "ac_cv_sizeof_struct_sockaddr_in" " if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_in))" "ac_cv_sizeof_struct_sockaddr_in" "
#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
"; then : "; then :
@ -20262,6 +20361,7 @@ if ${ac_cv_sizeof_struct_sockaddr_in6+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_in6))" "ac_cv_sizeof_struct_sockaddr_in6" " if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_in6))" "ac_cv_sizeof_struct_sockaddr_in6" "
#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
"; then : "; then :
@ -20298,6 +20398,7 @@ if ${ac_cv_sizeof_struct_sockaddr_un+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_un))" "ac_cv_sizeof_struct_sockaddr_un" " if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_un))" "ac_cv_sizeof_struct_sockaddr_un" "
#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
"; then : "; then :
@ -20334,6 +20435,7 @@ if ${ac_cv_sizeof_struct_sockaddr_ll+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_ll))" "ac_cv_sizeof_struct_sockaddr_ll" " if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_ll))" "ac_cv_sizeof_struct_sockaddr_ll" "
#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netpacket/packet.h> #include <netpacket/packet.h>
"; then : "; then :
@ -20370,8 +20472,8 @@ if ${ac_cv_sizeof_struct_sockaddr_dl+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_dl))" "ac_cv_sizeof_struct_sockaddr_dl" " if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (struct sockaddr_dl))" "ac_cv_sizeof_struct_sockaddr_dl" "
#include <sys/socket.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include <net/if_dl.h> #include <net/if_dl.h>
"; then : "; then :
@ -20397,6 +20499,8 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
# The cast to long int works around a bug in the HP C Compiler # The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
@ -20407,8 +20511,8 @@ if ${ac_cv_sizeof_socklen_t+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (socklen_t))" "ac_cv_sizeof_socklen_t" " if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (socklen_t))" "ac_cv_sizeof_socklen_t" "
#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h>
"; then : "; then :
else else
@ -20433,7 +20537,6 @@ cat >>confdefs.h <<_ACEOF
_ACEOF _ACEOF
if test ${ac_cv_sizeof_socklen_t} -gt 0 if test ${ac_cv_sizeof_socklen_t} -gt 0
then then
@ -20446,6 +20549,7 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
int int
main () main ()
@ -20475,7 +20579,302 @@ $as_echo "#define MIO_SOCKLEN_T_IS_SIGNED 1" >>confdefs.h
fi fi
fi fi
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of sa_family_t" >&5
$as_echo_n "checking size of sa_family_t... " >&6; }
if ${ac_cv_sizeof_sa_family_t+:} false; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (sa_family_t))" "ac_cv_sizeof_sa_family_t" "
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
"; then :
else
if test "$ac_cv_type_sa_family_t" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (sa_family_t)
See \`config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_sa_family_t=0
fi fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_sa_family_t" >&5
$as_echo "$ac_cv_sizeof_sa_family_t" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_SA_FAMILY_T $ac_cv_sizeof_sa_family_t
_ACEOF
if test ${ac_cv_sizeof_sa_family_t} -gt 0
then
typename=`echo sa_family_t | sed "s/[^a-zA-Z0-9_]/_/g"`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sa_family_t is signed" >&5
$as_echo_n "checking whether sa_family_t is signed... " >&6; }
if eval \${ax_cv_decl_${typename}_signed+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int
main ()
{
int foo [ 1 - 2 * !(((sa_family_t) -1) < 0) ]
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "ax_cv_decl_${typename}_signed=\"yes\""
else
eval "ax_cv_decl_${typename}_signed=\"no\""
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$ax_cv_decl_${typename}_signed
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
symbolname=`echo sa_family_t | sed "s/[^a-zA-Z0-9_]/_/g" | tr "a-z" "A-Z"`
if eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"yes\""; then
$as_echo "#define MIO_SA_FAMILY_T_IS_SIGNED 1" >>confdefs.h
elif eval "test \"\${ax_cv_decl_${typename}_signed}\" = \"no\""; then
$as_echo_n ""
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking offset of sa_family in struct sockaddr" >&5
$as_echo_n "checking offset of sa_family in struct sockaddr... " >&6; }
if ac_fn_c_compute_int "$LINENO" "offsetof(struct sockaddr, sa_family)" "ac_cv_offsetof_sa_family" "#include <stddef.h>
#include <sys/types.h>
#include <sys/socket.h>"; then :
else
ac_cv_offsteof_sa_family=0
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_offsetof_sa_family" >&5
$as_echo "$ac_cv_offsetof_sa_family" >&6; }
cat >>confdefs.h <<_ACEOF
#define MIO_OFFSETOF_SA_FAMILY ${ac_cv_offsetof_sa_family}
_ACEOF
fi
if test ${ac_cv_sizeof___int128_t} -gt 0
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __int128_t with % and va_arg" >&5
$as_echo_n "checking __int128_t with % and va_arg... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
int
main ()
{
volatile __int128_t x, base;
va_list ap;
va_arg(ap, __int128_t);
x = (__int128_t)&base;
base = (__int128_t)&x;
x = x % base;
return (int)x;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
ac_cv_sizeof___int128_t=0
ac_cv_sizeof___uint128_t=0
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test ${ac_cv_sizeof___float128} -gt 0
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __float128 with linking" >&5
$as_echo_n "checking __float128 with linking... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
int
main ()
{
__float128 x, y, z;
z = x * y + x;
printf ("%p", (char*)(int)z);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
ac_cv_sizeof___float128=0
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
if test ${ac_cv_sizeof___float128} -gt 0
then
for ac_func in quadmath_snprintf
do :
ac_fn_c_check_func "$LINENO" "quadmath_snprintf" "ac_cv_func_quadmath_snprintf"
if test "x$ac_cv_func_quadmath_snprintf" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_QUADMATH_SNPRINTF 1
_ACEOF
fi
done
if test "$ac_cv_func_quadmath_snprintf" = "no"
then
OLDLIBS="$LIBS"
LIBS="$LIBM $LIBS"
for ac_func in quadmath_snprintf
do :
ac_fn_c_check_func "$LINENO" "quadmath_snprintf" "ac_cv_func_quadmath_snprintf"
if test "x$ac_cv_func_quadmath_snprintf" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_QUADMATH_SNPRINTF 1
_ACEOF
fi
done
LIBS="$OLDLIBS"
if test "$ac_cv_func_quadmath_snprintf" = "no"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for quadmath_snprintf in -lquadmath" >&5
$as_echo_n "checking for quadmath_snprintf in -lquadmath... " >&6; }
if ${ac_cv_lib_quadmath_quadmath_snprintf+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lquadmath $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char quadmath_snprintf ();
int
main ()
{
return quadmath_snprintf ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_quadmath_quadmath_snprintf=yes
else
ac_cv_lib_quadmath_quadmath_snprintf=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_quadmath_quadmath_snprintf" >&5
$as_echo "$ac_cv_lib_quadmath_quadmath_snprintf" >&6; }
if test "x$ac_cv_lib_quadmath_quadmath_snprintf" = xyes; then :
QUADMATH_LIBS="-lquadmath"
LIBM="$LIBM -lquadmath"
$as_echo "#define HAVE_QUADMATH_SNPRINTF 1" >>confdefs.h
fi
if test "$ac_cv_lib_quadmath_quadmath_snprintf" = "no"
then
ac_cv_sizeof___float128=0
fi
else
QUADMATH_LIBS="$LIBM"
fi
fi
if test ${ac_cv_sizeof___float128} -gt 0
then
OLDLIBS="$LIBS"
LIBS="$LIBM $LIBS"
for ac_func in powq fmodq sinq cosq tanq sinhq coshq tanhq asinq acosq atanq atan2q logq log10q expq sqrtq ceilq floorq roundq
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
for ac_func in strtoflt128
do :
ac_fn_c_check_func "$LINENO" "strtoflt128" "ac_cv_func_strtoflt128"
if test "x$ac_cv_func_strtoflt128" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRTOFLT128 1
_ACEOF
fi
done
LIBS="$OLDLIBS"
fi
fi
if test ${ac_cv_sizeof___int128_t} -gt 0 if test ${ac_cv_sizeof___int128_t} -gt 0

View File

@ -416,10 +416,10 @@ then
AC_CHECK_SIZEOF(struct sockaddr_dl,,[ AC_CHECK_SIZEOF(struct sockaddr_dl,,[
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h>]) #include <ws2tcpip.h>])
AC_CHECK_SIZEOF(socklen_t,, [ AC_CHECK_SIZEOF(socklen_t,, [
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h>]) #include <ws2tcpip.h>])
if test ${ac_cv_sizeof_socklen_t} -gt 0 if test ${ac_cv_sizeof_socklen_t} -gt 0
then then
AX_CHECK_SIGN([socklen_t], AX_CHECK_SIGN([socklen_t],
@ -428,36 +428,190 @@ then
[#include <winsock2.h> [#include <winsock2.h>
#include <ws2tcpip.h>]) #include <ws2tcpip.h>])
fi fi
AC_CHECK_SIZEOF(sa_family_t,, [
#include <winsock2.h>
#include <ws2tcpip.h>])
if test ${ac_cv_sizeof_sa_family_t} -gt 0
then
AX_CHECK_SIGN([sa_family_t],
[ AC_DEFINE(MIO_SA_FAMILY_T_IS_SIGNED, 1, [Define if sa_family_t is signed]) ],
[ AS_ECHO_N("") ],
[#include <winsock2.h>
#include <ws2tcpip.h>])
fi
AC_MSG_CHECKING([offset of sa_family in struct sockaddr])
AC_COMPUTE_INT([ac_cv_offsetof_sa_family],
[[offsetof(struct sockaddr, sa_family)]],
[#include <stddef.h>
#include <winsock2.h>
#include <ws2tcpip.h>], [ac_cv_offsteof_sa_family=0])
AC_MSG_RESULT([$ac_cv_offsetof_sa_family])
AC_DEFINE_UNQUOTED(MIO_OFFSETOF_SA_FAMILY, ${ac_cv_offsetof_sa_family}, [offsetof(struct sockaddr, sa_family)])
else else
AC_CHECK_SIZEOF(struct sockaddr_in,,[ AC_CHECK_SIZEOF(struct sockaddr_in,,[
#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h>]) #include <netinet/in.h>])
AC_CHECK_SIZEOF(struct sockaddr_in6,,[ AC_CHECK_SIZEOF(struct sockaddr_in6,,[
#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h>]) #include <netinet/in.h>])
AC_CHECK_SIZEOF(struct sockaddr_un,,[ AC_CHECK_SIZEOF(struct sockaddr_un,,[
#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h>]) #include <sys/un.h>])
AC_CHECK_SIZEOF(struct sockaddr_ll,,[ AC_CHECK_SIZEOF(struct sockaddr_ll,,[
#include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <netpacket/packet.h>]) #include <netpacket/packet.h>])
AC_CHECK_SIZEOF(struct sockaddr_dl,,[ AC_CHECK_SIZEOF(struct sockaddr_dl,,[
#include <sys/socket.h>
#include <sys/types.h> #include <sys/types.h>
#include <net/if_dl.h>])
AC_CHECK_SIZEOF(socklen_t,, [
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h>]) #include <net/if_dl.h>])
AC_CHECK_SIZEOF(socklen_t,, [
#include <sys/types.h>
#include <sys/socket.h>])
if test ${ac_cv_sizeof_socklen_t} -gt 0 if test ${ac_cv_sizeof_socklen_t} -gt 0
then then
AX_CHECK_SIGN([socklen_t], AX_CHECK_SIGN([socklen_t],
[ AC_DEFINE(MIO_SOCKLEN_T_IS_SIGNED, 1, [Define if socklen_t is signed]) ], [ AC_DEFINE(MIO_SOCKLEN_T_IS_SIGNED, 1, [Define if socklen_t is signed]) ],
[ AS_ECHO_N("") ], [ AS_ECHO_N("") ],
[#include <sys/socket.h>]) [#include <sys/types.h>
#include <sys/socket.h>])
fi
AC_CHECK_SIZEOF(sa_family_t,, [
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>])
if test ${ac_cv_sizeof_sa_family_t} -gt 0
then
AX_CHECK_SIGN([sa_family_t],
[ AC_DEFINE(MIO_SA_FAMILY_T_IS_SIGNED, 1, [Define if sa_family_t is signed]) ],
[ AS_ECHO_N("") ],
[#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>])
fi
AC_MSG_CHECKING([offset of sa_family in struct sockaddr])
AC_COMPUTE_INT([ac_cv_offsetof_sa_family],
[[offsetof(struct sockaddr, sa_family)]],
[#include <stddef.h>
#include <sys/types.h>
#include <sys/socket.h>], [ac_cv_offsteof_sa_family=0])
AC_MSG_RESULT([$ac_cv_offsetof_sa_family])
AC_DEFINE_UNQUOTED(MIO_OFFSETOF_SA_FAMILY, ${ac_cv_offsetof_sa_family}, [offsetof(struct sockaddr, sa_family)])
fi
dnl gcc 3.4.3 on opensolaris x86 gave this warning without -msse or
dnl something similar.
dnl SSE vector argument without SSE enabled changes the ABI
dnl it also ended with an internal compiler error while compiling
dnl some expressions like 'v % base' where v is of the __int128_t type.
dnl so i've added this check to determine if the compiler has
dnl proper support for __int128_t.
dnl
dnl Changing ac_cv_sizeof___int128_t here doesn't corret SIZEOF___INT128_T
dnl since it's already generated. It only affects MIO_SIZEOF___INT128_T below.
if test ${ac_cv_sizeof___int128_t} -gt 0
then
AC_MSG_CHECKING([__int128_t with % and va_arg])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <stdarg.h>], [
volatile __int128_t x, base;
va_list ap;
va_arg(ap, __int128_t);
x = (__int128_t)&base;
base = (__int128_t)&x;
x = x % base;
return (int)x;
])],
[
AC_MSG_RESULT(yes)
],
[
AC_MSG_RESULT(no)
ac_cv_sizeof___int128_t=0
ac_cv_sizeof___uint128_t=0
]
)
fi
dnl Some compilers doesn't seem to have full support for __float128
dnl even if the type is available.
if test ${ac_cv_sizeof___float128} -gt 0
then
AC_MSG_CHECKING([__float128 with linking])
AC_TRY_LINK(
[#include <stdio.h>],
[
__float128 x, y, z;
z = x * y + x;
printf ("%p", (char*)(int)z);
],
[AC_MSG_RESULT(yes)],
[
AC_MSG_RESULT(no)
ac_cv_sizeof___float128=0
]
)
fi
dnl Quadmath functions may not be in the default c library.
dnl Find a library containing them. Disable the float128 type
dnl if they are not available.
if test ${ac_cv_sizeof___float128} -gt 0
then
AC_CHECK_FUNCS([quadmath_snprintf])
if test "$ac_cv_func_quadmath_snprintf" = "no"
then
OLDLIBS="$LIBS"
LIBS="$LIBM $LIBS"
AC_CHECK_FUNCS([quadmath_snprintf])
LIBS="$OLDLIBS"
if test "$ac_cv_func_quadmath_snprintf" = "no"
then
dnl quadmath_snprintf not avalable in the
dnl standard math lib.
AC_CHECK_LIB([quadmath], [quadmath_snprintf], [
QUADMATH_LIBS="-lquadmath"
LIBM="$LIBM -lquadmath"
AC_DEFINE(HAVE_QUADMATH_SNPRINTF, 1)
])
if test "$ac_cv_lib_quadmath_quadmath_snprintf" = "no"
then
dnl quadmath_snprintf not avalable in the
dnl quadmath lib.
ac_cv_sizeof___float128=0
fi
else
QUADMATH_LIBS="$LIBM"
fi fi
fi fi
if test ${ac_cv_sizeof___float128} -gt 0
then
OLDLIBS="$LIBS"
LIBS="$LIBM $LIBS"
AC_CHECK_FUNCS([powq fmodq sinq cosq tanq sinhq coshq tanhq asinq acosq atanq atan2q logq log10q expq sqrtq ceilq floorq roundq])
AC_CHECK_FUNCS([strtoflt128])
LIBS="$OLDLIBS"
fi
fi
AC_SUBST(QUADMATH_LIBS)
dnl gcc 3.4.3 on opensolaris x86 gave this warning without -msse or dnl gcc 3.4.3 on opensolaris x86 gave this warning without -msse or
dnl something similar. dnl something similar.

View File

@ -741,6 +741,9 @@
/* MB_LEN_MAX */ /* MB_LEN_MAX */
#undef MIO_MBLEN_MAX #undef MIO_MBLEN_MAX
/* offsetof(struct sockaddr, sa_family) */
#undef MIO_OFFSETOF_SA_FAMILY
/* Author */ /* Author */
#undef MIO_PACKAGE_AUTHOR #undef MIO_PACKAGE_AUTHOR
@ -762,6 +765,9 @@
/* Patch level */ /* Patch level */
#undef MIO_PACKAGE_VERSION_PATCH #undef MIO_PACKAGE_VERSION_PATCH
/* Define if sa_family_t is signed */
#undef MIO_SA_FAMILY_T_IS_SIGNED
/* sizeof(char) */ /* sizeof(char) */
#undef MIO_SIZEOF_CHAR #undef MIO_SIZEOF_CHAR
@ -900,6 +906,9 @@
/* The size of `off_t', as computed by sizeof. */ /* The size of `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T #undef SIZEOF_OFF_T
/* The size of `sa_family_t', as computed by sizeof. */
#undef SIZEOF_SA_FAMILY_T
/* The size of `short', as computed by sizeof. */ /* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT #undef SIZEOF_SHORT

View File

@ -40,6 +40,9 @@
#define MIO_MEMCMP(dst,src,count) memcmp(dst,src,count) #define MIO_MEMCMP(dst,src,count) memcmp(dst,src,count)
#define MIO_ASSERT assert #define MIO_ASSERT assert
#define MIO_CWQFL_SIZE 16
#define MIO_CWQFL_ALIGN 16
typedef struct mio_mux_t mio_mux_t; typedef struct mio_mux_t mio_mux_t;
struct mio_t struct mio_t
@ -79,7 +82,7 @@ struct mio_t
} tmr; } tmr;
mio_cwq_t cwq; mio_cwq_t cwq;
mio_cwq_t* cwq_zdf; /* list of free cwq objects with 0-sized dstaddr */ mio_cwq_t* cwqfl[MIO_CWQFL_SIZE]; /* list of free cwq objects */
/* platform specific fields below */ /* platform specific fields below */
#if defined(_WIN32) #if defined(_WIN32)

View File

@ -215,6 +215,9 @@ typedef int mio_sckfam_t;
struct mio_sckaddr_t struct mio_sckaddr_t
{ {
#if defined(MIO_OFFSETOF_SA_FAMILY) && (MIO_OFFSETOF_SA_FAMILY > 0)
mio_uint8_t filler[MIO_OFFSETOF_SA_FAMILY];
#endif
mio_sckfam_t family; mio_sckfam_t family;
mio_uint8_t data[128]; /* TODO: use the actual sockaddr size */ mio_uint8_t data[128]; /* TODO: use the actual sockaddr size */
}; };

View File

@ -394,13 +394,18 @@ void mio_fini (mio_t* mio)
mio_dev_t* head; mio_dev_t* head;
mio_dev_t* tail; mio_dev_t* tail;
} diehard; } diehard;
mio_oow_t i;
while (mio->cwq_zdf) /* clean up free cwq list */
for (i = 0; i < MIO_COUNTOF(mio->cwqfl); i++)
{ {
mio_cwq_t* cwq = mio->cwq_zdf; mio_cwq_t* cwq;
mio->cwq_zdf = cwq->next; while ((cwq = mio->cwqfl[i]))
{
mio->cwqfl[i] = cwq->next;
MIO_MMGR_FREE (mio->mmgr, cwq); MIO_MMGR_FREE (mio->mmgr, cwq);
} }
}
/* kill all registered devices */ /* kill all registered devices */
while (mio->actdev.head) while (mio->actdev.head)
@ -408,6 +413,7 @@ void mio_fini (mio_t* mio)
mio_killdev (mio, mio->actdev.head); mio_killdev (mio, mio->actdev.head);
} }
/* kill all halted devices */
while (mio->hltdev.head) while (mio->hltdev.head)
{ {
mio_killdev (mio, mio->hltdev.head); mio_killdev (mio, mio->hltdev.head);
@ -735,16 +741,19 @@ static MIO_INLINE int __exec (mio_t* mio)
while (!MIO_CWQ_ISEMPTY(&mio->cwq)) while (!MIO_CWQ_ISEMPTY(&mio->cwq))
{ {
mio_cwq_t* cwq; mio_cwq_t* cwq;
mio_oow_t cwqfl_index;
cwq = MIO_CWQ_HEAD(&mio->cwq); cwq = MIO_CWQ_HEAD(&mio->cwq);
if (cwq->dev->dev_evcb->on_write(cwq->dev, cwq->olen, cwq->ctx, &cwq->dstaddr) <= -1) return -1; if (cwq->dev->dev_evcb->on_write(cwq->dev, cwq->olen, cwq->ctx, &cwq->dstaddr) <= -1) return -1;
cwq->dev->cw_count--; cwq->dev->cw_count--;
MIO_CWQ_UNLINK (cwq); MIO_CWQ_UNLINK (cwq);
if (cwq->dstaddr.len == 0) cwqfl_index = MIO_ALIGN_POW2(cwq->dstaddr.len, MIO_CWQFL_ALIGN) / MIO_CWQFL_SIZE;
if (cwqfl_index < MIO_COUNTOF(mio->cwqfl))
{ {
/* reuse the cwq object if dstaddr is 0 in size. chain it to the free list */ /* reuse the cwq object if dstaddr is 0 in size. chain it to the free list */
cwq->next = mio->cwq_zdf; cwq->next = mio->cwqfl[cwqfl_index];
mio->cwq_zdf = cwq; mio->cwqfl[cwqfl_index] = cwq;
} }
else else
{ {
@ -1291,6 +1300,7 @@ static int __dev_write (mio_dev_t* dev, const void* data, mio_iolen_t len, const
mio_iolen_t urem, ulen; mio_iolen_t urem, ulen;
mio_wq_t* q; mio_wq_t* q;
mio_cwq_t* cwq; mio_cwq_t* cwq;
mio_oow_t cwq_extra_aligned, cwqfl_index;
int x; int x;
if (dev->dev_capa & MIO_DEV_CAPA_OUT_CLOSED) if (dev->dev_capa & MIO_DEV_CAPA_OUT_CLOSED)
@ -1341,7 +1351,11 @@ static int __dev_write (mio_dev_t* dev, const void* data, mio_iolen_t len, const
dev->dev_capa |= MIO_DEV_CAPA_OUT_CLOSED; dev->dev_capa |= MIO_DEV_CAPA_OUT_CLOSED;
} }
//if (dev->dev_evcb->on_write(dev, len, wrctx, dstaddr) <= -1) return -1; /* if i trigger the write completion callback here, the performance
* may increase, but there can be annoying recursion issues if the
* callback requests another writing operation. it's imperative to
* delay the callback until this write function is finished.
* ---> if (dev->dev_evcb->on_write(dev, len, wrctx, dstaddr) <= -1) return -1; */
goto enqueue_completed_write; goto enqueue_completed_write;
} }
else else
@ -1352,8 +1366,11 @@ static int __dev_write (mio_dev_t* dev, const void* data, mio_iolen_t len, const
if (x <= -1) return -1; if (x <= -1) return -1;
else if (x == 0) goto enqueue_data; else if (x == 0) goto enqueue_data;
/* partial writing is still considered ok for a non-stream device */ /* partial writing is still considered ok for a non-stream device. */
//if (dev->dev_evcb->on_write(dev, ulen, wrctx, dstaddr) <= -1) return -1;
/* read the comment in the 'if' block above for why i enqueue the write completion event
* instead of calling the event callback here...
* --> if (dev->dev_evcb->on_write(dev, ulen, wrctx, dstaddr) <= -1) return -1; */
goto enqueue_completed_write; goto enqueue_completed_write;
} }
@ -1434,14 +1451,19 @@ enqueue_data:
enqueue_completed_write: enqueue_completed_write:
/* queue the remaining data*/ /* queue the remaining data*/
if (!dstaddr && dev->mio->cwq_zdf) cwq_extra_aligned = (dstaddr? dstaddr->len: 0);
cwq_extra_aligned = MIO_ALIGN_POW2(cwq_extra_aligned, MIO_CWQFL_ALIGN);
cwqfl_index = cwq_extra_aligned / MIO_CWQFL_SIZE;
if (cwqfl_index < MIO_COUNTOF(dev->mio->cwqfl) && dev->mio->cwqfl[cwqfl_index])
{ {
cwq = dev->mio->cwq_zdf; /* take an available cwq object from the free cwq list */
dev->mio->cwq_zdf = cwq->next; cwq = dev->mio->cwqfl[cwqfl_index];
dev->mio->cwqfl[cwqfl_index] = cwq->next;
} }
else else
{ {
cwq = (mio_cwq_t*)MIO_MMGR_ALLOC(dev->mio->mmgr, MIO_SIZEOF(*cwq) + (dstaddr? dstaddr->len: 0)); cwq = (mio_cwq_t*)MIO_MMGR_ALLOC(dev->mio->mmgr, MIO_SIZEOF(*cwq) + cwq_extra_aligned);
if (!cwq) if (!cwq)
{ {
dev->mio->errnum = MIO_ENOMEM; dev->mio->errnum = MIO_ENOMEM;