]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
main/utils: Simplify the FreeBSD ast_get_tid() handling
authorBrad Smith <brad@comstyle.com>
Sat, 27 Jan 2024 07:43:50 +0000 (02:43 -0500)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 7 Mar 2024 14:18:40 +0000 (14:18 +0000)
FreeBSD has had kernel threads for 20+ years.

(cherry picked from commit ec2c10689f8c3df1491db295fc7d9fdcf2f62b7d)

configure
configure.ac
include/asterisk/autoconfig.h.in
main/utils.c

index cf197551fcc9e96702c32151fa3dcd61c1aa8b8e..fc1b603f239a199a25ac63c2c500f2ff062918a0 100755 (executable)
--- a/configure
+++ b/configure
@@ -18454,20 +18454,6 @@ rm -f core conftest.err conftest.$ac_objext \
 #)
 #fi
 
-# for FreeBSD thr_self
-for ac_header in sys/thr.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "sys/thr.h" "ac_cv_header_sys_thr_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_thr_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_THR_H 1
-_ACEOF
-
-fi
-
-done
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler sync operations" >&5
 $as_echo_n "checking for compiler sync operations... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
index ab9a0c082d0b9fa316a238a3087623c22efed3a0..b179171587888b4ba42e60bc8c236c8df933ee28 100644 (file)
@@ -1172,9 +1172,6 @@ AC_LINK_IFELSE(
 #)
 #fi
 
-# for FreeBSD thr_self
-AC_CHECK_HEADERS([sys/thr.h])
-
 AC_MSG_CHECKING(for compiler sync operations)
 AC_LINK_IFELSE(
 [AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);])],
index 7a3c5831bd4eb2b995baa10eb4a2a8dfb8f2060f..f656f0b8683954949da067d30a048d96b95c3859 100644 (file)
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
-/* Define to 1 if you have the <sys/thr.h> header file. */
-#undef HAVE_SYS_THR_H
-
 /* Define to 1 if you have the <sys/time.h> header file. */
 #undef HAVE_SYS_TIME_H
 
index 58ba1914f8572cfaa4c62740e55f0ced047ec5b6..b4d79867c9c12762ee9a215d584696f6fa258893 100644 (file)
 #include <unistd.h>
 #if defined(__APPLE__)
 #include <mach/mach.h>
+#elif defined(__FreeBSD__)
+#include <sys/thr.h>
 #elif defined(__NetBSD__)
 #include <lwp.h>
-#elif defined(HAVE_SYS_THR_H)
-#include <sys/thr.h>
 #endif
 
 #include "asterisk/network.h"
@@ -2757,9 +2757,9 @@ int ast_get_tid(void)
 #elif defined(__APPLE__)
        ret = mach_thread_self();
        mach_port_deallocate(mach_task_self(), ret);
-#elif defined(__FreeBSD__) && defined(HAVE_SYS_THR_H)
+#elif defined(__FreeBSD__)
        long lwpid;
-       thr_self(&lwpid); /* available since sys/thr.h creation 2003 */
+       thr_self(&lwpid);
        ret = lwpid;
 #elif defined(__NetBSD__)
        ret = _lwp_self();