lib: posix: mutex: stubs remaining of _POSIX_THREAD_PRIO_PROTECT

Create stub functions for the remaining of
`_POSIX_THREAD_PRIO_PROTECT` option group.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
Yong Cong Sin 2024-06-17 15:18:51 +08:00 committed by Carles Cufí
commit 8e1ac56847
7 changed files with 68 additions and 14 deletions

View file

@ -85,6 +85,18 @@ static void test_mutex_common(int type, void *(*entry)(void *arg))
zassert_ok(pthread_mutex_destroy(&mutex), "Destroying mutex is failed");
}
ZTEST(mutex, test_mutex_prioceiling_stubs)
{
#ifdef CONFIG_POSIX_THREAD_PRIO_PROTECT
zassert_equal(pthread_mutex_getprioceiling(NULL, NULL), ENOSYS);
zassert_equal(pthread_mutex_setprioceiling(NULL, 0, NULL), ENOSYS);
zassert_equal(pthread_mutexattr_getprioceiling(NULL, NULL), ENOSYS);
zassert_equal(pthread_mutexattr_setprioceiling(NULL, 0), ENOSYS);
#else
ztest_test_skip();
#endif /* CONFIG_POSIX_THREAD_PRIO_PROTECT */
}
/**
* @brief Test to demonstrate PTHREAD_MUTEX_NORMAL
*

View file

@ -113,21 +113,21 @@ ZTEST(posix_headers, test_pthread_h)
zassert_not_null(pthread_key_delete);
/* zassert_not_null(pthread_mutex_consistent); */ /* not implemented */
zassert_not_null(pthread_mutex_destroy);
/* zassert_not_null(pthread_mutex_getprioceiling); */ /* not implemented */
zassert_not_null(pthread_mutex_getprioceiling);
zassert_not_null(pthread_mutex_init);
zassert_not_null(pthread_mutex_lock);
/* zassert_not_null(pthread_mutex_setprioceiling); */ /* not implemented */
zassert_not_null(pthread_mutex_setprioceiling);
zassert_not_null(pthread_mutex_timedlock);
zassert_not_null(pthread_mutex_trylock);
zassert_not_null(pthread_mutex_unlock);
zassert_not_null(pthread_mutexattr_destroy);
/* zassert_not_null(pthread_mutexattr_getprioceiling); */ /* not implemented */
zassert_not_null(pthread_mutexattr_getprioceiling);
zassert_not_null(pthread_mutexattr_getprotocol);
/* zassert_not_null(pthread_mutexattr_getpshared); */ /* not implemented */
/* zassert_not_null(pthread_mutexattr_getrobust); */ /* not implemented */
zassert_not_null(pthread_mutexattr_gettype);
zassert_not_null(pthread_mutexattr_init);
/* zassert_not_null(pthread_mutexattr_setprioceiling); */ /* not implemented */
zassert_not_null(pthread_mutexattr_setprioceiling);
zassert_not_null(pthread_mutexattr_setprotocol);
/* zassert_not_null(pthread_mutexattr_setpshared); */ /* not implemented */
/* zassert_not_null(pthread_mutexattr_setrobust); */ /* not implemented */