Skip to contentSkip to conversation

posix: Avoid double declarations

PATCH In review Jan Kiszka 2 participants 10 messages Apr 14, 2009

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 posix: Avoid double declarations

Please pull from git://git.xenomai.org/xenomai-jki.git for-upstream and run bootstrap.

---------->

Recent glibc versions come with support for pthread_mutexattr_get/setprotocol and pthread_condattr_get/setclock. Make sure we don't declare those prototypes in Xenomai's pthread.h a second time as this can cause g++ warnings and even errors.

---

 configure.in            |    4 ++--
 include/posix/pthread.h |    4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
configure.in +2 -2
index b291ce4..6a8b821 100644
@@ -750,8 +750,8 @@ if test x$CONFIG_XENO_POSIX_UITRON_MLOCKALL = xy; then
 fi
 
 save_LIBS="$LIBS"
-LIBS="$LIBS -lrt"
-AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64])
+LIBS="$LIBS -lrt -lpthread"
+AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64 pthread_mutexattr_setprotocol pthread_condattr_setclock])
 LIBS="$save_LIBS"
 
 AC_MSG_CHECKING(whether to enable dlopen support for skin libraries)
include/posix/pthread.h +4 -0
index 2344158..98db325 100644
@@ -418,17 +418,21 @@ int pthread_intr_control_np(pthread_intr_t intr,
 extern "C" {
 #endif
 
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
 				  int *proto);
 
 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
 				  int proto);
+#endif
 
+#ifndef HAVE_PTHREAD_CONDATTR_SETCLOCK
 int pthread_condattr_getclock(const pthread_condattr_t *attr,
 			      clockid_t *clk_id);
 
 int pthread_condattr_setclock(pthread_condattr_t *attr,
 			      clockid_t clk_id);
+#endif
 
 int pthread_make_periodic_np(pthread_t thread,
 			     struct timespec *starttp,
#1 lore raw
Quoted 37 lines · Jan Kiszka

Please pull from git://git.xenomai.org/xenomai-jki.git for-upstream and run bootstrap.

---------->

Recent glibc versions come with support for pthread_mutexattr_get/setprotocol and pthread_condattr_get/setclock. Make sure we don't declare those prototypes in Xenomai's pthread.h a second time as this can cause g++ warnings and even errors.

---

 configure.in            |    4 ++--
 include/posix/pthread.h |    4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
configure.in +2 -2
index b291ce4..6a8b821 100644
@@ -750,8 +750,8 @@ if test x$CONFIG_XENO_POSIX_UITRON_MLOCKALL = xy; then
 fi
 
 save_LIBS="$LIBS"
-LIBS="$LIBS -lrt"
-AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64])
+LIBS="$LIBS -lrt -lpthread"
+AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64 pthread_mutexattr_setprotocol pthread_condattr_setclock])
 LIBS="$save_LIBS"
 
 AC_MSG_CHECKING(whether to enable dlopen support for skin libraries)
include/posix/pthread.h +0 -0
index 2344158..98db325 100644

include/posix/pthread.h int pthread_intr_control_np(pthread_intr_t intr, · line 427

Quoted 10 lines
include/posix/pthread.h +2 -0
@@ -418,17 +418,21 @@ int pthread_intr_control_np(pthread_intr_t intr,
 extern "C" {
 #endif
 
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
 				  int *proto);
 
 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
 				  int proto);
+#endif

That is not enough, if these functions are defined, then the PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT are going to be defined.

Are you sure that the missing "restrict" are not causing the errors ?

Signature · 1 line
                                                 Gilles.
author
#2 lore raw
Quoted 53 lines · Gilles Chanteperdrix
Quoted 37 lines · Jan Kiszka

Please pull from git://git.xenomai.org/xenomai-jki.git for-upstream and run bootstrap.

---------->

Recent glibc versions come with support for pthread_mutexattr_get/setprotocol and pthread_condattr_get/setclock. Make sure we don't declare those prototypes in Xenomai's pthread.h a second time as this can cause g++ warnings and even errors.

---

 configure.in            |    4 ++--
 include/posix/pthread.h |    4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
configure.in +2 -2
index b291ce4..6a8b821 100644
@@ -750,8 +750,8 @@ if test x$CONFIG_XENO_POSIX_UITRON_MLOCKALL = xy; then
 fi
 
 save_LIBS="$LIBS"
-LIBS="$LIBS -lrt"
-AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64])
+LIBS="$LIBS -lrt -lpthread"
+AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64 pthread_mutexattr_setprotocol pthread_condattr_setclock])
 LIBS="$save_LIBS"
 
 AC_MSG_CHECKING(whether to enable dlopen support for skin libraries)
include/posix/pthread.h +0 -0
index 2344158..98db325 100644

include/posix/pthread.h int pthread_intr_control_np(pthread_intr_t intr, · line 427

Quoted 10 lines
include/posix/pthread.h +2 -0
@@ -418,17 +418,21 @@ int pthread_intr_control_np(pthread_intr_t intr,
 extern "C" {
 #endif
 
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
 				  int *proto);
 
 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
 				  int proto);
+#endif

That is not enough, if these functions are defined, then the PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT are going to be defined.

Quoted 1 line

Are you sure that the missing "restrict" are not causing the errors ?

This is enough to fix our build breakage due to different prototypes of those functions, at least under C++. The magic __THROW may make the difference, but I didn't test that in details as I think its simply fragile to redeclare them.

Don't know if those constants can cause trouble, they didn't do so here so far. But I can Include them if preferred.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 55 lines · Jan Kiszka
Quoted 45 lines · Gilles Chanteperdrix
Quoted 44 lines · Jan Kiszka

Please pull from git://git.xenomai.org/xenomai-jki.git for-upstream and run bootstrap.

---------->

Recent glibc versions come with support for pthread_mutexattr_get/setprotocol and pthread_condattr_get/setclock. Make sure we don't declare those prototypes in Xenomai's pthread.h a second time as this can cause g++ warnings and even errors.

---

 configure.in            |    4 ++--
 include/posix/pthread.h |    4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
configure.in +2 -2
index b291ce4..6a8b821 100644
@@ -750,8 +750,8 @@ if test x$CONFIG_XENO_POSIX_UITRON_MLOCKALL = xy; then
 fi
 
 save_LIBS="$LIBS"
-LIBS="$LIBS -lrt"
-AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64])
+LIBS="$LIBS -lrt -lpthread"
+AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64 pthread_mutexattr_setprotocol pthread_condattr_setclock])
 LIBS="$save_LIBS"
 
 AC_MSG_CHECKING(whether to enable dlopen support for skin libraries)
include/posix/pthread.h +1 -0
index 2344158..98db325 100644
@@ -418,17 +418,21 @@ int pthread_intr_control_np(pthread_intr_t intr,
 extern "C" {
 #endif
 
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
 				  int *proto);
 
Quoted 8 lines

include/posix/pthread.h int pthread_intr_control_np(pthread_intr_t intr, · line 427

Quoted 3 lines
include/posix/pthread.h +1 -0
 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
 				  int proto);
+#endif

That is not enough, if these functions are defined, then the PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT are going to be defined.

Are you sure that the missing "restrict" are not causing the errors ?

Quoted 7 lines

This is enough to fix our build breakage due to different prototypes of those functions, at least under C++. The magic __THROW may make the difference, but I didn't test that in details as I think its simply fragile to redeclare them.

Don't know if those constants can cause trouble, they didn't do so here so far. But I can Include them if preferred.

If it works, it is just as fragile as trying to match function declarations of Xenomai's pthread.h and glibc's pthread.h.

Signature · 1 line
                                                 Gilles.
author
#4 lore raw
Quoted 60 lines · Gilles Chanteperdrix
Quoted 59 lines · Jan Kiszka
Quoted 45 lines · Gilles Chanteperdrix
Quoted 44 lines · Jan Kiszka

Please pull from git://git.xenomai.org/xenomai-jki.git for-upstream and run bootstrap.

---------->

Recent glibc versions come with support for pthread_mutexattr_get/setprotocol and pthread_condattr_get/setclock. Make sure we don't declare those prototypes in Xenomai's pthread.h a second time as this can cause g++ warnings and even errors.

---

 configure.in            |    4 ++--
 include/posix/pthread.h |    4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
configure.in +2 -2
index b291ce4..6a8b821 100644
@@ -750,8 +750,8 @@ if test x$CONFIG_XENO_POSIX_UITRON_MLOCKALL = xy; then
 fi
 
 save_LIBS="$LIBS"
-LIBS="$LIBS -lrt"
-AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64])
+LIBS="$LIBS -lrt -lpthread"
+AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64 pthread_mutexattr_setprotocol pthread_condattr_setclock])
 LIBS="$save_LIBS"
 
 AC_MSG_CHECKING(whether to enable dlopen support for skin libraries)
include/posix/pthread.h +1 -0
index 2344158..98db325 100644
@@ -418,17 +418,21 @@ int pthread_intr_control_np(pthread_intr_t intr,
 extern "C" {
 #endif
 
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
 				  int *proto);
 
Quoted 8 lines

include/posix/pthread.h int pthread_intr_control_np(pthread_intr_t intr, · line 427

Quoted 3 lines
include/posix/pthread.h +1 -0
 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
 				  int proto);
+#endif

That is not enough, if these functions are defined, then the PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT are going to be defined.

Are you sure that the missing "restrict" are not causing the errors ?

This is enough to fix our build breakage due to different prototypes of those functions, at least under C++. The magic __THROW may make the difference, but I didn't test that in details as I think its simply fragile to redeclare them.

Quoted 5 lines
Quoted 2 lines

Don't know if those constants can cause trouble, they didn't do so here so far. But I can Include them if preferred.

If it works, it is just as fragile as trying to match function declarations of Xenomai's pthread.h and glibc's pthread.h.

Nope, because you don't repeat function attributes for their definitions. So Xenomai's pthread lib should pick up what the host header declares.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#5 lore raw
Quoted 61 lines · Jan Kiszka
Quoted 60 lines · Gilles Chanteperdrix
Quoted 59 lines · Jan Kiszka
Quoted 45 lines · Gilles Chanteperdrix
Quoted 44 lines · Jan Kiszka

Please pull from git://git.xenomai.org/xenomai-jki.git for-upstream and run bootstrap.

---------->

Recent glibc versions come with support for pthread_mutexattr_get/setprotocol and pthread_condattr_get/setclock. Make sure we don't declare those prototypes in Xenomai's pthread.h a second time as this can cause g++ warnings and even errors.

---

 configure.in            |    4 ++--
 include/posix/pthread.h |    4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
configure.in +2 -2
index b291ce4..6a8b821 100644
@@ -750,8 +750,8 @@ if test x$CONFIG_XENO_POSIX_UITRON_MLOCKALL = xy; then
 fi
 
 save_LIBS="$LIBS"
-LIBS="$LIBS -lrt"
-AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64])
+LIBS="$LIBS -lrt -lpthread"
+AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64 pthread_mutexattr_setprotocol pthread_condattr_setclock])
 LIBS="$save_LIBS"
 
 AC_MSG_CHECKING(whether to enable dlopen support for skin libraries)
include/posix/pthread.h +1 -0
index 2344158..98db325 100644
@@ -418,17 +418,21 @@ int pthread_intr_control_np(pthread_intr_t intr,
 extern "C" {
 #endif
 
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
 				  int *proto);
 
Quoted 8 lines

include/posix/pthread.h int pthread_intr_control_np(pthread_intr_t intr, · line 427

Quoted 3 lines
include/posix/pthread.h +1 -0
 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
 				  int proto);
+#endif

That is not enough, if these functions are defined, then the PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT are going to be defined.

Are you sure that the missing "restrict" are not causing the errors ?

This is enough to fix our build breakage due to different prototypes of those functions, at least under C++. The magic __THROW may make the difference, but I didn't test that in details as I think its simply fragile to redeclare them.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Don't know if those constants can cause trouble, they didn't do so here so far. But I can Include them if preferred.

If it works, it is just as fragile as trying to match function declarations of Xenomai's pthread.h and glibc's pthread.h.

Nope, because you don't repeat function attributes for their definitions. So Xenomai's pthread lib should pick up what the host header declares.

Currently, PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT and PTHREAD_PRIO_PROTECT are defined in Xenomai's header unconditionnaly. You see no warning or error because they are defined in an enum in glibc. But this is a fragile situation.

Signature · 1 line
                                                 Gilles.
author
#6 lore raw
Quoted 66 lines · Gilles Chanteperdrix
Quoted 65 lines · Jan Kiszka
Quoted 64 lines · Gilles Chanteperdrix
Quoted 53 lines · Jan Kiszka
Quoted 52 lines · Gilles Chanteperdrix
Quoted 37 lines · Jan Kiszka

Please pull from git://git.xenomai.org/xenomai-jki.git for-upstream and run bootstrap.

---------->

Recent glibc versions come with support for pthread_mutexattr_get/setprotocol and pthread_condattr_get/setclock. Make sure we don't declare those prototypes in Xenomai's pthread.h a second time as this can cause g++ warnings and even errors.

---

 configure.in            |    4 ++--
 include/posix/pthread.h |    4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
configure.in +2 -2
index b291ce4..6a8b821 100644
@@ -750,8 +750,8 @@ if test x$CONFIG_XENO_POSIX_UITRON_MLOCKALL = xy; then
 fi
 
 save_LIBS="$LIBS"
-LIBS="$LIBS -lrt"
-AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64])
+LIBS="$LIBS -lrt -lpthread"
+AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64 pthread_mutexattr_setprotocol pthread_condattr_setclock])
 LIBS="$save_LIBS"
 
 AC_MSG_CHECKING(whether to enable dlopen support for skin libraries)
include/posix/pthread.h +0 -0
index 2344158..98db325 100644

include/posix/pthread.h int pthread_intr_control_np(pthread_intr_t intr, · line 427

Quoted 10 lines
include/posix/pthread.h +2 -0
@@ -418,17 +418,21 @@ int pthread_intr_control_np(pthread_intr_t intr,
 extern "C" {
 #endif
 
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
 				  int *proto);
 
 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
 				  int proto);
+#endif

That is not enough, if these functions are defined, then the PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT are going to be defined.

Quoted 8 lines
Quoted 1 line

Are you sure that the missing "restrict" are not causing the errors ?

This is enough to fix our build breakage due to different prototypes of those functions, at least under C++. The magic __THROW may make the difference, but I didn't test that in details as I think its simply fragile to redeclare them.

Don't know if those constants can cause trouble, they didn't do so here so far. But I can Include them if preferred.

If it works, it is just as fragile as trying to match function declarations of Xenomai's pthread.h and glibc's pthread.h.

Quoted 9 lines
Quoted 3 lines

Nope, because you don't repeat function attributes for their definitions. So Xenomai's pthread lib should pick up what the host header declares.

Currently, PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT and PTHREAD_PRIO_PROTECT are defined in Xenomai's header unconditionnaly. You see no warning or error because they are defined in an enum in glibc. But this is a fragile situation.

I could offer this version and later add a patch to provide the missing __real prototypes for all POSIX wrappers.

Jan

-------->

Recent glibc versions come with support for pthread_mutexattr_get/setprotocol and pthread_condattr_get/setclock. Make sure we don't declare those prototypes in Xenomai's pthread.h a second time as this can cause g++ warnings and even errors. Also exclude mutexattr related constants at this chance.

---

 configure.in            |    4 ++--
 include/posix/pthread.h |    7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
configure.in +2 -2
index b291ce4..6a8b821 100644
@@ -750,8 +750,8 @@ if test x$CONFIG_XENO_POSIX_UITRON_MLOCKALL = xy; then
 fi
 
 save_LIBS="$LIBS"
-LIBS="$LIBS -lrt"
-AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64])
+LIBS="$LIBS -lrt -lpthread"
+AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64 pthread_mutexattr_setprotocol pthread_condattr_setclock])
 LIBS="$save_LIBS"
 
 AC_MSG_CHECKING(whether to enable dlopen support for skin libraries)
include/posix/pthread.h +7 -0
index 2344158..10176ad 100644
@@ -140,9 +140,12 @@ struct timespec;
 
 #endif /* __KERNEL__ || __XENO_SIM__ */
 
+#if defined(__KERNEL__) || defined(__XENO_SIM__) || \
+    !define(HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL)
 #define PTHREAD_PRIO_NONE    0
 #define PTHREAD_PRIO_INHERIT 1
 #define PTHREAD_PRIO_PROTECT 2
+#endif /* __KERNEL__ || __XENO_SIM__ || !HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL */
 
 #define PTHREAD_WARNSW     XNTRAPSW
 #define PTHREAD_LOCK_SCHED XNLOCK
@@ -418,17 +421,21 @@ int pthread_intr_control_np(pthread_intr_t intr,
 extern "C" {
 #endif
 
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
 				  int *proto);
 
 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
 				  int proto);
+#endif
 
+#ifndef HAVE_PTHREAD_CONDATTR_SETCLOCK
 int pthread_condattr_getclock(const pthread_condattr_t *attr,
 			      clockid_t *clk_id);
 
 int pthread_condattr_setclock(pthread_condattr_t *attr,
 			      clockid_t clk_id);
+#endif
 
 int pthread_make_periodic_np(pthread_t thread,
 			     struct timespec *starttp,
#7 lore raw
Quoted 70 lines · Jan Kiszka
Quoted 69 lines · Gilles Chanteperdrix
Quoted 68 lines · Jan Kiszka
Quoted 60 lines · Gilles Chanteperdrix
Quoted 59 lines · Jan Kiszka
Quoted 45 lines · Gilles Chanteperdrix
Quoted 44 lines · Jan Kiszka

Please pull from git://git.xenomai.org/xenomai-jki.git for-upstream and run bootstrap.

---------->

Recent glibc versions come with support for pthread_mutexattr_get/setprotocol and pthread_condattr_get/setclock. Make sure we don't declare those prototypes in Xenomai's pthread.h a second time as this can cause g++ warnings and even errors.

---

 configure.in            |    4 ++--
 include/posix/pthread.h |    4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
configure.in +2 -2
index b291ce4..6a8b821 100644
@@ -750,8 +750,8 @@ if test x$CONFIG_XENO_POSIX_UITRON_MLOCKALL = xy; then
 fi
 
 save_LIBS="$LIBS"
-LIBS="$LIBS -lrt"
-AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64])
+LIBS="$LIBS -lrt -lpthread"
+AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64 pthread_mutexattr_setprotocol pthread_condattr_setclock])
 LIBS="$save_LIBS"
 
 AC_MSG_CHECKING(whether to enable dlopen support for skin libraries)
include/posix/pthread.h +1 -0
index 2344158..98db325 100644
@@ -418,17 +418,21 @@ int pthread_intr_control_np(pthread_intr_t intr,
 extern "C" {
 #endif
 
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr,
 				  int *proto);
 
Quoted 8 lines

include/posix/pthread.h int pthread_intr_control_np(pthread_intr_t intr, · line 430

Quoted 3 lines
include/posix/pthread.h +1 -0
 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr,
 				  int proto);
+#endif

That is not enough, if these functions are defined, then the PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT are going to be defined.

Are you sure that the missing "restrict" are not causing the errors ?

This is enough to fix our build breakage due to different prototypes of those functions, at least under C++. The magic __THROW may make the difference, but I didn't test that in details as I think its simply fragile to redeclare them.

Quoted 4 lines
Quoted 2 lines

Don't know if those constants can cause trouble, they didn't do so here so far. But I can Include them if preferred.

If it works, it is just as fragile as trying to match function declarations of Xenomai's pthread.h and glibc's pthread.h.

Nope, because you don't repeat function attributes for their definitions. So Xenomai's pthread lib should pick up what the host header declares.

Quoted 8 lines
Quoted 5 lines

Currently, PTHREAD_PRIO_NONE, PTHREAD_PRIO_INHERIT and PTHREAD_PRIO_PROTECT are defined in Xenomai's header unconditionnaly. You see no warning or error because they are defined in an enum in glibc. But this is a fragile situation.

I could offer this version and later add a patch to provide the missing __real prototypes for all POSIX wrappers.

That's OK for me.

Signature · 1 line
                                                 Gilles.
#8 lore raw
In reply to Jan Kiszka
Quoted 9 lines · Jan Kiszka

Please pull from git://git.xenomai.org/xenomai-jki.git for-upstream and run bootstrap.

---------->

Recent glibc versions come with support for pthread_mutexattr_get/setprotocol and pthread_condattr_get/setclock. Make sure we don't declare those prototypes in Xenomai's pthread.h a second time as this can cause g++ warnings and even errors.

You need to declare the __real variants too, as well as the wrappers.

Signature · 1 line
                                                 Gilles.
author
#9 lore raw
Quoted 4 lines · Gilles Chanteperdrix
Quoted 3 lines · Jan Kiszka

Please pull from git://git.xenomai.org/xenomai-jki.git for-upstream and run bootstrap.

Quoted 8 lines
Quoted 6 lines

---------->

Recent glibc versions come with support for pthread_mutexattr_get/setprotocol and pthread_condattr_get/setclock. Make sure we don't declare those prototypes in Xenomai's pthread.h a second time as this can cause g++ warnings and even errors.

You need to declare the __real variants too, as well as the wrappers.

As they don't existed for all the other attr helpers, I skipped this. Guess more work is required here.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux