#At file:///home/mikael/mysql_clones/alarm_remove/
2847 Mikael Ronstrom 2009-05-08
Added configure handling to make use of alarm not default anymore on Linux, Solaris,
Mac OS X and FreeBSD, we will still use alarms if SO_SND/RCVTIMEO isn't supported on the
OS
modified:
configure.in
=== modified file 'configure.in'
--- a/configure.in 2009-02-23 23:37:08 +0000
+++ b/configure.in 2009-05-08 13:53:42 +0000
@@ -883,8 +883,89 @@ AC_CHECK_DECLS(MHA_MAPSIZE_VA,
#include <sys/mman.h>
]
)
+fi
+dnl --------------------------------------------------------------------
+dnl Use of ALARMs to wakeup on timeout on sockets
+dnl This feature makes use of a mutex and is a scalability hog we
+dnl try to avoid using. However we need support for SO_SNDTIME0 and
+dnl SO_RCVTIME0 socket options for this to work. So we will check
+dnl if this feature is supported by a simple AC_TRY_RUN macro. However
+dnl on some OS's there is support for setting those variables but
+dnl they are silently ignored. For those OS's we will not attempt
+dnl to use SO_SNDTIME0 and SO_RCVTIME0 even if it is said to work.
+dnl See bug#29093 for the problem with SO_SND/RCVTIME0 on HP/UX.
+dnl To use alarm is simple, simply avoid setting anything.
+dnl--------------------------------------------------------------------
+AC_ARG_WITH(alarm,
+ [ --with-alarm
+ Use alarm to implement socket timeout.],
+ [ with_alarm=$withval ],
+ [ with_alarm=no ]
+ )
+AC_CACHE_CHECK([whether the SO_SNDTIME0/SO_RCVTIME0 socket options work],
+ [mysql_cv_so_snd_time0],
+ [AC_TRY_RUN([
+#include <sys/types.h>
+#include <sys/socket.h>
+ int main()
+ {
+ struct timeval time_val;
+ int ret_val;
+ int sockfd = socket(AF_INET, SOCK_STREAM, 0);
+
+ time_val.tv_sec= 2;
+ time_val.tv_usec= 0;
+ ret_val= setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, (void*)&time_val,
+ sizeof(time_val));
+ if (ret_val != 0)
+ return -1;
+ ret_val= setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, (void*)&time_val,
+ sizeof(time_val));
+ if (ret_val != 0)
+ return -1;
+ return 0;
+ }
+],
+ [mysql_cv_so_snd_time0=yes],
+ [mysql_cv_so_snd_time0=no],
+ [mysql_cv_so_snd_time0=no])])
+
+use_alarm=no
+if test "$mysql_cv_so_snd_time0" = "yes" ; then
+ if test "$with_alarm" = "no" ; then
+ case $SYSTEM_TYPE in
+ *solaris*)
+dnl We trust the result from Solaris
+ use_alarm=yes
+ ;;
+ *freebsd*)
+dnl We trust the result from FreeBSD
+ use_alarm=yes
+ ;;
+ *darwin*)
+dnl We trust the result from Mac OS X
+ use_alarm=yes
+ ;;
+ *)
+ if test "$TARGET_LINUX" = "true" ; then
+dnl We trust the result from Linux also
+dnl We trust no one else for the moment
+dnl (Windows is hardcoded to not use alarms)
+ use_alarm=yes
+ fi
+ ;;
+ esac
+ fi
+fi
+AC_MSG_CHECKING(whether to use alarms to implement socket timeout)
+if test "$use_alarm" = "yes" ; then
+ CFLAGS="$CFLAGS -DNO_ALARM"
+ CXXFLAGS="$CXXFLAGS -DNO_ALARM"
+ AC_MSG_RESULT(no)
+else
+ AC_MSG_RESULT(yes)
fi
#--------------------------------------------------------------------
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (mikael:2847) | Mikael Ronstrom | 11 May 2009 |