]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
attempt to properly check if we can use CPU_SET with sched_setaffinity because some...
authorMichael Jerris <mike@jerris.com>
Tue, 12 Jan 2010 18:31:13 +0000 (18:31 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 12 Jan 2010 18:31:13 +0000 (18:31 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16263 d0543943-73ff-0310-b7d9-9358b9ac24b2

acinclude.m4
build/config/sched_setaffinity.m4 [new file with mode: 0644]
configure.in
src/switch_time.c

index 96389b274b7a44dd33b2228259ededaf84b2e340..705b9458b57d363cc7966588a8e16dc97a585a43 100644 (file)
@@ -8,6 +8,7 @@ m4_include([build/config/ax_lib_mysql.m4])
 m4_include([build/config/ax_check_java.m4])
 m4_include([build/config/erlang.m4])
 m4_include([build/config/odbc.m4])
+m4_include([build/config/sched_setaffinity.m4])
 m4_include([libs/apr/build/apr_common.m4])
 m4_include([libs/sofia-sip/m4/sac-pkg-config.m4])
 m4_include([libs/sofia-sip/m4/sac-openssl.m4])
diff --git a/build/config/sched_setaffinity.m4 b/build/config/sched_setaffinity.m4
new file mode 100644 (file)
index 0000000..d458dbb
--- /dev/null
@@ -0,0 +1,16 @@
+AC_DEFUN([AX_HAVE_CPU_SET], [
+#
+# Check for the Linux functions for controlling processor affinity.
+#
+# LINUX: sched_setaffinity
+AC_CHECK_FUNCS(sched_setaffinity sched_getaffinity)
+       if test "$ac_cv_func_sched_setaffinity" = "yes" ; then
+        AC_CACHE_CHECK([whether the CPU_SET and CPU_ZERO macros are defined],
+        ac_cv_cpu_set_defined,[
+        AC_TRY_COMPILE( [#include <sched.h>],[ cpu_set_t t; CPU_ZERO(&t); CPU_SET(1,&t); ],
+               ac_cv_cpu_set_defined=yes,ac_cv_cpu_set_defined=no)])
+        if test "$ac_cv_cpu_set_defined" = "yes" ; then
+               AC_DEFINE(HAVE_CPU_SET_MACROS,1,[Define if CPU_SET and CPU_ZERO defined])
+        fi
+       fi
+])
\ No newline at end of file
index d68842bdaa513f8675e19dfaf8ecee4d408cfa61..a06056ce8dfd613e584ff0e3ddbb2752eefb8bb8 100644 (file)
@@ -431,9 +431,11 @@ AC_FUNC_MALLOC
 AC_TYPE_SIGNAL
 AC_FUNC_STRFTIME
 AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep getifaddrs])
-AC_CHECK_FUNCS([sched_setscheduler sched_setaffinity setpriority setrlimit setgroups initgroups])
+AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups])
 AC_CHECK_FUNCS([wcsncmp setgroups asprintf setenv pselect gettimeofday localtime_r gmtime_r strcasecmp stricmp _stricmp])
 
+AX_HAVE_CPU_SET
+
 AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])])
 AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])])
 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
index b623abed25bd66ccd353717c6bed7dd22c08e1bc..42d761a937234e4ff7513ee245cf18836ea1eb91 100644 (file)
@@ -537,7 +537,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
        switch_time_t ts = 0, last = 0;
        int fwd_errs = 0, rev_errs = 0;
 
-#ifdef HAVE_SCHED_SETAFFINITY
+#ifdef HAVE_CPU_SET_MACROS
        cpu_set_t set;
        CPU_ZERO(&set);
        CPU_SET(0, &set);