aboutsummaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-01-28 11:58:33 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-02-11 18:22:11 +0100
commit7bb087bd7bfe3616c4c0974a3f7352b593353ea5 (patch)
treee2646dd2154bb1053f693dde21075fc85c46655a /nscd
parentlinux/aarch64: sync sys/ptrace.h with Linux 4.15 [BZ #22433] (diff)
downloadglibc-7bb087bd7bfe3616c4c0974a3f7352b593353ea5.tar.gz
glibc-7bb087bd7bfe3616c4c0974a3f7352b593353ea5.tar.bz2
glibc-7bb087bd7bfe3616c4c0974a3f7352b593353ea5.zip
nscd: don't unconditionally use PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP is Linux-only. * nscd/connections.c (RWLOCK_INITIALIZER): Define to PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP or PTHREAD_RWLOCK_INITIALIZER if that is not available. (dbs): Use RWLOCK_INITIALIZER instead of PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP.
Diffstat (limited to 'nscd')
-rw-r--r--nscd/connections.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index a2dee8ab0c..5f91985859 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -106,11 +106,17 @@ const char *const serv2str[LASTREQ] =
[GETFDNETGR] = "GETFDNETGR"
};
+#ifdef PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
+# define RWLOCK_INITIALIZER PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP
+#else
+# define RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER
+#endif
+
/* The control data structures for the services. */
struct database_dyn dbs[lastdb] =
{
[pwddb] = {
- .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+ .lock = RWLOCK_INITIALIZER,
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
.prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
.enabled = 0,
@@ -129,7 +135,7 @@ struct database_dyn dbs[lastdb] =
.mmap_used = false
},
[grpdb] = {
- .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+ .lock = RWLOCK_INITIALIZER,
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
.prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
.enabled = 0,
@@ -148,7 +154,7 @@ struct database_dyn dbs[lastdb] =
.mmap_used = false
},
[hstdb] = {
- .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+ .lock = RWLOCK_INITIALIZER,
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
.prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
.enabled = 0,
@@ -167,7 +173,7 @@ struct database_dyn dbs[lastdb] =
.mmap_used = false
},
[servdb] = {
- .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+ .lock = RWLOCK_INITIALIZER,
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
.prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
.enabled = 0,
@@ -186,7 +192,7 @@ struct database_dyn dbs[lastdb] =
.mmap_used = false
},
[netgrdb] = {
- .lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
+ .lock = RWLOCK_INITIALIZER,
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
.prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
.enabled = 0,