You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
2.0 KiB

  1. Index: libnetconf2-0.12-r1/CMakeLists.txt
  2. ===================================================================
  3. --- libnetconf2-0.12-r1.orig/CMakeLists.txt
  4. +++ libnetconf2-0.12-r1/CMakeLists.txt
  5. @@ -172,8 +172,10 @@ target_link_libraries(netconf2 ${CMAKE_T
  6. # check availability for some pthread functions
  7. set(CMAKE_REQUIRED_LIBRARIES pthread)
  8. +include(CheckFunctionExists)
  9. check_function_exists(pthread_spin_lock HAVE_SPINLOCK)
  10. check_function_exists(pthread_mutex_timedlock HAVE_PTHREAD_MUTEX_TIMEDLOCK)
  11. +check_function_exists(pthread_rwlockattr_setkind_np HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP)
  12. # dependencies - openssl
  13. if(ENABLE_TLS OR ENABLE_DNSSEC OR ENABLE_SSH)
  14. Index: libnetconf2-0.12-r1/src/config.h.in
  15. ===================================================================
  16. --- libnetconf2-0.12-r1.orig/src/config.h.in
  17. +++ libnetconf2-0.12-r1/src/config.h.in
  18. @@ -65,4 +65,7 @@
  19. */
  20. #define NC_PS_QUEUE_SIZE @MAX_PSPOLL_THREAD_COUNT@
  21. +/* Portability feature-check macros. */
  22. +#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP
  23. +
  24. #endif /* NC_CONFIG_H_ */
  25. Index: libnetconf2-0.12-r1/src/session_server.c
  26. ===================================================================
  27. --- libnetconf2-0.12-r1.orig/src/session_server.c
  28. +++ libnetconf2-0.12-r1/src/session_server.c
  29. @@ -520,6 +520,7 @@ nc_server_init(struct ly_ctx *ctx)
  30. errno=0;
  31. if (pthread_rwlockattr_init(&attr) == 0) {
  32. +#if defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP)
  33. if (pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) == 0) {
  34. if (pthread_rwlock_init(&server_opts.endpt_lock, &attr) != 0) {
  35. ERR("%s: failed to init rwlock(%s).", __FUNCTION__, strerror(errno));
  36. @@ -530,6 +531,7 @@ nc_server_init(struct ly_ctx *ctx)
  37. } else {
  38. ERR("%s: failed set attribute (%s).", __FUNCTION__, strerror(errno));
  39. }
  40. +#endif
  41. pthread_rwlockattr_destroy(&attr);
  42. } else {
  43. ERR("%s: failed init attribute (%s).", __FUNCTION__, strerror(errno));