|
|
b69e47 |
From 57b6e5afb6265363ede667ad450e267f8a803b9e Mon Sep 17 00:00:00 2001
|
|
|
b69e47 |
From: Mark Reynolds <mreynolds@redhat.com>
|
|
|
b69e47 |
Date: Wed, 19 Apr 2017 13:37:10 -0400
|
|
|
b69e47 |
Subject: [PATCH] Ticket 48864 - Add cgroup memory limit detection to 389-ds
|
|
|
b69e47 |
|
|
|
b69e47 |
Bug Description: Previously our memory limits only check hardware
|
|
|
b69e47 |
limits and shell resource limits. However, we may be in a container
|
|
|
b69e47 |
like docker or lxc, and unable to detect these limits. This can lead
|
|
|
b69e47 |
to crash conditions or worse, especially with autosizing
|
|
|
b69e47 |
on import we may have conditions where the server may not
|
|
|
b69e47 |
even be able to install.
|
|
|
b69e47 |
|
|
|
b69e47 |
Fix Description: Add support for cgroup memory limit detection
|
|
|
b69e47 |
so that we can properly determine our resource availability regardless
|
|
|
b69e47 |
of lxc, docker, systemd or others.
|
|
|
b69e47 |
|
|
|
b69e47 |
https://pagure.io/389-ds-base/issue/48864
|
|
|
b69e47 |
|
|
|
b69e47 |
Author: wibrown
|
|
|
b69e47 |
|
|
|
b69e47 |
Review by: mreynolds (Thanks!)
|
|
|
b69e47 |
---
|
|
|
b69e47 |
Makefile.am | 7 +-
|
|
|
b69e47 |
ldap/servers/plugins/acl/acl.c | 18 +-
|
|
|
b69e47 |
ldap/servers/plugins/acl/acl.h | 16 -
|
|
|
b69e47 |
ldap/servers/plugins/acl/aclanom.c | 8 +-
|
|
|
b69e47 |
ldap/servers/plugins/dna/dna.c | 50 ++-
|
|
|
b69e47 |
ldap/servers/plugins/posix-winsync/posix-winsync.c | 4 +-
|
|
|
b69e47 |
ldap/servers/plugins/replication/repl.h | 17 +-
|
|
|
b69e47 |
.../plugins/replication/repl5_inc_protocol.c | 2 +-
|
|
|
b69e47 |
ldap/servers/plugins/replication/repl5_init.c | 2 +-
|
|
|
b69e47 |
ldap/servers/plugins/replication/repl5_plugins.c | 2 +-
|
|
|
b69e47 |
ldap/servers/plugins/replication/repl5_replica.c | 8 +-
|
|
|
b69e47 |
ldap/servers/plugins/replication/repl5_total.c | 4 +-
|
|
|
b69e47 |
ldap/servers/plugins/replication/repl_connext.c | 20 +-
|
|
|
b69e47 |
ldap/servers/plugins/replication/repl_extop.c | 26 +-
|
|
|
b69e47 |
ldap/servers/plugins/sync/sync_persist.c | 6 +-
|
|
|
b69e47 |
ldap/servers/plugins/syntaxes/validate_task.c | 6 +-
|
|
|
b69e47 |
ldap/servers/plugins/usn/usn.c | 8 +-
|
|
|
b69e47 |
ldap/servers/slapd/abandon.c | 8 +-
|
|
|
b69e47 |
ldap/servers/slapd/add.c | 4 +-
|
|
|
b69e47 |
ldap/servers/slapd/auth.c | 18 +-
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/back-ldbm.h | 23 +-
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/cache.c | 34 +-
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/dblayer.c | 72 ++--
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/dblayer.h | 8 -
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/import-threads.c | 2 +-
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/import.c | 12 +-
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/ldbm_config.c | 32 +-
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/ldbm_delete.c | 4 +-
|
|
|
b69e47 |
.../servers/slapd/back-ldbm/ldbm_instance_config.c | 20 +-
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 4 +-
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/ldbm_search.c | 4 +-
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/misc.c | 2 +-
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/monitor.c | 10 +-
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/perfctrs.h | 2 +-
|
|
|
b69e47 |
ldap/servers/slapd/back-ldbm/start.c | 113 +++----
|
|
|
b69e47 |
ldap/servers/slapd/bind.c | 8 +-
|
|
|
b69e47 |
ldap/servers/slapd/compare.c | 2 +-
|
|
|
b69e47 |
ldap/servers/slapd/connection.c | 72 ++--
|
|
|
b69e47 |
ldap/servers/slapd/conntable.c | 8 +-
|
|
|
b69e47 |
ldap/servers/slapd/control.c | 2 +-
|
|
|
b69e47 |
ldap/servers/slapd/daemon.c | 48 +--
|
|
|
b69e47 |
ldap/servers/slapd/delete.c | 2 +-
|
|
|
b69e47 |
ldap/servers/slapd/entry.c | 2 +-
|
|
|
b69e47 |
ldap/servers/slapd/extendop.c | 4 +-
|
|
|
b69e47 |
ldap/servers/slapd/log.c | 10 +-
|
|
|
b69e47 |
ldap/servers/slapd/modify.c | 12 +-
|
|
|
b69e47 |
ldap/servers/slapd/modrdn.c | 6 +-
|
|
|
b69e47 |
ldap/servers/slapd/monitor.c | 8 +-
|
|
|
b69e47 |
ldap/servers/slapd/operation.c | 6 +-
|
|
|
b69e47 |
ldap/servers/slapd/opshared.c | 4 +-
|
|
|
b69e47 |
ldap/servers/slapd/pagedresults.c | 2 +-
|
|
|
b69e47 |
ldap/servers/slapd/psearch.c | 10 +-
|
|
|
b69e47 |
ldap/servers/slapd/result.c | 12 +-
|
|
|
b69e47 |
ldap/servers/slapd/sasl_io.c | 52 +--
|
|
|
b69e47 |
ldap/servers/slapd/saslbind.c | 2 +-
|
|
|
b69e47 |
ldap/servers/slapd/search.c | 2 +-
|
|
|
b69e47 |
ldap/servers/slapd/slap.h | 9 +-
|
|
|
b69e47 |
ldap/servers/slapd/slapi-plugin.h | 14 +-
|
|
|
b69e47 |
ldap/servers/slapd/slapi-private.h | 38 ++-
|
|
|
b69e47 |
ldap/servers/slapd/slapi_pal.c | 311 +++++++++++++++++
|
|
|
b69e47 |
ldap/servers/slapd/slapi_pal.h | 62 ++++
|
|
|
b69e47 |
ldap/servers/slapd/snmp_collator.c | 2 +-
|
|
|
b69e47 |
ldap/servers/slapd/unbind.c | 6 +-
|
|
|
b69e47 |
ldap/servers/slapd/util.c | 376 +--------------------
|
|
|
b69e47 |
test/libslapd/spal/meminfo.c | 54 +++
|
|
|
b69e47 |
test/libslapd/test.c | 2 +
|
|
|
b69e47 |
test/test_slapd.h | 5 +
|
|
|
b69e47 |
67 files changed, 870 insertions(+), 859 deletions(-)
|
|
|
b69e47 |
create mode 100644 ldap/servers/slapd/slapi_pal.c
|
|
|
b69e47 |
create mode 100644 ldap/servers/slapd/slapi_pal.h
|
|
|
b69e47 |
create mode 100644 test/libslapd/spal/meminfo.c
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/Makefile.am b/Makefile.am
|
|
|
b69e47 |
index 485a460..429a345 100644
|
|
|
b69e47 |
--- a/Makefile.am
|
|
|
b69e47 |
+++ b/Makefile.am
|
|
|
b69e47 |
@@ -481,6 +481,7 @@ dist_noinst_HEADERS = \
|
|
|
b69e47 |
ldap/servers/slapd/pw_verify.h \
|
|
|
b69e47 |
ldap/servers/slapd/secerrstrs.h \
|
|
|
b69e47 |
ldap/servers/slapd/slap.h \
|
|
|
b69e47 |
+ ldap/servers/slapd/slapi_pal.h \
|
|
|
b69e47 |
ldap/servers/slapd/slapi-plugin-compat4.h \
|
|
|
b69e47 |
ldap/servers/slapd/slapi-plugin.h \
|
|
|
b69e47 |
ldap/servers/slapd/slapi-private.h \
|
|
|
b69e47 |
@@ -850,6 +851,7 @@ pkgconfig_DATA = src/pkgconfig/dirsrv.pc \
|
|
|
b69e47 |
# header files
|
|
|
b69e47 |
#------------------------
|
|
|
b69e47 |
serverinc_HEADERS = ldap/servers/plugins/replication/repl-session-plugin.h \
|
|
|
b69e47 |
+ ldap/servers/slapd/slapi_pal.h \
|
|
|
b69e47 |
ldap/servers/slapd/slapi-plugin.h \
|
|
|
b69e47 |
ldap/servers/plugins/replication/winsync-plugin.h \
|
|
|
b69e47 |
src/nunc-stans/include/nunc-stans.h \
|
|
|
b69e47 |
@@ -1219,6 +1221,7 @@ libslapd_la_SOURCES = ldap/servers/slapd/add.c \
|
|
|
b69e47 |
ldap/servers/slapd/value.c \
|
|
|
b69e47 |
ldap/servers/slapd/valueset.c \
|
|
|
b69e47 |
ldap/servers/slapd/vattr.c \
|
|
|
b69e47 |
+ ldap/servers/slapd/slapi_pal.c \
|
|
|
b69e47 |
$(libavl_a_SOURCES)
|
|
|
b69e47 |
|
|
|
b69e47 |
libslapd_la_CPPFLAGS = $(AM_CPPFLAGS) $(DSPLUGIN_CPPFLAGS) $(SASL_INCLUDES) @db_inc@ $(SVRCORE_INCLUDES) @kerberos_inc@ @pcre_inc@
|
|
|
b69e47 |
@@ -2004,7 +2007,9 @@ test_slapd_SOURCES = test/main.c \
|
|
|
b69e47 |
test/libslapd/counters/atomic.c \
|
|
|
b69e47 |
test/libslapd/pblock/analytics.c \
|
|
|
b69e47 |
test/libslapd/pblock/v3_compat.c \
|
|
|
b69e47 |
- test/libslapd/operation/v3_compat.c
|
|
|
b69e47 |
+ test/libslapd/operation/v3_compat.c \
|
|
|
b69e47 |
+ test/libslapd/spal/meminfo.c
|
|
|
b69e47 |
+
|
|
|
b69e47 |
test_slapd_LDADD = libslapd.la
|
|
|
b69e47 |
test_slapd_LDFLAGS = $(AM_CPPFLAGS) $(CMOCKA_LINKS)
|
|
|
b69e47 |
### WARNING: Slap.h needs cert.h, which requires the -I/lib/ldaputil!!!
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/acl/acl.c b/ldap/servers/plugins/acl/acl.c
|
|
|
b69e47 |
index 48b8efc..561dd91 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/acl/acl.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/acl/acl.c
|
|
|
b69e47 |
@@ -276,7 +276,7 @@ acl_access_allowed(
|
|
|
b69e47 |
|
|
|
b69e47 |
if ( !privateBackend && (be_readonly || slapi_config_get_readonly () )){
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name,
|
|
|
b69e47 |
- "acl_access_allowed - conn=%" NSPRIu64 " op=%d (main): Deny %s on entry(%s)"
|
|
|
b69e47 |
+ "acl_access_allowed - conn=%" PRIu64 " op=%d (main): Deny %s on entry(%s)"
|
|
|
b69e47 |
": readonly backend\n",
|
|
|
b69e47 |
o_connid, o_opid,
|
|
|
b69e47 |
acl_access2str(access),
|
|
|
b69e47 |
@@ -289,7 +289,7 @@ acl_access_allowed(
|
|
|
b69e47 |
TNF_PROBE_0_DEBUG(acl_skipaccess_start,"ACL","");
|
|
|
b69e47 |
if ( acl_skip_access_check ( pb, e, access )) {
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name,
|
|
|
b69e47 |
- "acl_access_allowed - conn=%" NSPRIu64 " op=%d (main): Allow %s on entry(%s)"
|
|
|
b69e47 |
+ "acl_access_allowed - conn=%" PRIu64 " op=%d (main): Allow %s on entry(%s)"
|
|
|
b69e47 |
": root user\n",
|
|
|
b69e47 |
o_connid, o_opid,
|
|
|
b69e47 |
acl_access2str(access),
|
|
|
b69e47 |
@@ -448,7 +448,7 @@ acl_access_allowed(
|
|
|
b69e47 |
TNF_PROBE_0_DEBUG(acl_entry_first_touch_start,"ACL","");
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name,
|
|
|
b69e47 |
- "acl_access_allowed - #### conn=%" NSPRIu64 " op=%d binddn=\"%s\"\n",
|
|
|
b69e47 |
+ "acl_access_allowed - #### conn=%" PRIu64 " op=%d binddn=\"%s\"\n",
|
|
|
b69e47 |
o_connid, o_opid, clientDn);
|
|
|
b69e47 |
aclpb->aclpb_stat_total_entries++;
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -776,7 +776,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
|
|
|
b69e47 |
null_user);
|
|
|
b69e47 |
if (strcasecmp(right, access_str_moddn) == 0) {
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name, "print_access_control_summary - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to proxy (%s)"
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to proxy (%s)"
|
|
|
b69e47 |
": %s\n",
|
|
|
b69e47 |
o_connid, o_opid,
|
|
|
b69e47 |
source,
|
|
|
b69e47 |
@@ -790,7 +790,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
|
|
|
b69e47 |
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name,
|
|
|
b69e47 |
- "print_access_control_summary - conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
|
|
|
b69e47 |
+ "print_access_control_summary - conn=%" PRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
|
|
|
b69e47 |
": %s\n",
|
|
|
b69e47 |
o_connid, o_opid,
|
|
|
b69e47 |
source,
|
|
|
b69e47 |
@@ -805,7 +805,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
|
|
|
b69e47 |
proxy_user = null_user;
|
|
|
b69e47 |
if (strcasecmp(right, access_str_moddn) == 0) {
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name,
|
|
|
b69e47 |
- "print_access_control_summary - conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to proxy (%s)"
|
|
|
b69e47 |
+ "print_access_control_summary - conn=%" PRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to proxy (%s)"
|
|
|
b69e47 |
": %s\n",
|
|
|
b69e47 |
o_connid, o_opid,
|
|
|
b69e47 |
source,
|
|
|
b69e47 |
@@ -819,7 +819,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
|
|
|
b69e47 |
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name,
|
|
|
b69e47 |
- "print_access_control_summary - conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
|
|
|
b69e47 |
+ "print_access_control_summary - conn=%" PRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to proxy (%s)"
|
|
|
b69e47 |
": %s\n",
|
|
|
b69e47 |
o_connid, o_opid,
|
|
|
b69e47 |
source,
|
|
|
b69e47 |
@@ -834,7 +834,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
if (strcasecmp(right, access_str_moddn) == 0) {
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name,
|
|
|
b69e47 |
- "print_access_control_summary - conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to %s"
|
|
|
b69e47 |
+ "print_access_control_summary - conn=%" PRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) [from %s] to %s"
|
|
|
b69e47 |
": %s\n",
|
|
|
b69e47 |
o_connid, o_opid,
|
|
|
b69e47 |
source,
|
|
|
b69e47 |
@@ -848,7 +848,7 @@ print_access_control_summary( char *source, int ret_val, char *clientDn,
|
|
|
b69e47 |
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name,
|
|
|
b69e47 |
- "print_access_control_summary - conn=%" NSPRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to %s"
|
|
|
b69e47 |
+ "print_access_control_summary - conn=%" PRIu64 " op=%d (%s): %s %s on entry(%s).attr(%s) to %s"
|
|
|
b69e47 |
": %s\n",
|
|
|
b69e47 |
o_connid, o_opid,
|
|
|
b69e47 |
source,
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/acl/acl.h b/ldap/servers/plugins/acl/acl.h
|
|
|
b69e47 |
index 91f5071..8b3486c 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/acl/acl.h
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/acl/acl.h
|
|
|
b69e47 |
@@ -20,22 +20,6 @@
|
|
|
b69e47 |
#ifndef _ACL_H_
|
|
|
b69e47 |
#define _ACL_H_
|
|
|
b69e47 |
|
|
|
b69e47 |
-/* Required to get portable printf/scanf format macros */
|
|
|
b69e47 |
-#ifdef HAVE_INTTYPES_H
|
|
|
b69e47 |
-#include <inttypes.h>
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-/* NSPR uses the print macros a bit differently than ANSI C. We
|
|
|
b69e47 |
- * need to use ll for a 64-bit integer, even when a long is 64-bit.
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
-#undef PRIu64
|
|
|
b69e47 |
-#define PRIu64 "llu"
|
|
|
b69e47 |
-#undef PRI64
|
|
|
b69e47 |
-#define PRI64 "ll"
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-#else
|
|
|
b69e47 |
-#error Need to define portable format macros such as PRIu64
|
|
|
b69e47 |
-#endif /* HAVE_INTTYPES_H */
|
|
|
b69e47 |
-
|
|
|
b69e47 |
#include <stdio.h>
|
|
|
b69e47 |
#include <string.h>
|
|
|
b69e47 |
#include <sys/types.h>
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/acl/aclanom.c b/ldap/servers/plugins/acl/aclanom.c
|
|
|
b69e47 |
index 5462d87..96d0d9f 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/acl/aclanom.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/acl/aclanom.c
|
|
|
b69e47 |
@@ -523,7 +523,7 @@ aclanom_match_profile (Slapi_PBlock *pb, struct acl_pblock *aclpb, Slapi_Entry *
|
|
|
b69e47 |
aci_ndn = slapi_sdn_get_ndn (acl_anom_profile->anom_targetinfo[i].anom_target);
|
|
|
b69e47 |
if (access & SLAPI_ACL_MODDN) {
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name,
|
|
|
b69e47 |
- "aclanom_match_profile - conn=%" NSPRIu64 " op=%d: Allow access on entry(%s).attr(%s) (from %s) to anonymous: acidn=\"%s\"\n",
|
|
|
b69e47 |
+ "aclanom_match_profile - conn=%" PRIu64 " op=%d: Allow access on entry(%s).attr(%s) (from %s) to anonymous: acidn=\"%s\"\n",
|
|
|
b69e47 |
o_connid, o_opid,
|
|
|
b69e47 |
ndn,
|
|
|
b69e47 |
attr ? attr:"NULL",
|
|
|
b69e47 |
@@ -532,7 +532,7 @@ aclanom_match_profile (Slapi_PBlock *pb, struct acl_pblock *aclpb, Slapi_Entry *
|
|
|
b69e47 |
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name,
|
|
|
b69e47 |
- "aclanom_match_profile - conn=%" NSPRIu64 " op=%d: Allow access on entry(%s).attr(%s) to anonymous: acidn=\"%s\"\n",
|
|
|
b69e47 |
+ "aclanom_match_profile - conn=%" PRIu64 " op=%d: Allow access on entry(%s).attr(%s) to anonymous: acidn=\"%s\"\n",
|
|
|
b69e47 |
o_connid, o_opid,
|
|
|
b69e47 |
ndn,
|
|
|
b69e47 |
attr ? attr:"NULL",
|
|
|
b69e47 |
@@ -541,13 +541,13 @@ aclanom_match_profile (Slapi_PBlock *pb, struct acl_pblock *aclpb, Slapi_Entry *
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
if (access & SLAPI_ACL_MODDN) {
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name,
|
|
|
b69e47 |
- "aclanom_match_profile - conn=%" NSPRIu64 " op=%d: Deny access on entry(%s).attr(%s) (from %s) to anonymous\n",
|
|
|
b69e47 |
+ "aclanom_match_profile - conn=%" PRIu64 " op=%d: Deny access on entry(%s).attr(%s) (from %s) to anonymous\n",
|
|
|
b69e47 |
o_connid, o_opid,
|
|
|
b69e47 |
ndn, attr ? attr:"NULL" ,
|
|
|
b69e47 |
aclpb->aclpb_moddn_source_sdn ? slapi_sdn_get_dn(aclpb->aclpb_moddn_source_sdn) : "NULL");
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(loglevel, plugin_name,
|
|
|
b69e47 |
- "aclanom_match_profile - conn=%" NSPRIu64 " op=%d: Deny access on entry(%s).attr(%s) to anonymous\n",
|
|
|
b69e47 |
+ "aclanom_match_profile - conn=%" PRIu64 " op=%d: Deny access on entry(%s).attr(%s) to anonymous\n",
|
|
|
b69e47 |
o_connid, o_opid,
|
|
|
b69e47 |
ndn, attr ? attr:"NULL" );
|
|
|
b69e47 |
}
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
|
|
|
b69e47 |
index 34011b9..a085941 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/dna/dna.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/dna/dna.c
|
|
|
b69e47 |
@@ -23,14 +23,6 @@
|
|
|
b69e47 |
#include "slapi-private.h"
|
|
|
b69e47 |
#include "prclist.h"
|
|
|
b69e47 |
|
|
|
b69e47 |
-/* Required to get portable printf/scanf format macros */
|
|
|
b69e47 |
-#ifdef HAVE_INTTYPES_H
|
|
|
b69e47 |
-#include <inttypes.h>
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-#else
|
|
|
b69e47 |
-#error Need to define portable format macros such as PRIu64
|
|
|
b69e47 |
-#endif /* HAVE_INTTYPES_H */
|
|
|
b69e47 |
-
|
|
|
b69e47 |
#include <sys/stat.h>
|
|
|
b69e47 |
|
|
|
b69e47 |
#define DNA_PLUGIN_SUBSYSTEM "dna-plugin"
|
|
|
b69e47 |
@@ -997,7 +989,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
|
|
|
b69e47 |
- "dna_parse_config_entry - %s [%" NSPRIu64 "]\n", DNA_NEXTVAL,
|
|
|
b69e47 |
+ "dna_parse_config_entry - %s [%" PRIu64 "]\n", DNA_NEXTVAL,
|
|
|
b69e47 |
entry->nextval);
|
|
|
b69e47 |
|
|
|
b69e47 |
value = slapi_entry_attr_get_charptr(e, DNA_PREFIX);
|
|
|
b69e47 |
@@ -1026,7 +1018,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
|
|
|
b69e47 |
- "dna_parse_config_entry - %s [%" NSPRIu64 "]\n", DNA_INTERVAL, entry->interval);
|
|
|
b69e47 |
+ "dna_parse_config_entry - %s [%" PRIu64 "]\n", DNA_INTERVAL, entry->interval);
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
|
|
|
b69e47 |
value = slapi_entry_attr_get_charptr(e, DNA_GENERATE);
|
|
|
b69e47 |
@@ -1126,7 +1118,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
|
|
|
b69e47 |
- "dna_parse_config_entry - %s [%" NSPRIu64 "]\n", DNA_MAXVAL,
|
|
|
b69e47 |
+ "dna_parse_config_entry - %s [%" PRIu64 "]\n", DNA_MAXVAL,
|
|
|
b69e47 |
entry->maxval);
|
|
|
b69e47 |
|
|
|
b69e47 |
/* get the global bind dn and password(if any) */
|
|
|
b69e47 |
@@ -1256,7 +1248,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
|
|
|
b69e47 |
- "dna_parse_config_entry - %s [%" NSPRIu64 "]\n", DNA_THRESHOLD,
|
|
|
b69e47 |
+ "dna_parse_config_entry - %s [%" PRIu64 "]\n", DNA_THRESHOLD,
|
|
|
b69e47 |
entry->threshold);
|
|
|
b69e47 |
|
|
|
b69e47 |
value = slapi_entry_attr_get_charptr(e, DNA_RANGE_REQUEST_TIMEOUT);
|
|
|
b69e47 |
@@ -1268,7 +1260,7 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry * e, int apply)
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONFIG, DNA_PLUGIN_SUBSYSTEM,
|
|
|
b69e47 |
- "dna_parse_config_entry - %s [%" NSPRIu64 "]\n", DNA_RANGE_REQUEST_TIMEOUT,
|
|
|
b69e47 |
+ "dna_parse_config_entry - %s [%" PRIu64 "]\n", DNA_RANGE_REQUEST_TIMEOUT,
|
|
|
b69e47 |
entry->timeout);
|
|
|
b69e47 |
|
|
|
b69e47 |
value = slapi_entry_attr_get_charptr(e, DNA_NEXT_RANGE);
|
|
|
b69e47 |
@@ -2307,7 +2299,7 @@ dna_first_free_value(struct configEntry *config_entry,
|
|
|
b69e47 |
return LDAP_OPERATIONS_ERROR;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
- filter = slapi_ch_smprintf("(&%s(&(%s>=%" NSPRIu64 ")(%s<=%" NSPRIu64 ")))",
|
|
|
b69e47 |
+ filter = slapi_ch_smprintf("(&%s(&(%s>=%" PRIu64 ")(%s<=%" PRIu64 ")))",
|
|
|
b69e47 |
config_entry->filter,
|
|
|
b69e47 |
config_entry->types[0], tmpval,
|
|
|
b69e47 |
config_entry->types[0], config_entry->maxval);
|
|
|
b69e47 |
@@ -2497,7 +2489,7 @@ static int dna_get_next_value(struct configEntry *config_entry,
|
|
|
b69e47 |
if ((config_entry->maxval == -1) ||
|
|
|
b69e47 |
(nextval <= (config_entry->maxval + config_entry->interval))) {
|
|
|
b69e47 |
/* try to set the new next value in the config entry */
|
|
|
b69e47 |
- snprintf(next_value, sizeof(next_value),"%" NSPRIu64, nextval);
|
|
|
b69e47 |
+ snprintf(next_value, sizeof(next_value),"%" PRIu64, nextval);
|
|
|
b69e47 |
|
|
|
b69e47 |
/* set up our replace modify operation */
|
|
|
b69e47 |
replace_val[0] = next_value;
|
|
|
b69e47 |
@@ -2524,7 +2516,7 @@ static int dna_get_next_value(struct configEntry *config_entry,
|
|
|
b69e47 |
|
|
|
b69e47 |
if (LDAP_SUCCESS == ret) {
|
|
|
b69e47 |
slapi_ch_free_string(next_value_ret);
|
|
|
b69e47 |
- *next_value_ret = slapi_ch_smprintf("%" NSPRIu64, setval);
|
|
|
b69e47 |
+ *next_value_ret = slapi_ch_smprintf("%" PRIu64, setval);
|
|
|
b69e47 |
if (NULL == *next_value_ret) {
|
|
|
b69e47 |
ret = LDAP_OPERATIONS_ERROR;
|
|
|
b69e47 |
goto done;
|
|
|
b69e47 |
@@ -2609,7 +2601,7 @@ dna_update_shared_config(struct configEntry *config_entry)
|
|
|
b69e47 |
|
|
|
b69e47 |
/* We store the number of remaining assigned values
|
|
|
b69e47 |
* in the shared config entry. */
|
|
|
b69e47 |
- snprintf(remaining_vals, sizeof(remaining_vals),"%" NSPRIu64,
|
|
|
b69e47 |
+ snprintf(remaining_vals, sizeof(remaining_vals),"%" PRIu64,
|
|
|
b69e47 |
config_entry->remaining);
|
|
|
b69e47 |
|
|
|
b69e47 |
/* set up our replace modify operation */
|
|
|
b69e47 |
@@ -2709,7 +2701,7 @@ dna_update_next_range(struct configEntry *config_entry,
|
|
|
b69e47 |
int ret = 0;
|
|
|
b69e47 |
|
|
|
b69e47 |
/* Try to set the new next range in the config entry. */
|
|
|
b69e47 |
- snprintf(nextrange_value, sizeof(nextrange_value), "%" NSPRIu64 "-%" NSPRIu64,
|
|
|
b69e47 |
+ snprintf(nextrange_value, sizeof(nextrange_value), "%" PRIu64 "-%" PRIu64,
|
|
|
b69e47 |
lower, upper);
|
|
|
b69e47 |
|
|
|
b69e47 |
/* set up our replace modify operation */
|
|
|
b69e47 |
@@ -2778,8 +2770,8 @@ dna_activate_next_range(struct configEntry *config_entry)
|
|
|
b69e47 |
int ret = 0;
|
|
|
b69e47 |
|
|
|
b69e47 |
/* Setup the modify operation for the config entry */
|
|
|
b69e47 |
- snprintf(maxval_val, sizeof(maxval_val),"%" NSPRIu64, config_entry->next_range_upper);
|
|
|
b69e47 |
- snprintf(nextval_val, sizeof(nextval_val),"%" NSPRIu64, config_entry->next_range_lower);
|
|
|
b69e47 |
+ snprintf(maxval_val, sizeof(maxval_val),"%" PRIu64, config_entry->next_range_upper);
|
|
|
b69e47 |
+ snprintf(nextval_val, sizeof(nextval_val),"%" PRIu64, config_entry->next_range_lower);
|
|
|
b69e47 |
|
|
|
b69e47 |
maxval_vals[0] = maxval_val;
|
|
|
b69e47 |
maxval_vals[1] = 0;
|
|
|
b69e47 |
@@ -3319,7 +3311,7 @@ dna_create_valcheck_filter(struct configEntry *config_entry, PRUint64 value, cha
|
|
|
b69e47 |
* - the string length of the filter in the config
|
|
|
b69e47 |
* - the string length sum of all configured types
|
|
|
b69e47 |
* - 23 bytes for each type (20 for the max string
|
|
|
b69e47 |
- * representation of a NSPRIu64, 3 for "(=)"
|
|
|
b69e47 |
+ * representation of a PRIu64, 3 for "(=)"
|
|
|
b69e47 |
* - 3 bytes for the beginning and end of the filter - "(&" and ")"
|
|
|
b69e47 |
* - 3 bytes to OR together multiple types (if present) - "(|" and ")"
|
|
|
b69e47 |
* - the string length of the prefix (if one is configured) for each type
|
|
|
b69e47 |
@@ -3556,8 +3548,8 @@ _dna_pre_op_add(Slapi_PBlock *pb, Slapi_Entry *e, char **errstr)
|
|
|
b69e47 |
(config_entry->remaining <= config_entry->threshold)) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_PLUGIN, DNA_PLUGIN_SUBSYSTEM,
|
|
|
b69e47 |
"_dna_pre_op_add - Passed threshold of %"
|
|
|
b69e47 |
- NSPRIu64 " remaining values "
|
|
|
b69e47 |
- "for range %s. (%" NSPRIu64 " values remain)\n",
|
|
|
b69e47 |
+ PRIu64 " remaining values "
|
|
|
b69e47 |
+ "for range %s. (%" PRIu64 " values remain)\n",
|
|
|
b69e47 |
config_entry->threshold, config_entry->dn,
|
|
|
b69e47 |
config_entry->remaining);
|
|
|
b69e47 |
dna_fix_maxval(config_entry, 0);
|
|
|
b69e47 |
@@ -3828,8 +3820,8 @@ _dna_pre_op_modify(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Mods *smods, char **e
|
|
|
b69e47 |
(config_entry->remaining <= config_entry->threshold)) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, DNA_PLUGIN_SUBSYSTEM,
|
|
|
b69e47 |
"_dna_pre_op_modify - Passed threshold of %"
|
|
|
b69e47 |
- NSPRIu64 " remaining values "
|
|
|
b69e47 |
- "for range %s. (%" NSPRIu64 " values remain)\n",
|
|
|
b69e47 |
+ PRIu64 " remaining values "
|
|
|
b69e47 |
+ "for range %s. (%" PRIu64 " values remain)\n",
|
|
|
b69e47 |
config_entry->threshold, config_entry->dn,
|
|
|
b69e47 |
config_entry->remaining);
|
|
|
b69e47 |
dna_fix_maxval(config_entry, 0);
|
|
|
b69e47 |
@@ -4411,8 +4403,8 @@ static int dna_extend_exop(Slapi_PBlock *pb)
|
|
|
b69e47 |
char highstr[16];
|
|
|
b69e47 |
|
|
|
b69e47 |
/* Create the exop response */
|
|
|
b69e47 |
- snprintf(lowstr, sizeof(lowstr), "%" NSPRIu64, lower);
|
|
|
b69e47 |
- snprintf(highstr, sizeof(highstr), "%" NSPRIu64, upper);
|
|
|
b69e47 |
+ snprintf(lowstr, sizeof(lowstr), "%" PRIu64, lower);
|
|
|
b69e47 |
+ snprintf(highstr, sizeof(highstr), "%" PRIu64, upper);
|
|
|
b69e47 |
range_low.bv_val = lowstr;
|
|
|
b69e47 |
range_low.bv_len = strlen(range_low.bv_val);
|
|
|
b69e47 |
range_high.bv_val = highstr;
|
|
|
b69e47 |
@@ -4445,7 +4437,7 @@ static int dna_extend_exop(Slapi_PBlock *pb)
|
|
|
b69e47 |
ber_bvfree(respdata);
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_PLUGIN, DNA_PLUGIN_SUBSYSTEM,
|
|
|
b69e47 |
- "dna_extend_exop - Released range %" NSPRIu64 "-%" NSPRIu64 ".\n",
|
|
|
b69e47 |
+ "dna_extend_exop - Released range %" PRIu64 "-%" PRIu64 ".\n",
|
|
|
b69e47 |
lower, upper);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -4588,7 +4580,7 @@ dna_release_range(char *range_dn, PRUint64 *lower, PRUint64 *upper)
|
|
|
b69e47 |
*lower = *upper - release + 1;
|
|
|
b69e47 |
|
|
|
b69e47 |
/* try to set the new maxval in the config entry */
|
|
|
b69e47 |
- snprintf(max_value, sizeof(max_value),"%" NSPRIu64, (*lower - 1));
|
|
|
b69e47 |
+ snprintf(max_value, sizeof(max_value),"%" PRIu64, (*lower - 1));
|
|
|
b69e47 |
|
|
|
b69e47 |
/* set up our replace modify operation */
|
|
|
b69e47 |
replace_val[0] = max_value;
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/posix-winsync/posix-winsync.c b/ldap/servers/plugins/posix-winsync/posix-winsync.c
|
|
|
b69e47 |
index 63444e5..21e4ad0 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/posix-winsync/posix-winsync.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/posix-winsync/posix-winsync.c
|
|
|
b69e47 |
@@ -270,7 +270,7 @@ sync_acct_disable(void *cbdata, /* the usual domain config data */
|
|
|
b69e47 |
if (update_entry) {
|
|
|
b69e47 |
slapi_entry_attr_set_ulong(update_entry, "userAccountControl", adval);
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
|
|
|
b69e47 |
- "<-- sync_acct_disable - %s AD account [%s] - new value is [%" NSPRIu64 "]\n",
|
|
|
b69e47 |
+ "<-- sync_acct_disable - %s AD account [%s] - new value is [%" PRIu64 "]\n",
|
|
|
b69e47 |
(ds_is_enabled) ? "enabled" : "disabled", slapi_entry_get_dn_const(update_entry), adval);
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
/* iterate through the mods - if there is already a mod
|
|
|
b69e47 |
@@ -326,7 +326,7 @@ sync_acct_disable(void *cbdata, /* the usual domain config data */
|
|
|
b69e47 |
mod_bval->bv_len = strlen(acctvalstr);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_PLUGIN, posix_winsync_plugin_name,
|
|
|
b69e47 |
- "<-- sync_acct_disable - %s AD account [%s] - new value is [%" NSPRIu64 "]\n",
|
|
|
b69e47 |
+ "<-- sync_acct_disable - %s AD account [%s] - new value is [%" PRIu64 "]\n",
|
|
|
b69e47 |
(ds_is_enabled) ? "enabled" : "disabled", slapi_entry_get_dn_const(ad_entry), adval);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
}
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/replication/repl.h b/ldap/servers/plugins/replication/repl.h
|
|
|
b69e47 |
index 89ad481..9460ca9 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/replication/repl.h
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/replication/repl.h
|
|
|
b69e47 |
@@ -15,21 +15,8 @@
|
|
|
b69e47 |
#ifndef _REPL_H_
|
|
|
b69e47 |
#define _REPL_H_
|
|
|
b69e47 |
|
|
|
b69e47 |
-/* Required to get portable printf/scanf format macros */
|
|
|
b69e47 |
-#ifdef HAVE_INTTYPES_H
|
|
|
b69e47 |
-#include <inttypes.h>
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-/* NSPR uses the print macros a bit differently than ANSI C. We
|
|
|
b69e47 |
- * need to use ll for a 64-bit integer, even when a long is 64-bit.
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
-#undef PRIu64
|
|
|
b69e47 |
-#define PRIu64 "llu"
|
|
|
b69e47 |
-#undef PRI64
|
|
|
b69e47 |
-#define PRI64 "ll"
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-#else
|
|
|
b69e47 |
-#error Need to define portable format macros such as PRIu64
|
|
|
b69e47 |
-#endif /* HAVE_INTTYPES_H */
|
|
|
b69e47 |
+/* Provides our int types and platform specific requirements. */
|
|
|
b69e47 |
+#include <slapi_pal.h>
|
|
|
b69e47 |
|
|
|
b69e47 |
#include <limits.h>
|
|
|
b69e47 |
#include <time.h>
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c b/ldap/servers/plugins/replication/repl5_inc_protocol.c
|
|
|
b69e47 |
index a5ae885..36c279e 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/replication/repl5_inc_protocol.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c
|
|
|
b69e47 |
@@ -2104,7 +2104,7 @@ repl5_inc_stop(Private_Repl_Protocol *prp)
|
|
|
b69e47 |
/* Isn't listening. Do something drastic. */
|
|
|
b69e47 |
return_value = -1;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
- "repl5_inc_stop - %s: Protocol does not stop after %" NSPRIu64 " seconds\n",
|
|
|
b69e47 |
+ "repl5_inc_stop - %s: Protocol does not stop after %" PRIu64 " seconds\n",
|
|
|
b69e47 |
agmt_get_long_name(prp->agmt), timeout);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
else
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/replication/repl5_init.c b/ldap/servers/plugins/replication/repl5_init.c
|
|
|
b69e47 |
index 9549dcf..edffb84 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/replication/repl5_init.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/replication/repl5_init.c
|
|
|
b69e47 |
@@ -208,7 +208,7 @@ get_repl_session_id (Slapi_PBlock *pb, char *idstr, CSN **csn)
|
|
|
b69e47 |
/* Avoid "Connection is NULL and hence cannot access SLAPI_CONN_ID" */
|
|
|
b69e47 |
if (opid) {
|
|
|
b69e47 |
slapi_pblock_get (pb, SLAPI_CONN_ID, &connid);
|
|
|
b69e47 |
- snprintf (idstr, REPL_SESSION_ID_SIZE, "conn=%" NSPRIu64 " op=%d",
|
|
|
b69e47 |
+ snprintf (idstr, REPL_SESSION_ID_SIZE, "conn=%" PRIu64 " op=%d",
|
|
|
b69e47 |
connid, opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/replication/repl5_plugins.c b/ldap/servers/plugins/replication/repl5_plugins.c
|
|
|
b69e47 |
index 357c093..ebcc230 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/replication/repl5_plugins.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/replication/repl5_plugins.c
|
|
|
b69e47 |
@@ -1335,7 +1335,7 @@ process_postop (Slapi_PBlock *pb)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name,
|
|
|
b69e47 |
"process_postop - Failed to apply update (%s) error (%d). "
|
|
|
b69e47 |
- "Aborting replication session(conn=%" NSPRIu64 " op=%d)\n",
|
|
|
b69e47 |
+ "Aborting replication session(conn=%" PRIu64 " op=%d)\n",
|
|
|
b69e47 |
csn_as_string(opcsn, PR_FALSE, csn_str), retval,
|
|
|
b69e47 |
connid, opid);
|
|
|
b69e47 |
/*
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
|
|
|
b69e47 |
index 5718a98..a106f8b 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/replication/repl5_replica.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/replication/repl5_replica.c
|
|
|
b69e47 |
@@ -596,7 +596,7 @@ replica_get_exclusive_access(Replica *r, PRBool *isInc, PRUint64 connid, int opi
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"replica_get_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
"Replica in use locking_purl=%s\n",
|
|
|
b69e47 |
connid, opid,
|
|
|
b69e47 |
slapi_sdn_get_dn(r->repl_root),
|
|
|
b69e47 |
@@ -620,7 +620,7 @@ replica_get_exclusive_access(Replica *r, PRBool *isInc, PRUint64 connid, int opi
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"replica_get_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": Acquired replica\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": Acquired replica\n",
|
|
|
b69e47 |
connid, opid,
|
|
|
b69e47 |
slapi_sdn_get_dn(r->repl_root));
|
|
|
b69e47 |
r->repl_state_flags |= REPLICA_IN_USE;
|
|
|
b69e47 |
@@ -664,13 +664,13 @@ replica_relinquish_exclusive_access(Replica *r, PRUint64 connid, int opid)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"replica_relinquish_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
"Replica not in use\n",
|
|
|
b69e47 |
connid, opid, slapi_sdn_get_dn(r->repl_root));
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"replica_relinquish_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
"Released replica held by locking_purl=%s\n",
|
|
|
b69e47 |
connid, opid,
|
|
|
b69e47 |
slapi_sdn_get_dn(r->repl_root), r->locking_purl);
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/replication/repl5_total.c b/ldap/servers/plugins/replication/repl5_total.c
|
|
|
b69e47 |
index af570a8..064a099 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/replication/repl5_total.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/replication/repl5_total.c
|
|
|
b69e47 |
@@ -853,7 +853,7 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock *pb)
|
|
|
b69e47 |
const char *dn = slapi_entry_get_dn_const(e);
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_NSDS50ReplicationEntry - "
|
|
|
b69e47 |
- "Error %d: could not import entry dn %s for total update operation conn=%" NSPRIu64 " op=%d\n",
|
|
|
b69e47 |
+ "Error %d: could not import entry dn %s for total update operation conn=%" PRIu64 " op=%d\n",
|
|
|
b69e47 |
rc, dn, connid, opid);
|
|
|
b69e47 |
rc = -1;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -864,7 +864,7 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock *pb)
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_NSDS50ReplicationEntry - "
|
|
|
b69e47 |
"Error %d: could not decode the total update extop "
|
|
|
b69e47 |
- "for total update operation conn=%" NSPRIu64 " op=%d\n",
|
|
|
b69e47 |
+ "for total update operation conn=%" PRIu64 " op=%d\n",
|
|
|
b69e47 |
rc, connid, opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/replication/repl_connext.c b/ldap/servers/plugins/replication/repl_connext.c
|
|
|
b69e47 |
index 29dc2a7..ba0fa15 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/replication/repl_connext.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/replication/repl_connext.c
|
|
|
b69e47 |
@@ -84,7 +84,7 @@ void consumer_connection_extension_destructor (void *ext, void *object, void *pa
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"consumer_connection_extension_destructor - "
|
|
|
b69e47 |
"Aborting total update in progress for replicated "
|
|
|
b69e47 |
- "area %s connid=%" NSPRIu64 "\n", slapi_sdn_get_dn(repl_root_sdn), connid);
|
|
|
b69e47 |
+ "area %s connid=%" PRIu64 "\n", slapi_sdn_get_dn(repl_root_sdn), connid);
|
|
|
b69e47 |
slapi_stop_bulk_import(pb);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
else
|
|
|
b69e47 |
@@ -156,7 +156,7 @@ consumer_connection_extension_acquire_exclusive_access(void* conn, PRUint64 conn
|
|
|
b69e47 |
ret = connext;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"consumer_connection_extension_acquire_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d Acquired consumer connection extension\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d Acquired consumer connection extension\n",
|
|
|
b69e47 |
connid, opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
else if (opid == connext->in_use_opid)
|
|
|
b69e47 |
@@ -164,14 +164,14 @@ consumer_connection_extension_acquire_exclusive_access(void* conn, PRUint64 conn
|
|
|
b69e47 |
ret = connext;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"consumer_connection_extension_acquire_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d Reacquired consumer connection extension\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d Reacquired consumer connection extension\n",
|
|
|
b69e47 |
connid, opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
else
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"consumer_connection_extension_acquire_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d Could not acquire consumer connection extension; it is in use by op=%d\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d Could not acquire consumer connection extension; it is in use by op=%d\n",
|
|
|
b69e47 |
connid, opid, connext->in_use_opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -182,7 +182,7 @@ consumer_connection_extension_acquire_exclusive_access(void* conn, PRUint64 conn
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"consumer_connection_extension_acquire_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d Could not acquire consumer extension, it is NULL!\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d Could not acquire consumer extension, it is NULL!\n",
|
|
|
b69e47 |
connid, opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -221,7 +221,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"consumer_connection_extension_relinquish_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d Consumer connection extension is not in use\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d Consumer connection extension is not in use\n",
|
|
|
b69e47 |
connid, opid);
|
|
|
b69e47 |
ret = 2;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -230,7 +230,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
|
|
|
b69e47 |
/* step 4, relinquish it (normal) */
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"consumer_connection_extension_relinquish_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d Relinquishing consumer connection extension\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d Relinquishing consumer connection extension\n",
|
|
|
b69e47 |
connid, opid);
|
|
|
b69e47 |
connext->in_use_opid = -1;
|
|
|
b69e47 |
ret = 1;
|
|
|
b69e47 |
@@ -240,7 +240,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
|
|
|
b69e47 |
/* step 4, relinquish it (forced) */
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"consumer_connection_extension_relinquish_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d Forced to relinquish consumer connection extension held by op=%d\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d Forced to relinquish consumer connection extension held by op=%d\n",
|
|
|
b69e47 |
connid, opid, connext->in_use_opid);
|
|
|
b69e47 |
connext->in_use_opid = -1;
|
|
|
b69e47 |
ret = 1;
|
|
|
b69e47 |
@@ -249,7 +249,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"consumer_connection_extension_relinquish_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d Not relinquishing consumer connection extension, it is held by op=%d!\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d Not relinquishing consumer connection extension, it is held by op=%d!\n",
|
|
|
b69e47 |
connid, opid, connext->in_use_opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -260,7 +260,7 @@ consumer_connection_extension_relinquish_exclusive_access(void* conn, PRUint64 c
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"consumer_connection_extension_relinquish_exclusive_access - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d Could not relinquish consumer extension, it is NULL!\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d Could not relinquish consumer extension, it is NULL!\n",
|
|
|
b69e47 |
connid, opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
|
|
|
b69e47 |
index 80580f9..412caec 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/replication/repl_extop.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/replication/repl_extop.c
|
|
|
b69e47 |
@@ -668,7 +668,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
|
|
|
b69e47 |
connext->repl_protocol_version = REPL_PROTOCOL_50_INCREMENTAL;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_StartNSDS50ReplicationRequest - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin incremental protocol\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": Begin incremental protocol\n",
|
|
|
b69e47 |
connid, opid, repl_root);
|
|
|
b69e47 |
isInc = PR_TRUE;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -695,7 +695,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
|
|
|
b69e47 |
}
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_StartNSDS50ReplicationRequest - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin total protocol\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": Begin total protocol\n",
|
|
|
b69e47 |
connid, opid, repl_root);
|
|
|
b69e47 |
isInc = PR_FALSE;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -705,7 +705,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
|
|
|
b69e47 |
connext->repl_protocol_version = REPL_PROTOCOL_50_INCREMENTAL;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_StartNSDS50ReplicationRequest - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin 7.1 incremental protocol\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": Begin 7.1 incremental protocol\n",
|
|
|
b69e47 |
connid, opid, repl_root);
|
|
|
b69e47 |
isInc = PR_TRUE;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -718,7 +718,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
|
|
|
b69e47 |
}
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_StartNSDS50ReplicationRequest - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": Begin 7.1 total protocol\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": Begin 7.1 total protocol\n",
|
|
|
b69e47 |
connid, opid, repl_root);
|
|
|
b69e47 |
isInc = PR_FALSE;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -741,7 +741,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_StartNSDS50ReplicationRequest - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d replica=\"%s\": "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d replica=\"%s\": "
|
|
|
b69e47 |
"Replica is being configured: try again later\n",
|
|
|
b69e47 |
connid, opid, repl_root);
|
|
|
b69e47 |
response = NSDS50_REPL_REPLICA_BUSY;
|
|
|
b69e47 |
@@ -814,7 +814,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_StartNSDS50ReplicationRequest - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
"Excessive clock skew from supplier RUV\n",
|
|
|
b69e47 |
connid, opid, repl_root);
|
|
|
b69e47 |
response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
|
|
|
b69e47 |
@@ -852,7 +852,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
|
|
|
b69e47 |
if (check_replica_id_uniqueness(replica, supplier_ruv) != 0){
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_StartNSDS50ReplicationRequest - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
"Replica has same replicaID %d as supplier\n",
|
|
|
b69e47 |
connid, opid, repl_root, replica_get_rid(replica));
|
|
|
b69e47 |
response = NSDS50_REPL_REPLICAID_ERROR;
|
|
|
b69e47 |
@@ -865,7 +865,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
|
|
|
b69e47 |
* the session's conn id and op id to identify the the supplier.
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
/* junkrc = ruv_get_first_id_and_purl(supplier_ruv, &junkrid, &locking_purl); */
|
|
|
b69e47 |
- snprintf(locking_session, sizeof(locking_session), "conn=%" NSPRIu64 " id=%d",
|
|
|
b69e47 |
+ snprintf(locking_session, sizeof(locking_session), "conn=%" PRIu64 " id=%d",
|
|
|
b69e47 |
connid, opid);
|
|
|
b69e47 |
locking_purl = &locking_session[0];
|
|
|
b69e47 |
if (replica_get_exclusive_access(replica, &isInc, connid, opid,
|
|
|
b69e47 |
@@ -892,7 +892,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
|
|
|
b69e47 |
int max = 480 * 5;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_StartNSDS50ReplicationRequest - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
"374 - Starting sleep: connext->repl_protocol_version == %d\n",
|
|
|
b69e47 |
connid, opid, repl_root, connext->repl_protocol_version);
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -902,7 +902,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_StartNSDS50ReplicationRequest - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
"374 - Finished sleep: connext->repl_protocol_version == %d\n",
|
|
|
b69e47 |
connid, opid, repl_root, connext->repl_protocol_version);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -997,7 +997,7 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
|
|
|
b69e47 |
response = NSDS50_REPL_INTERNAL_ERROR;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_StartNSDS50ReplicationRequest - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
"Unexpected update protocol received: %d. "
|
|
|
b69e47 |
"Expected incremental or total.\n",
|
|
|
b69e47 |
connid, opid, repl_root, connext->repl_protocol_version);
|
|
|
b69e47 |
@@ -1039,7 +1039,7 @@ send_response:
|
|
|
b69e47 |
slapi_log_err (resp_log_level,
|
|
|
b69e47 |
repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_StartNSDS50ReplicationRequest - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d replica=\"%s\": "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d replica=\"%s\": "
|
|
|
b69e47 |
"Unable to acquire replica: error: %s%s\n",
|
|
|
b69e47 |
connid, opid,
|
|
|
b69e47 |
(replica ? slapi_sdn_get_dn(replica_get_root(replica)) : "unknown"),
|
|
|
b69e47 |
@@ -1092,7 +1092,7 @@ send_response:
|
|
|
b69e47 |
slapi_pblock_set(pb, SLAPI_EXT_OP_RET_VALUE, resp_bval);
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name,
|
|
|
b69e47 |
"multimaster_extop_StartNSDS50ReplicationRequest - "
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d repl=\"%s\": "
|
|
|
b69e47 |
"%s: response=%d rc=%d\n",
|
|
|
b69e47 |
connid, opid, repl_root,
|
|
|
b69e47 |
is90 ? "StartNSDS90ReplicationRequest" :
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/sync/sync_persist.c b/ldap/servers/plugins/sync/sync_persist.c
|
|
|
b69e47 |
index 667a529..bd856cb 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/sync/sync_persist.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/sync/sync_persist.c
|
|
|
b69e47 |
@@ -548,14 +548,14 @@ sync_send_results( void *arg )
|
|
|
b69e47 |
slapi_pblock_get(req->req_pblock, SLAPI_CONNECTION, &conn;;
|
|
|
b69e47 |
if (NULL == conn) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, SYNC_PLUGIN_SUBSYSTEM,
|
|
|
b69e47 |
- "sync_send_results - conn=%" NSPRIu64 " op=%d Null connection - aborted\n",
|
|
|
b69e47 |
+ "sync_send_results - conn=%" PRIu64 " op=%d Null connection - aborted\n",
|
|
|
b69e47 |
connid, opid);
|
|
|
b69e47 |
goto done;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
conn_acq_flag = sync_acquire_connection (conn);
|
|
|
b69e47 |
if (conn_acq_flag) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, SYNC_PLUGIN_SUBSYSTEM,
|
|
|
b69e47 |
- "sync_send_results - conn=%" NSPRIu64 " op=%d Could not acquire the connection - aborted\n",
|
|
|
b69e47 |
+ "sync_send_results - conn=%" PRIu64 " op=%d Could not acquire the connection - aborted\n",
|
|
|
b69e47 |
connid, opid);
|
|
|
b69e47 |
goto done;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -566,7 +566,7 @@ sync_send_results( void *arg )
|
|
|
b69e47 |
/* Check for an abandoned operation */
|
|
|
b69e47 |
if ( op == NULL || slapi_is_operation_abandoned( op ) ) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_PLUGIN, SYNC_PLUGIN_SUBSYSTEM,
|
|
|
b69e47 |
- "sync_send_results - conn=%" NSPRIu64 " op=%d Operation no longer active - terminating\n",
|
|
|
b69e47 |
+ "sync_send_results - conn=%" PRIu64 " op=%d Operation no longer active - terminating\n",
|
|
|
b69e47 |
connid, opid);
|
|
|
b69e47 |
break;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/syntaxes/validate_task.c b/ldap/servers/plugins/syntaxes/validate_task.c
|
|
|
b69e47 |
index eae2d2a..c051573 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/syntaxes/validate_task.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/syntaxes/validate_task.c
|
|
|
b69e47 |
@@ -201,12 +201,12 @@ syntax_validate_task_thread(void *arg)
|
|
|
b69e47 |
slapi_pblock_destroy(search_pb);
|
|
|
b69e47 |
|
|
|
b69e47 |
/* Log finished message. */
|
|
|
b69e47 |
- slapi_task_log_notice(task, "Syntax validate task complete. Found %" NSPRIu64
|
|
|
b69e47 |
+ slapi_task_log_notice(task, "Syntax validate task complete. Found %" PRIu64
|
|
|
b69e47 |
" invalid entries.\n", slapi_counter_get_value(td->invalid_entries));
|
|
|
b69e47 |
- slapi_task_log_status(task, "Syntax validate task complete. Found %" NSPRIu64
|
|
|
b69e47 |
+ slapi_task_log_status(task, "Syntax validate task complete. Found %" PRIu64
|
|
|
b69e47 |
" invalid entries.\n", slapi_counter_get_value(td->invalid_entries));
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, SYNTAX_PLUGIN_SUBSYSTEM, "syntax_validate_task_thread - Complete."
|
|
|
b69e47 |
- " Found %" NSPRIu64 " invalid entries.\n",
|
|
|
b69e47 |
+ " Found %" PRIu64 " invalid entries.\n",
|
|
|
b69e47 |
slapi_counter_get_value(td->invalid_entries));
|
|
|
b69e47 |
slapi_task_inc_progress(task);
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/plugins/usn/usn.c b/ldap/servers/plugins/usn/usn.c
|
|
|
b69e47 |
index 5e67e0a..54ebc31 100644
|
|
|
b69e47 |
--- a/ldap/servers/plugins/usn/usn.c
|
|
|
b69e47 |
+++ b/ldap/servers/plugins/usn/usn.c
|
|
|
b69e47 |
@@ -320,7 +320,7 @@ _usn_add_next_usn(Slapi_Entry *e, Slapi_Backend *be)
|
|
|
b69e47 |
"--> _usn_add_next_usn\n");
|
|
|
b69e47 |
|
|
|
b69e47 |
/* add next USN to the entry; "be" contains the usn counter */
|
|
|
b69e47 |
- usn_berval.bv_val = slapi_ch_smprintf("%" NSPRIu64,
|
|
|
b69e47 |
+ usn_berval.bv_val = slapi_ch_smprintf("%" PRIu64,
|
|
|
b69e47 |
slapi_counter_get_value(be->be_usn_counter));
|
|
|
b69e47 |
usn_berval.bv_len = strlen(usn_berval.bv_val);
|
|
|
b69e47 |
slapi_entry_attr_find(e, SLAPI_ATTR_ENTRYUSN, &attr);
|
|
|
b69e47 |
@@ -360,7 +360,7 @@ _usn_mod_next_usn(LDAPMod ***mods, Slapi_Backend *be)
|
|
|
b69e47 |
|
|
|
b69e47 |
/* add next USN to the mods; "be" contains the usn counter */
|
|
|
b69e47 |
usn_berval.bv_val = counter_buf;
|
|
|
b69e47 |
- snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" NSPRIu64,
|
|
|
b69e47 |
+ snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" PRIu64,
|
|
|
b69e47 |
slapi_counter_get_value(be->be_usn_counter));
|
|
|
b69e47 |
usn_berval.bv_len = strlen(usn_berval.bv_val);
|
|
|
b69e47 |
bvals[0] = &usn_berval;
|
|
|
b69e47 |
@@ -681,7 +681,7 @@ usn_rootdse_search(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter,
|
|
|
b69e47 |
/* get a next USN counter from be_usn_counter;
|
|
|
b69e47 |
* then minus 1 from it (except if be_usn_counter has value 0) */
|
|
|
b69e47 |
if (slapi_counter_get_value(be->be_usn_counter)) {
|
|
|
b69e47 |
- snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" NSPRIu64,
|
|
|
b69e47 |
+ snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" PRIu64,
|
|
|
b69e47 |
slapi_counter_get_value(be->be_usn_counter)-1);
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "-1");
|
|
|
b69e47 |
@@ -704,7 +704,7 @@ usn_rootdse_search(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter,
|
|
|
b69e47 |
/* get a next USN counter from be_usn_counter;
|
|
|
b69e47 |
* then minus 1 from it (except if be_usn_counter has value 0) */
|
|
|
b69e47 |
if (slapi_counter_get_value(be->be_usn_counter)) {
|
|
|
b69e47 |
- snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" NSPRIu64,
|
|
|
b69e47 |
+ snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "%" PRIu64,
|
|
|
b69e47 |
slapi_counter_get_value(be->be_usn_counter)-1);
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
snprintf(usn_berval.bv_val, USN_COUNTER_BUF_LEN, "-1");
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/abandon.c b/ldap/servers/slapd/abandon.c
|
|
|
b69e47 |
index 18ff8ce..0485006 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/abandon.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/abandon.c
|
|
|
b69e47 |
@@ -119,19 +119,19 @@ do_abandon( Slapi_PBlock *pb )
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
if ( 0 == pagedresults_free_one_msgid_nolock(pb->pb_conn, id) ) {
|
|
|
b69e47 |
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64
|
|
|
b69e47 |
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64
|
|
|
b69e47 |
" op=%d ABANDON targetop=Simple Paged Results msgid=%d\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
|
|
|
b69e47 |
} else if ( NULL == o ) {
|
|
|
b69e47 |
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ABANDON"
|
|
|
b69e47 |
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ABANDON"
|
|
|
b69e47 |
" targetop=NOTFOUND msgid=%d\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
|
|
|
b69e47 |
} else if ( suppressed_by_plugin ) {
|
|
|
b69e47 |
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ABANDON"
|
|
|
b69e47 |
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ABANDON"
|
|
|
b69e47 |
" targetop=SUPPRESSED-BY-PLUGIN msgid=%d\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid, id );
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ABANDON"
|
|
|
b69e47 |
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ABANDON"
|
|
|
b69e47 |
" targetop=%d msgid=%d nentries=%d etime=%ld\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid, o->o_opid, id,
|
|
|
b69e47 |
o->o_results.r.r_search.nentries, current_time() - o->o_time );
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/add.c b/ldap/servers/slapd/add.c
|
|
|
b69e47 |
index 1b994a0..9c4001e 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/add.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/add.c
|
|
|
b69e47 |
@@ -168,7 +168,7 @@ do_add( Slapi_PBlock *pb )
|
|
|
b69e47 |
if (( rc = slapi_entry_add_values( e, normtype, vals ))
|
|
|
b69e47 |
!= LDAP_SUCCESS ) {
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d ADD dn=\"%s\", add values for type %s failed\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d ADD dn=\"%s\", add values for type %s failed\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, operation->o_opid,
|
|
|
b69e47 |
slapi_entry_get_dn_const(e), normtype );
|
|
|
b69e47 |
send_ldap_result( pb, rc, NULL, NULL, 0, NULL );
|
|
|
b69e47 |
@@ -460,7 +460,7 @@ static void op_shared_add (Slapi_PBlock *pb)
|
|
|
b69e47 |
|
|
|
b69e47 |
if ( !internal_op )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d ADD dn=\"%s\"%s\n",
|
|
|
b69e47 |
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ADD dn=\"%s\"%s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid,
|
|
|
b69e47 |
operation->o_opid,
|
|
|
b69e47 |
slapi_entry_get_dn_const(e),
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/auth.c b/ldap/servers/slapd/auth.c
|
|
|
b69e47 |
index c787dd4..da1b586 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/auth.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/auth.c
|
|
|
b69e47 |
@@ -366,7 +366,7 @@ handle_bad_certificate (void* clientData, PRFileDesc *prfd)
|
|
|
b69e47 |
char* subject = subject_of (clientCert);
|
|
|
b69e47 |
char* issuer = issuer_of (clientCert);
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " " SLAPI_COMPONENT_NAME_NSPR " error %i (%s); unauthenticated client %s; issuer %s\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " " SLAPI_COMPONENT_NAME_NSPR " error %i (%s); unauthenticated client %s; issuer %s\n",
|
|
|
b69e47 |
conn->c_connid, errorCode, slapd_pr_strerror(errorCode),
|
|
|
b69e47 |
subject ? escape_string( subject, sbuf ) : "NULL",
|
|
|
b69e47 |
issuer ? escape_string( issuer, ibuf ) : "NULL" );
|
|
|
b69e47 |
@@ -402,7 +402,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
|
|
|
b69e47 |
if ( (slapd_ssl_getChannelInfo (prfd, &channelInfo, sizeof(channelInfo))) != SECSuccess ) {
|
|
|
b69e47 |
PRErrorCode errorCode = PR_GetError();
|
|
|
b69e47 |
slapi_log_access (LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " SSL failed to obtain channel info; "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " SSL failed to obtain channel info; "
|
|
|
b69e47 |
SLAPI_COMPONENT_NAME_NSPR " error %i (%s)\n",
|
|
|
b69e47 |
conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
|
|
|
b69e47 |
goto done;
|
|
|
b69e47 |
@@ -411,7 +411,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
|
|
|
b69e47 |
!= SECSuccess) {
|
|
|
b69e47 |
PRErrorCode errorCode = PR_GetError();
|
|
|
b69e47 |
slapi_log_access (LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " SSL failed to obtain cipher info; "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " SSL failed to obtain cipher info; "
|
|
|
b69e47 |
SLAPI_COMPONENT_NAME_NSPR " error %i (%s)\n",
|
|
|
b69e47 |
conn->c_connid, errorCode, slapd_pr_strerror(errorCode));
|
|
|
b69e47 |
goto done;
|
|
|
b69e47 |
@@ -432,14 +432,14 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
|
|
|
b69e47 |
|
|
|
b69e47 |
if (config_get_SSLclientAuth() == SLAPD_SSLCLIENTAUTH_OFF ) {
|
|
|
b69e47 |
(void) slapi_getSSLVersion_str(channelInfo.protocolVersion, sslversion, sizeof(sslversion));
|
|
|
b69e47 |
- slapi_log_access (LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " %s %i-bit %s\n",
|
|
|
b69e47 |
+ slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " %s %i-bit %s\n",
|
|
|
b69e47 |
conn->c_connid,
|
|
|
b69e47 |
sslversion, keySize, cipher ? cipher : "NULL" );
|
|
|
b69e47 |
goto done;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
if (clientCert == NULL) {
|
|
|
b69e47 |
(void) slapi_getSSLVersion_str(channelInfo.protocolVersion, sslversion, sizeof(sslversion));
|
|
|
b69e47 |
- slapi_log_access (LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " %s %i-bit %s\n",
|
|
|
b69e47 |
+ slapi_log_access (LDAP_DEBUG_STATS, "conn=%" PRIu64 " %s %i-bit %s\n",
|
|
|
b69e47 |
conn->c_connid,
|
|
|
b69e47 |
sslversion, keySize, cipher ? cipher : "NULL" );
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
@@ -448,7 +448,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
|
|
|
b69e47 |
(void) slapi_getSSLVersion_str(channelInfo.protocolVersion,
|
|
|
b69e47 |
sslversion, sizeof(sslversion));
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " %s %i-bit %s; missing subject\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " %s %i-bit %s; missing subject\n",
|
|
|
b69e47 |
conn->c_connid,
|
|
|
b69e47 |
sslversion, keySize, cipher ? cipher : "NULL");
|
|
|
b69e47 |
goto done;
|
|
|
b69e47 |
@@ -459,7 +459,7 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
|
|
|
b69e47 |
(void) slapi_getSSLVersion_str(channelInfo.protocolVersion,
|
|
|
b69e47 |
sslversion, sizeof(sslversion));
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " %s %i-bit %s; client %s; issuer %s\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " %s %i-bit %s; client %s; issuer %s\n",
|
|
|
b69e47 |
conn->c_connid,
|
|
|
b69e47 |
sslversion, keySize, cipher ? cipher : "NULL",
|
|
|
b69e47 |
subject ? escape_string( subject, sbuf ) : "NULL",
|
|
|
b69e47 |
@@ -503,14 +503,14 @@ handle_handshake_done (PRFileDesc *prfd, void* clientData)
|
|
|
b69e47 |
(void) slapi_getSSLVersion_str(channelInfo.protocolVersion,
|
|
|
b69e47 |
sslversion, sizeof(sslversion));
|
|
|
b69e47 |
slapi_log_access (LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " %s client bound as %s\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " %s client bound as %s\n",
|
|
|
b69e47 |
conn->c_connid,
|
|
|
b69e47 |
sslversion, clientDN);
|
|
|
b69e47 |
} else if (clientCert != NULL) {
|
|
|
b69e47 |
(void) slapi_getSSLVersion_str(channelInfo.protocolVersion,
|
|
|
b69e47 |
sslversion, sizeof(sslversion));
|
|
|
b69e47 |
slapi_log_access (LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " %s failed to map client "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " %s failed to map client "
|
|
|
b69e47 |
"certificate to LDAP DN (%s)\n",
|
|
|
b69e47 |
conn->c_connid,
|
|
|
b69e47 |
sslversion, extraErrorMsg);
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h
|
|
|
b69e47 |
index a5fc540..0bb15e3 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/back-ldbm.h
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h
|
|
|
b69e47 |
@@ -28,21 +28,8 @@
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
|
|
|
b69e47 |
-/* Required to get portable printf/scanf format macros */
|
|
|
b69e47 |
-#ifdef HAVE_INTTYPES_H
|
|
|
b69e47 |
-#include <inttypes.h>
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-/* NSPR uses the print macros a bit differently than ANSI C. We
|
|
|
b69e47 |
- * need to use ll for a 64-bit integer, even when a long is 64-bit.
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
-#undef PRIu64
|
|
|
b69e47 |
-#define PRIu64 "llu"
|
|
|
b69e47 |
-#undef PRI64
|
|
|
b69e47 |
-#define PRI64 "ll"
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-#else
|
|
|
b69e47 |
-#error Need to define portable format macros such as PRIu64
|
|
|
b69e47 |
-#endif /* HAVE_INTTYPES_H */
|
|
|
b69e47 |
+/* Provides our int types and platform specific requirements. */
|
|
|
b69e47 |
+#include <slapi_pal.h>
|
|
|
b69e47 |
|
|
|
b69e47 |
/* A bunch of random system headers taken from all the source files, no source file should #include
|
|
|
b69e47 |
any system headers now */
|
|
|
b69e47 |
@@ -162,11 +149,11 @@ typedef unsigned short u_int16_t;
|
|
|
b69e47 |
#define DBVERSION_FILENAME "DBVERSION"
|
|
|
b69e47 |
/* 0 here means to let the autotuning reset the value on first run */
|
|
|
b69e47 |
/* cache can't get any smaller than this (in bytes) */
|
|
|
b69e47 |
-#define MINCACHESIZE (size_t)512000
|
|
|
b69e47 |
-#define DEFAULT_CACHE_SIZE (size_t)0
|
|
|
b69e47 |
+#define MINCACHESIZE (uint64_t)512000
|
|
|
b69e47 |
+#define DEFAULT_CACHE_SIZE (uint64_t)0
|
|
|
b69e47 |
#define DEFAULT_CACHE_SIZE_STR "0"
|
|
|
b69e47 |
#define DEFAULT_CACHE_ENTRIES -1 /* no limit */
|
|
|
b69e47 |
-#define DEFAULT_DNCACHE_SIZE (size_t)16777216
|
|
|
b69e47 |
+#define DEFAULT_DNCACHE_SIZE (uint64_t)16777216
|
|
|
b69e47 |
#define DEFAULT_DNCACHE_SIZE_STR "16777216"
|
|
|
b69e47 |
#define DEFAULT_DNCACHE_MAXCOUNT -1 /* no limit */
|
|
|
b69e47 |
#define DEFAULT_DBCACHE_SIZE 33554432
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/cache.c b/ldap/servers/slapd/back-ldbm/cache.c
|
|
|
b69e47 |
index ade2240..0f0cf3b 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/cache.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/cache.c
|
|
|
b69e47 |
@@ -649,7 +649,7 @@ void cache_set_max_size(struct cache *cache, size_t bytes, int type)
|
|
|
b69e47 |
}
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
-static void entrycache_set_max_size(struct cache *cache, size_t bytes)
|
|
|
b69e47 |
+static void entrycache_set_max_size(struct cache *cache, uint64_t bytes)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
struct backentry *eflush = NULL;
|
|
|
b69e47 |
struct backentry *eflushtemp = NULL;
|
|
|
b69e47 |
@@ -659,16 +659,17 @@ static void entrycache_set_max_size(struct cache *cache, size_t bytes)
|
|
|
b69e47 |
* to happen. In that case, suppress this warning.
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
if (bytes > 0) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_WARNING, "entrycache_set_max_size", "Minimum cache size is %lu -- rounding up\n", MINCACHESIZE);
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_WARNING, "entrycache_set_max_size", "Minimum cache size is %"PRIu64" -- rounding up\n", MINCACHESIZE);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
bytes = MINCACHESIZE;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
cache_lock(cache);
|
|
|
b69e47 |
cache->c_maxsize = bytes;
|
|
|
b69e47 |
- LOG("entry cache size set to %lu\n", bytes);
|
|
|
b69e47 |
+ LOG("entry cache size set to %"PRIu64"\n", bytes);
|
|
|
b69e47 |
/* check for full cache, and clear out if necessary */
|
|
|
b69e47 |
- if (CACHE_FULL(cache))
|
|
|
b69e47 |
+ if (CACHE_FULL(cache)) {
|
|
|
b69e47 |
eflush = entrycache_flush(cache);
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
while (eflush)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
eflushtemp = BACK_LRU_NEXT(eflush, struct backentry *);
|
|
|
b69e47 |
@@ -686,12 +687,11 @@ static void entrycache_set_max_size(struct cache *cache, size_t bytes)
|
|
|
b69e47 |
/* This may already have been called by one of the functions in
|
|
|
b69e47 |
* ldbm_instance_config
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
- if (! util_is_cachesize_sane(&bytes)) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_WARNING,
|
|
|
b69e47 |
- "entrycache_set_max_size", "Possible CONFIGURATION ERROR -- cachesize "
|
|
|
b69e47 |
- "(%lu) may be configured to use more than the available "
|
|
|
b69e47 |
- "physical memory.\n", bytes);
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
+ if (util_is_cachesize_sane(mi, &bytes) != UTIL_CACHESIZE_VALID) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_WARNING, "entrycache_set_max_size", "Cachesize (%"PRIu64") may use more than the available physical memory.\n", bytes);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
void cache_set_max_entries(struct cache *cache, long entries)
|
|
|
b69e47 |
@@ -1597,7 +1597,7 @@ dn_same_id(const void *bdn, const void *k)
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
static void
|
|
|
b69e47 |
-dncache_set_max_size(struct cache *cache, size_t bytes)
|
|
|
b69e47 |
+dncache_set_max_size(struct cache *cache, uint64_t bytes)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
struct backdn *dnflush = NULL;
|
|
|
b69e47 |
struct backdn *dnflushtemp = NULL;
|
|
|
b69e47 |
@@ -1609,12 +1609,12 @@ dncache_set_max_size(struct cache *cache, size_t bytes)
|
|
|
b69e47 |
if (bytes < MINCACHESIZE) {
|
|
|
b69e47 |
bytes = MINCACHESIZE;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_WARNING,
|
|
|
b69e47 |
- "dncache_set_max_size", "Minimum cache size is %lu -- rounding up\n",
|
|
|
b69e47 |
+ "dncache_set_max_size", "Minimum cache size is %"PRIu64" -- rounding up\n",
|
|
|
b69e47 |
MINCACHESIZE);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
cache_lock(cache);
|
|
|
b69e47 |
cache->c_maxsize = bytes;
|
|
|
b69e47 |
- LOG("entry cache size set to %lu\n", bytes);
|
|
|
b69e47 |
+ LOG("entry cache size set to %"PRIu64"\n", bytes);
|
|
|
b69e47 |
/* check for full cache, and clear out if necessary */
|
|
|
b69e47 |
if (CACHE_FULL(cache)) {
|
|
|
b69e47 |
dnflush = dncache_flush(cache);
|
|
|
b69e47 |
@@ -1636,12 +1636,12 @@ dncache_set_max_size(struct cache *cache, size_t bytes)
|
|
|
b69e47 |
/* This may already have been called by one of the functions in
|
|
|
b69e47 |
* ldbm_instance_config
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
- if (! util_is_cachesize_sane(&bytes)) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_WARNING,
|
|
|
b69e47 |
- "dncache_set_max_size", "Possible CONFIGURATION ERROR -- cachesize "
|
|
|
b69e47 |
- "(%lu) may be configured to use more than the available "
|
|
|
b69e47 |
- "physical memory.\n", bytes);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
+ if (util_is_cachesize_sane(mi, &bytes) != UTIL_CACHESIZE_VALID) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_WARNING, "dncache_set_max_size", "Cachesize (%"PRIu64") may use more than the available physical memory.\n", bytes);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
/* remove a dn from the cache */
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
|
|
|
b69e47 |
index 507a3cc..3c1fbb0 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
|
|
|
b69e47 |
@@ -1386,14 +1386,16 @@ dblayer_start(struct ldbminfo *li, int dbmode)
|
|
|
b69e47 |
|
|
|
b69e47 |
/* Sanity check on cache size on platforms which allow us to figure out
|
|
|
b69e47 |
* the available phys mem */
|
|
|
b69e47 |
- if (!util_is_cachesize_sane(&(priv->dblayer_cachesize))) {
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
+ if (!util_is_cachesize_sane(mi, &(priv->dblayer_cachesize))) {
|
|
|
b69e47 |
/* Oops---looks like the admin misconfigured, let's warn them */
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_WARNING,"dblayer_start", "Likely CONFIGURATION ERROR -"
|
|
|
b69e47 |
"dbcachesize is configured to use more than the available "
|
|
|
b69e47 |
- "physical memory, decreased to the largest available size (%lu bytes).\n",
|
|
|
b69e47 |
+ "physical memory, decreased to the largest available size (%"PRIu64" bytes).\n",
|
|
|
b69e47 |
priv->dblayer_cachesize);
|
|
|
b69e47 |
li->li_dbcachesize = priv->dblayer_cachesize;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
|
|
|
b69e47 |
/* fill in DB_ENV stuff from the common configuration */
|
|
|
b69e47 |
return_value = dblayer_make_env(&pEnv, li);
|
|
|
b69e47 |
@@ -1690,9 +1692,6 @@ dblayer_start(struct ldbminfo *li, int dbmode)
|
|
|
b69e47 |
* nsslapd-import-cache-autosize: 0
|
|
|
b69e47 |
* get the nsslapd-import-cachesize.
|
|
|
b69e47 |
* Calculate the memory size left after allocating the import cache size.
|
|
|
b69e47 |
- * If the size is less than the hard limit, it issues an error and quit.
|
|
|
b69e47 |
- * If the size is greater than the hard limit and less than the soft limit,
|
|
|
b69e47 |
- * it issues a warning, but continues the import task.
|
|
|
b69e47 |
*
|
|
|
b69e47 |
* Note: this function is called only if the import is executed as a stand
|
|
|
b69e47 |
* alone command line (ldif2db).
|
|
|
b69e47 |
@@ -1700,27 +1699,17 @@ dblayer_start(struct ldbminfo *li, int dbmode)
|
|
|
b69e47 |
int
|
|
|
b69e47 |
check_and_set_import_cache(struct ldbminfo *li)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- size_t import_pages = 0;
|
|
|
b69e47 |
- size_t pagesize, pages, procpages, availpages;
|
|
|
b69e47 |
- size_t soft_limit = 0;
|
|
|
b69e47 |
- size_t hard_limit = 0;
|
|
|
b69e47 |
- size_t page_delta = 0;
|
|
|
b69e47 |
+ uint64_t import_cache = 0;
|
|
|
b69e47 |
char s[64]; /* big enough to hold %ld */
|
|
|
b69e47 |
+ /* Get our platform memory values. */
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
|
|
|
b69e47 |
- if (util_info_sys_pages(&pagesize, &pages, &procpages, &availpages) != 0 || 0 == pagesize || 0 == pages) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_ERR, "check_and_set_import_cache",
|
|
|
b69e47 |
- "Failed to get pagesize: %ld or pages: %ld\n",
|
|
|
b69e47 |
- pagesize, pages);
|
|
|
b69e47 |
+ if (mi == NULL) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_ERR, "check_and_set_import_cache", "Failed to get system memory infomation\n");
|
|
|
b69e47 |
return ENOENT;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_INFO, "check_and_set_import_cache",
|
|
|
b69e47 |
- "pagesize: %ld, pages: %ld, procpages: %ld\n",
|
|
|
b69e47 |
- pagesize, pages, procpages);
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_INFO, "check_and_set_import_cache", "pagesize: %"PRIu64", available bytes %"PRIu64", process usage %"PRIu64" \n", mi->pagesize_bytes, mi->system_available_bytes, mi->process_consumed_bytes);
|
|
|
b69e47 |
|
|
|
b69e47 |
- /* Soft limit: pages equivalent to 1GB (defined in dblayer.h) */
|
|
|
b69e47 |
- soft_limit = (DBLAYER_IMPORTCACHESIZE_SL*1024) / (pagesize/1024);
|
|
|
b69e47 |
- /* Hard limit: pages equivalent to 100MB (defined in dblayer.h) */
|
|
|
b69e47 |
- hard_limit = (DBLAYER_IMPORTCACHESIZE_HL*1024) / (pagesize/1024);
|
|
|
b69e47 |
/*
|
|
|
b69e47 |
* default behavior for ldif2db import cache,
|
|
|
b69e47 |
* nsslapd-import-cache-autosize==-1,
|
|
|
b69e47 |
@@ -1741,48 +1730,29 @@ check_and_set_import_cache(struct ldbminfo *li)
|
|
|
b69e47 |
|
|
|
b69e47 |
if (li->li_import_cache_autosize == 0) {
|
|
|
b69e47 |
/* user specified importCache */
|
|
|
b69e47 |
- import_pages = li->li_import_cachesize / pagesize;
|
|
|
b69e47 |
+ import_cache = li->li_import_cachesize;
|
|
|
b69e47 |
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
/* autosizing importCache */
|
|
|
b69e47 |
/* ./125 instead of ./100 is for adjusting the BDB overhead. */
|
|
|
b69e47 |
-#ifdef LINUX
|
|
|
b69e47 |
- /* On linux, availpages is correct so we should use it! */
|
|
|
b69e47 |
- import_pages = (li->li_import_cache_autosize * availpages) / 125;
|
|
|
b69e47 |
-#else
|
|
|
b69e47 |
- import_pages = (li->li_import_cache_autosize * pages) / 125;
|
|
|
b69e47 |
-#endif
|
|
|
b69e47 |
+ import_cache = (li->li_import_cache_autosize * mi->system_available_bytes) / 125;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
- page_delta = pages - import_pages;
|
|
|
b69e47 |
- if (page_delta < hard_limit) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_ERR,
|
|
|
b69e47 |
- "check_and_set_import_cache", "After allocating import cache %ldKB, "
|
|
|
b69e47 |
- "the available memory is %ldKB, "
|
|
|
b69e47 |
- "which is less than the hard limit %ldKB. "
|
|
|
b69e47 |
- "Please decrease the import cache size and rerun import.\n",
|
|
|
b69e47 |
- import_pages*(pagesize/1024), page_delta*(pagesize/1024),
|
|
|
b69e47 |
- hard_limit*(pagesize/1024));
|
|
|
b69e47 |
+ if (util_is_cachesize_sane(mi, &import_cache) == UTIL_CACHESIZE_ERROR) {
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_INFO, "check_and_set_import_cache", "Import failed to run: unable to validate system memory limits.\n");
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
return ENOMEM;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
- if (page_delta < soft_limit) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_WARNING,
|
|
|
b69e47 |
- "check_and_set_import_cache", "After allocating import cache %ldKB, "
|
|
|
b69e47 |
- "the available memory is %ldKB, "
|
|
|
b69e47 |
- "which is less than the soft limit %ldKB. "
|
|
|
b69e47 |
- "You may want to decrease the import cache size and "
|
|
|
b69e47 |
- "rerun import.\n",
|
|
|
b69e47 |
- import_pages*(pagesize/1024), page_delta*(pagesize/1024),
|
|
|
b69e47 |
- soft_limit*(pagesize/1024));
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_INFO, "check_and_set_import_cache", "Import allocates %ldKB import cache.\n",
|
|
|
b69e47 |
- import_pages*(pagesize/1024));
|
|
|
b69e47 |
- if (li->li_import_cache_autosize > 0) { /* import cache autosizing */
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_INFO, "check_and_set_import_cache", "Import allocates %"PRIu64"KB import cache.\n", import_cache / 1024);
|
|
|
b69e47 |
+ if (li->li_import_cache_autosize > 0) {
|
|
|
b69e47 |
+ /* import cache autosizing */
|
|
|
b69e47 |
/* set the calculated import cache size to the config */
|
|
|
b69e47 |
- sprintf(s, "%lu", (unsigned long)(import_pages * pagesize));
|
|
|
b69e47 |
+ sprintf(s, "%"PRIu64, import_cache);
|
|
|
b69e47 |
ldbm_config_internal_set(li, CONFIG_IMPORT_CACHESIZE, s);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
return 0;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.h b/ldap/servers/slapd/back-ldbm/dblayer.h
|
|
|
b69e47 |
index e4307fc..816c943 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/dblayer.h
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/dblayer.h
|
|
|
b69e47 |
@@ -68,14 +68,6 @@
|
|
|
b69e47 |
#define DB_REGION_NAME 25 /* DB: named regions, no backing file. */
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
|
|
|
b69e47 |
-/* Used in check_and_set_import_cache */
|
|
|
b69e47 |
-/* After allocating the import cache, free memory must be left more than
|
|
|
b69e47 |
- * the hard limit to run import. */
|
|
|
b69e47 |
-/* If the free memory size left is greater than hard limit and less than
|
|
|
b69e47 |
- * soft limit, the import utility issues a warning, but it runs */
|
|
|
b69e47 |
-#define DBLAYER_IMPORTCACHESIZE_HL 100 /* import cache hard limit 100MB */
|
|
|
b69e47 |
-#define DBLAYER_IMPORTCACHESIZE_SL 1024 /* import cache soft limit 1GB */
|
|
|
b69e47 |
-
|
|
|
b69e47 |
struct dblayer_private_env {
|
|
|
b69e47 |
DB_ENV *dblayer_DB_ENV;
|
|
|
b69e47 |
Slapi_RWLock * dblayer_env_lock;
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c
|
|
|
b69e47 |
index 087103b..ab32e0a 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/import-threads.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/import-threads.c
|
|
|
b69e47 |
@@ -3979,7 +3979,7 @@ _get_import_entryusn(ImportJob *job, Slapi_Value **usn_value)
|
|
|
b69e47 |
* Use the counter which stores the old DB's
|
|
|
b69e47 |
* next entryusn. */
|
|
|
b69e47 |
PR_snprintf(counter_buf, sizeof(counter_buf),
|
|
|
b69e47 |
- "%" NSPRIu64, slapi_counter_get_value(be->be_usn_counter));
|
|
|
b69e47 |
+ "%" PRIu64, slapi_counter_get_value(be->be_usn_counter));
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
/* import_init value is digit.
|
|
|
b69e47 |
* Initialize the entryusn values with the digit */
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/import.c b/ldap/servers/slapd/back-ldbm/import.c
|
|
|
b69e47 |
index d0cef1a..7161bac 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/import.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/import.c
|
|
|
b69e47 |
@@ -84,17 +84,19 @@ static int import_fifo_init(ImportJob *job)
|
|
|
b69e47 |
int import_fifo_validate_capacity_or_expand(ImportJob *job, size_t entrysize) {
|
|
|
b69e47 |
int result = 1;
|
|
|
b69e47 |
/* We shoot for four times as much to start with. */
|
|
|
b69e47 |
- size_t request = entrysize * 4;
|
|
|
b69e47 |
- int sane = 0;
|
|
|
b69e47 |
+ uint64_t request = entrysize * 4;
|
|
|
b69e47 |
+ util_cachesize_result sane;
|
|
|
b69e47 |
|
|
|
b69e47 |
if (entrysize > job->fifo.bsize) {
|
|
|
b69e47 |
/* Check the amount of memory on the system */
|
|
|
b69e47 |
- sane = util_is_cachesize_sane(&request);
|
|
|
b69e47 |
- if (!sane && entrysize <= request) {
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
+ sane = util_is_cachesize_sane(mi, &request);
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
+ if (sane == UTIL_CACHESIZE_REDUCED && entrysize <= request) {
|
|
|
b69e47 |
/* Did the amount cachesize set still exceed entrysize? It'll do ... */
|
|
|
b69e47 |
job->fifo.bsize = request;
|
|
|
b69e47 |
result = 0;
|
|
|
b69e47 |
- } else if (!sane) {
|
|
|
b69e47 |
+ } else if (sane != UTIL_CACHESIZE_VALID) {
|
|
|
b69e47 |
/* Can't allocate! No!!! */
|
|
|
b69e47 |
result = 1;
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
|
|
|
b69e47 |
index dfe7a13..d5120d3 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
|
|
|
b69e47 |
@@ -403,8 +403,8 @@ static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, i
|
|
|
b69e47 |
{
|
|
|
b69e47 |
struct ldbminfo *li = (struct ldbminfo *) arg;
|
|
|
b69e47 |
int retval = LDAP_SUCCESS;
|
|
|
b69e47 |
- size_t val = (size_t)value;
|
|
|
b69e47 |
- size_t delta = (size_t)value;
|
|
|
b69e47 |
+ uint64_t val = (size_t)value;
|
|
|
b69e47 |
+ uint64_t delta = (size_t)value;
|
|
|
b69e47 |
|
|
|
b69e47 |
/* There is an error here. We check the new val against our current mem-alloc
|
|
|
b69e47 |
* Issue is that we already are using system pages, so while our value *might*
|
|
|
b69e47 |
@@ -430,7 +430,13 @@ static int ldbm_config_dbcachesize_set(void *arg, void *value, char *errorbuf, i
|
|
|
b69e47 |
val = DBDEFMINSIZ;
|
|
|
b69e47 |
} else if (val > li->li_dbcachesize) {
|
|
|
b69e47 |
delta = val - li->li_dbcachesize;
|
|
|
b69e47 |
- if (!util_is_cachesize_sane(&delta)){
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ util_cachesize_result sane;
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
+ sane = util_is_cachesize_sane(mi, &delta);
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (sane != UTIL_CACHESIZE_VALID){
|
|
|
b69e47 |
slapi_create_errormsg(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: nsslapd-dbcachesize value is too large.");
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "ldbm_config_dbcachesize_set",
|
|
|
b69e47 |
"nsslapd-dbcachesize value is too large.\n");
|
|
|
b69e47 |
@@ -1086,7 +1092,7 @@ static int ldbm_config_db_cache_set(void *arg, void *value, char *errorbuf, int
|
|
|
b69e47 |
struct ldbminfo *li = (struct ldbminfo *) arg;
|
|
|
b69e47 |
int retval = LDAP_SUCCESS;
|
|
|
b69e47 |
int val = ((uintptr_t)value);
|
|
|
b69e47 |
- size_t delta = 0;
|
|
|
b69e47 |
+ uint64_t delta = 0;
|
|
|
b69e47 |
|
|
|
b69e47 |
/* There is an error here. We check the new val against our current mem-alloc
|
|
|
b69e47 |
* Issue is that we already are using system pages, so while our value *might*
|
|
|
b69e47 |
@@ -1101,7 +1107,13 @@ static int ldbm_config_db_cache_set(void *arg, void *value, char *errorbuf, int
|
|
|
b69e47 |
if (apply) {
|
|
|
b69e47 |
if (val > li->li_dblayer_private->dblayer_cache_config) {
|
|
|
b69e47 |
delta = val - li->li_dblayer_private->dblayer_cache_config;
|
|
|
b69e47 |
- if (!util_is_cachesize_sane(&delta)){
|
|
|
b69e47 |
+ util_cachesize_result sane;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
+ sane = util_is_cachesize_sane(mi, &delta);
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (sane != UTIL_CACHESIZE_VALID){
|
|
|
b69e47 |
slapi_create_errormsg(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: db cachesize value is too large");
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR,"ldbm_config_db_cache_set", "db cachesize value is too large.\n");
|
|
|
b69e47 |
return LDAP_UNWILLING_TO_PERFORM;
|
|
|
b69e47 |
@@ -1219,7 +1231,7 @@ static int ldbm_config_import_cachesize_set(void *arg, void *value, char *errorb
|
|
|
b69e47 |
{
|
|
|
b69e47 |
struct ldbminfo *li = (struct ldbminfo *)arg;
|
|
|
b69e47 |
size_t val = (size_t)value;
|
|
|
b69e47 |
- size_t delta = (size_t)value;
|
|
|
b69e47 |
+ uint64_t delta = (size_t)value;
|
|
|
b69e47 |
/* There is an error here. We check the new val against our current mem-alloc
|
|
|
b69e47 |
* Issue is that we already are using system pages, so while our value *might*
|
|
|
b69e47 |
* be valid, we may reject it here due to the current procs page usage.
|
|
|
b69e47 |
@@ -1232,7 +1244,13 @@ static int ldbm_config_import_cachesize_set(void *arg, void *value, char *errorb
|
|
|
b69e47 |
if (apply){
|
|
|
b69e47 |
if (val > li->li_import_cachesize) {
|
|
|
b69e47 |
delta = val - li->li_import_cachesize;
|
|
|
b69e47 |
- if (!util_is_cachesize_sane(&delta)){
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ util_cachesize_result sane;
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
+ sane = util_is_cachesize_sane(mi, &delta);
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (sane != UTIL_CACHESIZE_VALID){
|
|
|
b69e47 |
slapi_create_errormsg(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: import cachesize value is too large.");
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR,"ldbm_config_import_cachesize_set",
|
|
|
b69e47 |
"Import cachesize value is too large.\n");
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
|
|
|
b69e47 |
index 92d982e..0b0b37e 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
|
|
|
b69e47 |
@@ -107,7 +107,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
|
|
|
b69e47 |
|
|
|
b69e47 |
if (pb->pb_conn)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_delete", "Enter conn=%" NSPRIu64 " op=%d\n",
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_delete", "Enter conn=%" PRIu64 " op=%d\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, operation->o_opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -1493,7 +1493,7 @@ diskfull_return:
|
|
|
b69e47 |
slapi_sdn_done(&parentsdn);
|
|
|
b69e47 |
if (pb->pb_conn)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_delete", "leave conn=%" NSPRIu64 " op=%d\n",
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_delete", "leave conn=%" PRIu64 " op=%d\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, operation->o_opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
|
|
|
b69e47 |
index e03954d..62cdbc3 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c
|
|
|
b69e47 |
@@ -92,7 +92,7 @@ ldbm_instance_config_cachememsize_set(void *arg, void *value, char *errorbuf, in
|
|
|
b69e47 |
ldbm_instance *inst = (ldbm_instance *) arg;
|
|
|
b69e47 |
int retval = LDAP_SUCCESS;
|
|
|
b69e47 |
size_t val = (size_t) value;
|
|
|
b69e47 |
- size_t delta = 0;
|
|
|
b69e47 |
+ uint64_t delta = 0;
|
|
|
b69e47 |
|
|
|
b69e47 |
/* Do whatever we can to make sure the data is ok. */
|
|
|
b69e47 |
/* There is an error here. We check the new val against our current mem-alloc
|
|
|
b69e47 |
@@ -108,7 +108,13 @@ ldbm_instance_config_cachememsize_set(void *arg, void *value, char *errorbuf, in
|
|
|
b69e47 |
if (apply) {
|
|
|
b69e47 |
if (val > inst->inst_cache.c_maxsize) {
|
|
|
b69e47 |
delta = val - inst->inst_cache.c_maxsize;
|
|
|
b69e47 |
- if (!util_is_cachesize_sane(&delta)){
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ util_cachesize_result sane;
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
+ sane = util_is_cachesize_sane(mi, &delta);
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (sane != UTIL_CACHESIZE_VALID){
|
|
|
b69e47 |
slapi_create_errormsg(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: cachememsize value is too large.");
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "ldbm_instance_config_cachememsize_set", "cachememsize value is too large.\n");
|
|
|
b69e47 |
return LDAP_UNWILLING_TO_PERFORM;
|
|
|
b69e47 |
@@ -134,7 +140,7 @@ ldbm_instance_config_dncachememsize_set(void *arg, void *value, char *errorbuf,
|
|
|
b69e47 |
ldbm_instance *inst = (ldbm_instance *) arg;
|
|
|
b69e47 |
int retval = LDAP_SUCCESS;
|
|
|
b69e47 |
size_t val = (size_t)value;
|
|
|
b69e47 |
- size_t delta = 0;
|
|
|
b69e47 |
+ uint64_t delta = 0;
|
|
|
b69e47 |
|
|
|
b69e47 |
/* Do whatever we can to make sure the data is ok. */
|
|
|
b69e47 |
/* There is an error here. We check the new val against our current mem-alloc
|
|
|
b69e47 |
@@ -150,7 +156,13 @@ ldbm_instance_config_dncachememsize_set(void *arg, void *value, char *errorbuf,
|
|
|
b69e47 |
if (apply) {
|
|
|
b69e47 |
if (val > inst->inst_dncache.c_maxsize) {
|
|
|
b69e47 |
delta = val - inst->inst_dncache.c_maxsize;
|
|
|
b69e47 |
- if (!util_is_cachesize_sane(&delta)){
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ util_cachesize_result sane;
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
+ sane = util_is_cachesize_sane(mi, &delta);
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (sane != UTIL_CACHESIZE_VALID){
|
|
|
b69e47 |
slapi_create_errormsg(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE,
|
|
|
b69e47 |
"Error: dncachememsize value is too large.");
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR,"ldbm_instance_config_dncachememsize_set",
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
|
|
|
b69e47 |
index a78d850..533273b 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c
|
|
|
b69e47 |
@@ -142,7 +142,7 @@ ldbm_back_modrdn( Slapi_PBlock *pb )
|
|
|
b69e47 |
|
|
|
b69e47 |
if (pb->pb_conn)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_modrdn", "enter conn=%" NSPRIu64 " op=%d\n",
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_modrdn", "enter conn=%" PRIu64 " op=%d\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, operation->o_opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -1539,7 +1539,7 @@ common_return:
|
|
|
b69e47 |
if (pb->pb_conn)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_TRACE, "ldbm_back_modrdn",
|
|
|
b69e47 |
- "leave conn=%" NSPRIu64 " op=%d\n",
|
|
|
b69e47 |
+ "leave conn=%" PRIu64 " op=%d\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, operation->o_opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
return retval;
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
|
|
|
b69e47 |
index a6c3b74..cfb0d6b 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
|
|
|
b69e47 |
@@ -407,7 +407,7 @@ ldbm_back_search( Slapi_PBlock *pb )
|
|
|
b69e47 |
slapi_pblock_get(pb, SLAPI_OPERATION_ID, &op_id);
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_WARNING,
|
|
|
b69e47 |
- "ldbm_back_search", "Sort control ignored for conn=%" NSPRIu64 " op=%d\n",
|
|
|
b69e47 |
+ "ldbm_back_search", "Sort control ignored for conn=%" PRIu64 " op=%d\n",
|
|
|
b69e47 |
conn_id, op_id);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
@@ -442,7 +442,7 @@ ldbm_back_search( Slapi_PBlock *pb )
|
|
|
b69e47 |
slapi_pblock_get(pb, SLAPI_OPERATION_ID, &op_id);
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_WARNING,
|
|
|
b69e47 |
- "ldbm_back_search", "VLV control ignored for conn=%" NSPRIu64 " op=%d\n",
|
|
|
b69e47 |
+ "ldbm_back_search", "VLV control ignored for conn=%" PRIu64 " op=%d\n",
|
|
|
b69e47 |
conn_id, op_id);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/misc.c b/ldap/servers/slapd/back-ldbm/misc.c
|
|
|
b69e47 |
index 5268087..7192b3a 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/misc.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/misc.c
|
|
|
b69e47 |
@@ -54,7 +54,7 @@ void ldbm_log_access_message(Slapi_PBlock *pblock,char *string)
|
|
|
b69e47 |
return;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
operation_id = operation->o_opid;
|
|
|
b69e47 |
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d %s\n",
|
|
|
b69e47 |
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d %s\n",
|
|
|
b69e47 |
connection_id, operation_id, string);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/monitor.c b/ldap/servers/slapd/back-ldbm/monitor.c
|
|
|
b69e47 |
index 757792b..c58b069 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/monitor.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/monitor.c
|
|
|
b69e47 |
@@ -101,9 +101,9 @@ int ldbm_back_monitor_instance_search(Slapi_PBlock *pb, Slapi_Entry *e,
|
|
|
b69e47 |
/* fetch cache statistics */
|
|
|
b69e47 |
cache_get_stats(&(inst->inst_dncache), &hits, &tries,
|
|
|
b69e47 |
&nentries, &maxentries, &size, &maxsize);
|
|
|
b69e47 |
- sprintf(buf, "%" NSPRIu64, hits);
|
|
|
b69e47 |
+ sprintf(buf, "%" PRIu64, hits);
|
|
|
b69e47 |
MSET("dnCacheHits");
|
|
|
b69e47 |
- sprintf(buf, "%" NSPRIu64, tries);
|
|
|
b69e47 |
+ sprintf(buf, "%" PRIu64, tries);
|
|
|
b69e47 |
MSET("dnCacheTries");
|
|
|
b69e47 |
sprintf(buf, "%lu", (unsigned long)(100.0*(double)hits / (double)(tries > 0 ? tries : 1)));
|
|
|
b69e47 |
MSET("dnCacheHitRatio");
|
|
|
b69e47 |
@@ -119,11 +119,11 @@ int ldbm_back_monitor_instance_search(Slapi_PBlock *pb, Slapi_Entry *e,
|
|
|
b69e47 |
/* normalized dn cache stats */
|
|
|
b69e47 |
if(ndn_cache_started()){
|
|
|
b69e47 |
ndn_cache_get_stats(&hits, &tries, &size, &maxsize, &count);
|
|
|
b69e47 |
- sprintf(buf, "%" NSPRIu64, tries);
|
|
|
b69e47 |
+ sprintf(buf, "%" PRIu64, tries);
|
|
|
b69e47 |
MSET("normalizedDnCacheTries");
|
|
|
b69e47 |
- sprintf(buf, "%" NSPRIu64, hits);
|
|
|
b69e47 |
+ sprintf(buf, "%" PRIu64, hits);
|
|
|
b69e47 |
MSET("normalizedDnCacheHits");
|
|
|
b69e47 |
- sprintf(buf, "%" NSPRIu64, (tries - hits));
|
|
|
b69e47 |
+ sprintf(buf, "%" PRIu64, (tries - hits));
|
|
|
b69e47 |
MSET("normalizedDnCacheMisses");
|
|
|
b69e47 |
sprintf(buf, "%lu", (unsigned long)(100.0*(double)hits / (double)(tries > 0 ? tries : 1)));
|
|
|
b69e47 |
MSET("normalizedDnCacheHitRatio");
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/perfctrs.h b/ldap/servers/slapd/back-ldbm/perfctrs.h
|
|
|
b69e47 |
index 57be1d1..64c79e1 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/perfctrs.h
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/perfctrs.h
|
|
|
b69e47 |
@@ -11,7 +11,7 @@
|
|
|
b69e47 |
# include <config.h>
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
|
|
|
b69e47 |
-#include <inttypes.h>
|
|
|
b69e47 |
+#include <slapi_pal.h>
|
|
|
b69e47 |
|
|
|
b69e47 |
/* Structure definition for performance data */
|
|
|
b69e47 |
/* This stuff goes in shared memory, so make sure the packing is consistent */
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c
|
|
|
b69e47 |
index 1ae9858..a207bd8 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/back-ldbm/start.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/back-ldbm/start.c
|
|
|
b69e47 |
@@ -32,34 +32,25 @@ ldbm_back_start_autotune(struct ldbminfo *li) {
|
|
|
b69e47 |
Object *inst_obj = NULL;
|
|
|
b69e47 |
ldbm_instance *inst = NULL;
|
|
|
b69e47 |
/* size_t is a platform unsigned int, IE uint64_t */
|
|
|
b69e47 |
- size_t total_cache_size = 0;
|
|
|
b69e47 |
- size_t pagesize = 0;
|
|
|
b69e47 |
- size_t pages = 0;
|
|
|
b69e47 |
- size_t procpages __attribute__((unused)) = 0;
|
|
|
b69e47 |
- size_t availpages = 0;
|
|
|
b69e47 |
- size_t cache_size_to_configure = 0;
|
|
|
b69e47 |
- size_t zone_pages = 0;
|
|
|
b69e47 |
- size_t db_pages = 0;
|
|
|
b69e47 |
- size_t entry_pages = 0;
|
|
|
b69e47 |
- size_t import_pages = 0;
|
|
|
b69e47 |
- size_t zone_size = 0;
|
|
|
b69e47 |
- size_t import_size = 0;
|
|
|
b69e47 |
- size_t cache_size = 0;
|
|
|
b69e47 |
- size_t db_size = 0;
|
|
|
b69e47 |
+ uint64_t total_cache_size = 0;
|
|
|
b69e47 |
+ uint64_t entry_size = 0;
|
|
|
b69e47 |
+ uint64_t zone_size = 0;
|
|
|
b69e47 |
+ uint64_t import_size = 0;
|
|
|
b69e47 |
+ uint64_t cache_size = 0;
|
|
|
b69e47 |
+ uint64_t db_size = 0;
|
|
|
b69e47 |
/* For clamping the autotune value to a 64Mb boundary */
|
|
|
b69e47 |
- size_t clamp_pages = 0;
|
|
|
b69e47 |
- size_t clamp_div = 0;
|
|
|
b69e47 |
- size_t clamp_mod = 0;
|
|
|
b69e47 |
+ uint64_t clamp_div = 0;
|
|
|
b69e47 |
/* Backend count */
|
|
|
b69e47 |
- size_t backend_count = 0;
|
|
|
b69e47 |
+ uint64_t backend_count = 0;
|
|
|
b69e47 |
|
|
|
b69e47 |
int_fast32_t autosize_percentage = 0;
|
|
|
b69e47 |
int_fast32_t autosize_db_percentage_split = 0;
|
|
|
b69e47 |
int_fast32_t import_percentage = 0;
|
|
|
b69e47 |
- int32_t issane = 0;
|
|
|
b69e47 |
+ util_cachesize_result issane;
|
|
|
b69e47 |
char *msg = ""; /* This will be set by one of the two cache sizing paths below. */
|
|
|
b69e47 |
char size_to_str[32]; /* big enough to hold %ld */
|
|
|
b69e47 |
|
|
|
b69e47 |
+
|
|
|
b69e47 |
/* == Begin autotune == */
|
|
|
b69e47 |
|
|
|
b69e47 |
/*
|
|
|
b69e47 |
@@ -120,42 +111,34 @@ ldbm_back_start_autotune(struct ldbminfo *li) {
|
|
|
b69e47 |
return SLAPI_FAIL_GENERAL;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
- if (util_info_sys_pages(&pagesize, &pages, &procpages, &availpages) != 0) {
|
|
|
b69e47 |
+ /* Get our platform memory values. */
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
+ if (mi == NULL) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CRIT, "ldbm_back_start", "Unable to determine system page limits\n");
|
|
|
b69e47 |
return SLAPI_FAIL_GENERAL;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
- if (pagesize == 0) {
|
|
|
b69e47 |
- /* If this happens, we are in a very bad state indeed... */
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CRIT, "ldbm_back_start", "Unable to determine system page size\n");
|
|
|
b69e47 |
- return SLAPI_FAIL_GENERAL;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
-
|
|
|
b69e47 |
/* calculate the needed values */
|
|
|
b69e47 |
- zone_pages = (autosize_percentage * pages) / 100;
|
|
|
b69e47 |
- zone_size = zone_pages * pagesize;
|
|
|
b69e47 |
+ zone_size = (autosize_percentage * mi->system_total_bytes) / 100;
|
|
|
b69e47 |
/* This is how much we "might" use, lets check it's sane. */
|
|
|
b69e47 |
/* In the case it is not, this will *reduce* the allocation */
|
|
|
b69e47 |
- issane = util_is_cachesize_sane(&zone_size);
|
|
|
b69e47 |
- if (!issane) {
|
|
|
b69e47 |
+ issane = util_is_cachesize_sane(mi, &zone_size);
|
|
|
b69e47 |
+ if (issane == UTIL_CACHESIZE_REDUCED) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "Your autosized cache values have been reduced. Likely your nsslapd-cache-autosize percentage is too high.\n");
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "%s", msg);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
/* It's valid, lets divide it up and set according to user prefs */
|
|
|
b69e47 |
- zone_pages = zone_size / pagesize;
|
|
|
b69e47 |
- db_pages = (autosize_db_percentage_split * zone_pages) / 100;
|
|
|
b69e47 |
+ db_size = (autosize_db_percentage_split * zone_size) / 100;
|
|
|
b69e47 |
|
|
|
b69e47 |
/* Cap the DB size at 512MB, as this doesn't help perf much more (lkrispen's advice) */
|
|
|
b69e47 |
- if ((db_pages * pagesize) > (512 * MEGABYTE)) {
|
|
|
b69e47 |
- db_pages = (512 * MEGABYTE) / pagesize;
|
|
|
b69e47 |
+ if (db_size > (512 * MEGABYTE)) {
|
|
|
b69e47 |
+ db_size = (512 * MEGABYTE);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
if (backend_count > 0 ) {
|
|
|
b69e47 |
/* Number of entry cache pages per backend. */
|
|
|
b69e47 |
- entry_pages = (zone_pages - db_pages) / backend_count;
|
|
|
b69e47 |
+ entry_size = (zone_size - db_size) / backend_count;
|
|
|
b69e47 |
/* Now, clamp this value to a 64mb boundary. */
|
|
|
b69e47 |
- /* How many pages are in 64mb? */
|
|
|
b69e47 |
- clamp_pages = (64 * MEGABYTE) / pagesize;
|
|
|
b69e47 |
/* Now divide the entry pages by this, and also mod. If mod != 0, we need
|
|
|
b69e47 |
* to add 1 to the diveded number. This should give us:
|
|
|
b69e47 |
* 510 * 1024 * 1024 == 510MB
|
|
|
b69e47 |
@@ -166,17 +149,15 @@ ldbm_back_start_autotune(struct ldbminfo *li) {
|
|
|
b69e47 |
* 130560 % 16384 = 15872 which is != 0
|
|
|
b69e47 |
* therfore 7 + 1, aka 8 * 16384 = 131072 pages = 536870912 bytes = 512MB.
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
- clamp_div = entry_pages / clamp_pages;
|
|
|
b69e47 |
- clamp_mod = entry_pages % clamp_pages;
|
|
|
b69e47 |
- if (clamp_mod != 0) {
|
|
|
b69e47 |
- /* If we want to clamp down, remove this line. This would change the above from 510mb -> 448mb. */
|
|
|
b69e47 |
- clamp_div += 1;
|
|
|
b69e47 |
- entry_pages = clamp_div * clamp_pages;
|
|
|
b69e47 |
+ if (entry_size % (64 * MEGABYTE) != 0) {
|
|
|
b69e47 |
+ /* If we want to clamp down, remove the "+1". This would change the above from 510mb -> 448mb. */
|
|
|
b69e47 |
+ clamp_div = (entry_size / (64 * MEGABYTE)) + 1;
|
|
|
b69e47 |
+ entry_size = clamp_div * (64 * MEGABYTE);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %luk physical memory\n", pages*(pagesize/1024));
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %luk avaliable\n", zone_pages*(pagesize/1024));
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %luk physical memory\n", mi->system_total_bytes / 1024);
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %luk avaliable\n", mi->system_available_bytes / 1024);
|
|
|
b69e47 |
|
|
|
b69e47 |
/* We've now calculated the autotuning values. Do we need to apply it?
|
|
|
b69e47 |
* we use the logic of "if size is 0, or autosize is > 0. This way three
|
|
|
b69e47 |
@@ -191,13 +172,12 @@ ldbm_back_start_autotune(struct ldbminfo *li) {
|
|
|
b69e47 |
|
|
|
b69e47 |
/* First, check the dbcache */
|
|
|
b69e47 |
if (li->li_dbcachesize == 0 || li->li_cache_autosize > 0) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: db cache: %luk\n", db_pages*(pagesize/1024));
|
|
|
b69e47 |
- cache_size_to_configure = (unsigned long)(db_pages * pagesize);
|
|
|
b69e47 |
- if (cache_size_to_configure < (500 * MEGABYTE)) {
|
|
|
b69e47 |
- cache_size_to_configure = (unsigned long)((db_pages * pagesize) / 1.25);
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: db cache: %luk\n", db_size / 1024);
|
|
|
b69e47 |
+ if (db_size < (500 * MEGABYTE)) {
|
|
|
b69e47 |
+ db_size = db_size / 1.25;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
/* Have to set this value through text. */
|
|
|
b69e47 |
- sprintf(size_to_str, "%lu", cache_size_to_configure);
|
|
|
b69e47 |
+ sprintf(size_to_str, "%" PRIu64 , db_size);
|
|
|
b69e47 |
ldbm_config_internal_set(li, CONFIG_DBCACHESIZE, size_to_str);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
total_cache_size += li->li_dbcachesize;
|
|
|
b69e47 |
@@ -205,7 +185,7 @@ ldbm_back_start_autotune(struct ldbminfo *li) {
|
|
|
b69e47 |
/* For each backend */
|
|
|
b69e47 |
/* apply the appropriate cache size if 0 */
|
|
|
b69e47 |
if (backend_count > 0 ) {
|
|
|
b69e47 |
- li->li_cache_autosize_ec = (unsigned long)entry_pages * pagesize;
|
|
|
b69e47 |
+ li->li_cache_autosize_ec = entry_size;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
for (inst_obj = objset_first_obj(li->li_instance_set); inst_obj;
|
|
|
b69e47 |
@@ -220,7 +200,7 @@ ldbm_back_start_autotune(struct ldbminfo *li) {
|
|
|
b69e47 |
* it's highly unlikely.
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
if (cache_size == 0 || cache_size == MINCACHESIZE || li->li_cache_autosize > 0) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: %s entry cache (%lu total): %luk\n", inst->inst_name, backend_count, entry_pages*(pagesize/1024));
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: %s entry cache (%lu total): %luk\n", inst->inst_name, backend_count, entry_size / 1024);
|
|
|
b69e47 |
cache_set_max_entries(&(inst->inst_cache), -1);
|
|
|
b69e47 |
cache_set_max_size(&(inst->inst_cache), li->li_cache_autosize_ec, CACHE_TYPE_ENTRY);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -229,8 +209,8 @@ ldbm_back_start_autotune(struct ldbminfo *li) {
|
|
|
b69e47 |
db_size = dblayer_get_id2entry_size(inst);
|
|
|
b69e47 |
if (cache_size < db_size) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start",
|
|
|
b69e47 |
- "%s: entry cache size %lu B is "
|
|
|
b69e47 |
- "less than db size %lu B; "
|
|
|
b69e47 |
+ "%s: entry cache size %"PRIu64" B is "
|
|
|
b69e47 |
+ "less than db size %"PRIu64" B; "
|
|
|
b69e47 |
"We recommend to increase the entry cache size "
|
|
|
b69e47 |
"nsslapd-cachememsize.\n",
|
|
|
b69e47 |
inst->inst_name, cache_size, db_size);
|
|
|
b69e47 |
@@ -244,37 +224,36 @@ ldbm_back_start_autotune(struct ldbminfo *li) {
|
|
|
b69e47 |
/* autosizing importCache */
|
|
|
b69e47 |
if (li->li_import_cache_autosize > 0) {
|
|
|
b69e47 |
/* Use import percentage here, as it's been corrected for -1 behaviour */
|
|
|
b69e47 |
- import_pages = (import_percentage * pages) / 100;
|
|
|
b69e47 |
- import_size = import_pages * pagesize;
|
|
|
b69e47 |
- issane = util_is_cachesize_sane(&import_size);
|
|
|
b69e47 |
- if (!issane) {
|
|
|
b69e47 |
+ import_size = (import_percentage * mi->system_total_bytes) / 100;
|
|
|
b69e47 |
+ issane = util_is_cachesize_sane(mi, &import_size);
|
|
|
b69e47 |
+ if (issane == UTIL_CACHESIZE_REDUCED) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "Your autosized import cache values have been reduced. Likely your nsslapd-import-cache-autosize percentage is too high.\n");
|
|
|
b69e47 |
}
|
|
|
b69e47 |
/* We just accept the reduced allocation here. */
|
|
|
b69e47 |
- import_pages = import_size / pagesize;
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: import cache: %luk\n",
|
|
|
b69e47 |
- import_pages*(pagesize/1024));
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: import cache: %"PRIu64"k\n", import_size / 1024);
|
|
|
b69e47 |
|
|
|
b69e47 |
- sprintf(size_to_str, "%lu", (unsigned long)(import_pages * pagesize));
|
|
|
b69e47 |
+ sprintf(size_to_str, "%"PRIu64, import_size);
|
|
|
b69e47 |
ldbm_config_internal_set(li, CONFIG_IMPORT_CACHESIZE, size_to_str);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
/* Finally, lets check that the total result is sane. */
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "total cache size: %lu B; \n", total_cache_size);
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "total cache size: %"PRIu64" B; \n", total_cache_size);
|
|
|
b69e47 |
|
|
|
b69e47 |
- issane = util_is_cachesize_sane(&total_cache_size);
|
|
|
b69e47 |
- if (!issane) {
|
|
|
b69e47 |
+ issane = util_is_cachesize_sane(mi, &total_cache_size);
|
|
|
b69e47 |
+ if (issane != UTIL_CACHESIZE_VALID) {
|
|
|
b69e47 |
/* Right, it's time to panic */
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "It is highly likely your memory configuration of all backends will EXCEED your systems memory.\n");
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "In a future release this WILL prevent server start up. You MUST alter your configuration.\n");
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "Total entry cache size: %lu B; dbcache size: %lu B; available memory size: %lu B; \n",
|
|
|
b69e47 |
- (PRUint64)total_cache_size, (PRUint64)li->li_dbcachesize, availpages * pagesize
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "Total entry cache size: %"PRIu64" B; dbcache size: %"PRIu64" B; available memory size: %"PRIu64" B; \n",
|
|
|
b69e47 |
+ total_cache_size, (uint64_t)li->li_dbcachesize, mi->system_available_bytes
|
|
|
b69e47 |
);
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_WARNING, "ldbm_back_start", "%s\n", msg);
|
|
|
b69e47 |
/* WB 2016 - This should be UNCOMMENTED in a future release */
|
|
|
b69e47 |
/* return SLAPI_FAIL_GENERAL; */
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
/* == End autotune == */
|
|
|
b69e47 |
return 0;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
|
|
|
b69e47 |
index f83df7d..648a0f9 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/bind.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/bind.c
|
|
|
b69e47 |
@@ -853,25 +853,25 @@ log_bind_access (
|
|
|
b69e47 |
{
|
|
|
b69e47 |
if (method == LDAP_AUTH_SASL && saslmech && msg) {
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
|
|
|
b69e47 |
"method=sasl version=%d mech=%s, %s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
|
|
|
b69e47 |
version, saslmech, msg );
|
|
|
b69e47 |
} else if (method == LDAP_AUTH_SASL && saslmech) {
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
|
|
|
b69e47 |
"method=sasl version=%d mech=%s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
|
|
|
b69e47 |
version, saslmech );
|
|
|
b69e47 |
} else if (msg) {
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
|
|
|
b69e47 |
"method=%" BERTAG_T " version=%d, %s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
|
|
|
b69e47 |
method, version, msg );
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d BIND dn=\"%s\" "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d BIND dn=\"%s\" "
|
|
|
b69e47 |
"method=%" BERTAG_T " version=%d\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid, dn,
|
|
|
b69e47 |
method, version );
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/compare.c b/ldap/servers/slapd/compare.c
|
|
|
b69e47 |
index 07ded98..3c03053 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/compare.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/compare.c
|
|
|
b69e47 |
@@ -111,7 +111,7 @@ do_compare( Slapi_PBlock *pb )
|
|
|
b69e47 |
rawdn, ava.ava_type, 0 );
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d CMP dn=\"%s\" attr=\"%s\"\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d CMP dn=\"%s\" attr=\"%s\"\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid, dn, ava.ava_type );
|
|
|
b69e47 |
|
|
|
b69e47 |
/*
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
|
|
|
b69e47 |
index 7c83c66..359b59a 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/connection.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/connection.c
|
|
|
b69e47 |
@@ -411,7 +411,7 @@ connection_reset(Connection* conn, int ns, PRNetAddr * from, int fromLen, int is
|
|
|
b69e47 |
|
|
|
b69e47 |
/* log useful stuff to our access log */
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " fd=%d slot=%d %sconnection from %s to %s\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " fd=%d slot=%d %sconnection from %s to %s\n",
|
|
|
b69e47 |
conn->c_connid, conn->c_sd, ns, pTmp, str_ip, str_destip );
|
|
|
b69e47 |
|
|
|
b69e47 |
/* initialize the remaining connection fields */
|
|
|
b69e47 |
@@ -511,7 +511,7 @@ connection_need_new_password(const Connection *conn, const Operation *op, Slapi_
|
|
|
b69e47 |
op->o_tag != LDAP_REQ_ABANDON && op->o_tag != LDAP_REQ_EXTENDED)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_add_pwd_control ( pb, LDAP_CONTROL_PWEXPIRED, 0);
|
|
|
b69e47 |
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d %s\n",
|
|
|
b69e47 |
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d %s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid,
|
|
|
b69e47 |
"UNPROCESSED OPERATION - need new password" );
|
|
|
b69e47 |
send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM,
|
|
|
b69e47 |
@@ -562,7 +562,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
|
|
|
b69e47 |
(op->o_tag != LDAP_REQ_EXTENDED) && (op->o_tag != LDAP_REQ_UNBIND) &&
|
|
|
b69e47 |
(op->o_tag != LDAP_REQ_ABANDON)) {
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d UNPROCESSED OPERATION"
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d UNPROCESSED OPERATION"
|
|
|
b69e47 |
" - Insufficient SSF (local_ssf=%d sasl_ssf=%d ssl_ssf=%d)\n",
|
|
|
b69e47 |
conn->c_connid, op->o_opid, conn->c_local_ssf,
|
|
|
b69e47 |
conn->c_sasl_ssf, conn->c_ssl_ssf );
|
|
|
b69e47 |
@@ -591,7 +591,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
|
|
|
b69e47 |
(op->o_tag != LDAP_REQ_ABANDON) && (op->o_tag != LDAP_REQ_SEARCH))))
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d UNPROCESSED OPERATION"
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d UNPROCESSED OPERATION"
|
|
|
b69e47 |
" - Anonymous access not allowed\n",
|
|
|
b69e47 |
conn->c_connid, op->o_opid );
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -650,7 +650,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
|
|
|
b69e47 |
int ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
|
|
|
b69e47 |
if (ret < 0) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "connection_dispatch_operation",
|
|
|
b69e47 |
- "Failed to set TCP_CORK on connection %" NSPRIu64 "\n",conn->c_connid);
|
|
|
b69e47 |
+ "Failed to set TCP_CORK on connection %" PRIu64 "\n",conn->c_connid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
pop_cork = 1;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -664,7 +664,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
|
|
|
b69e47 |
int ret = setsockopt(conn->c_sd,IPPROTO_TCP,TCP_CORK,&i,sizeof(i));
|
|
|
b69e47 |
if (ret < 0) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "connection_dispatch_operation",
|
|
|
b69e47 |
- "Failed to clear TCP_CORK on connection %" NSPRIu64 "\n",conn->c_connid);
|
|
|
b69e47 |
+ "Failed to clear TCP_CORK on connection %" PRIu64 "\n",conn->c_connid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
}
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
@@ -690,7 +690,7 @@ connection_dispatch_operation(Connection *conn, Operation *op, Slapi_PBlock *pb)
|
|
|
b69e47 |
|
|
|
b69e47 |
default:
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR,
|
|
|
b69e47 |
- "connection_dispatch_operation", "Ignoring unknown LDAP request (conn=%" NSPRIu64 ", tag=0x%lx)\n",
|
|
|
b69e47 |
+ "connection_dispatch_operation", "Ignoring unknown LDAP request (conn=%" PRIu64 ", tag=0x%lx)\n",
|
|
|
b69e47 |
conn->c_connid, op->o_tag);
|
|
|
b69e47 |
break;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -702,7 +702,7 @@ int connection_release_nolock_ext (Connection *conn, int release_only)
|
|
|
b69e47 |
if (conn->c_refcnt <= 0)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "connection_release_nolock_ext",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " fd=%d Attempt to release connection that is not acquired\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " fd=%d Attempt to release connection that is not acquired\n",
|
|
|
b69e47 |
conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
PR_ASSERT (PR_FALSE);
|
|
|
b69e47 |
return -1;
|
|
|
b69e47 |
@@ -734,7 +734,7 @@ int connection_acquire_nolock_ext (Connection *conn, int allow_when_closing)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
/* This may happen while other threads are still working on this connection */
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "connection_acquire_nolock_ext",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
|
|
|
b69e47 |
conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
return -1;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -1070,7 +1070,7 @@ get_next_from_buffer( void *buffer, size_t buffer_size, ber_len_t *lenp,
|
|
|
b69e47 |
syserr = errno;
|
|
|
b69e47 |
/* Bad stuff happened, like the client sent us some junk */
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "get_next_from_buffer",
|
|
|
b69e47 |
- "ber_get_next failed for connection %" NSPRIu64 "\n", conn->c_connid);
|
|
|
b69e47 |
+ "ber_get_next failed for connection %" PRIu64 "\n", conn->c_connid);
|
|
|
b69e47 |
/* reset private buffer */
|
|
|
b69e47 |
conn->c_private->c_buffer_bytes = conn->c_private->c_buffer_offset = 0;
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -1232,7 +1232,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
|
|
|
b69e47 |
/* Otherwise we loop, unless we exceeded the ioblock timeout */
|
|
|
b69e47 |
if (waits_done > ioblocktimeout_waits) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS,"connection_read_operation",
|
|
|
b69e47 |
- "ioblocktimeout expired on connection %" NSPRIu64 "\n", conn->c_connid);
|
|
|
b69e47 |
+ "ioblocktimeout expired on connection %" PRIu64 "\n", conn->c_connid);
|
|
|
b69e47 |
disconnect_server_nomutex( conn, conn->c_connid, -1,
|
|
|
b69e47 |
SLAPD_DISCONNECT_IO_TIMEOUT, 0 );
|
|
|
b69e47 |
ret = CONN_DONE;
|
|
|
b69e47 |
@@ -1253,19 +1253,19 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
|
|
|
b69e47 |
err = PR_GetError();
|
|
|
b69e47 |
syserr = PR_GetOSError();
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "connection_read_operation",
|
|
|
b69e47 |
- "PR_Poll for connection %" NSPRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
|
|
|
b69e47 |
+ "PR_Poll for connection %" PRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
|
|
|
b69e47 |
/* If this happens we should close the connection */
|
|
|
b69e47 |
disconnect_server_nomutex( conn, conn->c_connid, -1, err, syserr );
|
|
|
b69e47 |
ret = CONN_DONE;
|
|
|
b69e47 |
goto done;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS,
|
|
|
b69e47 |
- "connection_read_operation", "connection %" NSPRIu64 " waited %d times for read to be ready\n", conn->c_connid, waits_done);
|
|
|
b69e47 |
+ "connection_read_operation", "connection %" PRIu64 " waited %d times for read to be ready\n", conn->c_connid, waits_done);
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
/* Some other error, typically meaning bad stuff */
|
|
|
b69e47 |
syserr = PR_GetOSError();
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "connection_read_operation",
|
|
|
b69e47 |
- "PR_Recv for connection %" NSPRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
|
|
|
b69e47 |
+ "PR_Recv for connection %" PRIu64 " returns %d (%s)\n", conn->c_connid, err, slapd_pr_strerror( err ) );
|
|
|
b69e47 |
/* If this happens we should close the connection */
|
|
|
b69e47 |
disconnect_server_nomutex( conn, conn->c_connid, -1, err, syserr );
|
|
|
b69e47 |
ret = CONN_DONE;
|
|
|
b69e47 |
@@ -1286,7 +1286,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
|
|
|
b69e47 |
}
|
|
|
b69e47 |
}
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS,
|
|
|
b69e47 |
- "connection_read_operation", "connection %" NSPRIu64 " read %d bytes\n", conn->c_connid, ret);
|
|
|
b69e47 |
+ "connection_read_operation", "connection %" PRIu64 " read %d bytes\n", conn->c_connid, ret);
|
|
|
b69e47 |
|
|
|
b69e47 |
new_operation = 0;
|
|
|
b69e47 |
ret = CONN_FOUND_WORK_TO_DO;
|
|
|
b69e47 |
@@ -1307,7 +1307,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
|
|
|
b69e47 |
* We received a non-LDAP message. Log and close connection.
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR,
|
|
|
b69e47 |
- "connection_read_operation", "conn=%" NSPRIu64 " received a non-LDAP message (tag 0x%lx, expected 0x%lx)\n",
|
|
|
b69e47 |
+ "connection_read_operation", "conn=%" PRIu64 " received a non-LDAP message (tag 0x%lx, expected 0x%lx)\n",
|
|
|
b69e47 |
conn->c_connid, *tag, LDAP_TAG_MESSAGE );
|
|
|
b69e47 |
disconnect_server_nomutex( conn, conn->c_connid, -1,
|
|
|
b69e47 |
SLAPD_DISCONNECT_BAD_BER_TAG, EPROTO );
|
|
|
b69e47 |
@@ -1319,7 +1319,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
|
|
|
b69e47 |
!= LDAP_TAG_MSGID ) {
|
|
|
b69e47 |
/* log, close and send error */
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR,
|
|
|
b69e47 |
- "connection_read_operation", "conn=%" NSPRIu64 " unable to read tag for incoming request\n", conn->c_connid);
|
|
|
b69e47 |
+ "connection_read_operation", "conn=%" PRIu64 " unable to read tag for incoming request\n", conn->c_connid);
|
|
|
b69e47 |
disconnect_server_nomutex( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BAD_BER_TAG, EPROTO );
|
|
|
b69e47 |
ret = CONN_DONE;
|
|
|
b69e47 |
goto done;
|
|
|
b69e47 |
@@ -1337,7 +1337,7 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
|
|
|
b69e47 |
case LDAP_TAG_LDAPDN: /* optional username, for CLDAP */
|
|
|
b69e47 |
/* log, close and send error */
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR,
|
|
|
b69e47 |
- "connection_read_operation", "conn=%" NSPRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, *tag);
|
|
|
b69e47 |
+ "connection_read_operation", "conn=%" PRIu64 " ber_peek_tag returns 0x%lx\n", conn->c_connid, *tag);
|
|
|
b69e47 |
disconnect_server_nomutex( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BER_PEEK, EPROTO );
|
|
|
b69e47 |
ret = CONN_DONE;
|
|
|
b69e47 |
goto done;
|
|
|
b69e47 |
@@ -1361,7 +1361,7 @@ void connection_make_readable(Connection *conn)
|
|
|
b69e47 |
void connection_make_readable_nolock(Connection *conn)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
conn->c_gettingber = 0;
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS, "connection_make_readable_nolock", "making readable conn %" NSPRIu64 " fd=%d\n",
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS, "connection_make_readable_nolock", "making readable conn %" PRIu64 " fd=%d\n",
|
|
|
b69e47 |
conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
if (!(conn->c_flags & CONN_FLAG_CLOSING)) {
|
|
|
b69e47 |
/* if the connection is closing, try the close in connection_release_nolock */
|
|
|
b69e47 |
@@ -1388,7 +1388,7 @@ void connection_check_activity_level(Connection *conn)
|
|
|
b69e47 |
/* update the last checked time */
|
|
|
b69e47 |
conn->c_private->previous_count_check_time = current_time();
|
|
|
b69e47 |
PR_ExitMonitor(conn->c_mutex);
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS,"connection_check_activity_level", "conn %" NSPRIu64 " activity level = %d\n",conn->c_connid,delta_count);
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS,"connection_check_activity_level", "conn %" PRIu64 " activity level = %d\n",conn->c_connid,delta_count);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
typedef struct table_iterate_info_struct {
|
|
|
b69e47 |
@@ -1450,7 +1450,7 @@ void connection_enter_leave_turbo(Connection *conn, int current_turbo_flag, int
|
|
|
b69e47 |
double activet = 0.0;
|
|
|
b69e47 |
connection_find_our_rank(conn,&connection_count, &our_rank);
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS,"connection_enter_leave_turbo",
|
|
|
b69e47 |
- "conn %" NSPRIu64 " turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count);
|
|
|
b69e47 |
+ "conn %" PRIu64 " turbo rank = %d out of %d conns\n",conn->c_connid,our_rank,connection_count);
|
|
|
b69e47 |
activet = (double)g_get_active_threadcnt();
|
|
|
b69e47 |
threshold_rank = (int)(activet * ((double)CONN_TURBO_PERCENTILE / 100.0));
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -1491,9 +1491,9 @@ void connection_enter_leave_turbo(Connection *conn, int current_turbo_flag, int
|
|
|
b69e47 |
PR_ExitMonitor(conn->c_mutex);
|
|
|
b69e47 |
if (current_mode != new_mode) {
|
|
|
b69e47 |
if (current_mode) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS,"connection_enter_leave_turbo", "conn %" NSPRIu64 " leaving turbo mode\n",conn->c_connid);
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS,"connection_enter_leave_turbo", "conn %" PRIu64 " leaving turbo mode\n",conn->c_connid);
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS,"connection_enter_leave_turbo", "conn %" NSPRIu64 " entering turbo mode\n",conn->c_connid);
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS,"connection_enter_leave_turbo", "conn %" PRIu64 " entering turbo mode\n",conn->c_connid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
}
|
|
|
b69e47 |
*new_turbo_flag = new_mode;
|
|
|
b69e47 |
@@ -1617,12 +1617,12 @@ connection_threadmain()
|
|
|
b69e47 |
ret = connection_read_operation(conn, op, &tag, &more_data);
|
|
|
b69e47 |
if ((ret == CONN_DONE) || (ret == CONN_TIMEDOUT)) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "connection_threadmain",
|
|
|
b69e47 |
- "conn %" NSPRIu64 " read not ready due to %d - thread_turbo_flag %d more_data %d "
|
|
|
b69e47 |
+ "conn %" PRIu64 " read not ready due to %d - thread_turbo_flag %d more_data %d "
|
|
|
b69e47 |
"ops_initiated %d refcnt %d flags %d\n", conn->c_connid, ret, thread_turbo_flag, more_data,
|
|
|
b69e47 |
conn->c_opsinitiated, conn->c_refcnt, conn->c_flags);
|
|
|
b69e47 |
} else if (ret == CONN_FOUND_WORK_TO_DO) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "connection_threadmain",
|
|
|
b69e47 |
- "conn %" NSPRIu64 " read operation successfully - thread_turbo_flag %d more_data %d "
|
|
|
b69e47 |
+ "conn %" PRIu64 " read operation successfully - thread_turbo_flag %d more_data %d "
|
|
|
b69e47 |
"ops_initiated %d refcnt %d flags %d\n", conn->c_connid, thread_turbo_flag, more_data,
|
|
|
b69e47 |
conn->c_opsinitiated, conn->c_refcnt, conn->c_flags);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -1648,7 +1648,7 @@ connection_threadmain()
|
|
|
b69e47 |
if (thread_turbo_flag && !WORK_Q_EMPTY) {
|
|
|
b69e47 |
thread_turbo_flag = 0;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS,"connection_threadmain",
|
|
|
b69e47 |
- "conn %" NSPRIu64 " leaving turbo mode - pb_q is not empty %d\n",
|
|
|
b69e47 |
+ "conn %" PRIu64 " leaving turbo mode - pb_q is not empty %d\n",
|
|
|
b69e47 |
conn->c_connid,work_q_size);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
@@ -1675,7 +1675,7 @@ connection_threadmain()
|
|
|
b69e47 |
* connection_make_readable(conn);
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS,"connection_threadmain",
|
|
|
b69e47 |
- "conn %" NSPRIu64 " leaving turbo mode due to %d\n",
|
|
|
b69e47 |
+ "conn %" PRIu64 " leaving turbo mode due to %d\n",
|
|
|
b69e47 |
conn->c_connid,ret);
|
|
|
b69e47 |
goto done;
|
|
|
b69e47 |
case CONN_SHUTDOWN:
|
|
|
b69e47 |
@@ -1732,7 +1732,7 @@ connection_threadmain()
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
conn->c_idlesince = curtime;
|
|
|
b69e47 |
connection_activity(conn, maxthreads);
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS,"connection_threadmain", "conn %" NSPRIu64 " queued because more_data\n",
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS,"connection_threadmain", "conn %" PRIu64 " queued because more_data\n",
|
|
|
b69e47 |
conn->c_connid);
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
/* keep count of how many times maxthreads has blocked an operation */
|
|
|
b69e47 |
@@ -1814,7 +1814,7 @@ done:
|
|
|
b69e47 |
/* If we're in turbo mode, we keep our reference to the connection alive */
|
|
|
b69e47 |
/* can't use the more_data var because connection could have changed in another thread */
|
|
|
b69e47 |
more_data = conn_buffered_data_avail_nolock(conn, &conn_closed) ? 1 : 0;
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS,"connection_threadmain", "conn %" NSPRIu64 " check more_data %d thread_turbo_flag %d\n",
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS,"connection_threadmain", "conn %" PRIu64 " check more_data %d thread_turbo_flag %d\n",
|
|
|
b69e47 |
conn->c_connid,more_data,thread_turbo_flag);
|
|
|
b69e47 |
if (!more_data) {
|
|
|
b69e47 |
if (!thread_turbo_flag) {
|
|
|
b69e47 |
@@ -1863,7 +1863,7 @@ connection_activity(Connection *conn, int maxthreads)
|
|
|
b69e47 |
|
|
|
b69e47 |
if (connection_acquire_nolock (conn) == -1) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS,
|
|
|
b69e47 |
- "connection_activity", "Could not acquire lock in connection_activity as conn %" NSPRIu64 " closing fd=%d\n",
|
|
|
b69e47 |
+ "connection_activity", "Could not acquire lock in connection_activity as conn %" PRIu64 " closing fd=%d\n",
|
|
|
b69e47 |
conn->c_connid,conn->c_sd);
|
|
|
b69e47 |
/* XXX how to handle this error? */
|
|
|
b69e47 |
/* MAB: 25 Jan 01: let's return on error and pray this won't leak */
|
|
|
b69e47 |
@@ -2046,7 +2046,7 @@ connection_remove_operation( Connection *conn, Operation *op )
|
|
|
b69e47 |
|
|
|
b69e47 |
if ( *tmp == NULL )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_ERR, "connection_remove_operation", "Can't find op %d for conn %" NSPRIu64 "\n",
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_ERR, "connection_remove_operation", "Can't find op %d for conn %" PRIu64 "\n",
|
|
|
b69e47 |
(int)op->o_msgid, conn->c_connid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
else
|
|
|
b69e47 |
@@ -2187,13 +2187,13 @@ log_ber_too_big_error(const Connection *conn, ber_len_t ber_len,
|
|
|
b69e47 |
}
|
|
|
b69e47 |
if (0 == ber_len) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "log_ber_too_big_error",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " fd=%d Incoming BER Element was too long, max allowable"
|
|
|
b69e47 |
+ "conn=%" PRIu64 " fd=%d Incoming BER Element was too long, max allowable"
|
|
|
b69e47 |
" is %" BERLEN_T " bytes. Change the nsslapd-maxbersize attribute in"
|
|
|
b69e47 |
" cn=config to increase.\n",
|
|
|
b69e47 |
conn->c_connid, conn->c_sd, maxbersize );
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "log_ber_too_big_error",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " fd=%d Incoming BER Element was %" BERLEN_T " bytes, max allowable"
|
|
|
b69e47 |
+ "conn=%" PRIu64 " fd=%d Incoming BER Element was %" BERLEN_T " bytes, max allowable"
|
|
|
b69e47 |
" is %" BERLEN_T " bytes. Change the nsslapd-maxbersize attribute in"
|
|
|
b69e47 |
" cn=config to increase.\n",
|
|
|
b69e47 |
conn->c_connid, conn->c_sd, ber_len, maxbersize );
|
|
|
b69e47 |
@@ -2224,7 +2224,7 @@ disconnect_server_nomutex_ext( Connection *conn, PRUint64 opconnid, int opid, PR
|
|
|
b69e47 |
if ( ( conn->c_sd != SLAPD_INVALID_SOCKET &&
|
|
|
b69e47 |
conn->c_connid == opconnid ) && !(conn->c_flags & CONN_FLAG_CLOSING) )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS, "disconnect_server_nomutex_ext", "Setting conn %" NSPRIu64 " fd=%d "
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS, "disconnect_server_nomutex_ext", "Setting conn %" PRIu64 " fd=%d "
|
|
|
b69e47 |
"to be disconnected: reason %d\n", conn->c_connid, conn->c_sd, reason);
|
|
|
b69e47 |
/*
|
|
|
b69e47 |
* PR_Close must be called before anything else is done because
|
|
|
b69e47 |
@@ -2248,13 +2248,13 @@ disconnect_server_nomutex_ext( Connection *conn, PRUint64 opconnid, int opid, PR
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
if (error && (EPIPE != error) ) {
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d fd=%d closed error %d (%s) - %s\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d fd=%d closed error %d (%s) - %s\n",
|
|
|
b69e47 |
conn->c_connid, opid, conn->c_sd, error,
|
|
|
b69e47 |
slapd_system_strerror(error),
|
|
|
b69e47 |
slapd_pr_strerror(reason));
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d fd=%d closed - %s\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d fd=%d closed - %s\n",
|
|
|
b69e47 |
conn->c_connid, opid, conn->c_sd,
|
|
|
b69e47 |
slapd_pr_strerror(reason));
|
|
|
b69e47 |
}
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c
|
|
|
b69e47 |
index bcafa4e..30da055 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/conntable.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/conntable.c
|
|
|
b69e47 |
@@ -395,7 +395,7 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
|
|
|
b69e47 |
* 3 = The number of operations attempted that were blocked
|
|
|
b69e47 |
* by max threads.
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
- snprintf(maxthreadbuf, sizeof(maxthreadbuf), "%d:%"NSPRIu64":%"NSPRIu64"",
|
|
|
b69e47 |
+ snprintf(maxthreadbuf, sizeof(maxthreadbuf), "%d:%"PRIu64":%"PRIu64"",
|
|
|
b69e47 |
maxthreadstate, ct->c[i].c_maxthreadscount,
|
|
|
b69e47 |
ct->c[i].c_maxthreadsblocked);
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -431,17 +431,17 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
|
|
|
b69e47 |
val.bv_len = strlen( buf );
|
|
|
b69e47 |
attrlist_replace( &e->e_attrs, "currentconnections", vals );
|
|
|
b69e47 |
|
|
|
b69e47 |
- snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(num_conns));
|
|
|
b69e47 |
+ snprintf( buf, sizeof(buf), "%" PRIu64, slapi_counter_get_value(num_conns));
|
|
|
b69e47 |
val.bv_val = buf;
|
|
|
b69e47 |
val.bv_len = strlen( buf );
|
|
|
b69e47 |
attrlist_replace( &e->e_attrs, "totalconnections", vals );
|
|
|
b69e47 |
|
|
|
b69e47 |
- snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(conns_in_maxthreads));
|
|
|
b69e47 |
+ snprintf( buf, sizeof(buf), "%" PRIu64, slapi_counter_get_value(conns_in_maxthreads));
|
|
|
b69e47 |
val.bv_val = buf;
|
|
|
b69e47 |
val.bv_len = strlen( buf );
|
|
|
b69e47 |
attrlist_replace( &e->e_attrs, "currentconnectionsatmaxthreads", vals );
|
|
|
b69e47 |
|
|
|
b69e47 |
- snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(max_threads_count));
|
|
|
b69e47 |
+ snprintf( buf, sizeof(buf), "%" PRIu64, slapi_counter_get_value(max_threads_count));
|
|
|
b69e47 |
val.bv_val = buf;
|
|
|
b69e47 |
val.bv_len = strlen( buf );
|
|
|
b69e47 |
attrlist_replace( &e->e_attrs, "maxthreadsperconnhits", vals );
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/control.c b/ldap/servers/slapd/control.c
|
|
|
b69e47 |
index 8f9e74e..52f2519 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/control.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/control.c
|
|
|
b69e47 |
@@ -335,7 +335,7 @@ get_ldapmessage_controls_ext(
|
|
|
b69e47 |
slapi_pblock_set(pb, SLAPI_REQCONTROLS, NULL);
|
|
|
b69e47 |
slapi_pblock_set(pb, SLAPI_MANAGEDSAIT, &ctrl_not_found);
|
|
|
b69e47 |
slapi_pblock_set(pb, SLAPI_PWPOLICY, &ctrl_not_found);
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS, "get_ldapmessage_controls_ext", "Warning: conn=%" NSPRIu64 " op=%d contains an empty list of controls\n",
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS, "get_ldapmessage_controls_ext", "Warning: conn=%" PRIu64 " op=%d contains an empty list of controls\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid);
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
/* len, ber_len_t is uint, not int, cannot be != -1, may be better to remove this check. */
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
|
|
|
b69e47 |
index a4ea4c0..5f2471e 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/daemon.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/daemon.c
|
|
|
b69e47 |
@@ -616,7 +616,7 @@ disk_monitoring_thread(void *nothing)
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
if(disk_space < 4096){ /* 4 k */
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ALERT, "disk_monitoring_thread", "Disk space is critically low on disk (%s), "
|
|
|
b69e47 |
- "remaining space: %" NSPRIu64 " Kb. Signaling slapd for shutdown...\n", dirstr , (disk_space / 1024));
|
|
|
b69e47 |
+ "remaining space: %" PRIu64 " Kb. Signaling slapd for shutdown...\n", dirstr , (disk_space / 1024));
|
|
|
b69e47 |
g_set_shutdown( SLAPI_SHUTDOWN_EXIT );
|
|
|
b69e47 |
return;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -626,7 +626,7 @@ disk_monitoring_thread(void *nothing)
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
if(verbose_logging != 0 && verbose_logging != LDAP_DEBUG_ANY){
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ALERT, "disk_monitoring_thread", "Disk space is low on disk (%s), remaining space: "
|
|
|
b69e47 |
- "%" NSPRIu64 " Kb, temporarily setting error loglevel to the default level(%d).\n", dirstr,
|
|
|
b69e47 |
+ "%" PRIu64 " Kb, temporarily setting error loglevel to the default level(%d).\n", dirstr,
|
|
|
b69e47 |
(disk_space / 1024), SLAPD_DEFAULT_ERRORLOG_LEVEL);
|
|
|
b69e47 |
/* Setting the log level back to zero, actually sets the value to LDAP_DEBUG_ANY */
|
|
|
b69e47 |
config_set_errorlog_level(CONFIG_LOGLEVEL_ATTRIBUTE,
|
|
|
b69e47 |
@@ -640,7 +640,7 @@ disk_monitoring_thread(void *nothing)
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
if(!logs_disabled && !logging_critical){
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ALERT, "disk_monitoring_thread", "Disk space is too low on disk (%s), remaining "
|
|
|
b69e47 |
- "space: %" NSPRIu64 " Kb, disabling access and audit logging.\n", dirstr, (disk_space / 1024));
|
|
|
b69e47 |
+ "space: %" PRIu64 " Kb, disabling access and audit logging.\n", dirstr, (disk_space / 1024));
|
|
|
b69e47 |
config_set_accesslog_enabled(LOGGING_OFF);
|
|
|
b69e47 |
config_set_auditlog_enabled(LOGGING_OFF);
|
|
|
b69e47 |
config_set_auditfaillog_enabled(LOGGING_OFF);
|
|
|
b69e47 |
@@ -653,7 +653,7 @@ disk_monitoring_thread(void *nothing)
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
if(!deleted_rotated_logs && !logging_critical){
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ALERT, "disk_monitoring_thread", "Disk space is too low on disk (%s), remaining "
|
|
|
b69e47 |
- "space: %" NSPRIu64 " Kb, deleting rotated logs.\n", dirstr, (disk_space / 1024));
|
|
|
b69e47 |
+ "space: %" PRIu64 " Kb, deleting rotated logs.\n", dirstr, (disk_space / 1024));
|
|
|
b69e47 |
log__delete_rotated_logs();
|
|
|
b69e47 |
deleted_rotated_logs = 1;
|
|
|
b69e47 |
continue;
|
|
|
b69e47 |
@@ -663,7 +663,7 @@ disk_monitoring_thread(void *nothing)
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
if(disk_space < previous_mark){
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ALERT, "disk_monitoring_thread", "Disk space is too low on disk (%s), remaining "
|
|
|
b69e47 |
- "space: %" NSPRIu64 " Kb\n", dirstr, (disk_space / 1024));
|
|
|
b69e47 |
+ "space: %" PRIu64 " Kb\n", dirstr, (disk_space / 1024));
|
|
|
b69e47 |
}
|
|
|
b69e47 |
/*
|
|
|
b69e47 |
*
|
|
|
b69e47 |
@@ -674,7 +674,7 @@ disk_monitoring_thread(void *nothing)
|
|
|
b69e47 |
*
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
if(disk_space < halfway){
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_ALERT, "disk_monitoring_thread", "Disk space on (%s) is too far below the threshold(%" NSPRIu64 " bytes). "
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_ALERT, "disk_monitoring_thread", "Disk space on (%s) is too far below the threshold(%" PRIu64 " bytes). "
|
|
|
b69e47 |
"Waiting %d minutes for disk space to be cleaned up before shutting slapd down...\n",
|
|
|
b69e47 |
dirstr, threshold, (grace_period / 60));
|
|
|
b69e47 |
time(&start;;
|
|
|
b69e47 |
@@ -697,7 +697,7 @@ disk_monitoring_thread(void *nothing)
|
|
|
b69e47 |
* Excellent, we are back to acceptable levels, reset everything...
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_INFO, "disk_monitoring_thread", "Available disk space is now "
|
|
|
b69e47 |
- "acceptable (%" NSPRIu64 " bytes). Aborting shutdown, and restoring the log settings.\n",
|
|
|
b69e47 |
+ "acceptable (%" PRIu64 " bytes). Aborting shutdown, and restoring the log settings.\n",
|
|
|
b69e47 |
disk_space);
|
|
|
b69e47 |
if(logs_disabled && using_accesslog){
|
|
|
b69e47 |
config_set_accesslog_enabled(LOGGING_ON);
|
|
|
b69e47 |
@@ -721,7 +721,7 @@ disk_monitoring_thread(void *nothing)
|
|
|
b69e47 |
* Disk space is critical, log an error, and shut it down now!
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ALERT, "disk_monitoring_thread", "Disk space is critically low "
|
|
|
b69e47 |
- "on disk (%s), remaining space: %" NSPRIu64 " Kb. Signaling slapd for shutdown...\n",
|
|
|
b69e47 |
+ "on disk (%s), remaining space: %" PRIu64 " Kb. Signaling slapd for shutdown...\n",
|
|
|
b69e47 |
dirstr, (disk_space / 1024));
|
|
|
b69e47 |
g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
|
|
|
b69e47 |
return;
|
|
|
b69e47 |
@@ -739,7 +739,7 @@ disk_monitoring_thread(void *nothing)
|
|
|
b69e47 |
* If disk space was freed up we would of detected in the above while loop. So shut it down.
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ALERT, "disk_monitoring_thread", "Disk space is still too low "
|
|
|
b69e47 |
- "(%" NSPRIu64 " Kb). Signaling slapd for shutdown...\n", (disk_space / 1024));
|
|
|
b69e47 |
+ "(%" PRIu64 " Kb). Signaling slapd for shutdown...\n", (disk_space / 1024));
|
|
|
b69e47 |
g_set_shutdown( SLAPI_SHUTDOWN_DISKFULL );
|
|
|
b69e47 |
|
|
|
b69e47 |
return;
|
|
|
b69e47 |
@@ -1785,7 +1785,7 @@ handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll)
|
|
|
b69e47 |
* trying to acquire a closing connection
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR,
|
|
|
b69e47 |
- "handle_pr_read_ready", "connection_activity: abandoning conn %" NSPRIu64 " as "
|
|
|
b69e47 |
+ "handle_pr_read_ready", "connection_activity: abandoning conn %" PRIu64 " as "
|
|
|
b69e47 |
"fd=%d is already closing\n", c->c_connid,c->c_sd);
|
|
|
b69e47 |
/* The call disconnect_server should do nothing,
|
|
|
b69e47 |
* as the connection c should be already set to CLOSING */
|
|
|
b69e47 |
@@ -1843,7 +1843,7 @@ ns_handle_closure(struct ns_job_t *job)
|
|
|
b69e47 |
#else
|
|
|
b69e47 |
/* This doesn't actually confirm it's in the event loop thread, but it's a start */
|
|
|
b69e47 |
if (NS_JOB_IS_THREAD(ns_job_get_type(job)) != 0) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_ERR, "ns_handle_closure", "Attempt to close outside of event loop thread %" NSPRIu64 " for fd=%d\n",
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_ERR, "ns_handle_closure", "Attempt to close outside of event loop thread %" PRIu64 " for fd=%d\n",
|
|
|
b69e47 |
c->c_connid, c->c_sd);
|
|
|
b69e47 |
return;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -1883,7 +1883,7 @@ ns_connection_post_io_or_closing(Connection *conn)
|
|
|
b69e47 |
PR_ASSERT((conn->c_ns_close_jobs == 0) || (conn->c_ns_close_jobs == 1));
|
|
|
b69e47 |
if (conn->c_ns_close_jobs) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ns_connection_post_io_or_closing", "Already a close "
|
|
|
b69e47 |
- "job in progress on conn %" NSPRIu64 " for fd=%d\n", conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
+ "job in progress on conn %" PRIu64 " for fd=%d\n", conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
return;
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
/* just make sure we schedule the event to be closed in a timely manner */
|
|
|
b69e47 |
@@ -1898,10 +1898,10 @@ ns_connection_post_io_or_closing(Connection *conn)
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
if (job_result != PR_SUCCESS) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_WARNING, "ns_connection_post_io_or_closing", "post closure job "
|
|
|
b69e47 |
- "for conn %" NSPRIu64 " for fd=%d failed to be added to event queue\n", conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
+ "for conn %" PRIu64 " for fd=%d failed to be added to event queue\n", conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ns_connection_post_io_or_closing", "post closure job "
|
|
|
b69e47 |
- "for conn %" NSPRIu64 " for fd=%d\n", conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
+ "for conn %" PRIu64 " for fd=%d\n", conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -1938,10 +1938,10 @@ ns_connection_post_io_or_closing(Connection *conn)
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
if (job_result != PR_SUCCESS) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_WARNING, "ns_connection_post_io_or_closing", "post I/O job for "
|
|
|
b69e47 |
- "conn %" NSPRIu64 " for fd=%d failed to be added to event queue\n", conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
+ "conn %" PRIu64 " for fd=%d failed to be added to event queue\n", conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ns_connection_post_io_or_closing", "post I/O job for "
|
|
|
b69e47 |
- "conn %" NSPRIu64 " for fd=%d\n", conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
+ "conn %" PRIu64 " for fd=%d\n", conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
}
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
@@ -1964,14 +1964,14 @@ ns_handle_pr_read_ready(struct ns_job_t *job)
|
|
|
b69e47 |
#else
|
|
|
b69e47 |
/* This doesn't actually confirm it's in the event loop thread, but it's a start */
|
|
|
b69e47 |
if (NS_JOB_IS_THREAD(ns_job_get_type(job)) != 0) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_ERR, "ns_handle_pr_read_ready", "Attempt to handle read ready outside of event loop thread %" NSPRIu64 " for fd=%d\n",
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_ERR, "ns_handle_pr_read_ready", "Attempt to handle read ready outside of event loop thread %" PRIu64 " for fd=%d\n",
|
|
|
b69e47 |
c->c_connid, c->c_sd);
|
|
|
b69e47 |
return;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
|
|
|
b69e47 |
PR_EnterMonitor(c->c_mutex);
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS, "ns_handle_pr_read_ready", "activity on conn %" NSPRIu64 " for fd=%d\n",
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS, "ns_handle_pr_read_ready", "activity on conn %" PRIu64 " for fd=%d\n",
|
|
|
b69e47 |
c->c_connid, c->c_sd);
|
|
|
b69e47 |
/* if we were called due to some i/o event, see what the state of the socket is */
|
|
|
b69e47 |
if (slapi_is_loglevel_set(SLAPI_LOG_CONNS) && !NS_JOB_IS_TIMER(ns_job_get_output_type(job)) && c && c->c_sd) {
|
|
|
b69e47 |
@@ -1980,16 +1980,16 @@ ns_handle_pr_read_ready(struct ns_job_t *job)
|
|
|
b69e47 |
ssize_t rc = recv(c->c_sd, buf, sizeof(buf), MSG_PEEK);
|
|
|
b69e47 |
if (!rc) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ns_handle_pr_read_ready", "socket is closed conn"
|
|
|
b69e47 |
- " %" NSPRIu64 " for fd=%d\n", c->c_connid, c->c_sd);
|
|
|
b69e47 |
+ " %" PRIu64 " for fd=%d\n", c->c_connid, c->c_sd);
|
|
|
b69e47 |
} else if (rc > 0) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ns_handle_pr_read_ready", "socket read data available"
|
|
|
b69e47 |
- " for conn %" NSPRIu64 " for fd=%d\n", c->c_connid, c->c_sd);
|
|
|
b69e47 |
+ " for conn %" PRIu64 " for fd=%d\n", c->c_connid, c->c_sd);
|
|
|
b69e47 |
} else if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ns_handle_pr_read_ready", "socket has no data available"
|
|
|
b69e47 |
- " conn %" NSPRIu64 " for fd=%d\n", c->c_connid, c->c_sd);
|
|
|
b69e47 |
+ " conn %" PRIu64 " for fd=%d\n", c->c_connid, c->c_sd);
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ns_handle_pr_read_ready", "socket has error [%d] "
|
|
|
b69e47 |
- "conn %" NSPRIu64 " for fd=%d\n", errno, c->c_connid, c->c_sd);
|
|
|
b69e47 |
+ "conn %" PRIu64 " for fd=%d\n", errno, c->c_connid, c->c_sd);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
}
|
|
|
b69e47 |
connection_release_nolock_ext(c, 1); /* release ref acquired when job was added */
|
|
|
b69e47 |
@@ -2013,7 +2013,7 @@ ns_handle_pr_read_ready(struct ns_job_t *job)
|
|
|
b69e47 |
* trying to acquire a closing connection
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "ns_handle_pr_read_ready", "connection_activity: abandoning"
|
|
|
b69e47 |
- " conn %" NSPRIu64 " as fd=%d is already closing\n", c->c_connid, c->c_sd);
|
|
|
b69e47 |
+ " conn %" PRIu64 " as fd=%d is already closing\n", c->c_connid, c->c_sd);
|
|
|
b69e47 |
/* The call disconnect_server should do nothing,
|
|
|
b69e47 |
* as the connection c should be already set to CLOSING */
|
|
|
b69e47 |
disconnect_server_nomutex_ext(c, c->c_connid, -1,
|
|
|
b69e47 |
@@ -2021,7 +2021,7 @@ ns_handle_pr_read_ready(struct ns_job_t *job)
|
|
|
b69e47 |
0 /* do not schedule closure, do it next */);
|
|
|
b69e47 |
ns_handle_closure_nomutex(c);
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS, "ns_handle_pr_read_ready", "queued conn %" NSPRIu64 " for fd=%d\n",
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS, "ns_handle_pr_read_ready", "queued conn %" PRIu64 " for fd=%d\n",
|
|
|
b69e47 |
c->c_connid, c->c_sd);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
PR_ExitMonitor(c->c_mutex);
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/delete.c b/ldap/servers/slapd/delete.c
|
|
|
b69e47 |
index a16718a..e4e82a3 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/delete.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/delete.c
|
|
|
b69e47 |
@@ -260,7 +260,7 @@ static void op_shared_delete (Slapi_PBlock *pb)
|
|
|
b69e47 |
|
|
|
b69e47 |
if (!internal_op )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d DEL dn=\"%s\"%s\n",
|
|
|
b69e47 |
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d DEL dn=\"%s\"%s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid,
|
|
|
b69e47 |
pb->pb_op->o_opid,
|
|
|
b69e47 |
slapi_sdn_get_dn(sdn),
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
|
|
|
b69e47 |
index abacc57..b56e3da 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/entry.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/entry.c
|
|
|
b69e47 |
@@ -3095,7 +3095,7 @@ slapi_entry_attr_set_ulong( Slapi_Entry* e, const char *type, uint64_t l)
|
|
|
b69e47 |
struct berval *bvals[2];
|
|
|
b69e47 |
bvals[0] = &bv;
|
|
|
b69e47 |
bvals[1] = NULL;
|
|
|
b69e47 |
- sprintf(value,"%" NSPRIu64, l);
|
|
|
b69e47 |
+ sprintf(value,"%" PRIu64, l);
|
|
|
b69e47 |
bv.bv_val = value;
|
|
|
b69e47 |
bv.bv_len = strlen( value );
|
|
|
b69e47 |
slapi_entry_attr_replace( e, type, bvals );
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/extendop.c b/ldap/servers/slapd/extendop.c
|
|
|
b69e47 |
index 7e41b8c..6a5d2e3 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/extendop.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/extendop.c
|
|
|
b69e47 |
@@ -247,14 +247,14 @@ do_extended( Slapi_PBlock *pb )
|
|
|
b69e47 |
if ( NULL == ( name = extended_op_oid2string( extoid ))) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ARGS, "do_extended", "oid (%s)\n", extoid);
|
|
|
b69e47 |
|
|
|
b69e47 |
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d EXT oid=\"%s\"\n",
|
|
|
b69e47 |
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d EXT oid=\"%s\"\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid );
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ARGS, "do_extended", "oid (%s-%s)\n",
|
|
|
b69e47 |
extoid, name);
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d EXT oid=\"%s\" name=\"%s\"\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d EXT oid=\"%s\" name=\"%s\"\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid, extoid, name );
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/log.c b/ldap/servers/slapd/log.c
|
|
|
b69e47 |
index afedd5b..a63c6a6 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/log.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/log.c
|
|
|
b69e47 |
@@ -2769,7 +2769,7 @@ log__open_accesslogfile(int logfile_state, int locked)
|
|
|
b69e47 |
while ( logp) {
|
|
|
b69e47 |
log_convert_time (logp->l_ctime, tbuf, 1 /*short*/);
|
|
|
b69e47 |
PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
|
|
|
b69e47 |
- NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_access_file, tbuf,
|
|
|
b69e47 |
+ PRId64 "d)\n", PREVLOGFILE, loginfo.log_access_file, tbuf,
|
|
|
b69e47 |
logp->l_ctime, logp->l_size);
|
|
|
b69e47 |
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
|
|
|
b69e47 |
logp = logp->l_next;
|
|
|
b69e47 |
@@ -2907,7 +2907,7 @@ log_rotate:
|
|
|
b69e47 |
if (type == LOG_SIZE_EXCEEDED) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_TRACE, "log__needrotation",
|
|
|
b69e47 |
"LOGINFO:End of Log because size exceeded(Max:%"
|
|
|
b69e47 |
- NSPRI64 "d bytes) (Is:%" NSPRI64 "d bytes)\n",
|
|
|
b69e47 |
+ PRId64 "d bytes) (Is:%" PRId64 "d bytes)\n",
|
|
|
b69e47 |
maxlogsize, f_size);
|
|
|
b69e47 |
} else if ( type == LOG_EXPIRED) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_TRACE, "log__needrotation",
|
|
|
b69e47 |
@@ -4636,7 +4636,7 @@ log__open_errorlogfile(int logfile_state, int locked)
|
|
|
b69e47 |
while (logp) {
|
|
|
b69e47 |
log_convert_time (logp->l_ctime, tbuf, 1 /*short */);
|
|
|
b69e47 |
PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
|
|
|
b69e47 |
- NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_error_file, tbuf,
|
|
|
b69e47 |
+ PRId64 "d)\n", PREVLOGFILE, loginfo.log_error_file, tbuf,
|
|
|
b69e47 |
logp->l_ctime, logp->l_size);
|
|
|
b69e47 |
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
|
|
|
b69e47 |
logp = logp->l_next;
|
|
|
b69e47 |
@@ -4763,7 +4763,7 @@ log__open_auditlogfile(int logfile_state, int locked)
|
|
|
b69e47 |
while ( logp) {
|
|
|
b69e47 |
log_convert_time (logp->l_ctime, tbuf, 1 /*short */);
|
|
|
b69e47 |
PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
|
|
|
b69e47 |
- NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_audit_file, tbuf,
|
|
|
b69e47 |
+ PRId64 "d)\n", PREVLOGFILE, loginfo.log_audit_file, tbuf,
|
|
|
b69e47 |
logp->l_ctime, logp->l_size);
|
|
|
b69e47 |
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
|
|
|
b69e47 |
logp = logp->l_next;
|
|
|
b69e47 |
@@ -4889,7 +4889,7 @@ log__open_auditfaillogfile(int logfile_state, int locked)
|
|
|
b69e47 |
while ( logp) {
|
|
|
b69e47 |
log_convert_time (logp->l_ctime, tbuf, 1 /*short */);
|
|
|
b69e47 |
PR_snprintf(buffer, sizeof(buffer), "LOGINFO:%s%s.%s (%lu) (%"
|
|
|
b69e47 |
- NSPRI64 "d)\n", PREVLOGFILE, loginfo.log_auditfail_file, tbuf,
|
|
|
b69e47 |
+ PRId64 "d)\n", PREVLOGFILE, loginfo.log_auditfail_file, tbuf,
|
|
|
b69e47 |
logp->l_ctime, logp->l_size);
|
|
|
b69e47 |
LOG_WRITE(fpinfo, buffer, strlen(buffer), 0);
|
|
|
b69e47 |
logp = logp->l_next;
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/modify.c b/ldap/servers/slapd/modify.c
|
|
|
b69e47 |
index e23fe67..da66b44 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/modify.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/modify.c
|
|
|
b69e47 |
@@ -680,7 +680,7 @@ static void op_shared_modify (Slapi_PBlock *pb, int pw_change, char *old_pw)
|
|
|
b69e47 |
|
|
|
b69e47 |
if ( !internal_op )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s\n",
|
|
|
b69e47 |
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"%s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid,
|
|
|
b69e47 |
pb->pb_op->o_opid,
|
|
|
b69e47 |
slapi_sdn_get_dn(sdn),
|
|
|
b69e47 |
@@ -1227,7 +1227,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
|
|
|
b69e47 |
{
|
|
|
b69e47 |
if (operation_is_flag_set(operation,OP_FLAG_ACTION_LOG_ACCESS))
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"\n",
|
|
|
b69e47 |
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid,
|
|
|
b69e47 |
slapi_sdn_get_dn(&sdn));
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -1267,7 +1267,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
|
|
|
b69e47 |
if (proxydn){
|
|
|
b69e47 |
proxystr = slapi_ch_smprintf(" authzid=\"%s\"", proxydn);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s\n",
|
|
|
b69e47 |
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"%s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid,
|
|
|
b69e47 |
slapi_sdn_get_dn(&sdn), proxystr ? proxystr : "");
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -1312,7 +1312,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
|
|
|
b69e47 |
proxystr = slapi_ch_smprintf(" authzid=\"%s\"", proxydn);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
|
|
|
b69e47 |
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid,
|
|
|
b69e47 |
slapi_sdn_get_dn(&sdn),
|
|
|
b69e47 |
proxystr ? proxystr : "",
|
|
|
b69e47 |
@@ -1338,7 +1338,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
|
|
|
b69e47 |
|
|
|
b69e47 |
if ( !internal_op )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
|
|
|
b69e47 |
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid,
|
|
|
b69e47 |
pb->pb_op->o_opid,
|
|
|
b69e47 |
slapi_sdn_get_dn(&sdn),
|
|
|
b69e47 |
@@ -1381,7 +1381,7 @@ static int op_shared_allow_pw_change (Slapi_PBlock *pb, LDAPMod *mod, char **old
|
|
|
b69e47 |
|
|
|
b69e47 |
if ( !internal_op )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_access(LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
|
|
|
b69e47 |
+ slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d MOD dn=\"%s\"%s, %s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid,
|
|
|
b69e47 |
pb->pb_op->o_opid,
|
|
|
b69e47 |
slapi_sdn_get_dn(&sdn),
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/modrdn.c b/ldap/servers/slapd/modrdn.c
|
|
|
b69e47 |
index 15f5210..69cca40 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/modrdn.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/modrdn.c
|
|
|
b69e47 |
@@ -463,7 +463,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
|
|
|
b69e47 |
if ( !internal_op )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_access(LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"%s\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d MODRDN dn=\"%s\" newrdn=\"%s\" newsuperior=\"%s\"%s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid,
|
|
|
b69e47 |
pb->pb_op->o_opid,
|
|
|
b69e47 |
dn,
|
|
|
b69e47 |
@@ -497,7 +497,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
if ( !internal_op ) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ARGS, "op_shared_rename",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d MODRDN invalid new RDN (\"%s\")\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d MODRDN invalid new RDN (\"%s\")\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid,
|
|
|
b69e47 |
pb->pb_op->o_opid,
|
|
|
b69e47 |
(NULL == newrdn) ? "(null)" : newrdn);
|
|
|
b69e47 |
@@ -531,7 +531,7 @@ op_shared_rename(Slapi_PBlock *pb, int passin_args)
|
|
|
b69e47 |
"Syntax check of newSuperior failed\n");
|
|
|
b69e47 |
if (!internal_op) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ARGS, "op_shared_rename",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d MODRDN invalid new superior (\"%s\")",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d MODRDN invalid new superior (\"%s\")",
|
|
|
b69e47 |
pb->pb_conn->c_connid,
|
|
|
b69e47 |
pb->pb_op->o_opid,
|
|
|
b69e47 |
newsuperior ? newsuperior : "(null)");
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/monitor.c b/ldap/servers/slapd/monitor.c
|
|
|
b69e47 |
index f1fb38f..8d1788f 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/monitor.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/monitor.c
|
|
|
b69e47 |
@@ -60,19 +60,19 @@ monitor_info(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* entryAfter, int *ret
|
|
|
b69e47 |
|
|
|
b69e47 |
connection_table_as_entry(the_connection_table, e);
|
|
|
b69e47 |
|
|
|
b69e47 |
- val.bv_len = snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(ops_initiated) );
|
|
|
b69e47 |
+ val.bv_len = snprintf( buf, sizeof(buf), "%" PRIu64, slapi_counter_get_value(ops_initiated) );
|
|
|
b69e47 |
val.bv_val = buf;
|
|
|
b69e47 |
attrlist_replace( &e->e_attrs, "opsinitiated", vals );
|
|
|
b69e47 |
|
|
|
b69e47 |
- val.bv_len = snprintf( buf, sizeof(buf), "%" NSPRIu64, slapi_counter_get_value(ops_completed) );
|
|
|
b69e47 |
+ val.bv_len = snprintf( buf, sizeof(buf), "%" PRIu64, slapi_counter_get_value(ops_completed) );
|
|
|
b69e47 |
val.bv_val = buf;
|
|
|
b69e47 |
attrlist_replace( &e->e_attrs, "opscompleted", vals );
|
|
|
b69e47 |
|
|
|
b69e47 |
- val.bv_len = snprintf ( buf, sizeof(buf), "%" NSPRIu64, g_get_num_entries_sent() );
|
|
|
b69e47 |
+ val.bv_len = snprintf ( buf, sizeof(buf), "%" PRIu64, g_get_num_entries_sent() );
|
|
|
b69e47 |
val.bv_val = buf;
|
|
|
b69e47 |
attrlist_replace( &e->e_attrs, "entriessent", vals );
|
|
|
b69e47 |
|
|
|
b69e47 |
- val.bv_len = snprintf ( buf, sizeof(buf), "%" NSPRIu64, g_get_num_bytes_sent() );
|
|
|
b69e47 |
+ val.bv_len = snprintf ( buf, sizeof(buf), "%" PRIu64, g_get_num_bytes_sent() );
|
|
|
b69e47 |
val.bv_val = buf;
|
|
|
b69e47 |
attrlist_replace( &e->e_attrs, "bytessent", vals );
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/operation.c b/ldap/servers/slapd/operation.c
|
|
|
b69e47 |
index ccbc549..00fb9b8 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/operation.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/operation.c
|
|
|
b69e47 |
@@ -580,7 +580,7 @@ int slapi_connection_acquire(Slapi_Connection *conn)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
/* This may happen while other threads are still working on this connection */
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "slapi_connection_acquire",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " fd=%d Attempt to acquire connection in the closing state\n",
|
|
|
b69e47 |
conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
rc = -1;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -606,7 +606,7 @@ slapi_connection_remove_operation( Slapi_PBlock *pb, Slapi_Connection *conn, Sla
|
|
|
b69e47 |
if ( *tmp == NULL ) {
|
|
|
b69e47 |
if (op) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "slapi_connection_remove_operation",
|
|
|
b69e47 |
- "Can't find op %d for conn %" NSPRIu64 "\n",
|
|
|
b69e47 |
+ "Can't find op %d for conn %" PRIu64 "\n",
|
|
|
b69e47 |
(int)op->o_msgid, conn->c_connid);
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "slapi_connection_remove_operation",
|
|
|
b69e47 |
@@ -620,7 +620,7 @@ slapi_connection_remove_operation( Slapi_PBlock *pb, Slapi_Connection *conn, Sla
|
|
|
b69e47 |
/* connection_release_nolock(conn); */
|
|
|
b69e47 |
if (conn->c_refcnt <= 0) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "slapi_connection_remove_operation",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " fd=%d Attempt to release connection that is not acquired\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " fd=%d Attempt to release connection that is not acquired\n",
|
|
|
b69e47 |
conn->c_connid, conn->c_sd);
|
|
|
b69e47 |
rc = -1;
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
|
|
|
b69e47 |
index 3ce7970..4682a73 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/opshared.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/opshared.c
|
|
|
b69e47 |
@@ -289,7 +289,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
char *fmtstr;
|
|
|
b69e47 |
|
|
|
b69e47 |
-#define SLAPD_SEARCH_FMTSTR_BASE "conn=%" NSPRIu64 " op=%d SRCH base=\"%s\" scope=%d "
|
|
|
b69e47 |
+#define SLAPD_SEARCH_FMTSTR_BASE "conn=%" PRIu64 " op=%d SRCH base=\"%s\" scope=%d "
|
|
|
b69e47 |
#define SLAPD_SEARCH_FMTSTR_BASE_INT "conn=%s op=%d SRCH base=\"%s\" scope=%d "
|
|
|
b69e47 |
#define SLAPD_SEARCH_FMTSTR_REMAINDER " attrs=%s%s%s\n"
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -1744,7 +1744,7 @@ void op_shared_log_error_access (Slapi_PBlock *pb, const char *type, const char
|
|
|
b69e47 |
proxystr = slapi_ch_smprintf(" authzid=\"%s\"", proxydn);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d %s dn=\"%s\"%s, %s\n",
|
|
|
b69e47 |
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d %s dn=\"%s\"%s, %s\n",
|
|
|
b69e47 |
( pb->pb_conn ? pb->pb_conn->c_connid : 0),
|
|
|
b69e47 |
( pb->pb_op ? pb->pb_op->o_opid : 0),
|
|
|
b69e47 |
type,
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
|
|
|
b69e47 |
index a30e2fa..e8c80e7 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/pagedresults.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/pagedresults.c
|
|
|
b69e47 |
@@ -310,7 +310,7 @@ pagedresults_free_one( Connection *conn, Operation *op, int index )
|
|
|
b69e47 |
PR_EnterMonitor(conn->c_mutex);
|
|
|
b69e47 |
if (conn->c_pagedresults.prl_count <= 0) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_TRACE, "pagedresults_free_one",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " paged requests list count is %d\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " paged requests list count is %d\n",
|
|
|
b69e47 |
conn->c_connid, conn->c_pagedresults.prl_count);
|
|
|
b69e47 |
} else if (index < conn->c_pagedresults.prl_maxlen) {
|
|
|
b69e47 |
PagedResults *prp = conn->c_pagedresults.prl_list + index;
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/psearch.c b/ldap/servers/slapd/psearch.c
|
|
|
b69e47 |
index 793bea3..2d0badc 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/psearch.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/psearch.c
|
|
|
b69e47 |
@@ -283,7 +283,7 @@ ps_send_results( void *arg )
|
|
|
b69e47 |
|
|
|
b69e47 |
if (conn_acq_flag) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ps_send_results",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d Could not acquire the connection - psearch aborted\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d Could not acquire the connection - psearch aborted\n",
|
|
|
b69e47 |
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -293,7 +293,7 @@ ps_send_results( void *arg )
|
|
|
b69e47 |
/* Check for an abandoned operation */
|
|
|
b69e47 |
if ( ps->ps_pblock->pb_op == NULL || slapi_op_abandoned( ps->ps_pblock ) ) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ps_send_results",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d The operation has been abandoned\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d The operation has been abandoned\n",
|
|
|
b69e47 |
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid);
|
|
|
b69e47 |
break;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -351,7 +351,7 @@ ps_send_results( void *arg )
|
|
|
b69e47 |
ectrls, attrs, attrsonly );
|
|
|
b69e47 |
if (rc) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ps_send_results",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d Error %d sending entry %s with op status %d\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d Error %d sending entry %s with op status %d\n",
|
|
|
b69e47 |
ps->ps_pblock->pb_conn->c_connid, ps->ps_pblock->pb_op->o_opid,
|
|
|
b69e47 |
rc, slapi_entry_get_dn_const(ec), ps->ps_pblock->pb_op->o_status);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -400,7 +400,7 @@ ps_send_results( void *arg )
|
|
|
b69e47 |
PR_EnterMonitor(conn->c_mutex);
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ps_send_results",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d Releasing the connection and operation\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d Releasing the connection and operation\n",
|
|
|
b69e47 |
conn->c_connid, ps->ps_pblock->pb_op->o_opid);
|
|
|
b69e47 |
/* Delete this op from the connection's list */
|
|
|
b69e47 |
connection_remove_operation_ext( ps->ps_pblock, conn, ps->ps_pblock->pb_op );
|
|
|
b69e47 |
@@ -535,7 +535,7 @@ ps_service_persistent_searches( Slapi_Entry *e, Slapi_Entry *eprev, ber_int_t ch
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ps_service_persistent_searches",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d entry %s with chgtype %d "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d entry %s with chgtype %d "
|
|
|
b69e47 |
"matches the ps changetype %d\n",
|
|
|
b69e47 |
ps->ps_pblock->pb_conn->c_connid,
|
|
|
b69e47 |
ps->ps_pblock->pb_op->o_opid,
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c
|
|
|
b69e47 |
index 5c38bae..56257c3 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/result.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/result.c
|
|
|
b69e47 |
@@ -1980,7 +1980,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
|
|
|
b69e47 |
if ( !internal_op )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d RESULT err=%d"
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d RESULT err=%d"
|
|
|
b69e47 |
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
|
|
|
b69e47 |
", SASL bind in progress\n",
|
|
|
b69e47 |
op->o_connid,
|
|
|
b69e47 |
@@ -2012,7 +2012,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
|
|
|
b69e47 |
if ( !internal_op )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d RESULT err=%d"
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d RESULT err=%d"
|
|
|
b69e47 |
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
|
|
|
b69e47 |
" dn=\"%s\"\n",
|
|
|
b69e47 |
op->o_connid,
|
|
|
b69e47 |
@@ -2040,7 +2040,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
|
|
|
b69e47 |
if ( !internal_op )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d RESULT err=%d"
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d RESULT err=%d"
|
|
|
b69e47 |
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s"
|
|
|
b69e47 |
" pr_idx=%d pr_cookie=%d\n",
|
|
|
b69e47 |
op->o_connid,
|
|
|
b69e47 |
@@ -2073,7 +2073,7 @@ log_result( Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentrie
|
|
|
b69e47 |
ext_str = "";
|
|
|
b69e47 |
}
|
|
|
b69e47 |
slapi_log_access( LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d RESULT err=%d"
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d RESULT err=%d"
|
|
|
b69e47 |
" tag=%" BERTAG_T " nentries=%d etime=%s%s%s%s\n",
|
|
|
b69e47 |
op->o_connid,
|
|
|
b69e47 |
op->o_opid,
|
|
|
b69e47 |
@@ -2142,7 +2142,7 @@ log_entry( Operation *op, Slapi_Entry *e )
|
|
|
b69e47 |
|
|
|
b69e47 |
if ( !internal_op )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" NSPRIu64 " op=%d ENTRY dn=\"%s\"\n",
|
|
|
b69e47 |
+ slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" PRIu64 " op=%d ENTRY dn=\"%s\"\n",
|
|
|
b69e47 |
op->o_connid, op->o_opid,
|
|
|
b69e47 |
slapi_entry_get_dn_const(e));
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -2167,7 +2167,7 @@ log_referral( Operation *op )
|
|
|
b69e47 |
|
|
|
b69e47 |
if ( !internal_op )
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" NSPRIu64 " op=%d REFERRAL\n",
|
|
|
b69e47 |
+ slapi_log_access( LDAP_DEBUG_STATS2, "conn=%" PRIu64 " op=%d REFERRAL\n",
|
|
|
b69e47 |
op->o_connid, op->o_opid );
|
|
|
b69e47 |
}
|
|
|
b69e47 |
else
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/sasl_io.c b/ldap/servers/slapd/sasl_io.c
|
|
|
b69e47 |
index 1337e1c..9458083 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/sasl_io.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/sasl_io.c
|
|
|
b69e47 |
@@ -198,17 +198,17 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
|
|
|
b69e47 |
/* first we need the length bytes */
|
|
|
b69e47 |
ret = PR_Recv(fd->lower, buffer, amount, flags, timeout);
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet",
|
|
|
b69e47 |
- "Read sasl packet length returned %d on connection %" NSPRIu64 "\n",
|
|
|
b69e47 |
+ "Read sasl packet length returned %d on connection %" PRIu64 "\n",
|
|
|
b69e47 |
ret, c->c_connid);
|
|
|
b69e47 |
if (ret <= 0) {
|
|
|
b69e47 |
*err = PR_GetError();
|
|
|
b69e47 |
if (ret == 0) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet",
|
|
|
b69e47 |
- "Connection closed while reading sasl packet length on connection %" NSPRIu64 "\n",
|
|
|
b69e47 |
+ "Connection closed while reading sasl packet length on connection %" PRIu64 "\n",
|
|
|
b69e47 |
c->c_connid );
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet",
|
|
|
b69e47 |
- "Error reading sasl packet length on connection %" NSPRIu64 " %d:%s\n",
|
|
|
b69e47 |
+ "Error reading sasl packet length on connection %" PRIu64 " %d:%s\n",
|
|
|
b69e47 |
c->c_connid, *err, slapd_pr_strerror(*err) );
|
|
|
b69e47 |
}
|
|
|
b69e47 |
return ret;
|
|
|
b69e47 |
@@ -226,7 +226,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
|
|
|
b69e47 |
if (sp->encrypted_buffer_offset < sizeof(buffer)) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS,
|
|
|
b69e47 |
"sasl_io_start_packet", "Read only %d bytes of sasl packet "
|
|
|
b69e47 |
- "length on connection %" NSPRIu64 "\n", ret, c->c_connid );
|
|
|
b69e47 |
+ "length on connection %" PRIu64 "\n", ret, c->c_connid );
|
|
|
b69e47 |
#if defined(EWOULDBLOCK)
|
|
|
b69e47 |
errno = EWOULDBLOCK;
|
|
|
b69e47 |
#elif defined(EAGAIN)
|
|
|
b69e47 |
@@ -251,7 +251,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
|
|
|
b69e47 |
ber_len_t ber_len = 0;
|
|
|
b69e47 |
ber_tag_t tag = 0;
|
|
|
b69e47 |
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" NSPRIu64 " fd=%d "
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" PRIu64 " fd=%d "
|
|
|
b69e47 |
"Sent an LDAP message that was not encrypted.\n", c->c_connid,
|
|
|
b69e47 |
c->c_sd);
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -265,7 +265,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
|
|
|
b69e47 |
/* Is the ldap operation too large? */
|
|
|
b69e47 |
if(ber_len > maxbersize){
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "sasl_io_start_packet",
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " fd=%d Incoming BER Element was too long, max allowable "
|
|
|
b69e47 |
+ "conn=%" PRIu64 " fd=%d Incoming BER Element was too long, max allowable "
|
|
|
b69e47 |
"is %" BERLEN_T " bytes. Change the nsslapd-maxbersize attribute in "
|
|
|
b69e47 |
"cn=config to increase.\n",
|
|
|
b69e47 |
c->c_connid, c->c_sd, maxbersize );
|
|
|
b69e47 |
@@ -305,7 +305,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
|
|
|
b69e47 |
} else if (ret > 0) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS,
|
|
|
b69e47 |
"sasl_io_start_packet",
|
|
|
b69e47 |
- "Continued: read sasl packet length returned %d on connection %" NSPRIu64 "\n",
|
|
|
b69e47 |
+ "Continued: read sasl packet length returned %d on connection %" PRIu64 "\n",
|
|
|
b69e47 |
ret, c->c_connid);
|
|
|
b69e47 |
if((ret + sp->encrypted_buffer_offset) > sp->encrypted_buffer_size){
|
|
|
b69e47 |
sasl_io_resize_encrypted_buffer(sp, ret + sp->encrypted_buffer_offset);
|
|
|
b69e47 |
@@ -316,7 +316,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
|
|
|
b69e47 |
*err = PR_GetError();
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet",
|
|
|
b69e47 |
"Error reading sasl packet length on connection "
|
|
|
b69e47 |
- "%" NSPRIu64 " %d:%s\n", c->c_connid, *err, slapd_pr_strerror(*err) );
|
|
|
b69e47 |
+ "%" PRIu64 " %d:%s\n", c->c_connid, *err, slapd_pr_strerror(*err) );
|
|
|
b69e47 |
return ret;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -360,7 +360,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
|
|
|
b69e47 |
tag = *ber->ber_ptr++;
|
|
|
b69e47 |
if (*ber->ber_ptr == LDAP_REQ_UNBIND){
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" NSPRIu64 " fd=%d "
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" PRIu64 " fd=%d "
|
|
|
b69e47 |
"Received unencrypted UNBIND operation.\n", c->c_connid,
|
|
|
b69e47 |
c->c_sd);
|
|
|
b69e47 |
sp->encrypted_buffer_count = sp->encrypted_buffer_offset;
|
|
|
b69e47 |
@@ -368,7 +368,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
|
|
|
b69e47 |
ber_free(ber, 1);
|
|
|
b69e47 |
return SASL_IO_BUFFER_NOT_ENCRYPTED;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" NSPRIu64 " fd=%d "
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" PRIu64 " fd=%d "
|
|
|
b69e47 |
"Error: received an LDAP message (tag 0x%lx) that was not encrypted.\n",
|
|
|
b69e47 |
#ifdef USE_OPENLDAP
|
|
|
b69e47 |
c->c_connid, c->c_sd, (long unsigned int)tag);
|
|
|
b69e47 |
@@ -380,7 +380,7 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt
|
|
|
b69e47 |
|
|
|
b69e47 |
done:
|
|
|
b69e47 |
/* If we got here we have garbage, or a denied LDAP operation */
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" NSPRIu64 " fd=%d "
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet", "conn=%" PRIu64 " fd=%d "
|
|
|
b69e47 |
"Error: received an invalid message that was not encrypted.\n",
|
|
|
b69e47 |
c->c_connid, c->c_sd);
|
|
|
b69e47 |
|
|
|
b69e47 |
@@ -399,7 +399,7 @@ done:
|
|
|
b69e47 |
packet_length += sizeof(uint32_t);
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet",
|
|
|
b69e47 |
- "read sasl packet length %ld on connection %" NSPRIu64 "\n",
|
|
|
b69e47 |
+ "read sasl packet length %ld on connection %" PRIu64 "\n",
|
|
|
b69e47 |
packet_length, c->c_connid );
|
|
|
b69e47 |
|
|
|
b69e47 |
/* Check if the packet length is larger than our max allowed. A
|
|
|
b69e47 |
@@ -432,17 +432,17 @@ sasl_io_read_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt3
|
|
|
b69e47 |
size_t bytes_remaining_to_read = sp->encrypted_buffer_count - sp->encrypted_buffer_offset;
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS,
|
|
|
b69e47 |
- "sasl_io_read_packet", "Reading %lu bytes for connection %" NSPRIu64 "\n",
|
|
|
b69e47 |
+ "sasl_io_read_packet", "Reading %lu bytes for connection %" PRIu64 "\n",
|
|
|
b69e47 |
bytes_remaining_to_read, c->c_connid );
|
|
|
b69e47 |
ret = PR_Recv(fd->lower, sp->encrypted_buffer + sp->encrypted_buffer_offset, bytes_remaining_to_read, flags, timeout);
|
|
|
b69e47 |
if (ret <= 0) {
|
|
|
b69e47 |
*err = PR_GetError();
|
|
|
b69e47 |
if (ret == 0) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_read_packet",
|
|
|
b69e47 |
- "Connection closed while reading sasl packet on connection %" NSPRIu64 "\n", c->c_connid );
|
|
|
b69e47 |
+ "Connection closed while reading sasl packet on connection %" PRIu64 "\n", c->c_connid );
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_read_packet",
|
|
|
b69e47 |
- "Error reading sasl packet on connection %" NSPRIu64 " %d:%s\n",
|
|
|
b69e47 |
+ "Error reading sasl packet on connection %" PRIu64 " %d:%s\n",
|
|
|
b69e47 |
c->c_connid, *err, slapd_pr_strerror(*err) );
|
|
|
b69e47 |
}
|
|
|
b69e47 |
return ret;
|
|
|
b69e47 |
@@ -464,10 +464,10 @@ sasl_io_recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags,
|
|
|
b69e47 |
/* Do we have decrypted data buffered from 'before' ? */
|
|
|
b69e47 |
bytes_in_buffer = sp->decrypted_buffer_count - sp->decrypted_buffer_offset;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_recv",
|
|
|
b69e47 |
- "Connection %" NSPRIu64 " len %d bytes_in_buffer %lu\n",
|
|
|
b69e47 |
+ "Connection %" PRIu64 " len %d bytes_in_buffer %lu\n",
|
|
|
b69e47 |
c->c_connid, len, bytes_in_buffer );
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_recv",
|
|
|
b69e47 |
- "Connection %" NSPRIu64 " len %d encrypted buffer count %lu\n",
|
|
|
b69e47 |
+ "Connection %" PRIu64 " len %d encrypted buffer count %lu\n",
|
|
|
b69e47 |
c->c_connid, len, sp->encrypted_buffer_count );
|
|
|
b69e47 |
if (0 == bytes_in_buffer) {
|
|
|
b69e47 |
/* If there wasn't buffered decrypted data, we need to get some... */
|
|
|
b69e47 |
@@ -502,7 +502,7 @@ sasl_io_recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags,
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
if (!sasl_io_finished_packet(sp)) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_recv",
|
|
|
b69e47 |
- "Connection %" NSPRIu64 " - not finished reading packet yet\n", c->c_connid);
|
|
|
b69e47 |
+ "Connection %" PRIu64 " - not finished reading packet yet\n", c->c_connid);
|
|
|
b69e47 |
#if defined(EWOULDBLOCK)
|
|
|
b69e47 |
errno = EWOULDBLOCK;
|
|
|
b69e47 |
#elif defined(EAGAIN)
|
|
|
b69e47 |
@@ -516,7 +516,7 @@ sasl_io_recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags,
|
|
|
b69e47 |
const char *output_buffer = NULL;
|
|
|
b69e47 |
unsigned int output_length = 0;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_recv",
|
|
|
b69e47 |
- "Finished reading packet for connection %" NSPRIu64 "\n", c->c_connid );
|
|
|
b69e47 |
+ "Finished reading packet for connection %" PRIu64 "\n", c->c_connid );
|
|
|
b69e47 |
/* Now decode it */
|
|
|
b69e47 |
ret = sasl_decode(c->c_sasl_conn,sp->encrypted_buffer,sp->encrypted_buffer_count,&output_buffer,&output_length);
|
|
|
b69e47 |
/* even if decode fails, need re-initialize the encrypted_buffer */
|
|
|
b69e47 |
@@ -524,7 +524,7 @@ sasl_io_recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags,
|
|
|
b69e47 |
sp->encrypted_buffer_count = 0;
|
|
|
b69e47 |
if (SASL_OK == ret) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_recv",
|
|
|
b69e47 |
- "Decoded packet length %u for connection %" NSPRIu64 "\n", output_length, c->c_connid );
|
|
|
b69e47 |
+ "Decoded packet length %u for connection %" PRIu64 "\n", output_length, c->c_connid );
|
|
|
b69e47 |
if (output_length) {
|
|
|
b69e47 |
sasl_io_resize_decrypted_buffer(sp,output_length);
|
|
|
b69e47 |
memcpy(sp->decrypted_buffer,output_buffer,output_length);
|
|
|
b69e47 |
@@ -534,7 +534,7 @@ sasl_io_recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags,
|
|
|
b69e47 |
}
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "sasl_io_recv",
|
|
|
b69e47 |
- "Failed to decode packet for connection %" NSPRIu64 "\n", c->c_connid );
|
|
|
b69e47 |
+ "Failed to decode packet for connection %" PRIu64 "\n", c->c_connid );
|
|
|
b69e47 |
PR_SetError(PR_IO_ERROR, 0);
|
|
|
b69e47 |
return PR_FAILURE;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -552,11 +552,11 @@ sasl_io_recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags,
|
|
|
b69e47 |
sp->decrypted_buffer_offset = 0;
|
|
|
b69e47 |
sp->decrypted_buffer_count = 0;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_recv",
|
|
|
b69e47 |
- "All decrypted data returned for connection %" NSPRIu64 "\n", c->c_connid );
|
|
|
b69e47 |
+ "All decrypted data returned for connection %" PRIu64 "\n", c->c_connid );
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
sp->decrypted_buffer_offset += bytes_to_return;
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_recv",
|
|
|
b69e47 |
- "Returning %lu bytes to caller %lu bytes left to return for connection %" NSPRIu64 "\n",
|
|
|
b69e47 |
+ "Returning %lu bytes to caller %lu bytes left to return for connection %" PRIu64 "\n",
|
|
|
b69e47 |
bytes_to_return, sp->decrypted_buffer_count - sp->decrypted_buffer_offset, c->c_connid );
|
|
|
b69e47 |
}
|
|
|
b69e47 |
ret = bytes_to_return;
|
|
|
b69e47 |
@@ -772,11 +772,11 @@ sasl_io_enable(Connection *c, void *data /* UNUSED */)
|
|
|
b69e47 |
rv = PR_PushIOLayer(c->c_prfd, PR_TOP_IO_LAYER, layer);
|
|
|
b69e47 |
if (rv) {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_ERR, "sasl_io_enable",
|
|
|
b69e47 |
- "Error enabling sasl io on connection %" NSPRIu64 " %d:%s\n",
|
|
|
b69e47 |
+ "Error enabling sasl io on connection %" PRIu64 " %d:%s\n",
|
|
|
b69e47 |
c->c_connid, rv, slapd_pr_strerror(rv) );
|
|
|
b69e47 |
} else {
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_enable",
|
|
|
b69e47 |
- "Enabled sasl io on connection %" NSPRIu64 " \n", c->c_connid);
|
|
|
b69e47 |
+ "Enabled sasl io on connection %" PRIu64 " \n", c->c_connid);
|
|
|
b69e47 |
debug_print_layers(c->c_prfd);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
}
|
|
|
b69e47 |
@@ -794,7 +794,7 @@ sasl_io_cleanup(Connection *c, void *data /* UNUSED */)
|
|
|
b69e47 |
int ret = 0;
|
|
|
b69e47 |
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_cleanup",
|
|
|
b69e47 |
- "Connection %" NSPRIu64 "\n", c->c_connid);
|
|
|
b69e47 |
+ "Connection %" PRIu64 "\n", c->c_connid);
|
|
|
b69e47 |
|
|
|
b69e47 |
ret = sasl_pop_IO_layer(c->c_prfd, 0 /* do not close */);
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
|
|
|
b69e47 |
index 9e5d1f0..2d6fb64 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/saslbind.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/saslbind.c
|
|
|
b69e47 |
@@ -929,7 +929,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
|
|
|
b69e47 |
Slapi_Operation *operation;
|
|
|
b69e47 |
slapi_pblock_get( pb, SLAPI_OPERATION, &operation);
|
|
|
b69e47 |
slapi_log_err(SLAPI_LOG_CONNS, "ids_sasl_check_bind",
|
|
|
b69e47 |
- "cleaning up sasl IO conn=%" NSPRIu64 " op=%d complete=%d continuing=%d\n",
|
|
|
b69e47 |
+ "cleaning up sasl IO conn=%" PRIu64 " op=%d complete=%d continuing=%d\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, operation->o_opid,
|
|
|
b69e47 |
(pb->pb_conn->c_flags & CONN_FLAG_SASL_COMPLETE), continuing);
|
|
|
b69e47 |
/* reset flag */
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/search.c b/ldap/servers/slapd/search.c
|
|
|
b69e47 |
index 670347e..ea8b479 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/search.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/search.c
|
|
|
b69e47 |
@@ -380,7 +380,7 @@ free_and_return:;
|
|
|
b69e47 |
static void log_search_access (Slapi_PBlock *pb, const char *base, int scope, const char *fstr, const char *msg)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
slapi_log_access(LDAP_DEBUG_STATS,
|
|
|
b69e47 |
- "conn=%" NSPRIu64 " op=%d SRCH base=\"%s\" scope=%d filter=\"%s\", %s\n",
|
|
|
b69e47 |
+ "conn=%" PRIu64 " op=%d SRCH base=\"%s\" scope=%d filter=\"%s\", %s\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, pb->pb_op->o_opid,
|
|
|
b69e47 |
base, scope, fstr, msg ? msg : "");
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
|
|
|
b69e47 |
index 5871bf0..abfad20 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/slap.h
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/slap.h
|
|
|
b69e47 |
@@ -72,13 +72,8 @@ static char ptokPBE[34] = "Internal (Software) Token ";
|
|
|
b69e47 |
#include <sys/socket.h>
|
|
|
b69e47 |
#include <netinet/in.h>
|
|
|
b69e47 |
|
|
|
b69e47 |
-/* Required to get portable printf/scanf format macros */
|
|
|
b69e47 |
-#ifdef HAVE_INTTYPES_H
|
|
|
b69e47 |
-#include <inttypes.h>
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-#else
|
|
|
b69e47 |
-#error Need to define portable format macros such as PRIu64
|
|
|
b69e47 |
-#endif /* HAVE_INTTYPES_H */
|
|
|
b69e47 |
+/* Provides our int types and platform specific requirements. */
|
|
|
b69e47 |
+#include <slapi_pal.h>
|
|
|
b69e47 |
|
|
|
b69e47 |
#define LOG_INTERNAL_OP_CON_ID "Internal"
|
|
|
b69e47 |
#define LOG_INTERNAL_OP_OP_ID -1
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
|
|
|
b69e47 |
index 725fa1c..ec8917d 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/slapi-plugin.h
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/slapi-plugin.h
|
|
|
b69e47 |
@@ -27,6 +27,9 @@
|
|
|
b69e47 |
extern "C" {
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
|
|
|
b69e47 |
+/* Provides our int types and platform specific requirements. */
|
|
|
b69e47 |
+#include <slapi_pal.h>
|
|
|
b69e47 |
+
|
|
|
b69e47 |
#include "prtypes.h"
|
|
|
b69e47 |
#include "ldap.h"
|
|
|
b69e47 |
#include "prprf.h"
|
|
|
b69e47 |
@@ -57,17 +60,6 @@ NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...)
|
|
|
b69e47 |
;
|
|
|
b69e47 |
#endif
|
|
|
b69e47 |
|
|
|
b69e47 |
-/* NSPR uses the print macros a bit differently than ANSI C. We
|
|
|
b69e47 |
- * need to use ll for a 64-bit integer, even when a long is 64-bit.
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
-#if defined(HAVE_LONG_LONG) && PR_BYTES_PER_LONG == 8 && !defined(PR_ALTERNATE_INT64_TYPEDEF)
|
|
|
b69e47 |
-#define NSPRIu64 "lu"
|
|
|
b69e47 |
-#define NSPRI64 "l"
|
|
|
b69e47 |
-#else /* just assume long long is used */
|
|
|
b69e47 |
-#define NSPRIu64 "llu"
|
|
|
b69e47 |
-#define NSPRI64 "ll"
|
|
|
b69e47 |
-#endif
|
|
|
b69e47 |
-
|
|
|
b69e47 |
/* OpenLDAP uses unsigned long for ber_tag_t and ber_len_t but mozldap uses unsigned int */
|
|
|
b69e47 |
/* use this macro for printf statements for ber_tag_t and ber_len_t */
|
|
|
b69e47 |
#if defined(USE_OPENLDAP)
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h
|
|
|
b69e47 |
index dd180a7..0c76580 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/slapi-private.h
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/slapi-private.h
|
|
|
b69e47 |
@@ -30,6 +30,9 @@ extern "C" {
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
#include "slapi-plugin-compat4.h"
|
|
|
b69e47 |
|
|
|
b69e47 |
+/* slapi platform abstraction functions. */
|
|
|
b69e47 |
+#include <slapi_pal.h>
|
|
|
b69e47 |
+
|
|
|
b69e47 |
/* Define our internal logging macro */
|
|
|
b69e47 |
#define slapi_log_err(level, subsystem, fmt, ...)
|
|
|
b69e47 |
#ifdef LDAP_ERROR_LOGGING
|
|
|
b69e47 |
@@ -1363,26 +1366,33 @@ long long slapi_parse_duration_longlong(const char *value);
|
|
|
b69e47 |
int slapi_is_duration_valid(const char *value);
|
|
|
b69e47 |
|
|
|
b69e47 |
/**
|
|
|
b69e47 |
- * Populate the pointers with the system memory information.
|
|
|
b69e47 |
- * At this time, Linux is the only "reliable" system for returning these values
|
|
|
b69e47 |
- *
|
|
|
b69e47 |
- * \param pagesize Will return the system page size in bytes.
|
|
|
b69e47 |
- * \param pages The total number of memory pages on the system. May include swap pages depending on OS.
|
|
|
b69e47 |
- * \param procpages Number of memory pages our current process is consuming. May not be accurate on all platforms as this could be the VMSize rather than the actual number of consumed pages.
|
|
|
b69e47 |
- * \param availpages Number of available pages of memory on the system. Not all operating systems set this correctly.
|
|
|
b69e47 |
- *
|
|
|
b69e47 |
- * \return 0 on success, non-zero on failure to determine memory sizings.
|
|
|
b69e47 |
+ * Possible results of a cachesize check
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
-int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size_t *availpages);
|
|
|
b69e47 |
-
|
|
|
b69e47 |
+typedef enum _util_cachesize_result {
|
|
|
b69e47 |
+ /**
|
|
|
b69e47 |
+ * The requested cachesize was valid and can be used.
|
|
|
b69e47 |
+ */
|
|
|
b69e47 |
+ UTIL_CACHESIZE_VALID = 0,
|
|
|
b69e47 |
+ /**
|
|
|
b69e47 |
+ * The requested cachesize may cause OOM and was reduced.
|
|
|
b69e47 |
+ */
|
|
|
b69e47 |
+ UTIL_CACHESIZE_REDUCED = 1,
|
|
|
b69e47 |
+ /**
|
|
|
b69e47 |
+ * An error occured resolving the cache size. You must stop processing.
|
|
|
b69e47 |
+ */
|
|
|
b69e47 |
+ UTIL_CACHESIZE_ERROR = 2,
|
|
|
b69e47 |
+} util_cachesize_result;
|
|
|
b69e47 |
/**
|
|
|
b69e47 |
- * Determine if the requested cachesize will exceed the system memory limits causing an out of memory condition
|
|
|
b69e47 |
+ * Determine if the requested cachesize will exceed the system memory limits causing an out of memory condition. You must
|
|
|
b69e47 |
+ * check the result before proceeding to correctly use the cache.
|
|
|
b69e47 |
*
|
|
|
b69e47 |
+ * \param mi. The system memory infomation. You should retrieve this with spal_meminfo_get(), and destroy it after use.
|
|
|
b69e47 |
* \param cachesize. The requested allocation. If this value is greater than the memory available, this value will be REDUCED to be valid.
|
|
|
b69e47 |
*
|
|
|
b69e47 |
- * \return 0 if the size is "sane". 1 if the value will cause OOM and has been REDUCED
|
|
|
b69e47 |
+ * \return util_cachesize_result.
|
|
|
b69e47 |
+ * \sa util_cachesize_result, spal_meminfo_get
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
-int util_is_cachesize_sane(size_t *cachesize);
|
|
|
b69e47 |
+util_cachesize_result util_is_cachesize_sane(slapi_pal_meminfo *mi, size_t *cachesize);
|
|
|
b69e47 |
|
|
|
b69e47 |
/**
|
|
|
b69e47 |
* Retrieve the number of threads the server should run with based on this hardware.
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/slapi_pal.c b/ldap/servers/slapd/slapi_pal.c
|
|
|
b69e47 |
new file mode 100644
|
|
|
b69e47 |
index 0000000..91576ca
|
|
|
b69e47 |
--- /dev/null
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/slapi_pal.c
|
|
|
b69e47 |
@@ -0,0 +1,311 @@
|
|
|
b69e47 |
+/** BEGIN COPYRIGHT BLOCK
|
|
|
b69e47 |
+ * Copyright (C) 2017 Red Hat, Inc.
|
|
|
b69e47 |
+ * All rights reserved.
|
|
|
b69e47 |
+ *
|
|
|
b69e47 |
+ * License: GPL (version 3 or any later version).
|
|
|
b69e47 |
+ * See LICENSE for details.
|
|
|
b69e47 |
+ * END COPYRIGHT BLOCK **/
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+/*
|
|
|
b69e47 |
+ * Implementation of functions to abstract from platform
|
|
|
b69e47 |
+ * specific issues.
|
|
|
b69e47 |
+ */
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+/* Provide ch_malloc etc. */
|
|
|
b69e47 |
+#include <slapi-plugin.h>
|
|
|
b69e47 |
+/* Provide slapi_log_err macro wrapper */
|
|
|
b69e47 |
+#include <slapi-private.h>
|
|
|
b69e47 |
+#include <slapi_pal.h>
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+/* Assert macros */
|
|
|
b69e47 |
+#include <assert.h>
|
|
|
b69e47 |
+/* Access errno */
|
|
|
b69e47 |
+#include <errno.h>
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+/* For getpagesize */
|
|
|
b69e47 |
+#include <unistd.h>
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+/* For rlimit */
|
|
|
b69e47 |
+#include <sys/time.h>
|
|
|
b69e47 |
+#include <sys/resource.h>
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+#ifdef OS_solaris
|
|
|
b69e47 |
+#include <sys/procfs.h>
|
|
|
b69e47 |
+#endif
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+#if defined ( hpux )
|
|
|
b69e47 |
+#include <sys/pstat.h>
|
|
|
b69e47 |
+#endif
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+static int_fast32_t
|
|
|
b69e47 |
+_spal_rlimit_get(int resource, uint64_t *soft_limit, uint64_t *hard_limit) {
|
|
|
b69e47 |
+ struct rlimit rl = {0};
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (getrlimit(resource, &rl) != 0) {
|
|
|
b69e47 |
+ int errsrv = errno;
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_ERR, "_spal_rlimit_mem_get", "Failed to access system resource limits %d\n", errsrv);
|
|
|
b69e47 |
+ return 1;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (rl.rlim_cur != RLIM_INFINITY) {
|
|
|
b69e47 |
+ *soft_limit = (uint64_t)rl.rlim_cur;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+ if (rl.rlim_max != RLIM_INFINITY) {
|
|
|
b69e47 |
+ *hard_limit = (uint64_t)rl.rlim_max;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ return 0;
|
|
|
b69e47 |
+}
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+#ifdef LINUX
|
|
|
b69e47 |
+static int_fast32_t
|
|
|
b69e47 |
+_spal_uint64_t_file_get(char *name, char *prefix, uint64_t *dest) {
|
|
|
b69e47 |
+ FILE *f;
|
|
|
b69e47 |
+ char s[40] = {0};
|
|
|
b69e47 |
+ size_t prefix_len = 0;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (prefix != NULL) {
|
|
|
b69e47 |
+ prefix_len = strlen(prefix);
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ /* Make sure we can fit into our buffer */
|
|
|
b69e47 |
+ assert((prefix_len + 20) < 39);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ f = fopen(name, "r");
|
|
|
b69e47 |
+ if (!f) { /* fopen failed */
|
|
|
b69e47 |
+ int errsrv = errno;
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_ERR,"_spal_get_uint64_t_file", "Unable to open file \"%s\". errno=%d\n", name, errsrv);
|
|
|
b69e47 |
+ return 1;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ int_fast32_t retval = 0;
|
|
|
b69e47 |
+ while (! feof(f)) {
|
|
|
b69e47 |
+ if (!fgets(s, 39, f)) {
|
|
|
b69e47 |
+ retval = 1;
|
|
|
b69e47 |
+ break; /* error or eof */
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+ if (feof(f)) {
|
|
|
b69e47 |
+ retval = 1;
|
|
|
b69e47 |
+ break;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+ if (prefix_len > 0 && strncmp(s, prefix, prefix_len) == 0) {
|
|
|
b69e47 |
+ sscanf(s + prefix_len, "%"SCNu64, dest);
|
|
|
b69e47 |
+ break;
|
|
|
b69e47 |
+ } else if (prefix_len == 0) {
|
|
|
b69e47 |
+ sscanf(s, "%"SCNu64, dest);
|
|
|
b69e47 |
+ break;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+ fclose(f);
|
|
|
b69e47 |
+ return retval;
|
|
|
b69e47 |
+}
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+slapi_pal_meminfo *
|
|
|
b69e47 |
+spal_meminfo_get() {
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = (slapi_pal_meminfo *)slapi_ch_calloc(1, sizeof(slapi_pal_meminfo));
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ mi->pagesize_bytes = getpagesize();
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ /*
|
|
|
b69e47 |
+ * We have to compare values from a number of sources to ensure we have
|
|
|
b69e47 |
+ * the correct result.
|
|
|
b69e47 |
+ */
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ char f_proc_status[30] = {0};
|
|
|
b69e47 |
+ sprintf(f_proc_status, "/proc/%d/status", getpid());
|
|
|
b69e47 |
+ char *p_vmrss = "VmRSS:";
|
|
|
b69e47 |
+ uint64_t vmrss = 0;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (_spal_uint64_t_file_get(f_proc_status, p_vmrss, &vmrss)) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_ERR, "spal_meminfo_get", "Unable to retrieve vmrss\n");
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ /* vmrss is in kb, so convert to bytes */
|
|
|
b69e47 |
+ vmrss = vmrss * 1024;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ uint64_t rl_mem_soft = 0;
|
|
|
b69e47 |
+ uint64_t rl_mem_hard = 0;
|
|
|
b69e47 |
+ uint64_t rl_mem_soft_avail = 0;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (_spal_rlimit_get(RLIMIT_AS, &rl_mem_soft, &rl_mem_hard)) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_ERR, "spal_meminfo_get", "Unable to retrieve memory rlimit\n");
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (rl_mem_soft != 0 && vmrss != 0 && rl_mem_soft > vmrss) {
|
|
|
b69e47 |
+ rl_mem_soft_avail = rl_mem_soft - vmrss;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ char *f_meminfo = "/proc/meminfo";
|
|
|
b69e47 |
+ char *p_memtotal = "MemTotal:";
|
|
|
b69e47 |
+ char *p_memavail = "MemAvailable:";
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ uint64_t memtotal = 0;
|
|
|
b69e47 |
+ uint64_t memavail = 0;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (_spal_uint64_t_file_get(f_meminfo, p_memtotal, &memtotal)) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_ERR, "spal_meminfo_get", "Unable to retrieve %s : %s\n", f_meminfo, p_memtotal);
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (_spal_uint64_t_file_get(f_meminfo, p_memavail, &memavail)) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_ERR, "spal_meminfo_get", "Unable to retrieve %s : %s\n", f_meminfo, p_memavail);
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ /* Both memtotal and memavail are in kb */
|
|
|
b69e47 |
+ memtotal = memtotal * 1024;
|
|
|
b69e47 |
+ memavail = memavail * 1024;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ /* If it's possible, get our cgroup info */
|
|
|
b69e47 |
+ uint64_t cg_mem_soft = 0;
|
|
|
b69e47 |
+ uint64_t cg_mem_hard = 0;
|
|
|
b69e47 |
+ uint64_t cg_mem_usage = 0;
|
|
|
b69e47 |
+ uint64_t cg_mem_soft_avail = 0;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ char *f_cg_soft = "/sys/fs/cgroup/memory/memory.soft_limit_in_bytes";
|
|
|
b69e47 |
+ char *f_cg_hard = "/sys/fs/cgroup/memory/memory.limit_in_bytes";
|
|
|
b69e47 |
+ char *f_cg_usage = "/sys/fs/cgroup/memory/memory.usage_in_bytes";
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (_spal_uint64_t_file_get(f_cg_soft, NULL, &cg_mem_soft)) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "Unable to retrieve %s. There may be no cgroup support on this platform\n", f_cg_soft);
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (_spal_uint64_t_file_get(f_cg_hard, NULL, &cg_mem_hard)) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "Unable to retrieve %s. There may be no cgroup support on this platform\n", f_cg_hard);
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (_spal_uint64_t_file_get(f_cg_usage, NULL, &cg_mem_usage)) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_WARNING, "spal_meminfo_get", "Unable to retrieve %s. There may be no cgroup support on this platform\n", f_cg_hard);
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ /*
|
|
|
b69e47 |
+ * In some conditions, like docker, we only have a *hard* limit set.
|
|
|
b69e47 |
+ * This obviously breaks our logic, so we need to make sure we correct this
|
|
|
b69e47 |
+ */
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (cg_mem_hard != 0 && cg_mem_soft != 0 && cg_mem_hard < cg_mem_soft) {
|
|
|
b69e47 |
+ /* Right, we only have a hard limit. Impose a 10% watermark. */
|
|
|
b69e47 |
+ cg_mem_soft = cg_mem_hard * 0.9;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (cg_mem_soft != 0 && cg_mem_usage != 0 && cg_mem_soft > cg_mem_usage) {
|
|
|
b69e47 |
+ cg_mem_soft_avail = cg_mem_soft - cg_mem_usage;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ /* Now, compare the values and make a choice to which is provided */
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ /* Process consumed memory */
|
|
|
b69e47 |
+ mi->process_consumed_bytes = vmrss;
|
|
|
b69e47 |
+ mi->process_consumed_pages = vmrss / mi->pagesize_bytes;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ /* System Total memory */
|
|
|
b69e47 |
+ /* If we have a memtotal, OR if no memtotal but rlimit */
|
|
|
b69e47 |
+ if (rl_mem_hard != 0 &&
|
|
|
b69e47 |
+ ((memtotal != 0 && rl_mem_hard < memtotal) || memtotal == 0) &&
|
|
|
b69e47 |
+ ((cg_mem_hard != 0 && rl_mem_hard < cg_mem_hard) || cg_mem_hard == 0)
|
|
|
b69e47 |
+ )
|
|
|
b69e47 |
+ {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_TRACE, "spal_meminfo_get", "system_total_bytes - using rlimit\n");
|
|
|
b69e47 |
+ mi->system_total_bytes = rl_mem_hard;
|
|
|
b69e47 |
+ mi->system_total_pages = rl_mem_hard / mi->pagesize_bytes;
|
|
|
b69e47 |
+ } else if (cg_mem_hard != 0 && ((memtotal != 0 && cg_mem_hard < memtotal) || memtotal == 0)) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_TRACE, "spal_meminfo_get", "system_total_bytes - using cgroup\n");
|
|
|
b69e47 |
+ mi->system_total_bytes = cg_mem_hard;
|
|
|
b69e47 |
+ mi->system_total_pages = cg_mem_hard / mi->pagesize_bytes;
|
|
|
b69e47 |
+ } else if (memtotal != 0) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_TRACE, "spal_meminfo_get", "system_total_bytes - using memtotal\n");
|
|
|
b69e47 |
+ mi->system_total_bytes = memtotal;
|
|
|
b69e47 |
+ mi->system_total_pages = memtotal / mi->pagesize_bytes;
|
|
|
b69e47 |
+ } else {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CRIT, "spal_meminfo_get", "Unable to determine system total memory!\n");
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
+ return NULL;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ /* System Available memory */
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (rl_mem_soft_avail != 0 &&
|
|
|
b69e47 |
+ ((memavail != 0 && (rl_mem_soft_avail) < memavail) || memavail == 0) &&
|
|
|
b69e47 |
+ ((cg_mem_soft_avail != 0 && rl_mem_soft_avail < cg_mem_soft_avail) || cg_mem_soft_avail == 0)
|
|
|
b69e47 |
+ )
|
|
|
b69e47 |
+ {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_TRACE, "spal_meminfo_get", "system_available_bytes - using rlimit\n");
|
|
|
b69e47 |
+ mi->system_available_bytes = rl_mem_soft_avail;
|
|
|
b69e47 |
+ mi->system_available_pages = rl_mem_soft_avail / mi->pagesize_bytes;
|
|
|
b69e47 |
+ } else if (cg_mem_soft_avail != 0 && ((memavail != 0 && (cg_mem_soft_avail) < memavail) || memavail == 0)) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_TRACE, "spal_meminfo_get", "system_available_bytes - using cgroup\n");
|
|
|
b69e47 |
+ mi->system_available_bytes = cg_mem_soft_avail;
|
|
|
b69e47 |
+ mi->system_available_pages = cg_mem_soft_avail / mi->pagesize_bytes;
|
|
|
b69e47 |
+ } else if (memavail != 0) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_TRACE, "spal_meminfo_get", "system_available_bytes - using memavail\n");
|
|
|
b69e47 |
+ mi->system_available_bytes = memavail;
|
|
|
b69e47 |
+ mi->system_available_pages = memavail / mi->pagesize_bytes;
|
|
|
b69e47 |
+ } else {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CRIT, "spal_meminfo_get", "Unable to determine system available memory!\n");
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
+ return NULL;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_TRACE, "spal_meminfo_get", "{pagesize_bytes = %"PRIu64", system_total_pages = %"PRIu64", system_total_bytes = %"PRIu64", process_consumed_pages = %"PRIu64", process_consumed_bytes = %"PRIu64", system_available_pages = %"PRIu64", system_available_bytes = %"PRIu64"},\n",
|
|
|
b69e47 |
+ mi->pagesize_bytes, mi->system_total_pages, mi->system_total_bytes, mi->process_consumed_pages, mi->process_consumed_bytes, mi->system_available_pages, mi->system_available_bytes);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ return mi;
|
|
|
b69e47 |
+}
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+#endif
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+#ifdef OS_solaris
|
|
|
b69e47 |
+uint64_t
|
|
|
b69e47 |
+_spal_solaris_resident_pages_get() {
|
|
|
b69e47 |
+ uint64_t procpages = 0;
|
|
|
b69e47 |
+ struct prpsinfo psi = {0};
|
|
|
b69e47 |
+ char fn[40];
|
|
|
b69e47 |
+ int fd;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ sprintf(fn, "/proc/%d", getpid());
|
|
|
b69e47 |
+ fd = open(fn, O_RDONLY);
|
|
|
b69e47 |
+ if (fd >= 0) {
|
|
|
b69e47 |
+ if (ioctl(fd, PIOCPSINFO, (void *)&psi) == 0) {
|
|
|
b69e47 |
+ procpages = (uint64_t)psi.pr_size;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+ close(fd);
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+ return procpages;
|
|
|
b69e47 |
+}
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+slapi_pal_meminfo *
|
|
|
b69e47 |
+spal_meminfo_get() {
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = (slapi_pal_meminfo *)slapi_ch_calloc(1, sizeof(slapi_pal_meminfo));
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ uint64_t rl_mem_soft = 0;
|
|
|
b69e47 |
+ uint64_t rl_mem_hard = 0;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ if (_spal_rlimit_get(RLIMIT_AS, &rl_mem_soft, &rl_mem_hard)) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_ERR, "spal_meminfo_get", "Unable to retrieve memory rlimit\n");
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ mi->pagesize_bytes = sysconf(_SC_PAGESIZE);
|
|
|
b69e47 |
+ mi->system_total_pages = sysconf(_SC_PHYS_PAGES);
|
|
|
b69e47 |
+ mi->system_total_bytes = mi->system_total_pages * mi->pagesize_bytes;
|
|
|
b69e47 |
+ mi->system_available_bytes = rl_mem_soft;
|
|
|
b69e47 |
+ if (rl_mem_soft != 0) {
|
|
|
b69e47 |
+ mi->system_available_pages = rl_mem_soft / mi->pagesize_bytes;
|
|
|
b69e47 |
+ }
|
|
|
b69e47 |
+ mi->process_consumed_pages = _spal_solaris_resident_pages_get();
|
|
|
b69e47 |
+ mi->process_consumed_bytes = mi->process_consumed_pages * mi->pagesize_bytes;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ return mi;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+}
|
|
|
b69e47 |
+#endif
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+#ifdef HPUX
|
|
|
b69e47 |
+#endif
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+void
|
|
|
b69e47 |
+spal_meminfo_destroy(slapi_pal_meminfo *mi) {
|
|
|
b69e47 |
+ slapi_ch_free((void **)&mi);
|
|
|
b69e47 |
+}
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/slapi_pal.h b/ldap/servers/slapd/slapi_pal.h
|
|
|
b69e47 |
new file mode 100644
|
|
|
b69e47 |
index 0000000..cb61d84
|
|
|
b69e47 |
--- /dev/null
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/slapi_pal.h
|
|
|
b69e47 |
@@ -0,0 +1,62 @@
|
|
|
b69e47 |
+/** BEGIN COPYRIGHT BLOCK
|
|
|
b69e47 |
+ * Copyright (C) 2017 Red Hat, Inc.
|
|
|
b69e47 |
+ * All rights reserved.
|
|
|
b69e47 |
+ *
|
|
|
b69e47 |
+ * License: GPL (version 3 or any later version).
|
|
|
b69e47 |
+ * See LICENSE for details.
|
|
|
b69e47 |
+ * END COPYRIGHT BLOCK **/
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+/*
|
|
|
b69e47 |
+ * Header for the slapi platform abstraction layer.
|
|
|
b69e47 |
+ *
|
|
|
b69e47 |
+ * This implements a number of functions that help to provide vendor
|
|
|
b69e47 |
+ * neutral requests. Candidates for this are memory, thread, disk size
|
|
|
b69e47 |
+ * and other operations.
|
|
|
b69e47 |
+ *
|
|
|
b69e47 |
+ * Basically anywhere you see a "ifdef PLATFORM" is a candidate
|
|
|
b69e47 |
+ * for this.
|
|
|
b69e47 |
+ */
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+#pragma once
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+#include <config.h>
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+#ifdef HAVE_INTTYPES_H
|
|
|
b69e47 |
+#include <inttypes.h>
|
|
|
b69e47 |
+#else
|
|
|
b69e47 |
+#error Need to define portable format macros such as PRIu64
|
|
|
b69e47 |
+#endif /* HAVE_INTTYPES_H */
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+/**
|
|
|
b69e47 |
+ * Structure that contains our system memory information in bytes and pages.
|
|
|
b69e47 |
+ *
|
|
|
b69e47 |
+ */
|
|
|
b69e47 |
+typedef struct _slapi_pal_meminfo {
|
|
|
b69e47 |
+ uint64_t pagesize_bytes;
|
|
|
b69e47 |
+ uint64_t system_total_pages;
|
|
|
b69e47 |
+ uint64_t system_total_bytes;
|
|
|
b69e47 |
+ uint64_t process_consumed_pages;
|
|
|
b69e47 |
+ uint64_t process_consumed_bytes;
|
|
|
b69e47 |
+ /* This value may be limited by cgroup or others. */
|
|
|
b69e47 |
+ uint64_t system_available_pages;
|
|
|
b69e47 |
+ uint64_t system_available_bytes;
|
|
|
b69e47 |
+} slapi_pal_meminfo;
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+/**
|
|
|
b69e47 |
+ * Allocate and returne a populated memory info structure. This will be NULL
|
|
|
b69e47 |
+ * on error, or contain a structure populated with platform information on
|
|
|
b69e47 |
+ * success. You should free this with spal_meminfo_destroy.
|
|
|
b69e47 |
+ *
|
|
|
b69e47 |
+ * \return slapi_pal_meminfo * pointer to structure containing data, or NULL.
|
|
|
b69e47 |
+ */
|
|
|
b69e47 |
+slapi_pal_meminfo * spal_meminfo_get();
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+/**
|
|
|
b69e47 |
+ * Destroy an allocated memory info structure. The caller is responsible for
|
|
|
b69e47 |
+ * ensuring this is called.
|
|
|
b69e47 |
+ *
|
|
|
b69e47 |
+ * \param mi the allocated slapi_pal_meminfo structure from spal_meminfo_get();
|
|
|
b69e47 |
+ */
|
|
|
b69e47 |
+void spal_meminfo_destroy(slapi_pal_meminfo *mi);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
|
|
|
b69e47 |
index b0c873d..21043d9 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/snmp_collator.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/snmp_collator.c
|
|
|
b69e47 |
@@ -711,7 +711,7 @@ static void
|
|
|
b69e47 |
add_counter_to_value(Slapi_Entry *e, const char *type, PRUint64 countervalue)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
char value[40];
|
|
|
b69e47 |
- snprintf(value,sizeof(value),"%" NSPRIu64, countervalue);
|
|
|
b69e47 |
+ snprintf(value,sizeof(value),"%" PRIu64, countervalue);
|
|
|
b69e47 |
slapi_entry_attr_set_charptr( e, type, value);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/unbind.c b/ldap/servers/slapd/unbind.c
|
|
|
b69e47 |
index fd44249..92dd905 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/unbind.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/unbind.c
|
|
|
b69e47 |
@@ -49,7 +49,7 @@ do_unbind( Slapi_PBlock *pb )
|
|
|
b69e47 |
* UnBindRequest ::= NULL
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
if ( ber_get_null( ber ) == LBER_ERROR ) {
|
|
|
b69e47 |
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d UNBIND,"
|
|
|
b69e47 |
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND,"
|
|
|
b69e47 |
" decoding error: UnBindRequest not null\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, operation->o_opid );
|
|
|
b69e47 |
/* LDAPv3 does not allow a response to an unbind... so just return. */
|
|
|
b69e47 |
@@ -64,7 +64,7 @@ do_unbind( Slapi_PBlock *pb )
|
|
|
b69e47 |
* MUST ignore the criticality field of controls
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
if ( (err = get_ldapmessage_controls_ext( pb, ber, NULL, ignore_criticality )) != 0 ) {
|
|
|
b69e47 |
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d UNBIND,"
|
|
|
b69e47 |
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND,"
|
|
|
b69e47 |
" error processing controls - error %d (%s)\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, operation->o_opid,
|
|
|
b69e47 |
err, ldap_err2string( err ));
|
|
|
b69e47 |
@@ -79,7 +79,7 @@ do_unbind( Slapi_PBlock *pb )
|
|
|
b69e47 |
|
|
|
b69e47 |
/* ONREPL - plugins should be called and passed bind dn and, possibly, other data */
|
|
|
b69e47 |
|
|
|
b69e47 |
- slapi_log_access( LDAP_DEBUG_STATS, "conn=%" NSPRIu64 " op=%d UNBIND\n",
|
|
|
b69e47 |
+ slapi_log_access( LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d UNBIND\n",
|
|
|
b69e47 |
pb->pb_conn->c_connid, operation->o_opid );
|
|
|
b69e47 |
|
|
|
b69e47 |
/* pass the unbind to all backends */
|
|
|
b69e47 |
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
|
|
|
b69e47 |
index 48fa3c4..012e83d 100644
|
|
|
b69e47 |
--- a/ldap/servers/slapd/util.c
|
|
|
b69e47 |
+++ b/ldap/servers/slapd/util.c
|
|
|
b69e47 |
@@ -40,20 +40,8 @@
|
|
|
b69e47 |
#define FILTER_BUF 128 /* initial buffer size for attr value */
|
|
|
b69e47 |
#define BUF_INCR 16 /* the amount to increase the FILTER_BUF once it fills up */
|
|
|
b69e47 |
|
|
|
b69e47 |
-/* Used by our util_info_sys_pages function
|
|
|
b69e47 |
- *
|
|
|
b69e47 |
- * platforms supported so far:
|
|
|
b69e47 |
- * Solaris, Linux, Windows
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
-#ifdef OS_solaris
|
|
|
b69e47 |
-#include <sys/procfs.h>
|
|
|
b69e47 |
-#endif
|
|
|
b69e47 |
-#ifdef LINUX
|
|
|
b69e47 |
-#include <linux/kernel.h>
|
|
|
b69e47 |
-#endif
|
|
|
b69e47 |
-#if defined ( hpux )
|
|
|
b69e47 |
-#include <sys/pstat.h>
|
|
|
b69e47 |
-#endif
|
|
|
b69e47 |
+/* slapi-private contains the pal. */
|
|
|
b69e47 |
+#include <slapi-private.h>
|
|
|
b69e47 |
|
|
|
b69e47 |
static int special_filename(unsigned char c)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
@@ -1471,361 +1459,25 @@ slapi_uniqueIDRdnSize(void)
|
|
|
b69e47 |
return util_uniqueidlen;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-/**
|
|
|
b69e47 |
- * Get the virtual memory size as defined by system rlimits.
|
|
|
b69e47 |
- *
|
|
|
b69e47 |
- * \return size_t bytes available
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
-static size_t util_getvirtualmemsize(void)
|
|
|
b69e47 |
-{
|
|
|
b69e47 |
- struct rlimit rl;
|
|
|
b69e47 |
- /* the maximum size of a process's total available memory, in bytes */
|
|
|
b69e47 |
- if (getrlimit(RLIMIT_AS, &rl) != 0) {
|
|
|
b69e47 |
- /* We received an error condition. There are a number of possible
|
|
|
b69e47 |
- * reasons we have have gotten here, but most likely is EINVAL, where
|
|
|
b69e47 |
- * rlim->rlim_cur was greater than rlim->rlim_max.
|
|
|
b69e47 |
- * As a result, we should return a 0, to tell the system we can't alloc
|
|
|
b69e47 |
- * memory.
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
- int errsrv = errno;
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_ERR,"util_getvirtualmemsize",
|
|
|
b69e47 |
- "getrlimit returned non-zero. errno=%u\n", errsrv);
|
|
|
b69e47 |
- return 0;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- return rl.rlim_cur;
|
|
|
b69e47 |
-}
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-/* pages = number of pages of physical ram on the machine (corrected for 32-bit build on 64-bit machine).
|
|
|
b69e47 |
- * procpages = pages currently used by this process (or working set size, sometimes)
|
|
|
b69e47 |
- * availpages = some notion of the number of pages 'free'. Typically this number is not useful.
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
-int util_info_sys_pages(size_t *pagesize, size_t *pages, size_t *procpages, size_t *availpages)
|
|
|
b69e47 |
-{
|
|
|
b69e47 |
- if ((NULL == pagesize) || (NULL == pages) || (NULL == procpages) || (NULL == availpages)) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_ERR, "util_info_sys_pages",
|
|
|
b69e47 |
- "Null return variables are passed. Skip getting the system info.\n");
|
|
|
b69e47 |
- return 1;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- *pagesize = 0;
|
|
|
b69e47 |
- *pages = 0;
|
|
|
b69e47 |
- *availpages = 0;
|
|
|
b69e47 |
- *procpages = 0;
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-#ifdef OS_solaris
|
|
|
b69e47 |
- *pagesize = (int)sysconf(_SC_PAGESIZE);
|
|
|
b69e47 |
- *pages = (int)sysconf(_SC_PHYS_PAGES);
|
|
|
b69e47 |
- *availpages = util_getvirtualmemsize() / *pagesize;
|
|
|
b69e47 |
- /* solaris has THE most annoying way to get this info */
|
|
|
b69e47 |
- {
|
|
|
b69e47 |
- struct prpsinfo psi = {0};
|
|
|
b69e47 |
- char fn[40];
|
|
|
b69e47 |
- int fd;
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- sprintf(fn, "/proc/%d", getpid());
|
|
|
b69e47 |
- fd = open(fn, O_RDONLY);
|
|
|
b69e47 |
- if (fd >= 0) {
|
|
|
b69e47 |
- if (ioctl(fd, PIOCPSINFO, (void *)&psi) == 0) {
|
|
|
b69e47 |
- *procpages = psi.pr_size;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- close(fd);
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
-#endif
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-#ifdef LINUX
|
|
|
b69e47 |
- {
|
|
|
b69e47 |
- /*
|
|
|
b69e47 |
- * On linux because of the way that the virtual memory system works, we
|
|
|
b69e47 |
- * don't really need to think about other processes, or fighting them.
|
|
|
b69e47 |
- * But that's not without quirks.
|
|
|
b69e47 |
- *
|
|
|
b69e47 |
- * We are given a virtual memory space, represented by vsize (man 5 proc)
|
|
|
b69e47 |
- * This space is a "funny number". It's a best effort based system
|
|
|
b69e47 |
- * where linux instead of telling us how much memory *actually* exists
|
|
|
b69e47 |
- * for us to use, gives us a virtual memory allocation which is the
|
|
|
b69e47 |
- * value of ram + swap.... sometimes. Depends on platform.
|
|
|
b69e47 |
- *
|
|
|
b69e47 |
- * But none of these pages even exist or belong to us on the real system
|
|
|
b69e47 |
- * until will malloc them AND write a non-zero to them.
|
|
|
b69e47 |
- *
|
|
|
b69e47 |
- * The biggest issue with this is that vsize does NOT consider the
|
|
|
b69e47 |
- * effect other processes have on the system. So a process can malloc
|
|
|
b69e47 |
- * 2 Gig from the host, and our vsize doesn't reflect that until we
|
|
|
b69e47 |
- * suddenly can't malloc anything.
|
|
|
b69e47 |
- *
|
|
|
b69e47 |
- * We can see exactly what we are using inside of the vmm by
|
|
|
b69e47 |
- * looking at rss (man 5 proc). This shows us the current actual
|
|
|
b69e47 |
- * allocation of memory we are using. This is a good thing.
|
|
|
b69e47 |
- *
|
|
|
b69e47 |
- * We obviously don't want to have any pages in swap, but sometimes we
|
|
|
b69e47 |
- * can't help that: And there is also no guarantee that while we have
|
|
|
b69e47 |
- * X bytes in vsize, that we can even allocate any of them. Plus, we
|
|
|
b69e47 |
- * don't know if we are about to allocate to swap or not .... or get us
|
|
|
b69e47 |
- * killed in a blaze of oom glory.
|
|
|
b69e47 |
- *
|
|
|
b69e47 |
- * So there are now two strategies avaliable in this function.
|
|
|
b69e47 |
- * The first is to blindly accept what the VMM tells us about vsize
|
|
|
b69e47 |
- * while we hope and pray that we don't get nailed because we used
|
|
|
b69e47 |
- * too much.
|
|
|
b69e47 |
- *
|
|
|
b69e47 |
- * The other is a more conservative approach: We check vsize from
|
|
|
b69e47 |
- * proc/pid/status, and we check /proc/meminfo for freemem
|
|
|
b69e47 |
- * Which ever value is "lower" is the upper bound on pages we could
|
|
|
b69e47 |
- * potentially allocate: generally, this will be MemAvailable.
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- size_t freesize = 0;
|
|
|
b69e47 |
- size_t rlimsize = 0;
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- *pagesize = getpagesize();
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- /* Get the amount of freeram, rss */
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- FILE *f;
|
|
|
b69e47 |
- char fn[40], s[80];
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- sprintf(fn, "/proc/%d/status", getpid());
|
|
|
b69e47 |
- f = fopen(fn, "r");
|
|
|
b69e47 |
- if (!f) { /* fopen failed */
|
|
|
b69e47 |
- /* We should probably make noise here! */
|
|
|
b69e47 |
- int errsrv = errno;
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_ERR,"util_info_sys_pages", "Unable to open file /proc/%d/status. errno=%u\n", getpid(), errsrv);
|
|
|
b69e47 |
- return 1;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- while (! feof(f)) {
|
|
|
b69e47 |
- if (!fgets(s, 79, f)) {
|
|
|
b69e47 |
- break; /* error or eof */
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- if (feof(f)) {
|
|
|
b69e47 |
- break;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- /* VmRSS shows us what we are ACTUALLY using for proc pages
|
|
|
b69e47 |
- * Rather than "funny" pages.
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
- if (strncmp(s, "VmRSS:", 6) == 0) {
|
|
|
b69e47 |
- sscanf(s+6, "%lu", (long unsigned int *)procpages);
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- fclose(f);
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- FILE *fm;
|
|
|
b69e47 |
- char *fmn = "/proc/meminfo";
|
|
|
b69e47 |
- fm = fopen(fmn, "r");
|
|
|
b69e47 |
- if (!fm) {
|
|
|
b69e47 |
- int errsrv = errno;
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_ERR,"util_info_sys_pages", "Unable to open file /proc/meminfo. errno=%u\n", errsrv);
|
|
|
b69e47 |
- return 1;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- while (! feof(fm)) {
|
|
|
b69e47 |
- if (!fgets(s, 79, fm)) {
|
|
|
b69e47 |
- break; /* error or eof */
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- if (feof(fm)) {
|
|
|
b69e47 |
- break;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- if (strncmp(s, "MemTotal:", 9) == 0) {
|
|
|
b69e47 |
- sscanf(s+9, "%lu", (long unsigned int *)pages);
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- if (strncmp(s, "MemAvailable:", 13) == 0) {
|
|
|
b69e47 |
- sscanf(s+13, "%lu", (long unsigned int *)&freesize);
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- fclose(fm);
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- *pages /= (*pagesize / 1024);
|
|
|
b69e47 |
- freesize /= (*pagesize / 1024);
|
|
|
b69e47 |
- /* procpages is now in kb not pages... */
|
|
|
b69e47 |
- *procpages /= (*pagesize / 1024);
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- rlimsize = util_getvirtualmemsize();
|
|
|
b69e47 |
- /* On a 64 bit system, this is uint64 max, but on 32 it's -1 */
|
|
|
b69e47 |
- /* Either way, we should be ignoring it at this point if it's infinite */
|
|
|
b69e47 |
- if (rlimsize != RLIM_INFINITY) {
|
|
|
b69e47 |
- /* This is in bytes, make it pages */
|
|
|
b69e47 |
- rlimsize = rlimsize / *pagesize;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- /* Pages is the total ram on the system. */
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_info_sys_pages", "pages=%lu, \n",
|
|
|
b69e47 |
- (unsigned long) *pages);
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_info_sys_pages", "using pages for pages \n");
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- /* Availpages is how much we *could* alloc. We should take the smallest:
|
|
|
b69e47 |
- * - pages
|
|
|
b69e47 |
- * - getrlimit (availpages)
|
|
|
b69e47 |
- * - freesize
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
- if (rlimsize == RLIM_INFINITY) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_info_sys_pages", "pages=%lu, getrlim=RLIM_INFINITY, freesize=%lu\n",
|
|
|
b69e47 |
- (unsigned long)*pages, (unsigned long)freesize);
|
|
|
b69e47 |
- } else {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_info_sys_pages", "pages=%lu, getrlim=%lu, freesize=%lu\n",
|
|
|
b69e47 |
- (unsigned long)*pages, (unsigned long)*availpages, (unsigned long)freesize);
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- if (rlimsize != RLIM_INFINITY && rlimsize < freesize && rlimsize < *pages && rlimsize > 0) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_info_sys_pages", "using getrlim for availpages \n");
|
|
|
b69e47 |
- *availpages = rlimsize;
|
|
|
b69e47 |
- } else if (freesize < *pages && freesize > 0) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_info_sys_pages", "using freesize for availpages \n");
|
|
|
b69e47 |
- *availpages = freesize;
|
|
|
b69e47 |
- } else {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_info_sys_pages", "using pages for availpages \n");
|
|
|
b69e47 |
- *availpages = *pages;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
-#endif /* linux */
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-#if defined ( hpux )
|
|
|
b69e47 |
- {
|
|
|
b69e47 |
- struct pst_static pst;
|
|
|
b69e47 |
- int rval = pstat_getstatic(&pst, sizeof(pst), (size_t)1, 0);
|
|
|
b69e47 |
- if (rval < 0) { /* pstat_getstatic failed */
|
|
|
b69e47 |
- return 1;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- *pagesize = pst.page_size;
|
|
|
b69e47 |
- *pages = pst.physical_memory;
|
|
|
b69e47 |
- *availpages = util_getvirtualmemsize() / *pagesize;
|
|
|
b69e47 |
- if (procpages)
|
|
|
b69e47 |
- {
|
|
|
b69e47 |
-#define BURST (size_t)32 /* get BURST proc info at one time... */
|
|
|
b69e47 |
- struct pst_status psts[BURST];
|
|
|
b69e47 |
- int i, count;
|
|
|
b69e47 |
- int idx = 0; /* index within the context */
|
|
|
b69e47 |
- int mypid = getpid();
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- *procpages = 0;
|
|
|
b69e47 |
- /* loop until count == 0, will occur all have been returned */
|
|
|
b69e47 |
- while ((count = pstat_getproc(psts, sizeof(psts[0]), BURST, idx)) > 0) {
|
|
|
b69e47 |
- /* got count (max of BURST) this time. process them */
|
|
|
b69e47 |
- for (i = 0; i < count; i++) {
|
|
|
b69e47 |
- if (psts[i].pst_pid == mypid)
|
|
|
b69e47 |
- {
|
|
|
b69e47 |
- *procpages = (size_t)(psts[i].pst_dsize + psts[i].pst_tsize + psts[i].pst_ssize);
|
|
|
b69e47 |
- break;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- if (i < count)
|
|
|
b69e47 |
- break;
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- /*
|
|
|
b69e47 |
- * now go back and do it again, using the next index after
|
|
|
b69e47 |
- * the current 'burst'
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
- idx = psts[count-1].pst_idx + 1;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
-#endif
|
|
|
b69e47 |
- /* If this is a 32-bit build, it might be running on a 64-bit machine,
|
|
|
b69e47 |
- * in which case, if the box has tons of ram, we can end up telling
|
|
|
b69e47 |
- * the auto cache code to use more memory than the process can address.
|
|
|
b69e47 |
- * so we cap the number returned here.
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
-#if defined(__LP64__) || defined (_LP64)
|
|
|
b69e47 |
-#else
|
|
|
b69e47 |
- {
|
|
|
b69e47 |
-#define GIGABYTE (1024*1024*1024)
|
|
|
b69e47 |
- size_t one_gig_pages = GIGABYTE / *pagesize;
|
|
|
b69e47 |
- if (*pages > (2 * one_gig_pages) ) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_info_sys_pages",
|
|
|
b69e47 |
- "More than 2Gbytes physical memory detected. Since this is a 32-bit process, truncating memory size used for auto cache calculations to 2Gbytes\n");
|
|
|
b69e47 |
- *pages = (2 * one_gig_pages);
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
-#endif
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- /* This is stupid. If you set %u to %zu to print a size_t, you get literal %zu in your logs
|
|
|
b69e47 |
- * So do the filthy cast instead.
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_info_sys_pages", "USING pages=%lu, procpages=%lu, availpages=%lu \n",
|
|
|
b69e47 |
- (unsigned long)*pages, (unsigned long)*procpages, (unsigned long)*availpages);
|
|
|
b69e47 |
- return 0;
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-}
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-int util_is_cachesize_sane(size_t *cachesize)
|
|
|
b69e47 |
+util_cachesize_result
|
|
|
b69e47 |
+util_is_cachesize_sane(slapi_pal_meminfo *mi, uint64_t *cachesize)
|
|
|
b69e47 |
{
|
|
|
b69e47 |
- size_t pages = 0;
|
|
|
b69e47 |
- size_t pagesize = 0;
|
|
|
b69e47 |
- size_t procpages = 0;
|
|
|
b69e47 |
- size_t availpages = 0;
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- size_t cachepages = 0;
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- int issane = 1;
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- if (util_info_sys_pages(&pagesize, &pages, &procpages, &availpages) != 0) {
|
|
|
b69e47 |
- goto out;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
-#ifdef LINUX
|
|
|
b69e47 |
- /* Linux we calculate availpages correctly, so USE IT */
|
|
|
b69e47 |
- if (!pagesize || !availpages) {
|
|
|
b69e47 |
- goto out;
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
-#else
|
|
|
b69e47 |
- if (!pagesize || !pages) {
|
|
|
b69e47 |
- goto out;
|
|
|
b69e47 |
+ /* Check we have a valid meminfo struct */
|
|
|
b69e47 |
+ if (mi->system_available_bytes == 0) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_CRIT, "util_is_cachesize_sane", "Invalid system memory info, can not proceed.");
|
|
|
b69e47 |
+ return UTIL_CACHESIZE_ERROR;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
-#endif
|
|
|
b69e47 |
- /* do nothing when we can't get the avail mem */
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- /* If the requested cache size is larger than the remaining physical memory
|
|
|
b69e47 |
- * after the current working set size for this process has been subtracted,
|
|
|
b69e47 |
- * then we say that's insane and try to correct.
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- cachepages = *cachesize / pagesize;
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_is_cachesize_sane", "cachesize=%lu / pagesize=%lu \n",
|
|
|
b69e47 |
- (unsigned long)*cachesize,(unsigned long)pagesize);
|
|
|
b69e47 |
-
|
|
|
b69e47 |
-#ifdef LINUX
|
|
|
b69e47 |
- /* Linux we calculate availpages correctly, so USE IT */
|
|
|
b69e47 |
- issane = (int)(cachepages <= availpages);
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_is_cachesize_sane", "cachepages=%lu <= availpages=%lu\n",
|
|
|
b69e47 |
- (unsigned long)cachepages,(unsigned long)availpages);
|
|
|
b69e47 |
|
|
|
b69e47 |
- if (!issane) {
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_TRACE, "util_is_cachesize_sane", "Available bytes %"PRIu64", requested bytes %"PRIu64"\n", mi->system_available_bytes, *cachesize);
|
|
|
b69e47 |
+ if (*cachesize > mi->system_available_bytes) {
|
|
|
b69e47 |
/* Since we are ask for more than what's available, we give 3/4 of the remaining.
|
|
|
b69e47 |
* the remaining system mem to the cachesize instead, and log a warning
|
|
|
b69e47 |
*/
|
|
|
b69e47 |
- *cachesize = (size_t)((availpages * 0.75 ) * pagesize);
|
|
|
b69e47 |
- /* These are now trace warnings, because it was to confusing to log this *then* kill the request anyway.
|
|
|
b69e47 |
- * Instead, we will let the caller worry about the notification, and we'll just use this in debugging and tracing.
|
|
|
b69e47 |
- */
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE, "util_is_cachesize_sane",
|
|
|
b69e47 |
- "Available pages %lu, requested pages %lu, pagesize %lu\n", (unsigned long)availpages, (unsigned long)cachepages, (unsigned long)pagesize);
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE, "util_is_cachesize_sane",
|
|
|
b69e47 |
- "WARNING adjusted cachesize to %lu\n", (unsigned long)*cachesize);
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
-#else
|
|
|
b69e47 |
- size_t freepages = 0;
|
|
|
b69e47 |
- freepages = pages - procpages;
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_is_cachesize_sane", "pages=%lu - procpages=%lu\n",
|
|
|
b69e47 |
- (unsigned long)pages,(unsigned long)procpages);
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- issane = (int)(cachepages <= freepages);
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_is_cachesize_sane", "cachepages=%lu <= freepages=%lu\n",
|
|
|
b69e47 |
- (unsigned long)cachepages,(unsigned long)freepages);
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- if (!issane) {
|
|
|
b69e47 |
- *cachesize = (size_t)((pages - procpages) * pagesize);
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_WARNING, "util_is_cachesize_sane", "WARNING adjusted cachesize to %lu\n",
|
|
|
b69e47 |
- (unsigned long )*cachesize);
|
|
|
b69e47 |
+ *cachesize = (mi->system_available_bytes * 0.75);
|
|
|
b69e47 |
+ slapi_log_err(SLAPI_LOG_TRACE, "util_is_cachesize_sane", "Adjusted cachesize to %"PRIu64"\n", *cachesize);
|
|
|
b69e47 |
+ return UTIL_CACHESIZE_REDUCED;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
-#endif
|
|
|
b69e47 |
-out:
|
|
|
b69e47 |
- if (!issane) {
|
|
|
b69e47 |
- slapi_log_err(SLAPI_LOG_TRACE,"util_is_cachesize_sane", "WARNING: Cachesize not sane \n");
|
|
|
b69e47 |
- }
|
|
|
b69e47 |
-
|
|
|
b69e47 |
- return issane;
|
|
|
b69e47 |
+ return UTIL_CACHESIZE_VALID;
|
|
|
b69e47 |
}
|
|
|
b69e47 |
|
|
|
b69e47 |
long
|
|
|
b69e47 |
diff --git a/test/libslapd/spal/meminfo.c b/test/libslapd/spal/meminfo.c
|
|
|
b69e47 |
new file mode 100644
|
|
|
b69e47 |
index 0000000..776141a
|
|
|
b69e47 |
--- /dev/null
|
|
|
b69e47 |
+++ b/test/libslapd/spal/meminfo.c
|
|
|
b69e47 |
@@ -0,0 +1,54 @@
|
|
|
b69e47 |
+/** BEGIN COPYRIGHT BLOCK
|
|
|
b69e47 |
+ * Copyright (C) 2017 Red Hat, Inc.
|
|
|
b69e47 |
+ * All rights reserved.
|
|
|
b69e47 |
+ *
|
|
|
b69e47 |
+ * License: GPL (version 3 or any later version).
|
|
|
b69e47 |
+ * See LICENSE for details.
|
|
|
b69e47 |
+ * END COPYRIGHT BLOCK **/
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+#include "../../test_slapd.h"
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+#include <slapi_pal.h>
|
|
|
b69e47 |
+#include <slapi-private.h>
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+/*
|
|
|
b69e47 |
+ * Assert that our meminfo interface in slapi_pal works.
|
|
|
b69e47 |
+ */
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+void
|
|
|
b69e47 |
+test_libslapd_pal_meminfo(void **state __attribute__((unused))) {
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
+ assert_true(mi->pagesize_bytes > 0);
|
|
|
b69e47 |
+ assert_true(mi->system_total_pages > 0);
|
|
|
b69e47 |
+ assert_true(mi->system_total_bytes > 0);
|
|
|
b69e47 |
+ assert_true(mi->process_consumed_pages > 0);
|
|
|
b69e47 |
+ assert_true(mi->process_consumed_bytes > 0);
|
|
|
b69e47 |
+ assert_true(mi->system_available_pages > 0);
|
|
|
b69e47 |
+ assert_true(mi->system_available_bytes > 0);
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
+}
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+void
|
|
|
b69e47 |
+test_libslapd_util_cachesane(void **state __attribute__((unused))) {
|
|
|
b69e47 |
+ slapi_pal_meminfo *mi = spal_meminfo_get();
|
|
|
b69e47 |
+ uint64_t request = 0;
|
|
|
b69e47 |
+ mi->system_available_bytes = 0;
|
|
|
b69e47 |
+ assert_true(util_is_cachesize_sane(mi, &request) == UTIL_CACHESIZE_ERROR);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ // Set the values to known quantities
|
|
|
b69e47 |
+ request = 50000;
|
|
|
b69e47 |
+ mi->system_available_bytes = 99999;
|
|
|
b69e47 |
+ assert_true(util_is_cachesize_sane(mi, &request) == UTIL_CACHESIZE_VALID);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ request = 99999;
|
|
|
b69e47 |
+ assert_true(util_is_cachesize_sane(mi, &request) == UTIL_CACHESIZE_VALID);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ request = 100000;
|
|
|
b69e47 |
+ assert_true(util_is_cachesize_sane(mi, &request) == UTIL_CACHESIZE_REDUCED);
|
|
|
b69e47 |
+ assert_true(request <= 75000);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+ spal_meminfo_destroy(mi);
|
|
|
b69e47 |
+}
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+
|
|
|
b69e47 |
diff --git a/test/libslapd/test.c b/test/libslapd/test.c
|
|
|
b69e47 |
index 6e1171a..6fa7996 100644
|
|
|
b69e47 |
--- a/test/libslapd/test.c
|
|
|
b69e47 |
+++ b/test/libslapd/test.c
|
|
|
b69e47 |
@@ -26,6 +26,8 @@ run_libslapd_tests (void) {
|
|
|
b69e47 |
cmocka_unit_test(test_libslapd_operation_v3c_target_spec),
|
|
|
b69e47 |
cmocka_unit_test(test_libslapd_counters_atomic_usage),
|
|
|
b69e47 |
cmocka_unit_test(test_libslapd_counters_atomic_overflow),
|
|
|
b69e47 |
+ cmocka_unit_test(test_libslapd_pal_meminfo),
|
|
|
b69e47 |
+ cmocka_unit_test(test_libslapd_util_cachesane),
|
|
|
b69e47 |
};
|
|
|
b69e47 |
return cmocka_run_group_tests(tests, NULL, NULL);
|
|
|
b69e47 |
}
|
|
|
b69e47 |
diff --git a/test/test_slapd.h b/test/test_slapd.h
|
|
|
b69e47 |
index b8f1aba..50de11b 100644
|
|
|
b69e47 |
--- a/test/test_slapd.h
|
|
|
b69e47 |
+++ b/test/test_slapd.h
|
|
|
b69e47 |
@@ -42,3 +42,8 @@ void test_libslapd_operation_v3c_target_spec(void **state);
|
|
|
b69e47 |
void test_libslapd_counters_atomic_usage(void **state);
|
|
|
b69e47 |
void test_libslapd_counters_atomic_overflow(void **state);
|
|
|
b69e47 |
|
|
|
b69e47 |
+/* libslapd-pal-meminfo */
|
|
|
b69e47 |
+
|
|
|
b69e47 |
+void test_libslapd_pal_meminfo(void **state);
|
|
|
b69e47 |
+void test_libslapd_util_cachesane(void **state);
|
|
|
b69e47 |
+
|
|
|
b69e47 |
--
|
|
|
b69e47 |
2.9.3
|
|
|
b69e47 |
|