net/haproxy-devel: partially sync with upstream
Taken from: HardenedBSD
This commit is contained in:
parent
5efd4b11d4
commit
700e21783b
3 changed files with 11 additions and 67 deletions
|
|
@ -2,7 +2,7 @@
|
|||
# $FreeBSD$
|
||||
|
||||
PORTNAME= haproxy
|
||||
DISTVERSION= 1.8.3
|
||||
DISTVERSION= 1.8.4
|
||||
CATEGORIES= net www
|
||||
MASTER_SITES= http://www.haproxy.org/download/1.8/src/
|
||||
PKGNAMESUFFIX= -devel
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
TIMESTAMP = 1514665787
|
||||
SHA256 (haproxy-1.8.3.tar.gz) = 3dc7f65c4ed6ac1420dfd01896833e0f765f72471fbfa316a195793272e58b4a
|
||||
SIZE (haproxy-1.8.3.tar.gz) = 2043861
|
||||
TIMESTAMP = 1518099471
|
||||
SHA256 (haproxy-1.8.4.tar.gz) = e305b0a4e7dec08072841eef6ac6dcd1b5586b1eff09c2d51e152a912e8884a6
|
||||
SIZE (haproxy-1.8.4.tar.gz) = 2049789
|
||||
|
|
|
|||
|
|
@ -1,67 +1,11 @@
|
|||
--- include/common/hathreads.h.orig 2018-02-04 16:36:55 UTC
|
||||
--- include/common/hathreads.h.orig 2018-02-09 07:39:50 UTC
|
||||
+++ include/common/hathreads.h
|
||||
@@ -99,6 +99,55 @@ extern THREAD_LOCAL unsigned long tid_bi
|
||||
|
||||
@@ -104,7 +104,7 @@ extern THREAD_LOCAL unsigned long tid_bi
|
||||
/* TODO: thread: For now, we rely on GCC builtins but it could be a good idea to
|
||||
* have a header file regrouping all functions dealing with threads. */
|
||||
+
|
||||
|
||||
-#if defined(__GNUC__) && (__GNUC__ < 4 || __GNUC__ == 4 && __GNUC_MINOR__ < 7) && !defined(__clang__)
|
||||
+#ifdef __clang__
|
||||
+#define HA_ATOMIC_ADD(val, i) __sync_add_and_fetch(val, i)
|
||||
+#define HA_ATOMIC_SUB(val, i) __sync_sub_and_fetch(val, i)
|
||||
+#define HA_ATOMIC_AND(val, flags) __sync_and_and_fetch(val, flags)
|
||||
+#define HA_ATOMIC_OR(val, flags) __sync_or_and_fetch(val, flags)
|
||||
+
|
||||
+/* the CAS is a bit complicated. The older API doesn't support returning the
|
||||
+ * value and the swap's result at the same time. So here we take what looks
|
||||
+ * like the safest route, consisting in using the boolean version guaranteeing
|
||||
+ * that the operation was performed or not, and we snoop a previous value. If
|
||||
+ * the compare succeeds, we return. If it fails, we return the previous value,
|
||||
+ * but only if it differs from the expected one. If it's the same it's a race
|
||||
+ * thus we try again to avoid confusing a possibly sensitive caller.
|
||||
+ */
|
||||
+#define HA_ATOMIC_CAS(val, old, new) \
|
||||
+ ({ \
|
||||
+ typeof((val)) __val = (val); \
|
||||
+ typeof((old)) __oldp = (old); \
|
||||
+ typeof(*(old)) __oldv; \
|
||||
+ typeof((new)) __new = (new); \
|
||||
+ int __ret; \
|
||||
+ do { \
|
||||
+ __oldv = *__val; \
|
||||
+ __ret = __sync_bool_compare_and_swap(__val, *__oldp, __new); \
|
||||
+ } while (!__ret && *__oldp == __oldv); \
|
||||
+ if (!__ret) \
|
||||
+ *__oldp = __oldv; \
|
||||
+ __ret; \
|
||||
+ })
|
||||
+
|
||||
+#define HA_ATOMIC_XCHG(val, new) \
|
||||
+ ({ \
|
||||
+ typeof((val)) __val = (val); \
|
||||
+ typeof(*(val)) __old; \
|
||||
+ typeof((new)) __new = (new); \
|
||||
+ do { __old = *__val; \
|
||||
+ } while (!__sync_bool_compare_and_swap(__val, __old, __new)); \
|
||||
+ __old; \
|
||||
+ })
|
||||
+#define HA_ATOMIC_STORE(val, new) \
|
||||
+ ({ \
|
||||
+ typeof((val)) __val = (val); \
|
||||
+ typeof(*(val)) __old; \
|
||||
+ typeof((new)) __new = (new); \
|
||||
+ do { __old = *__val; \
|
||||
+ } while (!__sync_bool_compare_and_swap(__val, __old, __new)); \
|
||||
+ })
|
||||
+#else
|
||||
#define HA_ATOMIC_CAS(val, old, new) __atomic_compare_exchange_n(val, old, new, 0, 0, 0)
|
||||
#define HA_ATOMIC_ADD(val, i) __atomic_add_fetch(val, i, 0)
|
||||
#define HA_ATOMIC_SUB(val, i) __atomic_sub_fetch(val, i, 0)
|
||||
@@ -106,6 +155,8 @@ extern THREAD_LOCAL unsigned long tid_bi
|
||||
#define HA_ATOMIC_OR(val, flags) __atomic_or_fetch(val, flags, 0)
|
||||
#define HA_ATOMIC_XCHG(val, new) __atomic_exchange_n(val, new, 0)
|
||||
#define HA_ATOMIC_STORE(val, new) __atomic_store_n(val, new, 0)
|
||||
+#endif
|
||||
+
|
||||
#define HA_ATOMIC_UPDATE_MAX(val, new) \
|
||||
({ \
|
||||
typeof(*(val)) __old = *(val); \
|
||||
/* gcc < 4.7 */
|
||||
|
||||
#define HA_ATOMIC_ADD(val, i) __sync_add_and_fetch(val, i)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue