One of the new NetBSD tests initializes a pthread_mutexattr, then tests out priority ceiling manipulation via pthread_mutexattr_getprioceiling/pthread_mutexattr_setprioceiling . Unfortunately the test fails with EINVAL because of a check made in lib/libthr/thr_mutexattr.c: 230 int 231 _pthread_mutexattr_getprioceiling(pthread_mutexattr_t *mattr, int *prioceiling) 232 { 233 int ret = 0; 234 235 if (mattr == NULL || *mattr == NULL) 236 ret = EINVAL; 237 else if ((*mattr)->m_protocol != PTHREAD_PRIO_PROTECT) 238 ret = EINVAL; 239 else 240 *prioceiling = (*mattr)->m_ceiling; 241 242 return (ret); 243 } 244 245 int 246 _pthread_mutexattr_setprioceiling(pthread_mutexattr_t *mattr, int prioceiling) 247 { 248 int ret = 0; 249 250 if (mattr == NULL || *mattr == NULL) 251 ret = EINVAL; 252 else if ((*mattr)->m_protocol != PTHREAD_PRIO_PROTECT) 253 ret = EINVAL; 254 else 255 (*mattr)->m_ceiling = prioceiling; 256 257 return (ret); 258 } opengroup.org [1] and the pthread*(3) [2] manages don't state why m_protocol being set to PTHREAD_PRIO_PROTECT would cause the functions to return EINVAL. 1. https://www.freebsd.org/cgi/man.cgi?apropos=0&sektion=3&query=pthread_mutexattr&manpath=FreeBSD+7.0-current&format=html 2. http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_mutexattr_getprioceiling.html
A commit references this bug: Author: ngie Date: Sat Aug 13 04:45:40 UTC 2016 New revision: 304036 URL: https://svnweb.freebsd.org/changeset/base/304036 Log: Expect :mutexattr2 to fail on FreeBSD pthread_mutexattr_getprioceiling and pthread_mutexattr_setprioceiling both return EINVAL if ->m_protocol != PTHREAD_PRIO_PROTECT. The reasoning behind this decision isn't documented in neither the FreeBSD nor the OpenGroup manpages. Add printf's to add in debugging the issue PR: 211802 Sponsored by: EMC / Isilon Storage Division Changes: projects/netbsd-tests-update-12/contrib/netbsd-tests/lib/libpthread/t_mutex.c
(In reply to commit-hook from comment #1) They do not state because there is no value in adding banal and obvious things to the text. Can you explain what shall be the system action when prioceiling is requested or set on non-prio protected mutexes ?
^Triage: committed many years ago.