Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Aug 2016 04:38:38 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 211802] pthread_mutexattr_setprioceiling fails with EINVAL if m_protocol != PTHREAD_PRIO_PROTECT
Message-ID:  <bug-211802-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211802

            Bug ID: 211802
           Summary: pthread_mutexattr_setprioceiling fails with EINVAL if
                    m_protocol != PTHREAD_PRIO_PROTECT
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: ngie@FreeBSD.org

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

-- 
You are receiving this mail because:
You are the assignee for the bug.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-211802-8>