mailing list of musl libc
 help / color / mirror / 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

mailing list of musl libc

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/musl

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 musl musl/ http://inbox.vuxu.org/musl \
		musl@inbox.vuxu.org
	public-inbox-index musl

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.musl


code repositories for the project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git