summaryrefslogtreecommitdiff
path: root/0004-add-two-header-files-with-some-deleted-macros.patch
diff options
context:
space:
mode:
Diffstat (limited to '0004-add-two-header-files-with-some-deleted-macros.patch')
-rw-r--r--0004-add-two-header-files-with-some-deleted-macros.patch166
1 files changed, 166 insertions, 0 deletions
diff --git a/0004-add-two-header-files-with-some-deleted-macros.patch b/0004-add-two-header-files-with-some-deleted-macros.patch
new file mode 100644
index 0000000..7acb8e2
--- /dev/null
+++ b/0004-add-two-header-files-with-some-deleted-macros.patch
@@ -0,0 +1,166 @@
+From d6e6184b4f10ef2cbdec09eae60350ced71e3de7 Mon Sep 17 00:00:00 2001
+From: Yang Yanchao <yangyanchao6@huawei.com>
+Date: Wed Nov 24 09:31:31 2021 +0800
+Subject: [PATCH 4/9] build extra lipthreadcond so
+
+For compatibility with glibc2.17, two header files are added with some
+deleted macros.
+
+---
+ nptl_2_17/compat_pthread_2_17.h | 61 +++++++++++++++++++++++++++
+ nptl_2_17/old_macros_2_17.h | 75 +++++++++++++++++++++++++++++++++
+ 2 files changed, 136 insertions(+)
+ create mode 100644 nptl_2_17/compat_pthread_2_17.h
+ create mode 100644 nptl_2_17/old_macros_2_17.h
+
+diff --git a/nptl_2_17/compat_pthread_2_17.h b/nptl_2_17/compat_pthread_2_17.h
+new file mode 100644
+index 00000000..d13051ba
+--- /dev/null
++++ b/nptl_2_17/compat_pthread_2_17.h
+@@ -0,0 +1,61 @@
++#ifndef _COMPAT_PTHREAD_2_17_H
++#define _COMPAT_PTHREAD_2_17_H 1
++
++#include <bits/struct_rwlock.h>
++#include <unistd.h>
++
++#ifdef __x86_64__
++#define __PTHREAD_COMPAT_PADDING_MID
++#define __PTHREAD_COMPAT_PADDING_END
++#define __PTHREAD_MUTEX_LOCK_ELISION 1
++# define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
++# define __PTHREAD_MUTEX_USE_UNION 0
++//# define ENABLE_ELISION_SUPPORT 1
++#else
++#define __PTHREAD_COMPAT_PADDING_MID
++#define __PTHREAD_COMPAT_PADDING_END
++#define __PTHREAD_MUTEX_LOCK_ELISION 0
++#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
++#define __PTHREAD_MUTEX_USE_UNION 0
++#endif
++
++#define CANCELSTATE_BIT 0
++#define CANCELSTATE_BITMASK (0x01 << CANCELSTATE_BIT)
++ /* Bit set if asynchronous cancellation mode is selected. */
++#define CANCELTYPE_BIT 1
++#define CANCELTYPE_BITMASK (0x01 << CANCELTYPE_BIT)
++ /* Bit set if canceling has been initiated. */
++#define CANCELING_BIT 2
++#define CANCELING_BITMASK (0x01 << CANCELING_BIT)
++ /* Bit set if canceled. */
++#define CANCELED_BIT 3
++#define CANCELED_BITMASK (0x01 << CANCELED_BIT)
++ /* Bit set if thread is exiting. */
++#define EXITING_BIT 4
++#define EXITING_BITMASK (0x01 << EXITING_BIT)
++ /* Bit set if thread terminated and TCB is freed. */
++#define TERMINATED_BIT 5
++#define TERMINATED_BITMASK (0x01 << TERMINATED_BIT)
++ /* Bit set if thread is supposed to change XID. */
++#define SETXID_BIT 6
++#define SETXID_BITMASK (0x01 << SETXID_BIT)
++ /* Mask for the rest. Helps the compiler to optimize. */
++#define CANCEL_RESTMASK 0xffffff80
++
++
++#define CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS(value) \
++ (((value) & (CANCELSTATE_BITMASK | CANCELTYPE_BITMASK | CANCELED_BITMASK \
++ | EXITING_BITMASK | CANCEL_RESTMASK | TERMINATED_BITMASK)) \
++ == (CANCELTYPE_BITMASK | CANCELED_BITMASK))
++
++# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
++
++/*
++ * __pause_nocancel delete by fbb4a3143724ef3f044a4f05351,add it
++ */
++
++__typeof (pause) __pause_nocancel;
++hidden_proto (__pause_nocancel)
++
++#endif
++
+diff --git a/nptl_2_17/old_macros_2_17.h b/nptl_2_17/old_macros_2_17.h
+new file mode 100644
+index 00000000..334b2ab1
+--- /dev/null
++++ b/nptl_2_17/old_macros_2_17.h
+@@ -0,0 +1,75 @@
++#ifndef _OLD_MACROS_2_17_H
++#define _OLD_MACROS_2_17_H 1
++
++/*
++ * Contains macros that have been defined in glibc2.34.
++ * Cancel the definition and use the old version.
++ * This header file needs to be included at the end.
++ */
++#undef __lll_unlock
++#define __lll_unlock(futex, private) \
++ ((void) \
++ ({ \
++ int *__futex = (futex); \
++ int __private = (private); \
++ int __oldval = atomic_exchange_rel (__futex, 0); \
++ if (__glibc_unlikely (__oldval > 1)) \
++ lll_futex_wake (__futex, 1, __private); \
++ }))
++
++#undef lll_unlock
++#define lll_unlock(futex, private) \
++ __lll_unlock (&(futex), private)
++
++extern int __lll_timedlock_wait (int *futex, const struct timespec *,
++ int private) attribute_hidden;
++
++
++/* As __lll_lock, but with a timeout. If the timeout occurs then return
++ ETIMEDOUT. If ABSTIME is invalid, return EINVAL. */
++#define __lll_timedlock(futex, abstime, private) \
++ ({ \
++ int *__futex = (futex); \
++ int __val = 0; \
++ \
++ if (__glibc_unlikely \
++ (atomic_compare_and_exchange_bool_acq (__futex, 1, 0))) \
++ __val = __lll_timedlock_wait (__futex, abstime, private); \
++ __val; \
++ })
++#define lll_timedlock(futex, abstime, private) \
++ __lll_timedlock (&(futex), abstime, private)
++
++/* Verify whether the supplied clockid is supported by
++ lll_futex_clock_wait_bitset. */
++#define lll_futex_supported_clockid(clockid) \
++ ((clockid) == CLOCK_REALTIME || (clockid) == CLOCK_MONOTONIC)
++
++/* The kernel currently only supports CLOCK_MONOTONIC or
++ CLOCK_REALTIME timeouts for FUTEX_WAIT_BITSET. We could attempt to
++ convert others here but currently do not. */
++#define lll_futex_clock_wait_bitset(futexp, val, clockid, timeout, private) \
++ ({ \
++ long int __ret; \
++ if (lll_futex_supported_clockid (clockid)) \
++ { \
++ const unsigned int clockbit = \
++ (clockid == CLOCK_REALTIME) ? FUTEX_CLOCK_REALTIME : 0; \
++ const int op = \
++ __lll_private_flag (FUTEX_WAIT_BITSET | clockbit, private); \
++ \
++ __ret = lll_futex_syscall (6, futexp, op, val, \
++ timeout, NULL /* Unused. */, \
++ FUTEX_BITSET_MATCH_ANY); \
++ } \
++ else \
++ __ret = -EINVAL; \
++ __ret; \
++ })
++
++# undef INTERNAL_VSYSCALL
++# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
++# undef INLINE_VSYSCALL
++# define INLINE_VSYSCALL INLINE_SYSCALL
++
++#endif
+--
+2.30.0
+