Some newer systems have a new version of pthreadtypes.h that comes from glibc
2.3.3, which is binary-compatible, but not source compatible with the old one,
which came from LinuxThreads. We were using the types defined in the old one,
which caused compilation errors on systems using the new one.
This commit introduces our own versions of these types. Our versions are laid
out identically to the LinuxThreads ones, but the field names are different.
We convert all pthread types to our versions before using them, so we don't
rely on the pthreadtypes.h types any more. Hopefully this will fix the
problem; I have three reports that it does. Let's see...
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2272 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h
index a764362..49b47ec 100644
--- a/coregrind/vg_include.h
+++ b/coregrind/vg_include.h
@@ -644,6 +644,41 @@
/* ---------------------------------------------------------------------
+ Exports of vg_libpthread.c
+ ------------------------------------------------------------------ */
+
+/* Replacements for pthread types, shared between vg_libpthread.c and
+ vg_scheduler.c. See comment in vg_libpthread.c above the other
+ vg_pthread_*_t types for a description of how these are used. */
+
+struct _vg_pthread_fastlock
+{
+ long int __vg_status; /* "Free" or "taken" or head of waiting list */
+ int __vg_spinlock; /* Used by compare_and_swap emulation. Also,
+ adaptive SMP lock stores spin count here. */
+};
+
+typedef struct
+{
+ int __vg_m_reserved; /* Reserved for future use */
+ int __vg_m_count; /* Depth of recursive locking */
+ /*_pthread_descr*/ void* __vg_m_owner; /* Owner thread (if recursive or errcheck) */
+ int __vg_m_kind; /* Mutex kind: fast, recursive or errcheck */
+ struct _vg_pthread_fastlock __vg_m_lock; /* Underlying fast lock */
+} vg_pthread_mutex_t;
+
+typedef struct
+{
+ struct _vg_pthread_fastlock __vg_c_lock; /* Protect against concurrent access */
+ /*_pthread_descr*/ void* __vg_c_waiting; /* Threads waiting on this condition */
+ // Padding ensures the size is 48 bytes
+ char __vg_padding[48 - sizeof(struct _vg_pthread_fastlock)
+ - sizeof(void*) - sizeof(long long)];
+ long long __vg_align;
+} vg_pthread_cond_t;
+
+
+/* ---------------------------------------------------------------------
Exports of vg_scheduler.c
------------------------------------------------------------------ */
@@ -702,7 +737,7 @@
When .status == WaitCV, points to the mutex associated with
the condition variable indicated by the .associated_cv field.
In all other cases, should be NULL. */
- void* /*pthread_mutex_t* */ associated_mx;
+ vg_pthread_mutex_t* associated_mx;
/* When .status == WaitCV, points to the condition variable I am
waiting for. In all other cases, should be NULL. */
@@ -981,6 +1016,7 @@
out what's happening. */
#define VG_PTHREAD_PREHISTORY 0x80000000
+
/* ---------------------------------------------------------------------
Exports of vg_signals.c
------------------------------------------------------------------ */