[PATCH v2 10/20] lib/cobalt: mutex: Provide time64 variant of pthread_timedmutex_lock_interruptible_np

Florian Bezdeka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <20260302-wip-flo-fix-time64-32bit-native-v2-10-7caefce29bcd@siemens.com>
That service / function was forgotten when introducing the time64_t
services. This is a non-posix / non portable (np) mutex function, so
not marked with COBALT_{IMPL,DECL}_TIME64() as no wrapping is taking
place.

Provide a time64_t variant in case time64_t support has been requested.

Signed-off-by: Florian Bezdeka <[email protected]>
---
 include/cobalt/pthread.h     | 16 +++++++++++++++-
 lib/cobalt/wrappers_time64.c |  8 ++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h
index fed7dd2d8ecee155cd58d2d07cbd6077b6c7612a..b6a6d7a58b0fb44abcdb11e9666b78a9e6b48667 100644
--- a/include/cobalt/pthread.h
+++ b/include/cobalt/pthread.h
@@ -173,7 +173,21 @@ int pthread_attr_setpersonality_ex(pthread_attr_ex_t *attr_ex,
 
 int pthread_mutex_lock_interruptible_np(pthread_mutex_t *mutex);
 
-int pthread_timedmutex_lock_interruptible_np(pthread_mutex_t *mutex, const struct timespec *to);
+int pthread_timedmutex_lock_interruptible_np(pthread_mutex_t *mutex,
+					     const struct timespec *to);
+
+#if __USE_TIME_BITS64 && __TIMESIZE == 32
+int pthread_timedmutex_lock_interruptible_np_time64(pthread_mutex_t *mutex,
+						    const struct timespec *to);
+#ifdef __REDIRECT
+int __REDIRECT(pthread_timedmutex_lock_interruptible_np,
+	       (pthread_mutex_t * mutex, const struct timespec *to),
+	       pthread_timedmutex_lock_interruptible_np_time64);
+#else
+#define pthread_timedmutex_lock_interruptible_np                               \
+	pthread_timedmutex_lock_interruptible_np_time64
+#endif
+#endif
 
 #ifdef __cplusplus
 }
diff --git a/lib/cobalt/wrappers_time64.c b/lib/cobalt/wrappers_time64.c
index 25581fd6f0b2b0405d575435a0ba81c397244aad..404e0c63f8a1241b5a34ad663e5ac020dcf0b44a 100644
--- a/lib/cobalt/wrappers_time64.c
+++ b/lib/cobalt/wrappers_time64.c
@@ -674,8 +674,16 @@ COBALT_IMPL_TIME64(int, pthread_mutex_timedlock, __pthread_mutex_timedlock64,
 	return ret;
 }
 
+#if __USE_TIME_BITS64 && __TIMESIZE == 32
+int pthread_timedmutex_lock_interruptible_np_time64(pthread_mutex_t *mutex,
+						    const struct timespec *to)
+{
+	return __pthread_mutex_timedlock(mutex, to);
+}
+#else
 int pthread_timedmutex_lock_interruptible_np(pthread_mutex_t *mutex,
 					     const struct timespec *to)
 {
 	return __pthread_mutex_timedlock(mutex, to);
 }
+#endif

-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.