You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2021/03/23 08:00:52 UTC

[qpid-proton] branch master updated: PROTON-2346: c/src/proactor/epoll-internal.h: fix build on musl (#300)

This is an automated email from the ASF dual-hosted git repository.

jdanek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/master by this push:
     new 4d3dc48  PROTON-2346: c/src/proactor/epoll-internal.h: fix build on musl (#300)
4d3dc48 is described below

commit 4d3dc48463a8f4533edff53e66b25d7c760c6142
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Tue Mar 23 09:00:46 2021 +0100

    PROTON-2346: c/src/proactor/epoll-internal.h: fix build on musl (#300)
    
    * PROTON-2346: c/src/proactor/epoll-internal.h: fix build on musl
    
    Build with epoll proactor on musl is broken since at least version 0.23.0 and
    https://github.com/apache/qpid-proton/commit/37136940e3077f25ce58c94775f48c66f666f4a8
    because musl does not define PTHREAD_MUTEX_ADAPTIVE_NP resulting in the
    following build failure:
    
    In file included from /home/giuliobenetti/autobuild/run/instance-0/output-1/build/qpid-proton-0.33.0/c/src/proactor/epoll.c:60:
    /home/giuliobenetti/autobuild/run/instance-0/output-1/build/qpid-proton-0.33.0/c/src/proactor/epoll-internal.h: In function 'pmutex_init':
    /home/giuliobenetti/autobuild/run/instance-0/output-1/build/qpid-proton-0.33.0/c/src/proactor/epoll-internal.h:319:36: error: 'PTHREAD_MUTEX_ADAPTIVE_NP' undeclared (first use in this function); did you mean 'PTHREAD_MUTEX_STALLED'?
      319 |   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
          |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~
          |                                    PTHREAD_MUTEX_STALLED
    
    Fixes:
     - http://autobuild.buildroot.org/results/6a901b9ff68b7f52cabf8273d1017025fbd93b0d
    
    Signed-off-by: Fabrice Fontaine <fo...@gmail.com>
    
    * Update c/src/proactor/epoll-internal.h with explanatory comment
    
    Co-authored-by: Fabrice Fontaine <fo...@gmail.com>
---
 c/src/proactor/epoll-internal.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/c/src/proactor/epoll-internal.h b/c/src/proactor/epoll-internal.h
index e8c9f0a..5f7ed9b 100644
--- a/c/src/proactor/epoll-internal.h
+++ b/c/src/proactor/epoll-internal.h
@@ -315,7 +315,11 @@ static inline void pmutex_init(pthread_mutex_t *pm){
   pthread_mutexattr_t attr;
 
   pthread_mutexattr_init(&attr);
+  // PROTON-2346: Some stdlibs (e.g., musl) don't implement PTHREAD_MUTEX_ADAPTIVE_NP
+  //  Since this option is a performance hint, it should be harmless to drop it when it's not available.
+#ifdef PTHREAD_MUTEX_ADAPTIVE_NP
   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
+#endif
   if (pthread_mutex_init(pm, &attr)) {
     perror("pthread failure");
     abort();

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org