- Fix to detect if atomic_store links in configure.

This commit is contained in:
W.C.A. Wijngaards 2025-04-09 11:06:25 +02:00
parent 66b3abc803
commit fca3ae0535
5 changed files with 72 additions and 5 deletions

View file

@ -378,6 +378,9 @@
/* Define if we have LibreSSL */
#undef HAVE_LIBRESSL
/* If we have atomic_store */
#undef HAVE_LINK_ATOMIC_STORE
/* Define to 1 if you have the <linux/net_tstamp.h> header file. */
#undef HAVE_LINUX_NET_TSTAMP_H

42
configure vendored
View file

@ -23530,6 +23530,48 @@ if echo $host_os | grep darwin8 > /dev/null; then
printf "%s\n" "#define DARWIN_BROKEN_SETREUID 1" >>confdefs.h
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for atomic_store" >&5
printf %s "checking for atomic_store... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
#ifdef HAVE_STDATOMIC_H
#include <stdatomic.h>
#endif
int
main (void)
{
int newvar = 5, var = 0;
atomic_store((_Atomic int*)&var, newvar);
newvar = 0;
/* condition to use the variables. */
if(var == newvar) return 1;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
printf "%s\n" "#define HAVE_LINK_ATOMIC_STORE 1" >>confdefs.h
else $as_nop
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
ac_fn_check_decl "$LINENO" "inet_pton" "ac_cv_have_decl_inet_pton" "
$ac_includes_default
#ifdef HAVE_NETINET_IN_H

View file

@ -1818,6 +1818,25 @@ AC_CHECK_FUNCS([setresgid],,[AC_CHECK_FUNCS([setregid])])
if echo $host_os | grep darwin8 > /dev/null; then
AC_DEFINE(DARWIN_BROKEN_SETREUID, 1, [Define this if on macOSX10.4-darwin8 and setreuid and setregid do not work])
fi
AC_MSG_CHECKING([for atomic_store])
AC_LINK_IFELSE([AC_LANG_PROGRAM(AC_INCLUDES_DEFAULT [[
#ifdef HAVE_STDATOMIC_H
#include <stdatomic.h>
#endif
]], [[
int newvar = 5, var = 0;
atomic_store((_Atomic int*)&var, newvar);
newvar = 0;
/* condition to use the variables. */
if(var == newvar) return 1;
]])], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LINK_ATOMIC_STORE, 1, [If we have atomic_store])
], [
AC_MSG_RESULT([no])
])
AC_CHECK_DECLS([inet_pton,inet_ntop], [], [], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_NETINET_IN_H

View file

@ -5450,7 +5450,7 @@ auth_zones_swap(struct auth_zones* az, struct auth_zones* data)
* the xfer elements can continue to be their callbacks. */
}
#ifdef ATOMIC_POINTER_LOCK_FREE
#if defined(ATOMIC_POINTER_LOCK_FREE) && defined(HAVE_LINK_ATOMIC_STORE)
/** Fast reload thread, if atomics are available, copy the config items
* one by one with atomic store operations. */
static void
@ -5819,7 +5819,7 @@ fr_atomic_copy_cfg(struct config_file* oldcfg, struct config_file* cfg,
#endif
COPY_VAR_int(ede);
}
#endif /* ATOMIC_POINTER_LOCK_FREE */
#endif /* ATOMIC_POINTER_LOCK_FREE && HAVE_LINK_ATOMIC_STORE */
/** fast reload thread, adjust the cache sizes */
static void
@ -5997,7 +5997,7 @@ fr_reload_config(struct fast_reload_thread* fr, struct config_file* newcfg,
lock_basic_lock(&env->anchors->lock);
}
#ifdef ATOMIC_POINTER_LOCK_FREE
#if defined(ATOMIC_POINTER_LOCK_FREE) && defined(HAVE_LINK_ATOMIC_STORE)
if(fr->fr_nopause) {
fr_atomic_copy_cfg(ct->oldcfg, env->cfg, newcfg);
} else {
@ -6006,7 +6006,7 @@ fr_reload_config(struct fast_reload_thread* fr, struct config_file* newcfg,
*ct->oldcfg = *env->cfg;
/* Insert new config elements. */
*env->cfg = *newcfg;
#ifdef ATOMIC_POINTER_LOCK_FREE
#if defined(ATOMIC_POINTER_LOCK_FREE) && defined(HAVE_LINK_ATOMIC_STORE)
}
#endif
@ -6015,7 +6015,7 @@ fr_reload_config(struct fast_reload_thread* fr, struct config_file* newcfg,
log_ident_set_or_default(env->cfg->log_identity);
}
/* the newcfg elements are in env->cfg, so should not be freed here. */
#ifdef ATOMIC_POINTER_LOCK_FREE
#if defined(ATOMIC_POINTER_LOCK_FREE) && defined(HAVE_LINK_ATOMIC_STORE)
/* if used, the routine that copies the config has zeroed items. */
if(!fr->fr_nopause)
#endif

View file

@ -1,3 +1,6 @@
9 April 2025: Wouter
- Fix to detect if atomic_store links in configure.
8 April 2025: Wouter
- Tag for 1.23.0rc1.
- Fix fast_reload to print chroot with config file name.