RTEMS | Add sem_clockwait() support to RTEMS (!669)

Joel Sherrill (@joel) gitlab at rtems.org
Thu Sep 11 13:55:15 UTC 2025




Joel Sherrill started a new discussion on cpukit/posix/src/semclockwait.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/669#note_130761

 > +#include "config.h"
 > +#endif
 > +
 > +#include <rtems/posix/semaphoreimpl.h>
 > +#include <rtems/posix/posixapi.h>
 > +#include <rtems/score/todimpl.h>
 > +
 > +int sem_clockwait(
 > +  sem_t                 *__restrict _sem,
 > +  clockid_t             clock_id,
 > +  const struct timespec *__restrict abstime
 > +)
 > +{
 > +  
 > +  if (!_POSIX_Is_valid_clock_id( clock_id ) ){
 > +    return EINVAL;

Per POSIX this is wrong:

> If the call was unsuccessful, the state of the semaphoreshall be unchanged, and the functions shall return a value of −1 and set errnoto indicate the error.

As a general rule, POSIX methods follow that pattern unless the name starts with pthread_. But always read the specification carefully.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/669#note_130761
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250911/ea9bc080/attachment-0001.htm>


More information about the bugs mailing list