Compilation fixes for glibc-2.1.X systems. (Lionel Ulmer).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@117 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/arch/x86-linux/vg_libpthread.c b/coregrind/arch/x86-linux/vg_libpthread.c
index 5b18a84..fb70ec6 100644
--- a/coregrind/arch/x86-linux/vg_libpthread.c
+++ b/coregrind/arch/x86-linux/vg_libpthread.c
@@ -25,7 +25,9 @@
#include <unistd.h>
#include <string.h>
-
+#ifdef GLIBC_2_1
+#include <sys/time.h>
+#endif
/* ---------------------------------------------------------------------
Helpers. We have to be pretty self-sufficient.
@@ -257,10 +259,12 @@
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
{
switch (type) {
+#ifndef GLIBC_2_1
case PTHREAD_MUTEX_TIMED_NP:
+ case PTHREAD_MUTEX_ADAPTIVE_NP:
+#endif
case PTHREAD_MUTEX_RECURSIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ADAPTIVE_NP:
attr->__mutexkind = type;
return 0;
default:
@@ -391,7 +395,11 @@
{
kludged("pthread_getschedparam");
if (policy) *policy = SCHED_OTHER;
+# ifdef GLIBC_2_1
+ if (param) param->sched_priority = 0; /* who knows */
+# else
if (param) param->__sched_priority = 0; /* who knows */
+# endif
return 0;
}
@@ -538,7 +546,11 @@
const struct sigaction *act,
struct sigaction *oldact)
{
+# ifdef GLIBC_2_1
+ return __sigaction(signum, act, oldact);
+# else
return __libc_sigaction(signum, act, oldact);
+# endif
}
diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c
index 5b18a84..fb70ec6 100644
--- a/coregrind/vg_libpthread.c
+++ b/coregrind/vg_libpthread.c
@@ -25,7 +25,9 @@
#include <unistd.h>
#include <string.h>
-
+#ifdef GLIBC_2_1
+#include <sys/time.h>
+#endif
/* ---------------------------------------------------------------------
Helpers. We have to be pretty self-sufficient.
@@ -257,10 +259,12 @@
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
{
switch (type) {
+#ifndef GLIBC_2_1
case PTHREAD_MUTEX_TIMED_NP:
+ case PTHREAD_MUTEX_ADAPTIVE_NP:
+#endif
case PTHREAD_MUTEX_RECURSIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ADAPTIVE_NP:
attr->__mutexkind = type;
return 0;
default:
@@ -391,7 +395,11 @@
{
kludged("pthread_getschedparam");
if (policy) *policy = SCHED_OTHER;
+# ifdef GLIBC_2_1
+ if (param) param->sched_priority = 0; /* who knows */
+# else
if (param) param->__sched_priority = 0; /* who knows */
+# endif
return 0;
}
@@ -538,7 +546,11 @@
const struct sigaction *act,
struct sigaction *oldact)
{
+# ifdef GLIBC_2_1
+ return __sigaction(signum, act, oldact);
+# else
return __libc_sigaction(signum, act, oldact);
+# endif
}
diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c
index 90a9d9b..68dbf19 100644
--- a/coregrind/vg_scheduler.c
+++ b/coregrind/vg_scheduler.c
@@ -1729,10 +1729,12 @@
/* More paranoia ... */
switch (mutex->__m_kind) {
+# ifndef GLIBC_2_1
case PTHREAD_MUTEX_TIMED_NP:
+ case PTHREAD_MUTEX_ADAPTIVE_NP:
+# endif
case PTHREAD_MUTEX_RECURSIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ADAPTIVE_NP:
if (mutex->__m_count >= 0) break;
/* else fall thru */
default:
@@ -1817,10 +1819,12 @@
/* More paranoia ... */
switch (mutex->__m_kind) {
+# ifndef GLIBC_2_1
case PTHREAD_MUTEX_TIMED_NP:
+ case PTHREAD_MUTEX_ADAPTIVE_NP:
+# endif
case PTHREAD_MUTEX_RECURSIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ADAPTIVE_NP:
if (mutex->__m_count >= 0) break;
/* else fall thru */
default:
@@ -1979,10 +1983,12 @@
/* More paranoia ... */
switch (mutex->__m_kind) {
+# ifndef GLIBC_2_1
case PTHREAD_MUTEX_TIMED_NP:
+ case PTHREAD_MUTEX_ADAPTIVE_NP:
+# endif
case PTHREAD_MUTEX_RECURSIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ADAPTIVE_NP:
if (mutex->__m_count >= 0) break;
/* else fall thru */
default:
diff --git a/vg_libpthread.c b/vg_libpthread.c
index 5b18a84..fb70ec6 100644
--- a/vg_libpthread.c
+++ b/vg_libpthread.c
@@ -25,7 +25,9 @@
#include <unistd.h>
#include <string.h>
-
+#ifdef GLIBC_2_1
+#include <sys/time.h>
+#endif
/* ---------------------------------------------------------------------
Helpers. We have to be pretty self-sufficient.
@@ -257,10 +259,12 @@
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
{
switch (type) {
+#ifndef GLIBC_2_1
case PTHREAD_MUTEX_TIMED_NP:
+ case PTHREAD_MUTEX_ADAPTIVE_NP:
+#endif
case PTHREAD_MUTEX_RECURSIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ADAPTIVE_NP:
attr->__mutexkind = type;
return 0;
default:
@@ -391,7 +395,11 @@
{
kludged("pthread_getschedparam");
if (policy) *policy = SCHED_OTHER;
+# ifdef GLIBC_2_1
+ if (param) param->sched_priority = 0; /* who knows */
+# else
if (param) param->__sched_priority = 0; /* who knows */
+# endif
return 0;
}
@@ -538,7 +546,11 @@
const struct sigaction *act,
struct sigaction *oldact)
{
+# ifdef GLIBC_2_1
+ return __sigaction(signum, act, oldact);
+# else
return __libc_sigaction(signum, act, oldact);
+# endif
}
diff --git a/vg_scheduler.c b/vg_scheduler.c
index 90a9d9b..68dbf19 100644
--- a/vg_scheduler.c
+++ b/vg_scheduler.c
@@ -1729,10 +1729,12 @@
/* More paranoia ... */
switch (mutex->__m_kind) {
+# ifndef GLIBC_2_1
case PTHREAD_MUTEX_TIMED_NP:
+ case PTHREAD_MUTEX_ADAPTIVE_NP:
+# endif
case PTHREAD_MUTEX_RECURSIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ADAPTIVE_NP:
if (mutex->__m_count >= 0) break;
/* else fall thru */
default:
@@ -1817,10 +1819,12 @@
/* More paranoia ... */
switch (mutex->__m_kind) {
+# ifndef GLIBC_2_1
case PTHREAD_MUTEX_TIMED_NP:
+ case PTHREAD_MUTEX_ADAPTIVE_NP:
+# endif
case PTHREAD_MUTEX_RECURSIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ADAPTIVE_NP:
if (mutex->__m_count >= 0) break;
/* else fall thru */
default:
@@ -1979,10 +1983,12 @@
/* More paranoia ... */
switch (mutex->__m_kind) {
+# ifndef GLIBC_2_1
case PTHREAD_MUTEX_TIMED_NP:
+ case PTHREAD_MUTEX_ADAPTIVE_NP:
+# endif
case PTHREAD_MUTEX_RECURSIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
- case PTHREAD_MUTEX_ADAPTIVE_NP:
if (mutex->__m_count >= 0) break;
/* else fall thru */
default: