diff mbox series

[4/5] nptl: Add default pthread-offsets.h

Message ID 1514559519-13167-4-git-send-email-adhemerval.zanella@linaro.org
State New
Headers show
Series [1/5] nptl: Add mutex-internal.h | expand

Commit Message

Adhemerval Zanella Netto Dec. 29, 2017, 2:58 p.m. UTC
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

-- 
2.7.4
diff mbox series

Patch

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