All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] More latest glibc/gcc build fixes
@ 2021-10-16 18:31 Jan Kiszka
  2021-10-16 18:31 ` [PATCH 1/3] testsuite/latency: Use corresponding pclose for popen Jan Kiszka
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jan Kiszka @ 2021-10-16 18:31 UTC (permalink / raw)
  To: xenomai

Found while test-building against ALT linux.

Jan


CC: Jan Kiszka <jan.kiszka@siemens.com>

Jan Kiszka (3):
  testsuite/latency: Use corresponding pclose for popen
  lib/boilerplate: Convert pthread_mutexattr_setrobust_np stub into
    inline function
  lib: Switch to pthread_mutexattr_setrobust

 configure.ac                |  1 +
 include/boilerplate/libc.h  | 14 +++++++++++---
 lib/alchemy/mutex.c         |  4 ++--
 lib/vxworks/semLib.c        |  4 ++--
 testsuite/latency/latency.c |  2 +-
 5 files changed, 17 insertions(+), 8 deletions(-)

--
2.31.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] testsuite/latency: Use corresponding pclose for popen
  2021-10-16 18:31 [PATCH 0/3] More latest glibc/gcc build fixes Jan Kiszka
@ 2021-10-16 18:31 ` Jan Kiszka
  2021-10-16 18:31 ` [PATCH 2/3] lib/boilerplate: Convert pthread_mutexattr_setrobust_np stub into inline function Jan Kiszka
  2021-10-16 18:31 ` [PATCH 3/3] lib: Switch to pthread_mutexattr_setrobust Jan Kiszka
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2021-10-16 18:31 UTC (permalink / raw)
  To: xenomai

From: Jan Kiszka <jan.kiszka@siemens.com>

Was found by latest gcc-11 and -Werror=mismatched-dealloc.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 testsuite/latency/latency.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testsuite/latency/latency.c b/testsuite/latency/latency.c
index a0e6f48260..6cd3a28b44 100644
--- a/testsuite/latency/latency.c
+++ b/testsuite/latency/latency.c
@@ -412,7 +412,7 @@ static void dump_histo_gnuplot(int32_t *histogram, time_t duration)
 		fputs(buf, ofp);
 	}

-	fclose(ifp);
+	pclose(ifp);

 dump_data:
 	for (n = 0; n < histogram_size && histogram[n] == 0; n++)
--
2.31.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] lib/boilerplate: Convert pthread_mutexattr_setrobust_np stub into inline function
  2021-10-16 18:31 [PATCH 0/3] More latest glibc/gcc build fixes Jan Kiszka
  2021-10-16 18:31 ` [PATCH 1/3] testsuite/latency: Use corresponding pclose for popen Jan Kiszka
@ 2021-10-16 18:31 ` Jan Kiszka
  2021-10-16 18:31 ` [PATCH 3/3] lib: Switch to pthread_mutexattr_setrobust Jan Kiszka
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2021-10-16 18:31 UTC (permalink / raw)
  To: xenomai

From: Jan Kiszka <jan.kiszka@siemens.com>

Recent glibc (at leasst 2.34) triggers

  CC       libposix_fork_a-posix-fork.o
In file included from posix-fork.c:11:
../../../include/boilerplate/libc.h:248:10: error: expected identifier or '(' before '{' token
  248 |         ({ ENOSYS; })
      |          ^

So switch to a static inline, like for all the other stubs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/boilerplate/libc.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h
index 75e2d1da43..41b2eb91bb 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -244,8 +244,12 @@ __weak int shm_unlink(const char *name)
 #endif	/* !HAVE_SHM_UNLINK */

 #ifndef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP
-#define pthread_mutexattr_setrobust_np(__attr, __robust)	\
-	({ ENOSYS; })
+static inline
+int pthread_mutexattr_setrobust_np(const pthread_mutexattr_t *attr,
+				   int *robustness)
+{
+	return ENOSYS;
+}
 #endif /* !HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP */

 #if !defined(HAVE_PTHREAD_SETNAME_NP) && defined(CONFIG_XENO_MERCURY)
--
2.31.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] lib: Switch to pthread_mutexattr_setrobust
  2021-10-16 18:31 [PATCH 0/3] More latest glibc/gcc build fixes Jan Kiszka
  2021-10-16 18:31 ` [PATCH 1/3] testsuite/latency: Use corresponding pclose for popen Jan Kiszka
  2021-10-16 18:31 ` [PATCH 2/3] lib/boilerplate: Convert pthread_mutexattr_setrobust_np stub into inline function Jan Kiszka
@ 2021-10-16 18:31 ` Jan Kiszka
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2021-10-16 18:31 UTC (permalink / raw)
  To: xenomai

From: Jan Kiszka <jan.kiszka@siemens.com>

With recent glibc (at least 2.34), autoconf fails to detect
pthread_mutexattr_setrobust_np. But that is long deprecated anyway. So
switch to pthread_mutexattr_setrobust and only fall back to _np when
needed.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 configure.ac               |  1 +
 include/boilerplate/libc.h | 10 +++++++---
 lib/alchemy/mutex.c        |  4 ++--
 lib/vxworks/semLib.c       |  4 ++--
 4 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 480a94768d..d39443a35e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -542,6 +542,7 @@ AC_CHECK_FUNCS([pthread_mutexattr_setprotocol	\
 		pthread_mutexattr_getprotocol	\
 		pthread_mutexattr_getprioceiling \
 		pthread_mutexattr_setprioceiling \
+		pthread_mutexattr_setrobust	\
 		pthread_mutexattr_setrobust_np	\
 		pthread_mutex_getprioceiling	\
 		pthread_mutex_setprioceiling	\
diff --git a/include/boilerplate/libc.h b/include/boilerplate/libc.h
index 41b2eb91bb..797e377a2e 100644
--- a/include/boilerplate/libc.h
+++ b/include/boilerplate/libc.h
@@ -243,14 +243,18 @@ __weak int shm_unlink(const char *name)
 }
 #endif	/* !HAVE_SHM_UNLINK */

-#ifndef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP
+#ifndef HAVE_PTHREAD_MUTEXATTR_SETROBUST
+#ifdef HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP
+#define pthread_mutexattr_setrobust	pthread_mutexattr_setrobust_np
+#else
 static inline
-int pthread_mutexattr_setrobust_np(const pthread_mutexattr_t *attr,
-				   int *robustness)
+int pthread_mutexattr_setrobust(const pthread_mutexattr_t *attr,
+				int *robustness)
 {
 	return ENOSYS;
 }
 #endif /* !HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP */
+#endif /* !HAVE_PTHREAD_MUTEXATTR_SETROBUST */

 #if !defined(HAVE_PTHREAD_SETNAME_NP) && defined(CONFIG_XENO_MERCURY)
 static inline
diff --git a/lib/alchemy/mutex.c b/lib/alchemy/mutex.c
index 09eb1364ef..f893385864 100644
--- a/lib/alchemy/mutex.c
+++ b/lib/alchemy/mutex.c
@@ -131,8 +131,8 @@ int rt_mutex_create(RT_MUTEX *mutex, const char *name)
 	pthread_mutexattr_setprotocol(&mattr, PTHREAD_PRIO_INHERIT);
 	pthread_mutexattr_setpshared(&mattr, mutex_scope_attribute);
 	pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
-	/* pthread_mutexattr_setrobust_np() might not be implemented. */
-	pthread_mutexattr_setrobust_np(&mattr, PTHREAD_MUTEX_ROBUST_NP);
+	/* pthread_mutexattr_setrobust() might not be implemented. */
+	pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST_NP);
 	ret = __RT(pthread_mutex_init(&mcb->lock, &mattr));
 	if (ret) {
 		xnfree(mcb);
diff --git a/lib/vxworks/semLib.c b/lib/vxworks/semLib.c
index acce160ee1..180ed20005 100644
--- a/lib/vxworks/semLib.c
+++ b/lib/vxworks/semLib.c
@@ -411,8 +411,8 @@ SEM_ID semMCreate(int options)
 	 */
 	pthread_mutexattr_init(&mattr);
 	pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
-	/* pthread_mutexattr_setrobust_np() might not be implemented. */
-	pthread_mutexattr_setrobust_np(&mattr, PTHREAD_MUTEX_ROBUST_NP);
+	/* pthread_mutexattr_setrobust() might not be implemented. */
+	pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST_NP);
 	if (options & SEM_INVERSION_SAFE)
 		pthread_mutexattr_setprotocol(&mattr, PTHREAD_PRIO_INHERIT);
 	pthread_mutexattr_setpshared(&mattr, mutex_scope_attribute);
--
2.31.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-16 18:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-16 18:31 [PATCH 0/3] More latest glibc/gcc build fixes Jan Kiszka
2021-10-16 18:31 ` [PATCH 1/3] testsuite/latency: Use corresponding pclose for popen Jan Kiszka
2021-10-16 18:31 ` [PATCH 2/3] lib/boilerplate: Convert pthread_mutexattr_setrobust_np stub into inline function Jan Kiszka
2021-10-16 18:31 ` [PATCH 3/3] lib: Switch to pthread_mutexattr_setrobust Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.