[PATCH] RTEMS: Make `<semaphore.h>` self-contained
Sebastian Huber <[email protected]> Fri, 3 Jul 2026 02:19:53 +0200
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
Define `clockid_t` if necessary to allow using sem_clockwait() simply by including `<semaphore.h>`. Signed-off-by: Sebastian Huber <[email protected]> --- newlib/libc/sys/rtems/include/semaphore.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/newlib/libc/sys/rtems/include/semaphore.h b/newlib/libc/sys/= rtems/include/semaphore.h index 6d756d522..d81a10c21 100644 --- a/newlib/libc/sys/rtems/include/semaphore.h +++ b/newlib/libc/sys/rtems/include/semaphore.h @@ -57,7 +57,13 @@ int sem_unlink(const char *); int sem_wait(sem_t *); =20 #if (__GNU_VISIBLE || __POSIX_VISIBLE >=3D 202405) -int sem_clockwait(sem_t * __restrict, __clockid_t, +#if !defined(__clockid_t_defined) && !defined(_CLOCKID_T_DECLARED) +typedef __clockid_t clockid_t; +#define __clockid_t_defined +#define _CLOCKID_T_DECLARED +#endif + +int sem_clockwait(sem_t * __restrict, clockid_t, const struct timespec * __restrict); #endif /* __GNU_VISIBLE || __POSIX_VISIBLE >=3D 202405 */ =20 --=20 2.51.0