mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] pthread_mutexattr_getprotocol() issue
@ 2020-12-07 10:09 Bogdan Nistor
  2020-12-07 22:34 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Bogdan Nistor @ 2020-12-07 10:09 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1947 bytes --]

Hi,

While using MUSL C-library 1.1.22. we observed an issue with the pthread_mutexattr_getprotocol() implementation. The same implementation is in the latest version also.
When the priority inheritance mutexes were implemented, it seems that pthread_mutexattr_getprotocol() wasn't updated to return the proper mutex protocol type.

The PI mutexes update was done in this commit: http://git.musl-libc.org/cgit/musl/commit/?id=54ca677983d47529bab8752315ac1a2b49888870

If possible, maybe the get protocol function can be updated in a future merge.

In order to fix the get protocol function, we changed it to:
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol)
{
   if (a->__attr & 8)
               *protocol = PTHREAD_PRIO_INHERIT;
   else
               *protocol = PTHREAD_PRIO_NONE;
               return 0;
}

Best Regards,
Bogdan Nistor
Software Engineer
Enterprise Business Unit
Email
Bogdan.Nistor@enea.com
Phone
+40 74 517 5795

Enea
319 Splaiul Independentei
OB403A District 6
Bucharest 060044, ROMANIA

[https://www.enea.com/globalassets/images/enea-email-signature.png]<http://www.enea.com/>



This message, including attachments, is CONFIDENTIAL. It may also be privileged or otherwise protected by law. If you received this email by mistake please let us know by reply and then delete it from your system; you should not copy it or disclose its contents to anyone. All messages sent to and from Enea may be monitored to ensure compliance with internal policies and to protect our business. Emails are not secure and cannot be guaranteed to be error free as they can be intercepted, a mended, lost or destroyed, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of email transmission. Anyone who communicates with us by email accepts these risks.

[-- Attachment #2: Type: text/html, Size: 8443 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [musl] pthread_mutexattr_getprotocol() issue
  2020-12-07 10:09 [musl] pthread_mutexattr_getprotocol() issue Bogdan Nistor
@ 2020-12-07 22:34 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2020-12-07 22:34 UTC (permalink / raw)
  To: Bogdan Nistor; +Cc: musl

On Mon, Dec 07, 2020 at 10:09:54AM +0000, Bogdan Nistor wrote:
> Hi,
> 
> While using MUSL C-library 1.1.22. we observed an issue with the pthread_mutexattr_getprotocol() implementation. The same implementation is in the latest version also.
> When the priority inheritance mutexes were implemented, it seems that pthread_mutexattr_getprotocol() wasn't updated to return the proper mutex protocol type.
> 
> The PI mutexes update was done in this commit: http://git.musl-libc.org/cgit/musl/commit/?id=54ca677983d47529bab8752315ac1a2b49888870
> 
> If possible, maybe the get protocol function can be updated in a future merge.
> 
> In order to fix the get protocol function, we changed it to:
> int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol)
> {
>    if (a->__attr & 8)
>                *protocol = PTHREAD_PRIO_INHERIT;
>    else
>                *protocol = PTHREAD_PRIO_NONE;
>                return 0;
> }

Thanks. I'm doing it just by moving the bit around since that's how
the other similar functions are implemented now. Expect the fix to be
included in the next release, which should appear in the next couple
days.

Rich

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-07 22:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07 10:09 [musl] pthread_mutexattr_getprotocol() issue Bogdan Nistor
2020-12-07 22:34 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).