aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/netconf-pnp-simulator/engine/patches/libnetconf2/03-fix-missing-pthread_rwlockattr_setkind_np.patch
blob: 65537a01783ecfdd23cfb0b7ce3831db1323cab6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/src/session_server.c b/src/session_server.c
index 636b1a2..57f2854 100644
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -560,6 +560,7 @@ nc_server_init(struct ly_ctx *ctx)
     errno=0;
 
     if (pthread_rwlockattr_init(&attr) == 0) {
+#ifdef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
         if (pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) == 0) {
             if (pthread_rwlock_init(&server_opts.endpt_lock, &attr) != 0) {
                 ERR("%s: failed to init rwlock(%s).", __FUNCTION__, strerror(errno));
@@ -570,6 +571,7 @@ nc_server_init(struct ly_ctx *ctx)
         } else {
             ERR("%s: failed set attribute (%s).", __FUNCTION__, strerror(errno));
         }
+#endif
         pthread_rwlockattr_destroy(&attr);
     } else {
         ERR("%s: failed init attribute (%s).", __FUNCTION__, strerror(errno));