gentoo/net-nds/389-ds-base/files/389-ds-base-1.4.4.7-musl-and-nspr-build.patch

127 lines
4.2 KiB
Diff

From c88e97fecac4403f73242b673df195c4ae860db5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kaz=C4=B1m=20SARIKAYA?= <kazimsarikaya@sanaldiyar.com>
Date: Tue, 27 Oct 2020 06:34:47 +0000
Subject: [PATCH] build problems at alpine linux
---
ldap/servers/plugins/sync/sync_persist.c | 3 ---
ldap/servers/slapd/libglobs.c | 8 ++++++++
ldap/servers/slapd/main.c | 2 ++
ldap/servers/slapd/slapi2nspr.c | 3 +++
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ldap/servers/plugins/sync/sync_persist.c b/ldap/servers/plugins/sync/sync_persist.c
index 598c6868d..2085a4314 100644
--- a/ldap/servers/plugins/sync/sync_persist.c
+++ b/ldap/servers/plugins/sync/sync_persist.c
@@ -9,9 +9,6 @@
#include <config.h>
#endif
-#include <nspr4/prlog.h>
-#include <bits/stdint-intn.h>
-
#include "sync.h"
/* Main list of established persistent synchronizaton searches */
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 7d5374c90..e82ccaa5b 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -251,10 +251,12 @@ slapi_onoff_t init_cn_uses_dn_syntax_in_dns;
slapi_onoff_t init_global_backend_local;
slapi_onoff_t init_enable_nunc_stans;
#if defined(LINUX)
+#if defined(__GLIBC__)
slapi_int_t init_malloc_mxfast;
slapi_int_t init_malloc_trim_threshold;
slapi_int_t init_malloc_mmap_threshold;
#endif
+#endif
slapi_onoff_t init_extract_pem;
slapi_onoff_t init_ignore_vattrs;
slapi_onoff_t init_enable_upgrade_hash;
@@ -1133,6 +1135,7 @@ static struct config_get_and_set
(void **)&global_slapdFrontendConfig.cn_uses_dn_syntax_in_dns, CONFIG_ON_OFF,
(ConfigGetFunc)config_get_cn_uses_dn_syntax_in_dns, &init_cn_uses_dn_syntax_in_dns, NULL},
#if defined(LINUX)
+#if defined(__GLIBC__)
{CONFIG_MALLOC_MXFAST, config_set_malloc_mxfast,
NULL, 0,
(void **)&global_slapdFrontendConfig.malloc_mxfast,
@@ -1148,6 +1151,7 @@ static struct config_get_and_set
(void **)&global_slapdFrontendConfig.malloc_mmap_threshold,
CONFIG_INT, (ConfigGetFunc)config_get_malloc_mmap_threshold,
&init_malloc_mmap_threshold, NULL},
+#endif
#endif
{CONFIG_IGNORE_TIME_SKEW, config_set_ignore_time_skew,
NULL, 0,
@@ -1794,9 +1798,11 @@ FrontendConfig_init(void)
cfg->rootdn = slapi_ch_strdup(SLAPD_DEFAULT_DIRECTORY_MANAGER);
init_enable_nunc_stans = cfg->enable_nunc_stans = LDAP_OFF;
#if defined(LINUX)
+#if defined(__GLIBC__)
init_malloc_mxfast = cfg->malloc_mxfast = DEFAULT_MALLOC_UNSET;
init_malloc_trim_threshold = cfg->malloc_trim_threshold = DEFAULT_MALLOC_UNSET;
init_malloc_mmap_threshold = cfg->malloc_mmap_threshold = DEFAULT_MALLOC_UNSET;
+#endif
#endif
init_extract_pem = cfg->extract_pem = LDAP_ON;
/*
@@ -8548,6 +8554,7 @@ config_get_extract_pem()
}
#if defined(LINUX)
+#if defined(__GLIBC__)
int
config_set_malloc_mxfast(const char *attrname, char *value, char *errorbuf, int apply __attribute__((unused)))
{
@@ -8675,6 +8682,7 @@ config_get_malloc_mmap_threshold()
return retVal;
}
#endif
+#endif
char *
slapi_err2string(int result)
diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c
index 26d284f18..33f1fd1b1 100644
--- a/ldap/servers/slapd/main.c
+++ b/ldap/servers/slapd/main.c
@@ -529,6 +529,7 @@ main(int argc, char **argv)
daemon_ports_t ports_info = {0};
#ifdef LINUX
+#if defined(__GLIBC__)
char *m = getenv("SLAPD_MXFAST");
if (m) {
int val = atoi(m);
@@ -538,6 +539,7 @@ main(int argc, char **argv)
mallopt(M_MXFAST, val);
}
}
+#endif
#endif
/*
diff --git a/ldap/servers/slapd/slapi2nspr.c b/ldap/servers/slapd/slapi2nspr.c
index 232d1599e..30a687bec 100644
--- a/ldap/servers/slapd/slapi2nspr.c
+++ b/ldap/servers/slapd/slapi2nspr.c
@@ -189,11 +189,14 @@ slapi_new_rwlock_prio(int32_t prio_writer)
pthread_rwlockattr_t attr;
pthread_rwlockattr_init(&attr);
+
+#if defined(__GLIBC__)
if (prio_writer) {
pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
} else {
pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_READER_NP);
}
+#endif
rwlock = (pthread_rwlock_t *)slapi_ch_malloc(sizeof(pthread_rwlock_t));
if (rwlock) {