pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/sysutils/rsyslog sysutils/rsyslog: also test for atomi...
details: https://anonhg.NetBSD.org/pkgsrc/rev/9194b5622ada
branches: trunk
changeset: 386403:9194b5622ada
user: he <he%pkgsrc.org@localhost>
date: Fri Oct 07 20:22:56 2022 +0000
description:
sysutils/rsyslog: also test for atomic ops on time_t.
This is to cater to 32-bit NetBSD ports, where time_t is also
(and has been for a long time) __int64_t. Without this check,
__sync_bool_compare_and_swap_8 would end up being undefined when
linking rsyslog, since the compiler isn't obliged to supply that.
This causes the pthread / locking variant to be chosen on these
systems, but makes rsyslog build, at least.
(An earlier attempt at doing this only for time_t was met with
complications and was therefore abandoned.)
There's also just a single use of ATOMIC_CAS_time_t() in rsyslog...
Submitted upstream in
https://github.com/rsyslog/rsyslog/pull/4994
diffstat:
sysutils/rsyslog/distinfo | 5 +-
sysutils/rsyslog/patches/patch-configure | 67 ++++++++++++++++-
sysutils/rsyslog/patches/patch-m4_atomic__operations.m4 | 68 +++++++++++++++++
3 files changed, 137 insertions(+), 3 deletions(-)
diffs (168 lines):
diff -r 36b57b27bd20 -r 9194b5622ada sysutils/rsyslog/distinfo
--- a/sysutils/rsyslog/distinfo Fri Oct 07 20:03:28 2022 +0000
+++ b/sysutils/rsyslog/distinfo Fri Oct 07 20:22:56 2022 +0000
@@ -1,9 +1,10 @@
-$NetBSD: distinfo,v 1.40 2022/08/07 16:01:17 gutteridge Exp $
+$NetBSD: distinfo,v 1.41 2022/10/07 20:22:56 he Exp $
BLAKE2s (rsyslog-8.38.0.tar.gz) = 156eacb39772f84172a5d8ac0f95f09f324ea006ed648ec093779664dac00862
SHA512 (rsyslog-8.38.0.tar.gz) = 9dc3bdc4ef01c2af433478e182704694cb50849d811d476a03e4ce03b3c5aecfb506e7f1c1e51fadcd63da60b067d8011b92b8c9354a688fe66f7b6ffd8f9254
Size (rsyslog-8.38.0.tar.gz) = 2721798 bytes
-SHA1 (patch-configure) = c7b6ab1f7da4b78034ac5defe75f965b2b6a6e6b
+SHA1 (patch-configure) = 8c27c4eae410050a82ae98f32343f980b06e5164
+SHA1 (patch-m4_atomic__operations.m4) = 8f9ca068552263fab12507c0861729c48df7275b
SHA1 (patch-platform_redhat_rsyslog.conf) = 8cfce2df2551dc2ea81802c4cc1b52933cdda153
SHA1 (patch-tools_iminternal.c) = 76e140343456b120cd9f0743e6f10e78f9baaa5d
SHA1 (patch-tools_rsyslogd.8) = a0eea2ee7832fcb19babca24c7a198ca91386e53
diff -r 36b57b27bd20 -r 9194b5622ada sysutils/rsyslog/patches/patch-configure
--- a/sysutils/rsyslog/patches/patch-configure Fri Oct 07 20:03:28 2022 +0000
+++ b/sysutils/rsyslog/patches/patch-configure Fri Oct 07 20:22:56 2022 +0000
@@ -1,6 +1,8 @@
-$NetBSD: patch-configure,v 1.4 2018/09/20 13:30:11 fhajny Exp $
+$NetBSD: patch-configure,v 1.5 2022/10/07 20:22:56 he Exp $
Portability.
+Also, test whether we can do atomics on time_t,
+not possible on 32-bit CPUs running NetBSD (where time_t is __int64_t)
--- configure.orig 2018-09-17 11:27:47.000000000 +0000
+++ configure
@@ -31,3 +33,66 @@
OS_AIX_TRUE=
OS_AIX_FALSE='#'
else
+@@ -17265,40 +17265,54 @@ else
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
++#include <sys/types.h>
+
+ int main()
+ {
+ unsigned long val = 1010, tmp, *mem = &val;
++ time_t tval = 1010, ttmp, *tmem = &tval;
++
+
+ if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020)
+ return 1;
+-
+ tmp = val;
+-
+ if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010)
+ return 1;
+-
+ if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0)
+ return 1;
+-
+ tmp = 3030;
+-
+ if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp)
+ return 1;
+-
+ if (__sync_lock_test_and_set(&val, 4040) != 3030)
+ return 1;
+-
+ mem = &tmp;
+-
+ if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp)
+ return 1;
+
++ if (__sync_fetch_and_add(&tval, 1010) != 1010 || tval != 2020)
++ return 1;
++ ttmp = tval;
++ if (__sync_fetch_and_sub(tmem, 1010) != ttmp || tval != 1010)
++ return 1;
++ if (__sync_sub_and_fetch(&tval, 1010) != 0 || tval != 0)
++ return 1;
++ ttmp = 3030;
++ if (__sync_val_compare_and_swap(tmem, 0, ttmp) != 0 || tval != ttmp)
++ return 1;
++ if (__sync_lock_test_and_set(&tval, 4040) != 3030)
++ return 1;
++ tmem = &ttmp;
++ if (__sync_val_compare_and_swap(&tmem, &ttmp, &tval) != &ttmp)
++ return 1;
++
+ __sync_synchronize();
+
+ if (mem != &val)
+ return 1;
+
++ if (tmem != &tval)
++ return 1;
++
+ return 0;
+ }
+ _ACEOF
diff -r 36b57b27bd20 -r 9194b5622ada sysutils/rsyslog/patches/patch-m4_atomic__operations.m4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/rsyslog/patches/patch-m4_atomic__operations.m4 Fri Oct 07 20:22:56 2022 +0000
@@ -0,0 +1,68 @@
+$NetBSD: patch-m4_atomic__operations.m4,v 1.1 2022/10/07 20:22:56 he Exp $
+
+Also, test whether we can do atomics on time_t,
+not possible on 32-bit CPUs running NetBSD (where time_t is __int64_t)
+
+--- m4/atomic_operations.m4.orig 2018-05-04 09:37:56.000000000 +0000
++++ m4/atomic_operations.m4
+@@ -10,39 +10,52 @@
+ AC_DEFUN([RS_ATOMIC_OPERATIONS],
+ [AC_CACHE_CHECK([whether the compiler provides atomic builtins], [ap_cv_atomic_builtins],
+ [AC_TRY_RUN([
++#include <sys/types.h>
+ int main()
+ {
+ unsigned long val = 1010, tmp, *mem = &val;
++ time_t tval = 1010, ttmp, *tmem = &tval;
+
+ if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020)
+ return 1;
+-
+ tmp = val;
+-
+ if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010)
+ return 1;
+-
+ if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0)
+ return 1;
+-
+ tmp = 3030;
+-
+ if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp)
+ return 1;
+-
+ if (__sync_lock_test_and_set(&val, 4040) != 3030)
+ return 1;
+-
+ mem = &tmp;
+-
+ if (__sync_val_compare_and_swap(&mem, &tmp, &val) != &tmp)
+ return 1;
+
++ if (__sync_fetch_and_add(&tval, 1010) != 1010 || tval != 2020)
++ return 1;
++ ttmp = tval;
++ if (__sync_fetch_and_sub(tmem, 1010) != ttmp || tval != 1010)
++ return 1;
++ if (__sync_sub_and_fetch(&tval, 1010) != 0 || tval != 0)
++ return 1;
++ ttmp = 3030;
++ if (__sync_val_compare_and_swap(tmem, 0, ttmp) != 0 || tval != ttmp)
++ return 1;
++ if (__sync_lock_test_and_set(&tval, 4040) != 3030)
++ return 1;
++ tmem = &ttmp;
++ if (__sync_val_compare_and_swap(&tmem, &ttmp, &tval) != &ttmp)
++ return 1;
++
+ __sync_synchronize();
+
+ if (mem != &val)
+ return 1;
+
++ if (tmem != &tval)
++ return 1;
++
+ return 0;
+ }], [ap_cv_atomic_builtins=yes], [ap_cv_atomic_builtins=no], [ap_cv_atomic_builtins=no])])
+
Home |
Main Index |
Thread Index |
Old Index