[LTP] [PATCH] open_posix: Update pthread_rwlock_rdlock 2nd assertion

Ricardo B. Marlière rbm@suse.com
Tue May 20 20:13:27 CEST 2025


On Tue May 20, 2025 at 3:10 PM -03, Ricardo B. Marlière wrote:
> From: Ricardo B. Marlière <rbm@suse.com>
>
> The pthread_rwlock_rdlock/2-*.c tests are broken because they rely on an
> old version of the POSIX standard which says:
>
>   If the Thread Execution Scheduling option is supported, and the threads
>   involved in the lock are executing with the scheduling policies
>   SCHED_FIFO or SCHED_RR, the calling thread shall not acquire the lock if
>   a writer holds the lock or if writers of higher or equal priority are
>   blocked on the lock; otherwise, the calling thread shall acquire the
>   lock.
>
> Whereas the new version says:
>
>   If the Thread Execution Scheduling option is supported, and the threads
>   that hold or are blocked on the lock are executing with the scheduling
>   policies SCHED_FIFO or SCHED_RR, the calling thread shall not acquire the
>   lock if a writer holds the lock or if the calling thread does not already
>   hold a read lock and writers of higher or equal priority are blocked on
>   the lock; otherwise, the calling thread shall acquire the lock.
>
> This behaviour is not supported by default on GNU/Linux, so add a call to
> Glibc pthread_rwlockattr_setkind_np() to set the correct lock kind as a
> prerequisite to the 2-1.c and 2-2.c tests.
>
> Link: https://austingroupbugs.net/view.php?id=1111
> Link: https://sourceware.org/bugzilla/show_bug.cgi?id=13701
> Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
> ---
>  .../interfaces/pthread_rwlock_rdlock/2-1.c          | 21 ++++++++++++++-------
>  .../interfaces/pthread_rwlock_rdlock/2-2.c          | 21 ++++++++++++++-------
>  .../interfaces/pthread_rwlock_rdlock/2-3.c          | 13 +++++++------
>  .../interfaces/pthread_rwlock_rdlock/assertions.xml | 15 ++++++++-------
>  4 files changed, 43 insertions(+), 27 deletions(-)
>

Hi Cyril,

I think this one might be worth including in the new release!

Thanks,
-	Ricardo.




More information about the ltp mailing list