This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 4/5] nptl: Add default pthread-offsets.h
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-alpha at sourceware dot org
- Date: Fri, 29 Dec 2017 12:58:38 -0200
- Subject: [PATCH 4/5] nptl: Add default pthread-offsets.h
- Authentication-results: sourceware.org; auth=none
- References: <1514559519-13167-1-git-send-email-adhemerval.zanella@linaro.org>
This patch adds a default pthread-offsets.h based on default
thread definitions from mutex-internal.h, rwlock-internal.h,
thread-shared-types.h, and pthreadtypes.h. The idea is to simpify
new ports inclusion.
* sysdeps/nptl/pthread-offsets.h: New file.
Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---
ChangeLog | 2 ++
sysdeps/nptl/pthread-offsets.h | 19 +++++++++++++++++++
2 files changed, 21 insertions(+)
create mode 100644 sysdeps/nptl/pthread-offsets.h
diff --git a/sysdeps/nptl/pthread-offsets.h b/sysdeps/nptl/pthread-offsets.h
new file mode 100644
index 0000000..89cd73b
--- /dev/null
+++ b/sysdeps/nptl/pthread-offsets.h
@@ -0,0 +1,19 @@
+#include <bits/wordsize.h>
+
+/* These values are based on internal generic types from
+ sysdeps/nptl/internaltypes.h, sysdeps/nptl/bits/mutex-internal.h,
+ sysdeps/nptl/bits/rwlock-internal.h, and
+ sysdeps/nptl/bits/thread-shared-types.h */
+#if __WORDSIZE == 64
+# define __PTHREAD_MUTEX_NUSERS_OFFSET 12
+# define __PTHREAD_MUTEX_KIND_OFFSET 16
+# define __PTHREAD_MUTEX_SPINS_OFFSET 20
+# define __PTHREAD_MUTEX_ELISION_OFFSET 22
+# define __PTHREAD_MUTEX_LIST_OFFSET 24
+#else
+# define __PTHREAD_MUTEX_NUSERS_OFFSET 12
+# define __PTHREAD_MUTEX_KIND_OFFSET 16
+# define __PTHREAD_MUTEX_SPINS_OFFSET 20
+# define __PTHREAD_MUTEX_ELISION_OFFSET 22
+# define __PTHREAD_MUTEX_LIST_OFFSET 24
+#endif
--
2.7.4