GSoC Final Report

Matthew Joyce
3 min readAug 18, 2021

--

The goal of this project was to enhance Portable Operating System Interface (POSIX) compliance in the RTEMS real-time operating system by adding newly proposed standard methods which are not currently supported in the RTEMS environment. The purpose was to improve RTEMS application portability, allowing for flexibility in executing on multiple platforms and assisting in ongoing technical standard conformance.

The methods chosen have all been added to the latest draft version of the Issue 8 POSIX Standard (May 2021). Along with the implementation of each method, I added function prototypes, wrote compile tests to ensure the prototypes built successfully in RTEMS, as well as full tests in rtems/testsuites.

This final report highlights both my code which has already been merged or is still in review. All additions were my own except where explicitly noted in the files condwaitsupp.c. and condimpl.h.

sig2str(int signum, char *str)
Translates the signal number (signum) to a string stored in the location specified by str.

str2sig(const char *restrict str, int *restrict pnum)
Translate from signal name pointed to by str to its signal number and stores result in pnum.

Implementation of sig2str / str2sig:
Upstream Link: https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=2b50ec0cd205c72b17d8a905f7cfd9e7bb3a6794

Prototypes for sig2str / str2sig:

Upstream Link: https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=2b50ec0cd205c72b17d8a905f7cfd9e7bb3a6794

RTEMS Compile Test for sig2str / str2sig:

RTEMS Test for sig2str / str2sig (psxsignal09):

pthread_cond_clockwait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex, clockid_t clock_id, const struct timespec *restrict abstime)
Atomically releases mutex and causes calling thread to block on the condition variable cond. An error is returned if the absolute time specified by abstime is exceeded. Abstime is measured against the clock specified by clock_id.

Implementation for pthread_cond_clockwait:

In helper file condwaitsupp.c, I added lines 29–78, 148, and 164 –213 to implement the functionality of pthread_cond_clockwait(). The file condclockwait.c is my own.
In header file condimpl.h, I added the dummy clock CLOCK_NOT_SPECIFIED (44) and the clock_id parameter in the function prototype for wait_support() (159)

Prototypes for pthread_cond_clockwait, pthread_mutex_clocklock, pthread_rwlock_clockrdlock, and pthread_rwlock_clockwrlock:

Upstream Link: https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=4f81149937844582c6ae941acc80e623c9fcbbff

RTEMS Compile Test for pthread_cond_clockwait:

RTEMS Test for pthread_cond_clockwait (psxcond03):

pthread_mutex_clocklock(pthread_mutex_t *restrict mutex, clockid_t clock_id, const struct timespec *restrict abstime)
Locks the mutex object referenced by mutex; If the mutex is already locked, the calling thread blocks until the object becomes available or the timeout specified by abstime is met. The timeout based on the clock specified by the clock_id argument.

Implementation for pthread_mutex_clocklock:

RTEMS Test for pthread_mutex_clocklock (psx18):

RTEMS Compile Test for pthread_mutex_clocklock:

Pthread_wrlock_clockrdlock(pthread_rwlock_t *restrict rwlock, clockid_t clock_id, const struct timespec *restrict abstime): Lock a read-write lock for reading

Pthread_wrlock_clockwrlock(pthread_rwlock_t *restrict rwlock, clockid_t clock_id, const struct timespec *restrict abstime); Lock a read-write lock for writing.

Implementation of pthread_wrlock_clockrdlock():

Implementation of pthread_wrlock_clockwrlock():

RTEMS test for pthread_wrlock_clockrdlock() and pthread_wrlock_clockwrlock():

RTEMS Compile Test for pthread_rwlock_clockrdlock:

RTEMS Compile Test for pthread_rwlock_clockwrlock:

I would like to thank Eshan Dhawan for his helpful guidance and Vaibhav Gupta for his excellent blog posts as a reference source. I’d like to thank Dr. Gedare Bloom for his mentorship and for all the time he invested throughout the spring and summer. Finally, I’d like to especially thank Dr. Joel Sherrill for his many hours of expert guidance as my mentor throughout this process. Thank you for welcoming me to the RTEMS community and for being there for me throughout — from the hello world project back in March to adding some real functionality to this great project! I am very grateful for your help and I look forward to continuing this work for years to come.

--

--

Matthew Joyce

Studies Computer Science at Oregon State University. Student Developer with the RTEMS project through Google Summer of Code, 2021. Lives in Berlin, Germany.