0001-Use-mutex-types-compatible-with-musl-fixes-musl-buil.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From ba1057d74aac6c2dde5477bd6a2deea79f14962c Mon Sep 17 00:00:00 2001
  2. From: Luca Ceresoli <luca@lucaceresoli.net>
  3. Date: Sat, 12 Mar 2016 15:19:34 +0100
  4. Subject: [PATCH 1/2] Use mutex types compatible with musl (fixes musl build)
  5. PTHREAD_MUTEX_FAST_NP and PTHREAD_MUTEX_RECURSIVE_NP are not defined
  6. in the musl C library. Use values that map to the same mutex type in
  7. GNU libc and uClibc-ng.
  8. Fixes the following build errors when building with musl:
  9. ../src/pj/os_core_unix.c: In function 'init_mutex':
  10. ../src/pj/os_core_unix.c:1128:40: error: 'PTHREAD_MUTEX_FAST_NP' undeclared (first use in this function)
  11. rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_FAST_NP);
  12. ^
  13. ../src/pj/os_core_unix.c:1128:40: note: each undeclared identifier is reported only once for each function it appears in
  14. ../src/pj/os_core_unix.c:1138:40: error: 'PTHREAD_MUTEX_RECURSIVE_NP' undeclared (first use in this function)
  15. rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  16. ^
  17. Original patch:
  18. http://git.alpinelinux.org/cgit/aports/plain/main/pjproject/musl-fixes.patch
  19. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
  20. ---
  21. pjlib/src/pj/os_core_unix.c | 4 ++--
  22. 1 file changed, 2 insertions(+), 2 deletions(-)
  23. diff --git a/pjlib/src/pj/os_core_unix.c b/pjlib/src/pj/os_core_unix.c
  24. index 1c87b2f..f08ba27 100644
  25. --- a/pjlib/src/pj/os_core_unix.c
  26. +++ b/pjlib/src/pj/os_core_unix.c
  27. @@ -1125,7 +1125,7 @@ static pj_status_t init_mutex(pj_mutex_t *mutex, const char *name, int type)
  28. if (type == PJ_MUTEX_SIMPLE) {
  29. #if (defined(PJ_LINUX) && PJ_LINUX!=0) || \
  30. defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE)
  31. - rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_FAST_NP);
  32. + rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
  33. #elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \
  34. defined(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE)
  35. /* Nothing to do, default is simple */
  36. @@ -1135,7 +1135,7 @@ static pj_status_t init_mutex(pj_mutex_t *mutex, const char *name, int type)
  37. } else {
  38. #if (defined(PJ_LINUX) && PJ_LINUX!=0) || \
  39. defined(PJ_HAS_PTHREAD_MUTEXATTR_SETTYPE)
  40. - rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  41. + rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  42. #elif (defined(PJ_RTEMS) && PJ_RTEMS!=0) || \
  43. defined(PJ_PTHREAD_MUTEXATTR_T_HAS_RECURSIVE)
  44. // Phil Torre <ptorre@zetron.com>:
  45. --
  46. 1.9.1