This is an automated email from the git hooks/post-receive script.
mreynolds pushed a change to branch master in repository 389-ds-base.
from a3d3e1a Ticket 49601 - Replace HAVE_SYSTEMD define with WITH_SYSTEMD in svrcore new 5e383c8 Ticket 46918 - Fix compiler warnings on arm
The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference.
Summary of changes: ldap/servers/plugins/posix-winsync/posix-winsync.c | 2 +- ldap/servers/plugins/replication/repl5_agmt.c | 22 ++-- ldap/servers/plugins/replication/repl5_replica.c | 20 +-- ldap/servers/plugins/replication/replutil.c | 2 +- ldap/servers/slapd/abandon.c | 2 +- ldap/servers/slapd/back-ldbm/back-ldbm.h | 70 ++++------- ldap/servers/slapd/back-ldbm/cache.c | 16 +-- ldap/servers/slapd/back-ldbm/dblayer.c | 137 +++++++++++++++------ ldap/servers/slapd/back-ldbm/dblayer.h | 8 +- ldap/servers/slapd/back-ldbm/filterindex.c | 6 +- ldap/servers/slapd/back-ldbm/idl_new.c | 16 +-- ldap/servers/slapd/back-ldbm/import-threads.c | 14 +-- ldap/servers/slapd/back-ldbm/ldbm_add.c | 10 +- ldap/servers/slapd/back-ldbm/ldbm_config.c | 68 +++++++--- ldap/servers/slapd/back-ldbm/ldbm_config.h | 16 ++- ldap/servers/slapd/back-ldbm/ldbm_delete.c | 26 ++-- .../servers/slapd/back-ldbm/ldbm_instance_config.c | 8 +- ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 18 +-- ldap/servers/slapd/back-ldbm/monitor.c | 39 +++--- ldap/servers/slapd/back-ldbm/proto-back-ldbm.h | 17 +-- ldap/servers/slapd/back-ldbm/start.c | 12 +- ldap/servers/slapd/ch_malloc.c | 9 +- ldap/servers/slapd/conntable.c | 2 +- ldap/servers/slapd/daemon.c | 6 +- ldap/servers/slapd/dn.c | 33 +++-- ldap/servers/slapd/libglobs.c | 4 +- ldap/servers/slapd/main.c | 2 +- ldap/servers/slapd/monitor.c | 2 +- ldap/servers/slapd/proto-slap.h | 2 +- ldap/servers/slapd/result.c | 2 +- ldap/servers/slapd/sasl_io.c | 48 ++++---- ldap/servers/slapd/slap.h | 4 +- ldap/servers/slapd/slapi-plugin.h | 3 +- ldap/servers/slapd/slapi-private.h | 2 +- ldap/servers/slapd/tools/dbscan.c | 58 ++++----- ldap/servers/snmp/main.c | 2 +- src/libsds/sds/bpt/map.c | 8 +- src/libsds/sds/bpt_cow/bpt_cow.c | 8 +- 38 files changed, 398 insertions(+), 326 deletions(-)
This is an automated email from the git hooks/post-receive script.
mreynolds pushed a commit to branch master in repository 389-ds-base.
commit 5e383c8152d1273ff3df11578d4c9a94850ca60a Author: Mark Reynolds mreynolds@redhat.com Date: Wed Mar 28 14:28:42 2018 -0400
Ticket 46918 - Fix compiler warnings on arm
Description: On "arm" architecture there were many compiler warnings and after fixing some it also adressed a crash in replication when trying to update the agreement maxcsn.
All updatream architectures build without compilar warnings, and coverity scan did not report any regressions.
https://pagure.io/389-ds-base/issue/49618
Reviewed by: simon(Thanks!) --- ldap/servers/plugins/posix-winsync/posix-winsync.c | 2 +- ldap/servers/plugins/replication/repl5_agmt.c | 22 ++-- ldap/servers/plugins/replication/repl5_replica.c | 20 +-- ldap/servers/plugins/replication/replutil.c | 2 +- ldap/servers/slapd/abandon.c | 2 +- ldap/servers/slapd/back-ldbm/back-ldbm.h | 70 ++++------- ldap/servers/slapd/back-ldbm/cache.c | 16 +-- ldap/servers/slapd/back-ldbm/dblayer.c | 137 +++++++++++++++------ ldap/servers/slapd/back-ldbm/dblayer.h | 8 +- ldap/servers/slapd/back-ldbm/filterindex.c | 6 +- ldap/servers/slapd/back-ldbm/idl_new.c | 16 +-- ldap/servers/slapd/back-ldbm/import-threads.c | 14 +-- ldap/servers/slapd/back-ldbm/ldbm_add.c | 10 +- ldap/servers/slapd/back-ldbm/ldbm_config.c | 68 +++++++--- ldap/servers/slapd/back-ldbm/ldbm_config.h | 16 ++- ldap/servers/slapd/back-ldbm/ldbm_delete.c | 26 ++-- .../servers/slapd/back-ldbm/ldbm_instance_config.c | 8 +- ldap/servers/slapd/back-ldbm/ldbm_modrdn.c | 18 +-- ldap/servers/slapd/back-ldbm/monitor.c | 39 +++--- ldap/servers/slapd/back-ldbm/proto-back-ldbm.h | 17 +-- ldap/servers/slapd/back-ldbm/start.c | 12 +- ldap/servers/slapd/ch_malloc.c | 9 +- ldap/servers/slapd/conntable.c | 2 +- ldap/servers/slapd/daemon.c | 6 +- ldap/servers/slapd/dn.c | 33 +++-- ldap/servers/slapd/libglobs.c | 4 +- ldap/servers/slapd/main.c | 2 +- ldap/servers/slapd/monitor.c | 2 +- ldap/servers/slapd/proto-slap.h | 2 +- ldap/servers/slapd/result.c | 2 +- ldap/servers/slapd/sasl_io.c | 48 ++++---- ldap/servers/slapd/slap.h | 4 +- ldap/servers/slapd/slapi-plugin.h | 3 +- ldap/servers/slapd/slapi-private.h | 2 +- ldap/servers/slapd/tools/dbscan.c | 58 ++++----- ldap/servers/snmp/main.c | 2 +- src/libsds/sds/bpt/map.c | 8 +- src/libsds/sds/bpt_cow/bpt_cow.c | 8 +- 38 files changed, 398 insertions(+), 326 deletions(-)
diff --git a/ldap/servers/plugins/posix-winsync/posix-winsync.c b/ldap/servers/plugins/posix-winsync/posix-winsync.c index 07e4804..8e5ca4f 100644 --- a/ldap/servers/plugins/posix-winsync/posix-winsync.c +++ b/ldap/servers/plugins/posix-winsync/posix-winsync.c @@ -318,7 +318,7 @@ sync_acct_disable(void *cbdata __attribute__((unused)), /* the usual domain conf mask = 0x2; adval |= mask; /* set the 0x2 disable bit */ } - PR_snprintf(acctvalstr, sizeof(acctvalstr), "%lu", adval); + PR_snprintf(acctvalstr, sizeof(acctvalstr), "%" PRIu64, adval); slapi_ch_free_string(&mod_bval->bv_val); mod_bval->bv_val = slapi_ch_strdup(acctvalstr); mod_bval->bv_len = strlen(acctvalstr); diff --git a/ldap/servers/plugins/replication/repl5_agmt.c b/ldap/servers/plugins/replication/repl5_agmt.c index d71d3f3..9c88d58 100644 --- a/ldap/servers/plugins/replication/repl5_agmt.c +++ b/ldap/servers/plugins/replication/repl5_agmt.c @@ -182,25 +182,25 @@ agmt_is_valid(Repl_Agmt *ra) } if (ra->port <= 0) { slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "agmt_is_valid - Replication agreement "%s" " - "is malformed: invalid port number %ld.\n", + "is malformed: invalid port number %" PRId64 ".\n", slapi_sdn_get_dn(ra->dn), ra->port); return_value = 0; } if (ra->timeout < 0) { slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "agmt_is_valid - Replication agreement "%s" " - "is malformed: invalid timeout %ld.\n", + "is malformed: invalid timeout %" PRId64 ".\n", slapi_sdn_get_dn(ra->dn), ra->timeout); return_value = 0; } if (ra->busywaittime < 0) { slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "agmt_is_valid - Replication agreement "%s" " - "is malformed: invalid busy wait time %ld.\n", + "is malformed: invalid busy wait time %" PRId64 ".\n", slapi_sdn_get_dn(ra->dn), ra->busywaittime); return_value = 0; } if (ra->pausetime < 0) { slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "agmt_is_valid - Replication agreement "%s" " - "is malformed: invalid pausetime %ld.\n", + "is malformed: invalid pausetime %" PRId64 ".\n", slapi_sdn_get_dn(ra->dn), ra->pausetime); return_value = 0; } @@ -468,7 +468,7 @@ agmt_new_from_entry(Slapi_Entry *e) if (dot) { *dot = '\0'; } - ra->long_name = slapi_ch_smprintf("agmt="%s" (%s:%ld)", agmtname, hostname, ra->port); + ra->long_name = slapi_ch_smprintf("agmt="%s" (%s:%" PRId64 ")", agmtname, hostname, ra->port); }
/* DBDB: review this code */ @@ -791,10 +791,10 @@ agmt_start(Repl_Agmt *ra) char buf[BUFSIZ]; char unavail_buf[BUFSIZ];
- PR_snprintf(buf, BUFSIZ, "%s;%s;%s;%ld;", slapi_sdn_get_dn(repl_sdn), + PR_snprintf(buf, BUFSIZ, "%s;%s;%s;%" PRId64 ";", slapi_sdn_get_dn(repl_sdn), slapi_rdn_get_value_by_ref(slapi_rdn_get_rdn(ra->rdn)), ra->hostname, ra->port); - PR_snprintf(unavail_buf, BUFSIZ, "%s;%s;%s;%ld;unavailable", slapi_sdn_get_dn(repl_sdn), + PR_snprintf(unavail_buf, BUFSIZ, "%s;%s;%s;%" PRId64 ";unavailable", slapi_sdn_get_dn(repl_sdn), slapi_rdn_get_value_by_ref(slapi_rdn_get_rdn(ra->rdn)), ra->hostname, ra->port); if (strstr(maxcsns[i], buf) || strstr(maxcsns[i], unavail_buf)) { @@ -3029,11 +3029,11 @@ agmt_update_maxcsn(Replica *r, Slapi_DN *sdn, int op, LDAPMod **mods, CSN *csn) * temporarily mark it as "unavailable". */ slapi_ch_free_string(&agmt->maxcsn); - agmt->maxcsn = slapi_ch_smprintf("%s;%s;%s;%ld;unavailable", slapi_sdn_get_dn(agmt->replarea), + agmt->maxcsn = slapi_ch_smprintf("%s;%s;%s;%" PRId64 ";unavailable", slapi_sdn_get_dn(agmt->replarea), slapi_rdn_get_value_by_ref(slapi_rdn_get_rdn(agmt->rdn)), agmt->hostname, agmt->port); } else if (rid == oprid) { slapi_ch_free_string(&agmt->maxcsn); - agmt->maxcsn = slapi_ch_smprintf("%s;%s;%s;%ld;%d;%s", slapi_sdn_get_dn(agmt->replarea), + agmt->maxcsn = slapi_ch_smprintf("%s;%s;%s;%" PRId64 ";%" PRIu16 ";%s", slapi_sdn_get_dn(agmt->replarea), slapi_rdn_get_value_by_ref(slapi_rdn_get_rdn(agmt->rdn)), agmt->hostname, agmt->port, agmt->consumerRID, maxcsn); } @@ -3227,10 +3227,10 @@ agmt_remove_maxcsn(Repl_Agmt *ra) char unavail_buf[BUFSIZ]; struct berval val;
- PR_snprintf(buf, BUFSIZ, "%s;%s;%s;%ld;", slapi_sdn_get_dn(ra->replarea), + PR_snprintf(buf, BUFSIZ, "%s;%s;%s;%" PRId64 ";", slapi_sdn_get_dn(ra->replarea), slapi_rdn_get_value_by_ref(slapi_rdn_get_rdn(ra->rdn)), ra->hostname, ra->port); - PR_snprintf(unavail_buf, BUFSIZ, "%s;%s;%s;%ld;unavailable", + PR_snprintf(unavail_buf, BUFSIZ, "%s;%s;%s;%" PRId64 ";unavailable", slapi_sdn_get_dn(ra->replarea), slapi_rdn_get_value_by_ref(slapi_rdn_get_rdn(ra->rdn)), ra->hostname, ra->port); diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c index 5473d5b..2738b7a 100644 --- a/ldap/servers/plugins/replication/repl5_replica.c +++ b/ldap/servers/plugins/replication/repl5_replica.c @@ -72,8 +72,8 @@ struct replica typedef struct reap_callback_data { int rc; - unsigned long num_entries; - unsigned long num_purged_entries; + uint64_t num_entries; + uint64_t num_purged_entries; CSN *purge_csn; PRBool *tombstone_reap_stop; } reap_callback_data; @@ -1897,7 +1897,7 @@ _replica_init_from_config(Replica *r, Slapi_Entry *e, char *errortext) /* Verify backoff min and max work together */ if (backoff_min > backoff_max) { PR_snprintf(errormsg, SLAPI_DSE_RETURNTEXT_SIZE, - "Backoff minimum (%ld) can not be greater than the backoff maximum (%ld).", + "Backoff minimum (%" PRId64 ") can not be greater than the backoff maximum (%" PRId64 ").", backoff_min, backoff_max); slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "_replica_init_from_config - " "%s\n", errormsg); @@ -2996,8 +2996,8 @@ process_reap_entry(Slapi_Entry *entry, void *cb_data) { char deletion_csn_str[CSN_STRSIZE]; char purge_csn_str[CSN_STRSIZE]; - unsigned long *num_entriesp = &((reap_callback_data *)cb_data)->num_entries; - unsigned long *num_purged_entriesp = &((reap_callback_data *)cb_data)->num_purged_entries; + uint64_t *num_entriesp = &((reap_callback_data *)cb_data)->num_entries; + uint64_t *num_purged_entriesp = &((reap_callback_data *)cb_data)->num_purged_entries; CSN *purge_csn = ((reap_callback_data *)cb_data)->purge_csn; /* this is a pointer into the actual value in the Replica object - so that if the value is set in the replica, we will know about it immediately */ @@ -3181,14 +3181,14 @@ _replica_reap_tombstones(void *arg) if (LDAP_SUCCESS != oprc) { slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "_replica_reap_tombstones - Failed when searching for " - "tombstones in replica %s: %s. Will try again in %ld " + "tombstones in replica %s: %s. Will try again in %" PRId64 " " "seconds.\n", slapi_sdn_get_dn(replica->repl_root), ldap_err2string(oprc), replica->tombstone_reap_interval); } else { slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name, - "_replica_reap_tombstones - Purged %ld of %ld tombstones " - "in replica %s. Will try again in %ld " + "_replica_reap_tombstones - Purged %" PRIu64 " of %" PRIu64 " tombstones " + "in replica %s. Will try again in %" PRId64 " " "seconds.\n", cb_data.num_purged_entries, cb_data.num_entries, slapi_sdn_get_dn(replica->repl_root), @@ -3617,7 +3617,7 @@ replica_set_tombstone_reap_interval(Replica *r, long interval)
found = slapi_eq_cancel(r->repl_eqcxt_tr); slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name, - "replica_set_tombstone_reap_interval - tombstone_reap event (interval=%ld) was %s\n", + "replica_set_tombstone_reap_interval - tombstone_reap event (interval=%" PRId64 ") was %s\n", r->tombstone_reap_interval, (found ? "cancelled" : "not found")); r->repl_eqcxt_tr = NULL; } @@ -3627,7 +3627,7 @@ replica_set_tombstone_reap_interval(Replica *r, long interval) slapi_current_utc_time() + r->tombstone_reap_interval, 1000 * r->tombstone_reap_interval); slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name, - "replica_set_tombstone_reap_interval - tombstone_reap event (interval=%ld) was %s\n", + "replica_set_tombstone_reap_interval - tombstone_reap event (interval=%" PRId64 ") was %s\n", r->tombstone_reap_interval, (r->repl_eqcxt_tr ? "scheduled" : "not scheduled successfully")); } replica_unlock(r->repl_lock); diff --git a/ldap/servers/plugins/replication/replutil.c b/ldap/servers/plugins/replication/replutil.c index 7cc1323..a852f24 100644 --- a/ldap/servers/plugins/replication/replutil.c +++ b/ldap/servers/plugins/replication/replutil.c @@ -1076,7 +1076,7 @@ repl_config_valid_num(const char *config_attr, char *config_attr_value, int64_t *returncode = LDAP_UNWILLING_TO_PERFORM; if (errortext){ PR_snprintf(errortext, SLAPI_DSE_RETURNTEXT_SIZE, - "Attribute %s value (%s) is invalid, must be a number between %ld and %ld.", + "Attribute %s value (%s) is invalid, must be a number between %" PRId64 " and %" PRId64 ".", config_attr, config_attr_value, min, max); slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "repl_config_valid_num - %s\n", errortext); diff --git a/ldap/servers/slapd/abandon.c b/ldap/servers/slapd/abandon.c index e2237e5..3f7bef0 100644 --- a/ldap/servers/slapd/abandon.c +++ b/ldap/servers/slapd/abandon.c @@ -148,7 +148,7 @@ do_abandon(Slapi_PBlock *pb) slapi_log_access(LDAP_DEBUG_STATS, "conn=%" PRIu64 " op=%d ABANDON" " targetop=%d msgid=%d nentries=%d etime=%" PRId64 ".%010" PRId64 "\n", pb_conn->c_connid, pb_op->o_opid, o->o_opid, id, - o->o_results.r.r_search.nentries, o_hr_time_end.tv_sec, o_hr_time_end.tv_nsec); + o->o_results.r.r_search.nentries, (int64_t)o_hr_time_end.tv_sec, (int64_t)o_hr_time_end.tv_nsec); }
PR_ExitMonitor(pb_conn->c_mutex); diff --git a/ldap/servers/slapd/back-ldbm/back-ldbm.h b/ldap/servers/slapd/back-ldbm/back-ldbm.h index d2b25a7..ffc803e 100644 --- a/ldap/servers/slapd/back-ldbm/back-ldbm.h +++ b/ldap/servers/slapd/back-ldbm/back-ldbm.h @@ -351,7 +351,7 @@ struct backdn ID ep_id; /* entry id */ char ep_state; /* state in the cache; share ENTRY_STATE_* */ int ep_refcnt; /* entry reference cnt */ - size_t ep_size; /* for cache tracking */ + uint64_t ep_size; /* for cache tracking */ Slapi_DN *dn_sdn; void *dn_id_link; /* for hash table */ }; @@ -359,10 +359,10 @@ struct backdn /* for the in-core cache of entries */ struct cache { - size_t c_maxsize; /* max size in bytes */ + uint64_t c_maxsize; /* max size in bytes */ Slapi_Counter *c_cursize; /* size in bytes */ - long c_maxentries; /* max entries allowed (-1: no limit) */ - long c_curentries; /* current # entries in cache */ + uint64_t c_maxentries; /* max entries allowed (-1: no limit) */ + uint64_t c_curentries; /* current # entries in cache */ Hashtable *c_dntable; Hashtable *c_idtable; #ifdef UUIDCACHE_ON @@ -551,63 +551,45 @@ struct ldbminfo int li_allidsthreshold; char *li_directory; int li_reslimit_lookthrough_handle; - size_t li_dbcachesize; + uint64_t li_dbcachesize; int li_dblock; int li_dbncache; - int li_import_cache_autosize; /* % of free memory to use - * for the import caches - * (-1=default, 80% on cmd import) - * (0 = off) -- overrides - * import cache size settings */ - int li_cache_autosize; /* % of free memory to use - * for the combined caches - * (0 = off) -- overrides - * other cache size settings */ - int li_cache_autosize_split; /* % of li_cache_autosize to - * use for the libdb cache. - * the rest is split up among - * the instance entry caches */ - uint64_t li_cache_autosize_ec; /* new instances created while - * the server is up, should - * use this as the entry cache - * size (0 = autosize off) */ + int li_import_cache_autosize; /* % of free memory to use for the import caches + * (-1=default, 80% on cmd import) + * (0 = off) -- overrides import cache size settings */ + int li_cache_autosize; /* % of free memory to use for the combined caches + * (0 = off) -- overrides other cache size settings */ + int li_cache_autosize_split; /* % of li_cache_autosize to use for the libdb cache. + * the rest is split up among the instance entry caches */ + uint64_t li_cache_autosize_ec; /* new instances created while the server is up, should + * use this as the entry cache size (0 = autosize off) */ uint64_t li_dncache_autosize_ec; /* Same as above, but dncache. */ - size_t li_import_cachesize; /* size of the mpool for - * imports */ + uint64_t li_import_cachesize; /* size of the mpool for imports */ PRLock *li_dbcache_mutex; PRCondVar *li_dbcache_cv; - int li_shutdown; /* flag to tell any BE threads - * to end */ + int li_shutdown; /* flag to tell any BE threads to end */ PRLock *li_shutdown_mutex; /* protect shutdown flag */ dblayer_private *li_dblayer_private; /* session ptr for databases */ - int li_noparentcheck; /* check if parent exists on - * add */ + int li_noparentcheck; /* check if parent exists on add */
/* the next 3 fields are for the params that don't get changed until * the server is restarted (used by the admin console) */ char *li_new_directory; - size_t li_new_dbcachesize; + uint64_t li_new_dbcachesize; int li_new_dblock;
int li_new_dbncache;
db_upgrade_info *upgrade_info; - int li_filter_bypass; /* bypass filter testing, - * when possible */ - int li_filter_bypass_check; /* check that filter bypass - * is doing the right thing */ - int li_use_vlv; /* use vlv indexes to short- - * circuit matches when - * possible */ - void *li_identity; /* The ldbm plugin needs to keep - * track of its identity so it can - * perform internal ops. Its - * identity is given to it when - * its init function is called. */ - - Objset *li_instance_set; /* A set containing the ldbm - * instances. */ + int li_filter_bypass; /* bypass filter testing, when possible */ + int li_filter_bypass_check; /* check that filter bypass is doing the right thing */ + int li_use_vlv; /* use vlv indexes to short-circuit matches when possible */ + void *li_identity; /* The ldbm plugin needs to keep track of its identity so it can + * perform internal ops. Its identity is given to it when + * its init function is called. */ + + Objset *li_instance_set; /* A set containing the ldbm instances. */
PRLock *li_config_mutex;
diff --git a/ldap/servers/slapd/back-ldbm/cache.c b/ldap/servers/slapd/back-ldbm/cache.c index ee20dc3..77757c2 100644 --- a/ldap/servers/slapd/back-ldbm/cache.c +++ b/ldap/servers/slapd/back-ldbm/cache.c @@ -183,7 +183,7 @@ new_hash(u_long size, u_long offset, HashFn hfn, HashTestFn tfn) * already there (filled into 'alt' if 'alt' is not NULL) */ int -add_hash(Hashtable *ht, void *key, size_t keylen, void *entry, void **alt) +add_hash(Hashtable *ht, void *key, uint32_t keylen, void *entry, void **alt) { u_long val, slot; void *e; @@ -209,7 +209,7 @@ add_hash(Hashtable *ht, void *key, size_t keylen, void *entry, void **alt)
/* returns 1 if the item was found, and puts a ptr to it in 'entry' */ int -find_hash(Hashtable *ht, const void *key, size_t keylen, void **entry) +find_hash(Hashtable *ht, const void *key, uint32_t keylen, void **entry) { u_long val, slot; void *e; @@ -231,7 +231,7 @@ find_hash(Hashtable *ht, const void *key, size_t keylen, void **entry)
/* returns 1 if the item was found and removed */ int -remove_hash(Hashtable *ht, const void *key, size_t keylen) +remove_hash(Hashtable *ht, const void *key, uint32_t keylen) { u_long val, slot; void *e, *laste = NULL; @@ -494,7 +494,7 @@ cache_make_hashes(struct cache *cache, int type)
/* initialize the cache */ int -cache_init(struct cache *cache, size_t maxsize, long maxentries, int type) +cache_init(struct cache *cache, uint64_t maxsize, uint64_t maxentries, int type) { slapi_log_err(SLAPI_LOG_TRACE, "cache_init", "-->\n"); cache->c_maxsize = maxsize; @@ -598,7 +598,7 @@ entrycache_clear_int(struct cache *cache) cache->c_maxsize = size; if (cache->c_curentries > 0) { slapi_log_err(SLAPI_LOG_WARNING, - "entrycache_clear_int", "There are still %ld entries " + "entrycache_clear_int", "There are still %" PRIu64 " entries " "in the entry cache.\n", cache->c_curentries); #ifdef LDAP_CACHE_DEBUG @@ -648,7 +648,7 @@ cache_destroy_please(struct cache *cache, int type) }
void -cache_set_max_size(struct cache *cache, size_t bytes, int type) +cache_set_max_size(struct cache *cache, uint64_t bytes, int type) { if (CACHE_TYPE_ENTRY == type) { entrycache_set_max_size(cache, bytes); @@ -773,7 +773,7 @@ cache_entry_size(struct backentry *e) * these u_long *'s to a struct */ void -cache_get_stats(struct cache *cache, PRUint64 *hits, PRUint64 *tries, long *nentries, long *maxentries, size_t *size, size_t *maxsize) +cache_get_stats(struct cache *cache, PRUint64 *hits, PRUint64 *tries, uint64_t *nentries, uint64_t *maxentries, uint64_t *size, uint64_t *maxsize) { cache_lock(cache); if (hits) @@ -1580,7 +1580,7 @@ dncache_clear_int(struct cache *cache) cache->c_maxsize = size; if (cache->c_curentries > 0) { slapi_log_err(SLAPI_LOG_WARNING, - "dncache_clear_int", "There are still %ld dn's " + "dncache_clear_int", "There are still %" PRIu64 " dn's " "in the dn cache. :/\n", cache->c_curentries); } diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c index 5d870e3..5ab2211 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.c +++ b/ldap/servers/slapd/back-ldbm/dblayer.c @@ -822,10 +822,10 @@ dblayer_dump_config_tracing(dblayer_private *priv) slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "dbhome_directory=%s\n", priv->dblayer_dbhome_directory); } slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "trickle_percentage=%d\n", priv->dblayer_trickle_percentage); - slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "page_size=%lu\n", priv->dblayer_page_size); - slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "index_page_size=%lu\n", priv->dblayer_index_page_size); - slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "cachesize=%lu\n", priv->dblayer_cachesize); - slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "previous_cachesize=%lu\n", priv->dblayer_previous_cachesize); + slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "page_size=%" PRIu32 "\n", priv->dblayer_page_size); + slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "index_page_size=%" PRIu32 "\n", priv->dblayer_index_page_size); + slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "cachesize=%" PRIu64 "\n", priv->dblayer_cachesize); + slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "previous_cachesize=%" PRIu64 "\n", priv->dblayer_previous_cachesize); slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "ncache=%d\n", priv->dblayer_ncache); slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "previous_ncache=%d\n", priv->dblayer_previous_ncache); slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "recovery_required=%d\n", priv->dblayer_recovery_required); @@ -834,8 +834,8 @@ dblayer_dump_config_tracing(dblayer_private *priv) slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "transaction_batch_val=%d\n", trans_batch_limit); slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "circular_logging=%d\n", priv->dblayer_circular_logging); slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "idl_divisor=%d\n", priv->dblayer_idl_divisor); - slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "logfile_size=%lu\n", priv->dblayer_logfile_size); - slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "logbuf_size=%lu\n", priv->dblayer_logbuf_size); + slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "logfile_size=%" PRIu64 "\n", priv->dblayer_logfile_size); + slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "logbuf_size=%" PRIu64 "\n", priv->dblayer_logbuf_size); slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "file_mode=%d\n", priv->dblayer_file_mode); slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "cache_config=%d\n", priv->dblayer_cache_config); slapi_log_err(SLAPI_LOG_TRACE, "dblayer_dump_config_tracing", "lib_version=%d\n", priv->dblayer_lib_version); @@ -1203,8 +1203,8 @@ no_diskspace(struct ldbminfo *li, int dbenv_flags) /* Check if we have enough space */ if (fsiz < expected_siz) { slapi_log_err(SLAPI_LOG_ERR, - "no_diskspace", "No enough space left on device (%s) (%lu bytes); " - "at least %lu bytes space is needed for db region files\n", + "no_diskspace", "No enough space left on device (%s) (%" PRIu64 " bytes); " + "at least %" PRIu64 " bytes space is needed for db region files\n", region_dir, fsiz, expected_siz); return 1; } @@ -1322,9 +1322,9 @@ dblayer_start(struct ldbminfo *li, int dbmode) priv->dblayer_cachesize = MINCACHESIZE; } /* Oops---looks like the admin misconfigured, let's warn them */ - slapi_log_err(SLAPI_LOG_WARNING, "dblayer_start", "Likely CONFIGURATION ERROR - dbcachesize is configured to use more than the available " - "memory, decreased to (%" PRIu64 " bytes).\n", - priv->dblayer_cachesize); + slapi_log_err(SLAPI_LOG_WARNING, "dblayer_start", + "Likely CONFIGURATION ERROR - dbcachesize is configured to use more than the available " + "memory, decreased to (%" PRIu64 " bytes).\n", priv->dblayer_cachesize); li->li_dbcachesize = priv->dblayer_cachesize; } spal_meminfo_destroy(mi); @@ -1406,7 +1406,7 @@ dblayer_start(struct ldbminfo *li, int dbmode) (priv->dblayer_lock_config != priv->dblayer_previous_lock_config)) && !(dbmode & (DBLAYER_ARCHIVE_MODE | DBLAYER_EXPORT_MODE))) { if (priv->dblayer_cachesize != priv->dblayer_previous_cachesize) { - slapi_log_err(SLAPI_LOG_INFO, "dblayer_start", "Resizing db cache size: %lu -> %lu\n", + slapi_log_err(SLAPI_LOG_INFO, "dblayer_start", "Resizing db cache size: %" PRIu64 " -> %" PRIu64 "\n", priv->dblayer_previous_cachesize, priv->dblayer_cachesize); } if (priv->dblayer_ncache != priv->dblayer_previous_ncache) { @@ -1448,8 +1448,9 @@ dblayer_start(struct ldbminfo *li, int dbmode) if (priv->dblayer_logbuf_size >= 32768) { pEnv->dblayer_DB_ENV->set_lg_bsize(pEnv->dblayer_DB_ENV, priv->dblayer_logbuf_size); } else { - slapi_log_err(SLAPI_LOG_NOTICE, "dblayer_start", "Using default value for log bufsize because configured value (%lu) is too small.\n", - priv->dblayer_logbuf_size); + slapi_log_err(SLAPI_LOG_NOTICE, "dblayer_start", + "Using default value for log bufsize because configured value (%" PRIu64 ") is too small.\n", + priv->dblayer_logbuf_size); } }
@@ -1499,7 +1500,7 @@ dblayer_start(struct ldbminfo *li, int dbmode) */ slapi_log_err(SLAPI_LOG_CRIT, "dblayer_start", "mmap in opening database environment (recovery mode) " - "failed trying to allocate %lu bytes. (OS err %d - %s)\n", + "failed trying to allocate %" PRIu64 " bytes. (OS err %d - %s)\n", li->li_dbcachesize, return_value, dblayer_strerror(return_value)); dblayer_free_env(&priv->dblayer_env); priv->dblayer_env = CATASTROPHIC; @@ -1509,7 +1510,7 @@ dblayer_start(struct ldbminfo *li, int dbmode) return_value, dblayer_strerror(return_value)); slapi_log_err(SLAPI_LOG_CRIT, "dblayer_start", "Please make sure there is enough disk space for " - "dbcache (%lu bytes) and db region files\n", + "dbcache (%" PRIu64 " bytes) and db region files\n", li->li_dbcachesize); } return return_value; @@ -1588,7 +1589,7 @@ dblayer_start(struct ldbminfo *li, int dbmode) */ slapi_log_err(SLAPI_LOG_CRIT, "dblayer_start", "mmap in opening database environment " - "failed trying to allocate %lu bytes. (OS err %d - %s)\n", + "failed trying to allocate %" PRIu64 " bytes. (OS err %d - %s)\n", li->li_dbcachesize, return_value, dblayer_strerror(return_value)); dblayer_free_env(&priv->dblayer_env); priv->dblayer_env = CATASTROPHIC; @@ -1949,7 +1950,7 @@ dblayer_instance_start(backend *be, int mode) (priv->dblayer_page_size == 0) ? DBLAYER_PAGESIZE : priv->dblayer_page_size); if (0 != return_value) { slapi_log_err(SLAPI_LOG_ERR, - "dblayer_instance_start", "dbp->set_pagesize(%lu or %lu) failed %d\n", + "dblayer_instance_start", "dbp->set_pagesize(%" PRIu32 " or %" PRIu32 ") failed %d\n", priv->dblayer_page_size, DBLAYER_PAGESIZE, return_value); goto out; @@ -1976,7 +1977,7 @@ dblayer_instance_start(backend *be, int mode) (priv->dblayer_page_size == 0) ? DBLAYER_PAGESIZE : priv->dblayer_page_size); if (0 != return_value) { slapi_log_err(SLAPI_LOG_ERR, - "dblayer_instance_start", "dbp->set_pagesize(%lu or %lu) failed %d\n", + "dblayer_instance_start", "dbp->set_pagesize(%" PRIu32 " or %" PRIu32 ") failed %d\n", priv->dblayer_page_size, DBLAYER_PAGESIZE, return_value); goto out; @@ -2223,7 +2224,7 @@ dblayer_get_aux_id2entry_ext(backend *be, DB **ppDB, DB_ENV **ppEnv, char **path rval = dbp->set_pagesize(dbp, (priv->dblayer_page_size == 0) ? DBLAYER_PAGESIZE : priv->dblayer_page_size); if (rval) { slapi_log_err(SLAPI_LOG_ERR, - "dblayer_get_aux_id2entry_ext", "dbp->set_pagesize(%lu or %lu) failed %d\n", + "dblayer_get_aux_id2entry_ext", "dbp->set_pagesize(%" PRIu32 " or %" PRIu32 ") failed %d\n", priv->dblayer_page_size, DBLAYER_PAGESIZE, rval); goto err; } @@ -3495,11 +3496,11 @@ dblayer_txn_abort_all(struct ldbminfo *li, back_txn *txn) return (dblayer_txn_abort_ext(li, txn, PR_TRUE)); }
-size_t +uint32_t dblayer_get_optimal_block_size(struct ldbminfo *li) { dblayer_private *priv = NULL; - size_t page_size = 0; + uint32_t page_size = 0;
PR_ASSERT(NULL != li);
@@ -3650,7 +3651,7 @@ typedef struct txn_test_iter DBC *cur; uint64_t cnt; const char *attr; - u_int32_t flags; + uint32_t flags; backend *be; } txn_test_iter;
@@ -3658,14 +3659,14 @@ typedef struct txn_test_cfg { PRUint32 hold_msec; PRUint32 loop_msec; - u_int32_t flags; + uint32_t flags; int use_txn; char **indexes; int verbose; } txn_test_cfg;
static txn_test_iter * -new_txn_test_iter(DB *db, const char *attr, backend *be, u_int32_t flags) +new_txn_test_iter(DB *db, const char *attr, backend *be, uint32_t flags) { txn_test_iter *tti = (txn_test_iter *)slapi_ch_malloc(sizeof(txn_test_iter)); tti->db = db; @@ -3702,7 +3703,7 @@ free_txn_test_iter(txn_test_iter *tti) }
static void -free_ttilist(txn_test_iter ***ttilist, size_t *tticnt) +free_ttilist(txn_test_iter ***ttilist, uint64_t *tticnt) { if (!ttilist || !*ttilist || !**ttilist) { return; @@ -3715,7 +3716,7 @@ free_ttilist(txn_test_iter ***ttilist, size_t *tticnt) }
static void -init_ttilist(txn_test_iter **ttilist, size_t tticnt) +init_ttilist(txn_test_iter **ttilist, uint64_t tticnt) { if (!ttilist || !*ttilist) { return; @@ -3727,12 +3728,12 @@ init_ttilist(txn_test_iter **ttilist, size_t tticnt) }
static void -print_ttilist(txn_test_iter **ttilist, size_t tticnt) +print_ttilist(txn_test_iter **ttilist, uint64_t tticnt) { while (tticnt > 0) { tticnt--; slapi_log_err(SLAPI_LOG_ERR, - "txn_test_threadmain", "attr [%s] cnt [%lu]\n", + "txn_test_threadmain", "attr [%s] cnt [%" PRIu64 "]\n", ttilist[tticnt]->attr, ttilist[tticnt]->cnt); } } @@ -3903,7 +3904,7 @@ wait_for_init: /* phase 1 - open a cursor to each db */ if (cfg.verbose) { slapi_log_err(SLAPI_LOG_ERR, - "txn_test_threadmain", "Starting [%lu] indexes\n", tticnt); + "txn_test_threadmain", "Starting [%" PRIu64 "] indexes\n", tticnt); } for (ii = 0; ii < tticnt; ++ii) { txn_test_iter *tti = ttilist[ii]; @@ -4015,7 +4016,7 @@ wait_for_init: init_ttilist(ttilist, tticnt); if (cfg.verbose) { slapi_log_err(SLAPI_LOG_ERR, - "txn_test_threadmain", "Finished [%lu] indexes [%lu] records\n", tticnt, cnt); + "txn_test_threadmain", "Finished [%" PRIu64 "] indexes [%" PRIu64 "] records\n", tticnt, cnt); } TXN_TEST_LOOP_WAIT(cfg.loop_msec); } else { @@ -4612,10 +4613,10 @@ db_atoi(char *str, int *err) return db_atol(str, err); }
-unsigned long +uint32_t db_strtoul(const char *str, int *err) { - unsigned long val = 0, result, multiplier = 1; + uint32_t val = 0, result, multiplier = 1; char *p; errno = 0;
@@ -4678,6 +4679,72 @@ db_strtoul(const char *str, int *err) return result; }
+uint64_t +db_strtoull(const char *str, int *err) +{ + uint64_t val = 0, result, multiplier = 1; + char *p; + errno = 0; + + /* + * manpage of strtoull: Negative values are considered valid input and + * are silently converted to the equivalent unsigned long int value. + */ + /* We don't want to make it happen. */ + for (p = (char *)str; p && *p && (*p == ' ' || *p == '\t'); p++) + ; + if ('-' == *p) { + if (err) { + *err = ERANGE; + } + return val; + } + val = strtoull(str, &p, 10); + if (errno != 0) { + if (err) { + *err = errno; + } + return val; + } + + switch (*p) { + case 'g': + case 'G': + multiplier *= 1024 * 1024 * 1024; + break; + case 'm': + case 'M': + multiplier *= 1024 * 1024; + break; + case 'k': + case 'K': + multiplier *= 1024; + p++; + if (*p == 'b' || *p == 'B') { + p++; + } + if (err) { + /* extra chars? */ + *err = (*p != '\0') ? EINVAL : 0; + } + break; + case '\0': + if (err) { + *err = 0; + } + break; + default: + if (err) { + *err = EINVAL; + } + return val; + } + + result = val * multiplier; + + return result; +} + /* functions called directly by the plugin interface from the front-end */
/* Begin transaction */ @@ -7200,9 +7267,9 @@ ldbm_back_get_info(Slapi_Backend *be, int cmd, void **info) if (li) { dblayer_private *prv = (dblayer_private *)li->li_dblayer_private; if (prv && prv->dblayer_index_page_size) { - *(size_t *)info = prv->dblayer_index_page_size; + *(uint32_t *)info = prv->dblayer_index_page_size; } else { - *(size_t *)info = DBLAYER_INDEX_PAGESIZE; + *(uint32_t *)info = DBLAYER_INDEX_PAGESIZE; } rc = 0; } diff --git a/ldap/servers/slapd/back-ldbm/dblayer.h b/ldap/servers/slapd/back-ldbm/dblayer.h index 6fe28d1..5e4433e 100644 --- a/ldap/servers/slapd/back-ldbm/dblayer.h +++ b/ldap/servers/slapd/back-ldbm/dblayer.h @@ -28,8 +28,8 @@ #endif /* solaris: mmap */ #endif /* DB_USE_64LFS */
-#define DBLAYER_PAGESIZE (size_t)8 * 1024 -#define DBLAYER_INDEX_PAGESIZE (size_t)8 * 1024 /* With the new idl design, \ +#define DBLAYER_PAGESIZE (uint32_t)8 * 1024 +#define DBLAYER_INDEX_PAGESIZE (uint32_t)8 * 1024 /* With the new idl design, \ the large 8Kbyte pages we use are not optimal. The page pool churns very \ quickly as we add new IDs under a sustained add load. Smaller pages stop \ this happening so much and consequently make us spend less time flushing \ @@ -103,9 +103,9 @@ struct dblayer_private int dblayer_durable_transactions; int dblayer_checkpoint_interval; int dblayer_circular_logging; - uint64_t dblayer_page_size; /* db page size if configured, + uint32_t dblayer_page_size; /* db page size if configured, * otherwise default to DBLAYER_PAGESIZE */ - uint64_t dblayer_index_page_size; /* db index page size if configured, + uint32_t dblayer_index_page_size; /* db index page size if configured, * otherwise default to * DBLAYER_INDEX_PAGESIZE */ int dblayer_idl_divisor; /* divide page size by this to get IDL diff --git a/ldap/servers/slapd/back-ldbm/filterindex.c b/ldap/servers/slapd/back-ldbm/filterindex.c index e8c3c20..9a6d33f 100644 --- a/ldap/servers/slapd/back-ldbm/filterindex.c +++ b/ldap/servers/slapd/back-ldbm/filterindex.c @@ -974,7 +974,7 @@ keys2idl( IDList *idl = NULL;
slapi_log_err(SLAPI_LOG_TRACE, "keys2idl", "=> type %s indextype %s\n", type, indextype); - for (size_t i = 0; ivals[i] != NULL; i++) { + for (uint32_t i = 0; ivals[i] != NULL; i++) { IDList *idl2 = NULL;
idl2 = index_read_ext_allids(pb, be, type, indextype, slapi_value_get_berval(ivals[i]), txn, err, unindexed, allidslimit); @@ -985,8 +985,8 @@ keys2idl( char buf[BUFSIZ];
slapi_log_err(SLAPI_LOG_TRACE, "keys2idl", - " ival[%lu] = "%s" => %lu IDs\n", i, - encode(slapi_value_get_berval(ivals[i]), buf), (u_long)IDL_NIDS(idl2)); + " ival[%" PRIu32 "] = "%s" => %" PRIu32 " IDs\n", i, + encode(slapi_value_get_berval(ivals[i]), buf), (uint32_t)IDL_NIDS(idl2)); } #endif if (idl2 == NULL) { diff --git a/ldap/servers/slapd/back-ldbm/idl_new.c b/ldap/servers/slapd/back-ldbm/idl_new.c index 6c4abc2..7d56d19 100644 --- a/ldap/servers/slapd/back-ldbm/idl_new.c +++ b/ldap/servers/slapd/back-ldbm/idl_new.c @@ -83,10 +83,10 @@ idl_new_get_allidslimit(struct attrinfo *a, int allidslimit) }
int -idl_new_exceeds_allidslimit(size_t count, struct attrinfo *a, int allidslimit) +idl_new_exceeds_allidslimit(uint64_t count, struct attrinfo *a, int allidslimit) { - size_t limit = idl_new_get_allidslimit(a, allidslimit); - return (limit != (size_t)-1) && (count > limit); + uint64_t limit = idl_new_get_allidslimit(a, allidslimit); + return (limit != (uint64_t)-1) && (count > limit); }
@@ -138,7 +138,7 @@ idl_new_fetch( DBT key; DBT data; ID id = 0; - size_t count = 0; + uint64_t count = 0; /* beware that a large buffer on the stack might cause a stack overflow on some platforms */ char buffer[BULK_FETCH_BUFFER_SIZE]; void *ptr; @@ -245,7 +245,7 @@ idl_new_fetch( count++; }
- slapi_log_err(SLAPI_LOG_TRACE, "idl_new_fetch", "bulk fetch buffer nids=%lu\n", count); + slapi_log_err(SLAPI_LOG_TRACE, "idl_new_fetch", "bulk fetch buffer nids=%" PRIu64 "\n", count); #if defined(DB_ALLIDS_ON_READ) /* enforce the allids read limit */ if ((NEW_IDL_NO_ALLID != *flag_err) && (NULL != a) && @@ -254,7 +254,7 @@ idl_new_fetch( idl->b_ids[0] = ALLID; ret = DB_NOTFOUND; /* fool the code below into thinking that we finished the dups */ slapi_log_err(SLAPI_LOG_BACKLDBM, "idl_new_fetch", "Search for key for attribute index %s " - "exceeded allidslimit %d - count is %lu\n", + "exceeded allidslimit %d - count is %" PRIu64 "\n", a->ai_type, allidslimit, count); break; } @@ -348,7 +348,7 @@ idl_new_range_fetch( DBT cur_key = {0}; DBT data = {0}; ID id = 0; - size_t count = 0; + uint64_t count = 0; /* beware that a large buffer on the stack might cause a stack overflow on some platforms */ char buffer[BULK_FETCH_BUFFER_SIZE]; void *ptr; @@ -522,7 +522,7 @@ idl_new_range_fetch( }
slapi_log_err(SLAPI_LOG_TRACE, "idl_new_range_fetch", - "Bulk fetch buffer nids=%lu\n", count); + "Bulk fetch buffer nids=%" PRIu64 "\n", count); #if defined(DB_ALLIDS_ON_READ) /* enforce the allids read limit */ if ((NEW_IDL_NO_ALLID != *flag_err) && ai && (idl != NULL) && diff --git a/ldap/servers/slapd/back-ldbm/import-threads.c b/ldap/servers/slapd/back-ldbm/import-threads.c index 0419865..1be15a4 100644 --- a/ldap/servers/slapd/back-ldbm/import-threads.c +++ b/ldap/servers/slapd/back-ldbm/import-threads.c @@ -3563,7 +3563,7 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char slapi_search_internal_pb(srch_pb); slapi_pblock_get(srch_pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries); for (ep = entries; ep != NULL && *ep != NULL; ep++) { - size_t l = strlen(slapi_entry_get_dn_const(*ep)) + 5 /* "dn: \n" */; + int32_t l = strlen(slapi_entry_get_dn_const(*ep)) + 5 /* "dn: \n" */; slapi_log_err(SLAPI_LOG_TRACE, "dse_conf_backup_core", "dn: %s\n", slapi_entry_get_dn_const(*ep));
@@ -3573,9 +3573,9 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char tp = (char *)slapi_ch_malloc(l); /* should be very rare ... */ sprintf(tp, "dn: %s\n", slapi_entry_get_dn_const(*ep)); prrval = PR_Write(prfd, tp, l); - if ((size_t)prrval != l) { + if (prrval != l) { slapi_log_err(SLAPI_LOG_ERR, "dse_conf_backup_core", - "(%s): write %lu failed: %d (%s)\n", + "(%s): write %" PRId32 " failed: %d (%s)\n", filter, l, PR_GetError(), slapd_pr_strerror(PR_GetError())); rval = -1; if (l > sizeof(tmpbuf)) @@ -3609,9 +3609,9 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char tp = (char *)slapi_ch_malloc(l); sprintf(tp, "%s: %s\n", attr_name, attr_val->bv_val); prrval = PR_Write(prfd, tp, l); - if ((size_t)prrval != l) { + if (prrval != l) { slapi_log_err(SLAPI_LOG_ERR, "dse_conf_backup_core", - "(%s): write %lu failed: %d (%s)\n", + "(%s): write %" PRId32 " failed: %d (%s)\n", filter, l, PR_GetError(), slapd_pr_strerror(PR_GetError())); rval = -1; if (l > sizeof(tmpbuf)) @@ -3624,9 +3624,9 @@ dse_conf_backup_core(struct ldbminfo *li, char *dest_dir, char *file_name, char } if (ep + 1 != NULL && *(ep + 1) != NULL) { prrval = PR_Write(prfd, "\n", 1); - if ((int)prrval != 1) { + if (prrval != 1) { slapi_log_err(SLAPI_LOG_ERR, "dse_conf_backup_core", - "(%s): write %lu failed: %d (%s)\n", + "(%s): write %" PRId32 " failed: %d (%s)\n", filter, l, PR_GetError(), slapd_pr_strerror(PR_GetError())); rval = -1; goto out; diff --git a/ldap/servers/slapd/back-ldbm/ldbm_add.c b/ldap/servers/slapd/back-ldbm/ldbm_add.c index 412e1d3..32c8e71 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_add.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_add.c @@ -857,7 +857,7 @@ ldbm_back_add(Slapi_PBlock *pb) } retval = parent_update_on_childchange(&parent_modify_c, op, NULL); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_add", - "conn=%lu op=%d parent_update_on_childchange: old_entry=0x%p, new_entry=0x%p, rc=%d\n", + "conn=%" PRIu64 " op=%d parent_update_on_childchange: old_entry=0x%p, new_entry=0x%p, rc=%d\n", conn_id, op_id, parent_modify_c.old_entry, parent_modify_c.new_entry, retval); /* The modify context now contains info needed later */ if (retval) { @@ -1053,7 +1053,7 @@ ldbm_back_add(Slapi_PBlock *pb) /* Push out the db modifications from the parent entry */ retval = modify_update_all(be, pb, &parent_modify_c, &txn); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_add", - "conn=%lu op=%d modify_update_all: old_entry=0x%p, new_entry=0x%p, rc=%d\n", + "conn=%" PRIu64 " op=%d modify_update_all: old_entry=0x%p, new_entry=0x%p, rc=%d\n", conn_id, op_id, parent_modify_c.old_entry, parent_modify_c.new_entry, retval); if (DB_LOCK_DEADLOCK == retval) { slapi_log_err(SLAPI_LOG_ARGS, "ldbm_back_add", "add 6 DEADLOCK\n"); @@ -1177,7 +1177,7 @@ ldbm_back_add(Slapi_PBlock *pb) /* switch the parent entry copy into play */ myrc = modify_switch_entries(&parent_modify_c, be); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_add", - "conn=%lu op=%d modify_switch_entries: old_entry=0x%p, new_entry=0x%p, rc=%d\n", + "conn=%" PRIu64 " op=%d modify_switch_entries: old_entry=0x%p, new_entry=0x%p, rc=%d\n", conn_id, op_id, parent_modify_c.old_entry, parent_modify_c.new_entry, myrc); if (0 == myrc) { parent_switched = 1; @@ -1257,7 +1257,7 @@ error_return: */ myrc = modify_unswitch_entries(&parent_modify_c, be); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_add", - "conn=%lu op=%d modify_unswitch_entries: old_entry=0x%p, new_entry=0x%p, rc=%d\n", + "conn=%" PRIu64 " op=%d modify_unswitch_entries: old_entry=0x%p, new_entry=0x%p, rc=%d\n", conn_id, op_id, parent_modify_c.old_entry, parent_modify_c.new_entry, myrc); } diskfull_return: @@ -1394,7 +1394,7 @@ common_return: modify_term(&ruv_c, be); } slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_add", - "conn=%lu op=%d modify_term: old_entry=0x%p, new_entry=0x%p\n", + "conn=%" PRIu64 " op=%d modify_term: old_entry=0x%p, new_entry=0x%p\n", conn_id, op_id, parent_modify_c.old_entry, parent_modify_c.new_entry); myrc = modify_term(&parent_modify_c, be); done_with_pblock_entry(pb, SLAPI_ADD_EXISTING_DN_ENTRY); diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c index feb9933..67a6475 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_config.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c @@ -413,7 +413,7 @@ ldbm_config_dbcachesize_get(void *arg) { struct ldbminfo *li = (struct ldbminfo *)arg;
- return (void *)(li->li_new_dbcachesize); + return (void *)((uintptr_t)li->li_new_dbcachesize); }
static int @@ -724,7 +724,7 @@ ldbm_config_db_logbuf_size_get(void *arg) { struct ldbminfo *li = (struct ldbminfo *)arg;
- return (void *)li->li_dblayer_private->dblayer_logbuf_size; + return (void *)((uintptr_t)li->li_dblayer_private->dblayer_logbuf_size); }
static int @@ -736,7 +736,7 @@ ldbm_config_db_logbuf_size_set(void *arg, { struct ldbminfo *li = (struct ldbminfo *)arg; int retval = LDAP_SUCCESS; - size_t val = (size_t)value; + uint64_t val = (uint64_t)((uintptr_t)value);
if (apply) { li->li_dblayer_private->dblayer_logbuf_size = val; @@ -802,7 +802,7 @@ ldbm_config_db_page_size_get(void *arg) { struct ldbminfo *li = (struct ldbminfo *)arg;
- return (void *)li->li_dblayer_private->dblayer_page_size; + return (void *)((uintptr_t)li->li_dblayer_private->dblayer_page_size); }
static int @@ -814,7 +814,7 @@ ldbm_config_db_page_size_set(void *arg, { struct ldbminfo *li = (struct ldbminfo *)arg; int retval = LDAP_SUCCESS; - size_t val = (size_t)value; + uint32_t val = (uint32_t)((uintptr_t)value);
if (apply) { li->li_dblayer_private->dblayer_page_size = val; @@ -828,7 +828,7 @@ ldbm_config_db_index_page_size_get(void *arg) { struct ldbminfo *li = (struct ldbminfo *)arg;
- return (void *)li->li_dblayer_private->dblayer_index_page_size; + return (void *)((uintptr_t)li->li_dblayer_private->dblayer_index_page_size); }
static int @@ -840,7 +840,7 @@ ldbm_config_db_index_page_size_set(void *arg, { struct ldbminfo *li = (struct ldbminfo *)arg; int retval = LDAP_SUCCESS; - size_t val = (size_t)value; + uint32_t val = (uint32_t)((uintptr_t)value);
if (apply) { li->li_dblayer_private->dblayer_index_page_size = val; @@ -913,7 +913,7 @@ ldbm_config_db_logfile_size_get(void *arg) { struct ldbminfo *li = (struct ldbminfo *)arg;
- return (void *)li->li_dblayer_private->dblayer_logfile_size; + return (void *)((uintptr_t)li->li_dblayer_private->dblayer_logfile_size); }
static int @@ -925,7 +925,7 @@ ldbm_config_db_logfile_size_set(void *arg, { struct ldbminfo *li = (struct ldbminfo *)arg; int retval = LDAP_SUCCESS; - size_t val = (size_t)value; + uint64_t val = (uint64_t)((uintptr_t)value);
if (apply) { li->li_dblayer_private->dblayer_logfile_size = val; @@ -1218,12 +1218,12 @@ ldbm_config_db_lock_set(void *arg, void *value, char *errorbuf, int phase, int a { struct ldbminfo *li = (struct ldbminfo *)arg; int retval = LDAP_SUCCESS; - size_t val = (size_t)value; + uint64_t val = (uint64_t)((uintptr_t)value);
if (val < BDB_LOCK_NB_MIN) { slapi_create_errormsg(errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: Invalid value for %s (%d). Must be greater than %d\n", CONFIG_DB_LOCK, val, BDB_LOCK_NB_MIN); - slapi_log_err(SLAPI_LOG_ERR, "ldbm_config_db_lock_set", "Invalid value for %s (%lu)\n", + slapi_log_err(SLAPI_LOG_ERR, "ldbm_config_db_lock_set", "Invalid value for %s (%" PRIu64 ")\n", CONFIG_DB_LOCK, val); return LDAP_UNWILLING_TO_PERFORM; } @@ -1439,7 +1439,7 @@ ldbm_config_import_cachesize_get(void *arg) { struct ldbminfo *li = (struct ldbminfo *)arg;
- return (void *)(li->li_import_cachesize); + return (void *)((uintptr_t)li->li_import_cachesize); }
static int @@ -1450,8 +1450,8 @@ ldbm_config_import_cachesize_set(void *arg, int apply) { struct ldbminfo *li = (struct ldbminfo *)arg; - size_t val = (size_t)value; - uint64_t delta = (size_t)value; + uint64_t val = (uint64_t)((uintptr_t)value); + uint64_t delta; /* There is an error here. We check the new val against our current mem-alloc * Issue is that we already are using system pages, so while our value *might* * be valid, we may reject it here due to the current procs page usage. @@ -1819,7 +1819,7 @@ static config_info ldbm_config[] = { {CONFIG_MODE, CONFIG_TYPE_INT_OCTAL, "0600", &ldbm_config_mode_get, &ldbm_config_mode_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_IDLISTSCANLIMIT, CONFIG_TYPE_INT, "4000", &ldbm_config_allidsthreshold_get, &ldbm_config_allidsthreshold_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_DIRECTORY, CONFIG_TYPE_STRING, "", &ldbm_config_directory_get, &ldbm_config_directory_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE | CONFIG_FLAG_SKIP_DEFAULT_SETTING}, - {CONFIG_DBCACHESIZE, CONFIG_TYPE_SIZE_T, DEFAULT_CACHE_SIZE_STR, &ldbm_config_dbcachesize_get, &ldbm_config_dbcachesize_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, + {CONFIG_DBCACHESIZE, CONFIG_TYPE_UINT64, DEFAULT_CACHE_SIZE_STR, &ldbm_config_dbcachesize_get, &ldbm_config_dbcachesize_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_DBNCACHE, CONFIG_TYPE_INT, "0", &ldbm_config_dbncache_get, &ldbm_config_dbncache_set, CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_MAXPASSBEFOREMERGE, CONFIG_TYPE_INT, "100", &ldbm_config_maxpassbeforemerge_get, &ldbm_config_maxpassbeforemerge_set, 0},
@@ -1839,7 +1839,7 @@ static config_info ldbm_config[] = { {CONFIG_DB_INDEX_PAGE_SIZE, CONFIG_TYPE_SIZE_T, "0", &ldbm_config_db_index_page_size_get, &ldbm_config_db_index_page_size_set, 0}, {CONFIG_DB_IDL_DIVISOR, CONFIG_TYPE_INT, "0", &ldbm_config_db_idl_divisor_get, &ldbm_config_db_idl_divisor_set, 0}, {CONFIG_DB_OLD_IDL_MAXIDS, CONFIG_TYPE_INT, "0", &ldbm_config_db_old_idl_maxids_get, &ldbm_config_db_old_idl_maxids_set, 0}, - {CONFIG_DB_LOGFILE_SIZE, CONFIG_TYPE_SIZE_T, "0", &ldbm_config_db_logfile_size_get, &ldbm_config_db_logfile_size_set, 0}, + {CONFIG_DB_LOGFILE_SIZE, CONFIG_TYPE_UINT64, "0", &ldbm_config_db_logfile_size_get, &ldbm_config_db_logfile_size_set, 0}, {CONFIG_DB_TRICKLE_PERCENTAGE, CONFIG_TYPE_INT, "5", &ldbm_config_db_trickle_percentage_get, &ldbm_config_db_trickle_percentage_set, 0}, {CONFIG_DB_SPIN_COUNT, CONFIG_TYPE_INT, "0", &ldbm_config_db_spin_count_get, &ldbm_config_db_spin_count_set, 0}, {CONFIG_DB_VERBOSE, CONFIG_TYPE_ONOFF, "off", &ldbm_config_db_verbose_get, &ldbm_config_db_verbose_set, 0}, @@ -1856,7 +1856,7 @@ static config_info ldbm_config[] = { {CONFIG_IMPORT_CACHE_AUTOSIZE, CONFIG_TYPE_INT, "-1", &ldbm_config_import_cache_autosize_get, &ldbm_config_import_cache_autosize_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_CACHE_AUTOSIZE, CONFIG_TYPE_INT, "10", &ldbm_config_cache_autosize_get, &ldbm_config_cache_autosize_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_CACHE_AUTOSIZE_SPLIT, CONFIG_TYPE_INT, "25", &ldbm_config_cache_autosize_split_get, &ldbm_config_cache_autosize_split_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, - {CONFIG_IMPORT_CACHESIZE, CONFIG_TYPE_SIZE_T, "16777216", &ldbm_config_import_cachesize_get, &ldbm_config_import_cachesize_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, + {CONFIG_IMPORT_CACHESIZE, CONFIG_TYPE_UINT64, "16777216", &ldbm_config_import_cachesize_get, &ldbm_config_import_cachesize_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_IDL_SWITCH, CONFIG_TYPE_STRING, "new", &ldbm_config_idl_get_idl_new, &ldbm_config_idl_set_tune, CONFIG_FLAG_ALWAYS_SHOW}, {CONFIG_IDL_UPDATE, CONFIG_TYPE_ONOFF, "on", &ldbm_config_idl_get_update, &ldbm_config_idl_set_update, 0}, {CONFIG_BYPASS_FILTER_TEST, CONFIG_TYPE_STRING, "on", &ldbm_config_get_bypass_filter_test, &ldbm_config_set_bypass_filter_test, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, @@ -2118,7 +2118,11 @@ ldbm_config_get(void *arg, config_info *config, char *buf) break; case CONFIG_TYPE_SIZE_T: val = (size_t)config->config_get_fn(arg); - sprintf(buf, "%lu", (long unsigned int)val); + sprintf(buf, "%" PRIu32, (uint32_t)val); + break; + case CONFIG_TYPE_UINT64: + val = (uint64_t)((uintptr_t)config->config_get_fn(arg)); + sprintf(buf, "%" PRIu64, (uint64_t)val); break; case CONFIG_TYPE_STRING: /* Remember the get function for strings returns memory @@ -2371,6 +2375,34 @@ ldbm_config_set(void *arg, char *attr_name, config_info *config_array, struct be } retval = config->config_set_fn(arg, (void *)sz_val, err_buf, phase, apply_mod); break; + + + case CONFIG_TYPE_UINT64: + if (use_default) { + str_val = config->config_default_value; + } else { + str_val = bval->bv_val; + } + /* get the value as a size_t value */ + sz_val = db_strtoull(str_val, &err); + + /* check for parsing error (e.g. not a number) */ + if (err == EINVAL) { + slapi_create_errormsg(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is not a number\n", + str_val, attr_name); + slapi_log_err(SLAPI_LOG_ERR, "ldbm_config_set", "Value %s for attr %s is not a number\n", + str_val, attr_name); + return LDAP_UNWILLING_TO_PERFORM; + /* check for overflow */ + } else if (err == ERANGE) { + slapi_create_errormsg(err_buf, SLAPI_DSE_RETURNTEXT_SIZE, "Error: value %s for attr %s is outside the range of representable values\n", + str_val, attr_name); + slapi_log_err(SLAPI_LOG_ERR, "ldbm_config_set", "Value %s for attr %s is outside the range of representable values\n", + str_val, attr_name); + return LDAP_UNWILLING_TO_PERFORM; + } + retval = config->config_set_fn(arg, (void *)sz_val, err_buf, phase, apply_mod); + break; case CONFIG_TYPE_STRING: if (use_default) { retval = config->config_set_fn(arg, config->config_default_value, err_buf, phase, apply_mod); diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.h b/ldap/servers/slapd/back-ldbm/ldbm_config.h index c0f5d31..29fb7a7 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_config.h +++ b/ldap/servers/slapd/back-ldbm/ldbm_config.h @@ -18,19 +18,17 @@ struct config_info; typedef struct config_info config_info;
typedef int config_set_fn_t(void *arg, void *value, char *errorbuf, int phase, int apply); -typedef void *config_get_fn_t(void *arg); -/* The value for these is passed around as a - * void *, the actual value should be gotten - * by casting the void * as shown below. */ +typedef void *config_get_fn_t(void *arg); /* The value for these is passed around as a + * void *, the actual value should be gotten + * by casting the void * as shown below. */ #define CONFIG_TYPE_ONOFF 1 /* val = (int) value */ -#define CONFIG_TYPE_STRING 2 /* val = (char *) value - The get functions \ - * for this type must return alloced memory \ - * that should be freed by the caller. */ +#define CONFIG_TYPE_STRING 2 /* val = (char *) value - The get functions for this type + * must return alloced memory that should be freed by the caller. */ #define CONFIG_TYPE_INT 3 /* val = (int) value */ #define CONFIG_TYPE_LONG 4 /* val = (long) value */ -#define CONFIG_TYPE_INT_OCTAL 5 /* Same as CONFIG_TYPE_INT, but shown in \ - * octal */ +#define CONFIG_TYPE_INT_OCTAL 5 /* Same as CONFIG_TYPE_INT, but shown in octal */ #define CONFIG_TYPE_SIZE_T 6 /* val = (size_t) value */ +#define CONFIG_TYPE_UINT64 7 /* val = (uint64_t) value */
/* How changes to some config attributes are handled depends on what * "phase" the server is in. Initialization, reading the config diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c index bc0a365..3a27fd0 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c @@ -211,7 +211,7 @@ ldbm_back_delete(Slapi_PBlock *pb) CACHE_RETURN(&inst->inst_cache, &tombstone); if (tombstone) { slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_delete", - "conn=%lu op=%d [retry: %d] tombstone %s is not freed!!! refcnt %d, state %d\n", + "conn=%" PRIu64 " op=%d [retry: %d] tombstone %s is not freed!!! refcnt %d, state %d\n", conn_id, op_id, retry_count, slapi_entry_get_dn(tombstone->ep_entry), tombstone->ep_refcnt, tombstone->ep_state); } @@ -220,7 +220,7 @@ ldbm_back_delete(Slapi_PBlock *pb) tmptombstone = NULL; } else { slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_delete", - "conn=%lu op=%d [retry: %d] No original_tombstone for %s!!\n", + "conn=%" PRIu64 " op=%d [retry: %d] No original_tombstone for %s!!\n", conn_id, op_id, retry_count, slapi_entry_get_dn(e->ep_entry)); } } @@ -294,11 +294,11 @@ replace_entry: if (slapi_entry_has_conflict_children(e->ep_entry, (void *)li->li_identity) > 0) { ldap_result_message = "Entry has replication conflicts as children"; slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_delete", - "conn=%lu op=%d Deleting entry %s has replication conflicts as children.\n", + "conn=%" PRIu64 " op=%d Deleting entry %s has replication conflicts as children.\n", conn_id, op_id, slapi_entry_get_dn(e->ep_entry)); } else { slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_delete", - "conn=%lu op=%d Deleting entry %s has %d children.\n", + "conn=%" PRIu64 " op=%d Deleting entry %s has %d children.\n", conn_id, op_id, slapi_entry_get_dn(e->ep_entry), retval); } retval = -1; @@ -566,7 +566,7 @@ replace_entry: /* The modify context now contains info needed later */ if (0 != retval) { slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_delete", - "conn=%lu op=%d parent_update_on_childchange: old_entry=0x%p, new_entry=0x%p, rc=%d\n", + "conn=%" PRIu64 " op=%d parent_update_on_childchange: old_entry=0x%p, new_entry=0x%p, rc=%d\n", conn_id, op_id, parent_modify_c.old_entry, parent_modify_c.new_entry, retval); ldap_result_code = LDAP_OPERATIONS_ERROR; slapi_sdn_done(&parentsdn); @@ -604,7 +604,7 @@ replace_entry: if (slapi_entry_attr_hasvalue(e->ep_entry, SLAPI_ATTR_OBJECTCLASS, SLAPI_ATTR_VALUE_TOMBSTONE) && slapi_is_special_rdn(edn, RDN_IS_TOMBSTONE)) { slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_delete", - "conn=%lu op=%d Turning a tombstone into a tombstone! "%s"; e: 0x%p, cache_state: 0x%x, refcnt: %d\n", + "conn=%" PRIu64 " op=%d Turning a tombstone into a tombstone! "%s"; e: 0x%p, cache_state: 0x%x, refcnt: %d\n", conn_id, op_id, edn, e, e->ep_state, e->ep_refcnt); ldap_result_code = LDAP_OPERATIONS_ERROR; retval = -1; @@ -612,7 +612,7 @@ replace_entry: } if (!childuniqueid) { slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_delete", - "conn=%lu op=%d No nsUniqueId in the entry "%s"; e: 0x%p, cache_state: 0x%x, refcnt: %d\n", + "conn=%" PRIu64 " op=%d No nsUniqueId in the entry "%s"; e: 0x%p, cache_state: 0x%x, refcnt: %d\n", conn_id, op_id, edn, e, e->ep_state, e->ep_refcnt); ldap_result_code = LDAP_OPERATIONS_ERROR; retval = -1; @@ -743,7 +743,7 @@ replace_entry: retval = cache_add_tentative(&inst->inst_cache, tombstone, NULL); if (0 > retval) { slapi_log_err(SLAPI_LOG_CACHE, "ldbm_back_delete", - "conn=%lu op=%d tombstone entry %s failed to add to the cache: %d\n", + "conn=%" PRIu64 " op=%d tombstone entry %s failed to add to the cache: %d\n", conn_id, op_id, slapi_entry_get_dn(tombstone->ep_entry), retval); if (LDBM_OS_ERR_IS_DISKFULL(retval)) disk_full = 1; @@ -844,7 +844,7 @@ replace_entry: } if (0 != retval) { slapi_log_err(SLAPI_LOG_ERR, - "ldbm_back_delete", "delete tombsone csn(adding %s) failed, err=%d %s\n", + "ldbm_back_delete", "delete tombstone csn(adding %s) failed, err=%d %s\n", deletion_csn_str, retval, (msg = dblayer_strerror(retval)) ? msg : ""); @@ -1148,7 +1148,7 @@ replace_entry: /* Push out the db modifications from the parent entry */ retval = modify_update_all(be, pb, &parent_modify_c, &txn); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_delete", - "conn=%lu op=%d modify_update_all: old_entry=0x%p, new_entry=0x%p, rc=%d\n", + "conn=%" PRIu64 " op=%d modify_update_all: old_entry=0x%p, new_entry=0x%p, rc=%d\n", conn_id, op_id, parent_modify_c.old_entry, parent_modify_c.new_entry, retval); if (DB_LOCK_DEADLOCK == retval) { slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_delete", "4 DEADLOCK\n"); @@ -1276,7 +1276,7 @@ replace_entry: /* Replace the old parent entry with the newly modified one */ myrc = modify_switch_entries(&parent_modify_c, be); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_delete", - "conn=%lu op=%d modify_switch_entries: old_entry=0x%p, new_entry=0x%p, rc=%d\n", + "conn=%" PRIu64 " op=%d modify_switch_entries: old_entry=0x%p, new_entry=0x%p, rc=%d\n", conn_id, op_id, parent_modify_c.old_entry, parent_modify_c.new_entry, myrc); if (myrc == 0) { parent_switched = 1; @@ -1435,7 +1435,7 @@ error_return: */ myrc = modify_unswitch_entries(&parent_modify_c, be); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_delete", - "conn=%lu op=%d modify_unswitch_entries: old_entry=0x%p, new_entry=0x%p, rc=%d\n", + "conn=%" PRIu64 " op=%d modify_unswitch_entries: old_entry=0x%p, new_entry=0x%p, rc=%d\n", conn_id, op_id, parent_modify_c.old_entry, parent_modify_c.new_entry, myrc); }
@@ -1514,7 +1514,7 @@ diskfull_return: } } slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_delete", - "conn=%lu op=%d modify_term: old_entry=0x%p, new_entry=0x%p, in_cache=%d\n", + "conn=%" PRIu64 " op=%d modify_term: old_entry=0x%p, new_entry=0x%p, in_cache=%d\n", conn_id, op_id, parent_modify_c.old_entry, parent_modify_c.new_entry, cache_is_in_cache(&inst->inst_cache, parent_modify_c.new_entry)); myrc = modify_term(&parent_modify_c, be); diff --git a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c index eb26038..6f4f4e2 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_instance_config.c @@ -110,7 +110,7 @@ ldbm_instance_config_cachememsize_set(void *arg, { ldbm_instance *inst = (ldbm_instance *)arg; int retval = LDAP_SUCCESS; - size_t val = (size_t)value; + uint64_t val = (uint64_t)((uintptr_t)value); uint64_t delta = 0; uint64_t delta_original = 0;
@@ -194,7 +194,7 @@ ldbm_instance_config_dncachememsize_set(void *arg, { ldbm_instance *inst = (ldbm_instance *)arg; int retval = LDAP_SUCCESS; - size_t val = (size_t)value; + uint64_t val = (uint64_t)((uintptr_t)value); uint64_t delta = 0;
/* Do whatever we can to make sure the data is ok. */ @@ -366,11 +366,11 @@ ldbm_instance_config_require_index_set(void *arg, *----------------------------------------------------------------------*/ static config_info ldbm_instance_config[] = { {CONFIG_INSTANCE_CACHESIZE, CONFIG_TYPE_LONG, "-1", &ldbm_instance_config_cachesize_get, &ldbm_instance_config_cachesize_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, - {CONFIG_INSTANCE_CACHEMEMSIZE, CONFIG_TYPE_SIZE_T, DEFAULT_CACHE_SIZE_STR, &ldbm_instance_config_cachememsize_get, &ldbm_instance_config_cachememsize_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, + {CONFIG_INSTANCE_CACHEMEMSIZE, CONFIG_TYPE_LONG, DEFAULT_CACHE_SIZE_STR, &ldbm_instance_config_cachememsize_get, &ldbm_instance_config_cachememsize_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_INSTANCE_READONLY, CONFIG_TYPE_ONOFF, "off", &ldbm_instance_config_readonly_get, &ldbm_instance_config_readonly_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_INSTANCE_REQUIRE_INDEX, CONFIG_TYPE_ONOFF, "off", &ldbm_instance_config_require_index_get, &ldbm_instance_config_require_index_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {CONFIG_INSTANCE_DIR, CONFIG_TYPE_STRING, NULL, &ldbm_instance_config_instance_dir_get, &ldbm_instance_config_instance_dir_set, CONFIG_FLAG_ALWAYS_SHOW}, - {CONFIG_INSTANCE_DNCACHEMEMSIZE, CONFIG_TYPE_SIZE_T, DEFAULT_DNCACHE_SIZE_STR, &ldbm_instance_config_dncachememsize_get, &ldbm_instance_config_dncachememsize_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, + {CONFIG_INSTANCE_DNCACHEMEMSIZE, CONFIG_TYPE_LONG, DEFAULT_DNCACHE_SIZE_STR, &ldbm_instance_config_dncachememsize_get, &ldbm_instance_config_dncachememsize_set, CONFIG_FLAG_ALWAYS_SHOW | CONFIG_FLAG_ALLOW_RUNNING_CHANGE}, {NULL, 0, NULL, NULL, NULL, 0}};
void diff --git a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c index 5b4ea05..71e2a8f 100644 --- a/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c +++ b/ldap/servers/slapd/back-ldbm/ldbm_modrdn.c @@ -713,7 +713,7 @@ ldbm_back_modrdn(Slapi_PBlock *pb) ldap_result_code = LDAP_ALREADY_EXISTS; if (is_resurect_operation) { slapi_log_err(SLAPI_LOG_CACHE, "ldbm_back_modrdn", - "conn=%lu op=%d cache_add_tentative failed: %s\n", + "conn=%" PRIu64 " op=%d cache_add_tentative failed: %s\n", conn_id, op_id, slapi_entry_get_dn(ec->ep_entry)); } goto error_return; @@ -845,7 +845,7 @@ ldbm_back_modrdn(Slapi_PBlock *pb) retval = parent_update_on_childchange(&parent_modify_context, PARENTUPDATE_DEL, NULL); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_modrdn", - "conn=%lu op=%d parent_update_on_childchange: old_entry=0x%p, new_entry=0x%p, rc=%d\n", + "conn=%" PRIu64 " op=%d parent_update_on_childchange: old_entry=0x%p, new_entry=0x%p, rc=%d\n", conn_id, op_id, parent_modify_context.old_entry, parent_modify_context.new_entry, retval);
/* The parent modify context now contains info needed later */ @@ -857,7 +857,7 @@ ldbm_back_modrdn(Slapi_PBlock *pb) retval = parent_update_on_childchange(&newparent_modify_context, PARENTUPDATE_ADD, NULL); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_modrdn", - "conn=%lu op=%d parent_update_on_childchange: old_entry=0x%p, new_entry=0x%p, rc=%d\n", + "conn=%" PRIu64 " op=%d parent_update_on_childchange: old_entry=0x%p, new_entry=0x%p, rc=%d\n", conn_id, op_id, parent_modify_context.old_entry, parent_modify_context.new_entry, retval); /* The newparent modify context now contains info needed later */ if (retval) { @@ -870,7 +870,7 @@ ldbm_back_modrdn(Slapi_PBlock *pb) retval = parent_update_on_childchange(&parent_modify_context, PARENTUPDATE_RESURECT, NULL); if (retval) { slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_modrdn", - "conn=%lu op=%d parent_update_on_childchange parent %s of %s failed, rc=%d\n", + "conn=%" PRIu64 " op=%d parent_update_on_childchange parent %s of %s failed, rc=%d\n", conn_id, op_id, slapi_entry_get_dn_const(parent_modify_context.old_entry->ep_entry), slapi_entry_get_dn_const(ec->ep_entry), retval); @@ -1053,7 +1053,7 @@ ldbm_back_modrdn(Slapi_PBlock *pb) { retval = modify_update_all(be, pb, &newparent_modify_context, &txn); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_modrdn", - "conn=%lu op=%d modify_update_all: old_entry=0x%p, new_entry=0x%p, rc=%d\n", + "conn=%" PRIu64 " op=%d modify_update_all: old_entry=0x%p, new_entry=0x%p, rc=%d\n", conn_id, op_id, parent_modify_context.old_entry, parent_modify_context.new_entry, retval); if (DB_LOCK_DEADLOCK == retval) { /* Retry txn */ @@ -1178,7 +1178,7 @@ ldbm_back_modrdn(Slapi_PBlock *pb) if (newparententry != NULL) { myrc = modify_switch_entries(&newparent_modify_context, be); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_modrdn", - "conn=%lu op=%d modify_switch_entries: old_entry=0x%p, new_entry=0x%p, rc=%d\n", + "conn=%" PRIu64 " op=%d modify_switch_entries: old_entry=0x%p, new_entry=0x%p, rc=%d\n", conn_id, op_id, parent_modify_context.old_entry, parent_modify_context.new_entry, myrc); }
@@ -1455,13 +1455,13 @@ common_return: slapi_sdn_done(&dn_newrdn); slapi_sdn_done(&dn_parentdn); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_modrdn", - "conn=%lu op=%d modify_term: old_entry=0x%p, new_entry=0x%p\n", + "conn=%" PRIu64 " op=%d modify_term: old_entry=0x%p, new_entry=0x%p\n", conn_id, op_id, parent_modify_context.old_entry, parent_modify_context.new_entry); myrc = modify_term(&parent_modify_context, be); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_modrdn", - "conn=%lu op=%d modify_term: rc=%d\n", conn_id, op_id, myrc); + "conn=%" PRIu64 " op=%d modify_term: rc=%d\n", conn_id, op_id, myrc); slapi_log_err(SLAPI_LOG_BACKLDBM, "ldbm_back_modrdn", - "conn=%lu op=%d modify_term: old_entry=0x%p, new_entry=0x%p\n", + "conn=%" PRIu64 " op=%d modify_term: old_entry=0x%p, new_entry=0x%p\n", conn_id, op_id, newparent_modify_context.old_entry, newparent_modify_context.new_entry); myrc = modify_term(&newparent_modify_context, be); if (free_modrdn_existing_entry) { diff --git a/ldap/servers/slapd/back-ldbm/monitor.c b/ldap/servers/slapd/back-ldbm/monitor.c index f912dca..06f2b27 100644 --- a/ldap/servers/slapd/back-ldbm/monitor.c +++ b/ldap/servers/slapd/back-ldbm/monitor.c @@ -47,10 +47,9 @@ ldbm_back_monitor_instance_search(Slapi_PBlock *pb __attribute__((unused)), struct berval val; struct berval *vals[2]; char buf[BUFSIZ]; - PRUint64 hits, tries; - int64_t nentries; - int64_t maxentries; - size_t size, maxsize; + uint64_t hits, tries; + uint64_t nentries, maxentries; + uint64_t size, maxsize; /* NPCTE fix for bugid 544365, esc 0. <P.R> <04-Jul-2001> */ struct stat astat; /* end of NPCTE fix for bugid 544365 */ @@ -89,19 +88,19 @@ ldbm_back_monitor_instance_search(Slapi_PBlock *pb __attribute__((unused)), /* fetch cache statistics */ cache_get_stats(&(inst->inst_cache), &hits, &tries, &nentries, &maxentries, &size, &maxsize); - sprintf(buf, "%lu", (long unsigned int)hits); + sprintf(buf, "%" PRIu64, hits); MSET("entryCacheHits"); - sprintf(buf, "%lu", (long unsigned int)tries); + sprintf(buf, "%" PRIu64, tries); MSET("entryCacheTries"); - sprintf(buf, "%lu", (long unsigned int)(100.0 * (double)hits / (double)(tries > 0 ? tries : 1))); + sprintf(buf, "%" PRIu64, (uint64_t)(100.0 * (double)hits / (double)(tries > 0 ? tries : 1))); MSET("entryCacheHitRatio"); - sprintf(buf, "%lu", (long unsigned int)size); + sprintf(buf, "%" PRIu64, size); MSET("currentEntryCacheSize"); - sprintf(buf, "%lu", (long unsigned int)maxsize); + sprintf(buf, "%" PRIu64, maxsize); MSET("maxEntryCacheSize"); - sprintf(buf, "%" PRId64, nentries); + sprintf(buf, "%" PRIu64, nentries); MSET("currentEntryCacheCount"); - sprintf(buf, "%" PRId64, maxentries); + sprintf(buf, "%" PRIu64, maxentries); MSET("maxEntryCacheCount");
if (entryrdn_get_switch()) { @@ -112,15 +111,15 @@ ldbm_back_monitor_instance_search(Slapi_PBlock *pb __attribute__((unused)), MSET("dnCacheHits"); sprintf(buf, "%" PRIu64, tries); MSET("dnCacheTries"); - sprintf(buf, "%lu", (unsigned long)(100.0 * (double)hits / (double)(tries > 0 ? tries : 1))); + sprintf(buf, "%" PRIu64, (uint64_t)(100.0 * (double)hits / (double)(tries > 0 ? tries : 1))); MSET("dnCacheHitRatio"); - sprintf(buf, "%lu", (long unsigned int)size); + sprintf(buf, "%" PRIu64, size); MSET("currentDnCacheSize"); - sprintf(buf, "%lu", (long unsigned int)maxsize); + sprintf(buf, "%" PRIu64, maxsize); MSET("maxDnCacheSize"); - sprintf(buf, "%" PRId64, nentries); + sprintf(buf, "%" PRIu64, nentries); MSET("currentDnCacheCount"); - sprintf(buf, "%" PRId64, maxentries); + sprintf(buf, "%" PRIu64, maxentries); MSET("maxDnCacheCount"); }
@@ -204,8 +203,8 @@ ldbm_back_monitor_search(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *entryAft char buf[BUFSIZ]; DB_MPOOL_STAT *mpstat = NULL; DB_MPOOL_FSTAT **mpfstat = NULL; - uintmax_t cache_tries; - int64_t count; + uint64_t cache_tries; + uint64_t count; uint64_t hits; uint64_t tries; uint64_t size; @@ -233,7 +232,7 @@ ldbm_back_monitor_search(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *entryAft
/* cache tries*/ cache_tries = (mpstat->st_cache_miss + mpstat->st_cache_hit); - sprintf(buf, "%lu", cache_tries); + sprintf(buf, "%" PRIu64, cache_tries); MSET("dbCacheTries");
/* cache hit ratio*/ @@ -274,7 +273,7 @@ ldbm_back_monitor_search(Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Entry *entryAft MSET("NormalizedDnCacheThreadSize"); sprintf(buf, "%" PRIu64, slots); MSET("NormalizedDnCacheThreadSlots"); - sprintf(buf, "%" PRId64, count); + sprintf(buf, "%" PRIu64, count); MSET("currentNormalizedDnCacheCount"); }
diff --git a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h index 3327faa..2898a35 100644 --- a/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h +++ b/ldap/servers/slapd/back-ldbm/proto-back-ldbm.h @@ -32,14 +32,14 @@ void attr_create_empty(backend *be, char *type, struct attrinfo **ai); /* * cache.c */ -int cache_init(struct cache *cache, size_t maxsize, long maxentries, int type); +int cache_init(struct cache *cache, uint64_t maxsize, uint64_t maxentries, int type); void cache_clear(struct cache *cache, int type); void cache_destroy_please(struct cache *cache, int type); -void cache_set_max_size(struct cache *cache, size_t bytes, int type); +void cache_set_max_size(struct cache *cache, uint64_t bytes, int type); void cache_set_max_entries(struct cache *cache, long entries); size_t cache_get_max_size(struct cache *cache); long cache_get_max_entries(struct cache *cache); -void cache_get_stats(struct cache *cache, PRUint64 *hits, PRUint64 *tries, long *entries, long *maxentries, size_t *size, size_t *maxsize); +void cache_get_stats(struct cache *cache, uint64_t *hits, uint64_t *tries, uint64_t *entries, uint64_t *maxentries, uint64_t *size, uint64_t *maxsize); void cache_debug_hash(struct cache *cache, char **out); int cache_remove(struct cache *cache, void *e); void cache_return(struct cache *cache, void **bep); @@ -61,9 +61,9 @@ void check_entry_cache(struct cache *cache, struct backentry *e); #endif
Hashtable *new_hash(u_long size, u_long offset, HashFn hfn, HashTestFn tfn); -int add_hash(Hashtable *ht, void *key, size_t keylen, void *entry, void **alt); -int find_hash(Hashtable *ht, const void *key, size_t keylen, void **entry); -int remove_hash(Hashtable *ht, const void *key, size_t keylen); +int add_hash(Hashtable *ht, void *key, uint32_t keylen, void *entry, void **alt); +int find_hash(Hashtable *ht, const void *key, uint32_t keylen, void **entry); +int remove_hash(Hashtable *ht, const void *key, uint32_t keylen);
struct backdn *dncache_find_id(struct cache *cache, ID id);
@@ -99,7 +99,7 @@ int dblayer_read_txn_commit(backend *be, back_txn *txn); int dblayer_txn_begin_all(struct ldbminfo *li, back_txnid parent_txn, back_txn *txn); int dblayer_txn_commit_all(struct ldbminfo *li, back_txn *txn); int dblayer_txn_abort_all(struct ldbminfo *li, back_txn *txn); -size_t dblayer_get_optimal_block_size(struct ldbminfo *li); +uint32_t dblayer_get_optimal_block_size(struct ldbminfo *li); void dblayer_unlock_backend(backend *be); void dblayer_lock_backend(backend *be); int dblayer_plugin_begin(Slapi_PBlock *pb); @@ -126,7 +126,8 @@ int dblayer_get_instance_data_dir(backend *be); char *dblayer_strerror(int error); PRInt64 db_atol(char *str, int *err); PRInt64 db_atoi(char *str, int *err); -unsigned long db_strtoul(const char *str, int *err); +uint32_t db_strtoul(const char *str, int *err); +uint64_t db_strtoull(const char *str, int *err); int dblayer_set_batch_transactions(void *arg, void *value, char *errorbuf, int phase, int apply); int dblayer_set_batch_txn_min_sleep(void *arg, void *value, char *errorbuf, int phase, int apply); int dblayer_set_batch_txn_max_sleep(void *arg, void *value, char *errorbuf, int phase, int apply); diff --git a/ldap/servers/slapd/back-ldbm/start.c b/ldap/servers/slapd/back-ldbm/start.c index 45ed091..7d0cd22 100644 --- a/ldap/servers/slapd/back-ldbm/start.c +++ b/ldap/servers/slapd/back-ldbm/start.c @@ -177,8 +177,8 @@ ldbm_back_start_autotune(struct ldbminfo *li) } }
- slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %luk physical memory\n", mi->system_total_bytes / 1024); - slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %luk available\n", mi->system_available_bytes / 1024); + slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %" PRIu64 "k physical memory\n", mi->system_total_bytes / 1024); + slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "found %" PRIu64 "k available\n", mi->system_available_bytes / 1024);
/* We've now calculated the autotuning values. Do we need to apply it? * we use the logic of "if size is 0, or autosize is > 0. This way three @@ -193,7 +193,7 @@ ldbm_back_start_autotune(struct ldbminfo *li)
/* First, check the dbcache */ if (li->li_dbcachesize == 0 || li->li_cache_autosize > 0) { - slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: db cache: %luk\n", db_size / 1024); + slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: db cache: %" PRIu64 "k\n", db_size / 1024); if (db_size < (500 * MEGABYTE)) { db_size = db_size / 1.25; } @@ -223,12 +223,12 @@ ldbm_back_start_autotune(struct ldbminfo *li) * it's highly unlikely. */ if (cache_size == 0 || cache_size == MINCACHESIZE || li->li_cache_autosize > 0) { - 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); + slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: %s entry cache (%" PRIu64 " total): %" PRIu64 "k\n", inst->inst_name, backend_count, entry_size / 1024); cache_set_max_entries(&(inst->inst_cache), -1); cache_set_max_size(&(inst->inst_cache), li->li_cache_autosize_ec, CACHE_TYPE_ENTRY); } if (dncache_size == 0 || dncache_size == MINCACHESIZE || li->li_cache_autosize > 0) { - slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: %s dn cache (%lu total): %luk\n", inst->inst_name, backend_count, dn_size / 1024); + slapi_log_err(SLAPI_LOG_NOTICE, "ldbm_back_start", "cache autosizing: %s dn cache (%" PRIu64 " total): %" PRIu64 "k\n", inst->inst_name, backend_count, dn_size / 1024); cache_set_max_entries(&(inst->inst_dncache), -1); cache_set_max_size(&(inst->inst_dncache), li->li_dncache_autosize_ec, CACHE_TYPE_DN); } @@ -389,7 +389,7 @@ ldbm_back_start(Slapi_PBlock *pb) return return_on_disk_full(li); else { if ((li->li_cache_autosize > 0) && (li->li_cache_autosize <= 100)) { - slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_start", "Failed to allocate %lu byte dbcache. " + slapi_log_err(SLAPI_LOG_ERR, "ldbm_back_start", "Failed to allocate %" PRIu64 " byte dbcache. " "Please reduce the value of %s and restart the server.\n", li->li_dbcachesize, CONFIG_CACHE_AUTOSIZE); } diff --git a/ldap/servers/slapd/ch_malloc.c b/ldap/servers/slapd/ch_malloc.c index ef436b3..75e7911 100644 --- a/ldap/servers/slapd/ch_malloc.c +++ b/ldap/servers/slapd/ch_malloc.c @@ -109,21 +109,16 @@ slapi_ch_malloc(
/* See slapi-plugin.h */ char * -slapi_ch_memalign(size_t size, size_t alignment) +slapi_ch_memalign(uint32_t size, uint32_t alignment) { char *newmem;
- if (size <= 0) { - log_negative_alloc_msg("memalign", "bytes", size); - return 0; - } - if (posix_memalign((void **)&newmem, alignment, size) != 0) { int oserr = errno;
oom_occurred(); slapi_log_err(SLAPI_LOG_ERR, SLAPD_MODULE, - "malloc of %lu bytes failed; OS error %d (%s)%s\n", + "malloc of %" PRIu32 " bytes failed; OS error %d (%s)%s\n", size, oserr, slapd_system_strerror(oserr), oom_advice); exit(1); } diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c index f2f763d..4fae174 100644 --- a/ldap/servers/slapd/conntable.c +++ b/ldap/servers/slapd/conntable.c @@ -416,7 +416,7 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e) bufptr = newbuf; }
- sprintf(bufptr, "%d:%s:%d:%d:%s%s:%s:%s:%lu:ip=%s", + sprintf(bufptr, "%d:%s:%d:%d:%s%s:%s:%s:%" PRIu64 ":ip=%s", i, buf2, ct->c[i].c_opsinitiated, diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c index c245a4d..3358f34 100644 --- a/ldap/servers/slapd/daemon.c +++ b/ldap/servers/slapd/daemon.c @@ -1087,7 +1087,7 @@ slapd_daemon(daemon_ports_t *ports, ns_thrpool_t *tp) /* we have exited from ns_thrpool_wait. This means we are shutting down! */ /* Please see https://firstyear.fedorapeople.org/nunc-stans/md_docs_job-safety.html */ /* tldr is shutdown needs to run first to allow job_done on an ARMED job */ - for (size_t i = 0; i < listeners; i++) { + for (uint64_t i = 0; i < listeners; i++) { PRStatus shutdown_status = ns_job_done(listener_idxs[i].ns_job); if (shutdown_status != PR_SUCCESS) { slapi_log_err(SLAPI_LOG_CRIT, "ns_set_shutdown", "Failed to shutdown listener idx %" PRIu64 " !\n", i); @@ -1203,7 +1203,7 @@ slapd_daemon(daemon_ports_t *ports, ns_thrpool_t *tp) threads = g_get_active_threadcnt(); if (threads > 0) { slapi_log_err(SLAPI_LOG_INFO, "slapd_daemon", - "slapd shutting down - waiting for %lu thread%s to terminate\n", + "slapd shutting down - waiting for %" PRIu64 " thread%s to terminate\n", threads, (threads > 1) ? "s" : ""); }
@@ -1240,7 +1240,7 @@ slapd_daemon(daemon_ports_t *ports, ns_thrpool_t *tp) DS_Sleep(PR_INTERVAL_NO_WAIT); if (threads != g_get_active_threadcnt()) { slapi_log_err(SLAPI_LOG_TRACE, "slapd_daemon", - "slapd shutting down - waiting for %lu threads to terminate\n", + "slapd shutting down - waiting for %" PRIu64 " threads to terminate\n", g_get_active_threadcnt()); threads = g_get_active_threadcnt(); } diff --git a/ldap/servers/slapd/dn.c b/ldap/servers/slapd/dn.c index abc1555..2af3f38 100644 --- a/ldap/servers/slapd/dn.c +++ b/ldap/servers/slapd/dn.c @@ -41,14 +41,14 @@ struct ndn_cache_stats { Slapi_Counter *cache_count; Slapi_Counter *cache_size; Slapi_Counter *cache_evicts; - size_t max_size; - size_t thread_max_size; - size_t slots; + uint64_t max_size; + uint64_t thread_max_size; + uint64_t slots; };
struct ndn_cache_value { - size_t size; - size_t slot; + uint64_t size; + uint64_t slot; char *dn; char *ndn; struct ndn_cache_value *next; @@ -64,23 +64,22 @@ struct ndn_cache { /* * We keep per thread stats and flush them occasionally */ - size_t max_size; + uint64_t max_size; /* Need to track this because we need to provide diffs to counter */ - size_t last_count; - size_t count; + uint64_t last_count; + uint64_t count; /* Number of ops */ - size_t tries; + uint64_t tries; /* hit vs miss. in theroy miss == tries - hits.*/ - size_t hits; + uint64_t hits; /* How many values we kicked out */ - size_t evicts; + uint64_t evicts; /* Need to track this because we need to provide diffs to counter */ - size_t last_size; - size_t size; - - size_t slots; + uint64_t last_size; + uint64_t size; + uint64_t slots; /* - * This is used by siphash to prevent hash bugket attacks + * This is used by siphash to prevent hash bucket attacks */ char key[16];
@@ -3260,7 +3259,7 @@ ndn_cache_add(char *dn, size_t dn_len, char *ndn, size_t ndn_len)
/* stats for monitor */ void -ndn_cache_get_stats(PRUint64 *hits, PRUint64 *tries, size_t *size, size_t *max_size, size_t *thread_size, size_t *evicts, size_t *slots, long *count) +ndn_cache_get_stats(uint64_t *hits, uint64_t *tries, uint64_t *size, uint64_t *max_size, uint64_t *thread_size, uint64_t *evicts, uint64_t *slots, uint64_t *count) { *max_size = t_cache_stats.max_size; *thread_size = t_cache_stats.thread_max_size; diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c index d0865e1..4ec447b 100644 --- a/ldap/servers/slapd/libglobs.c +++ b/ldap/servers/slapd/libglobs.c @@ -5966,10 +5966,10 @@ config_set_maxsasliosize(const char *attrname, char *value, char *errorbuf, int return retVal; }
-size_t +int32_t config_get_maxsasliosize() { - size_t maxsasliosize; + int32_t maxsasliosize; slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
maxsasliosize = slapdFrontendConfig->maxsasliosize; diff --git a/ldap/servers/slapd/main.c b/ldap/servers/slapd/main.c index 521d314..1108ad2 100644 --- a/ldap/servers/slapd/main.c +++ b/ldap/servers/slapd/main.c @@ -688,7 +688,7 @@ main(int argc, char **argv) } else if (secs > 3600) { secs = 3600; } - printf("slapd pid is %d - sleeping for %ld\n", getpid(), secs); + printf("slapd pid is %d - sleeping for %" PRId64 "\n", getpid(), secs); sleep(secs); } } diff --git a/ldap/servers/slapd/monitor.c b/ldap/servers/slapd/monitor.c index a281608..68c4864 100644 --- a/ldap/servers/slapd/monitor.c +++ b/ldap/servers/slapd/monitor.c @@ -59,7 +59,7 @@ monitor_info(Slapi_PBlock *pb __attribute__((unused)), attrlist_replace(&e->e_attrs, "version", vals); slapi_ch_free((void **)&val.bv_val);
- val.bv_len = snprintf(buf, sizeof(buf), "%lu", g_get_active_threadcnt()); + val.bv_len = snprintf(buf, sizeof(buf), "%" PRIu64, g_get_active_threadcnt()); val.bv_val = buf; attrlist_replace(&e->e_attrs, "threads", vals);
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h index b13334a..4a6b8f0 100644 --- a/ldap/servers/slapd/proto-slap.h +++ b/ldap/servers/slapd/proto-slap.h @@ -491,7 +491,7 @@ char *config_get_referral_mode(void); int config_get_conntablesize(void); int config_check_referral_mode(void); ber_len_t config_get_maxbersize(void); -size_t config_get_maxsasliosize(void); +int32_t config_get_maxsasliosize(void); char *config_get_versionstring(void); char *config_get_buildnum(void); int config_get_enquote_sup_oc(void); diff --git a/ldap/servers/slapd/result.c b/ldap/servers/slapd/result.c index 6892ccf..d9f431c 100644 --- a/ldap/servers/slapd/result.c +++ b/ldap/servers/slapd/result.c @@ -1920,7 +1920,7 @@ log_result(Slapi_PBlock *pb, Operation *op, int err, ber_tag_t tag, int nentries struct timespec o_hr_time_end; slapi_operation_time_elapsed(op, &o_hr_time_end);
- snprintf(etime, ETIME_BUFSIZ, "%" PRId64 ".%010" PRId64 "", o_hr_time_end.tv_sec, o_hr_time_end.tv_nsec); + snprintf(etime, ETIME_BUFSIZ, "%" PRId64 ".%010" PRId64 "", (int64_t)o_hr_time_end.tv_sec, (int64_t)o_hr_time_end.tv_nsec);
slapi_pblock_get(pb, SLAPI_OPERATION_NOTES, &operation_notes);
diff --git a/ldap/servers/slapd/sasl_io.c b/ldap/servers/slapd/sasl_io.c index 5fe37dc..751832b 100644 --- a/ldap/servers/slapd/sasl_io.c +++ b/ldap/servers/slapd/sasl_io.c @@ -46,13 +46,13 @@ MOZLDAP is newer than expected, if the ber structure has not changed(see ldap / struct PRFilePrivate { char *decrypted_buffer; - size_t decrypted_buffer_size; - size_t decrypted_buffer_count; - size_t decrypted_buffer_offset; + uint32_t decrypted_buffer_size; + uint32_t decrypted_buffer_count; + uint32_t decrypted_buffer_offset; char *encrypted_buffer; - size_t encrypted_buffer_size; - size_t encrypted_buffer_count; - size_t encrypted_buffer_offset; + uint32_t encrypted_buffer_size; + uint32_t encrypted_buffer_count; + uint32_t encrypted_buffer_offset; Connection *conn; /* needed for connid and sasl_conn context */ PRBool send_encrypted; /* can only send encrypted data after the first read - that is, we cannot send back an encrypted response @@ -130,7 +130,7 @@ sasl_io_init_buffers(sasl_io_private *sp)
static void -sasl_io_resize_encrypted_buffer(sasl_io_private *sp, size_t requested_size) +sasl_io_resize_encrypted_buffer(sasl_io_private *sp, uint32_t requested_size) { if (requested_size > sp->encrypted_buffer_size) { sp->encrypted_buffer = slapi_ch_realloc(sp->encrypted_buffer, requested_size); @@ -139,7 +139,7 @@ sasl_io_resize_encrypted_buffer(sasl_io_private *sp, size_t requested_size) }
static void -sasl_io_resize_decrypted_buffer(sasl_io_private *sp, size_t requested_size) +sasl_io_resize_decrypted_buffer(sasl_io_private *sp, uint32_t requested_size) { if (requested_size > sp->decrypted_buffer_size) { sp->decrypted_buffer = slapi_ch_realloc(sp->decrypted_buffer, requested_size); @@ -189,10 +189,10 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt unsigned char buffer[SASL_IO_BUFFER_START_SIZE]; sasl_io_private *sp = sasl_get_io_private(fd); Connection *c = sp->conn; - PRInt32 amount = sizeof(buffer); - PRInt32 ret = 0; - size_t packet_length = 0; - size_t saslio_limit; + uint32_t amount = sizeof(buffer); + uint32_t ret = 0; + uint32_t packet_length = 0; + int32_t saslio_limit;
*err = 0; debug_print_layers(fd); @@ -404,15 +404,15 @@ sasl_io_start_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt packet_length += sizeof(uint32_t);
slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_start_packet", - "read sasl packet length %ld on connection %" PRIu64 "\n", + "read sasl packet length %" PRIu32 " on connection %" PRIu64 "\n", packet_length, c->c_connid);
/* Check if the packet length is larger than our max allowed. A * setting of -1 means that we allow any size SASL IO packet. */ saslio_limit = config_get_maxsasliosize(); - if (((long)saslio_limit != -1) && (packet_length > saslio_limit)) { + if ((saslio_limit != -1) && (packet_length > saslio_limit)) { slapi_log_err(SLAPI_LOG_ERR, "sasl_io_start_packet", - "SASL encrypted packet length exceeds maximum allowed limit (length=%ld, limit=%ld)." + "SASL encrypted packet length exceeds maximum allowed limit (length=%" PRIu32 ", limit=%" PRIu32")." " Change the nsslapd-maxsasliosize attribute in cn=config to increase limit.\n", packet_length, config_get_maxsasliosize()); PR_SetError(PR_BUFFER_OVERFLOW_ERROR, 0); @@ -434,10 +434,10 @@ sasl_io_read_packet(PRFileDesc *fd, PRIntn flags, PRIntervalTime timeout, PRInt3 PRInt32 ret = 0; sasl_io_private *sp = sasl_get_io_private(fd); Connection *c = sp->conn; - size_t bytes_remaining_to_read = sp->encrypted_buffer_count - sp->encrypted_buffer_offset; + uint32_t bytes_remaining_to_read = sp->encrypted_buffer_count - sp->encrypted_buffer_offset;
slapi_log_err(SLAPI_LOG_CONNS, - "sasl_io_read_packet", "Reading %lu bytes for connection %" PRIu64 "\n", + "sasl_io_read_packet", "Reading %" PRIu32" bytes for connection %" PRIu64 "\n", bytes_remaining_to_read, c->c_connid); ret = PR_Recv(fd->lower, sp->encrypted_buffer + sp->encrypted_buffer_offset, bytes_remaining_to_read, flags, timeout); if (ret <= 0) { @@ -461,17 +461,17 @@ sasl_io_recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags, PRIntervalTim { sasl_io_private *sp = sasl_get_io_private(fd); Connection *c = sp->conn; - PRInt32 ret = 0; - size_t bytes_in_buffer = 0; - PRInt32 err = 0; + int32_t ret = 0; + uint32_t bytes_in_buffer = 0; + int32_t err = 0;
/* Do we have decrypted data buffered from 'before' ? */ bytes_in_buffer = sp->decrypted_buffer_count - sp->decrypted_buffer_offset; slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_recv", - "Connection %" PRIu64 " len %d bytes_in_buffer %lu\n", + "Connection %" PRIu64 " len %d bytes_in_buffer %" PRIu32 "\n", c->c_connid, len, bytes_in_buffer); slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_recv", - "Connection %" PRIu64 " len %d encrypted buffer count %lu\n", + "Connection %" PRIu64 " len %d encrypted buffer count %" PRIu32 "\n", c->c_connid, len, sp->encrypted_buffer_count); if (0 == bytes_in_buffer) { /* If there wasn't buffered decrypted data, we need to get some... */ @@ -546,7 +546,7 @@ sasl_io_recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags, PRIntervalTim } /* Finally, return data from the buffer to the caller */ { - size_t bytes_to_return = sp->decrypted_buffer_count - sp->decrypted_buffer_offset; + uint32_t bytes_to_return = sp->decrypted_buffer_count - sp->decrypted_buffer_offset; if (bytes_to_return > len) { bytes_to_return = len; } @@ -560,7 +560,7 @@ sasl_io_recv(PRFileDesc *fd, void *buf, PRInt32 len, PRIntn flags, PRIntervalTim } else { sp->decrypted_buffer_offset += bytes_to_return; slapi_log_err(SLAPI_LOG_CONNS, "sasl_io_recv", - "Returning %lu bytes to caller %lu bytes left to return for connection %" PRIu64 "\n", + "Returning %" PRIu32 " bytes to caller %" PRIu32 " bytes left to return for connection %" PRIu64 "\n", bytes_to_return, sp->decrypted_buffer_count - sp->decrypted_buffer_offset, c->c_connid); } ret = bytes_to_return; diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h index e58f488..bbaa7a4 100644 --- a/ldap/servers/slapd/slap.h +++ b/ldap/servers/slapd/slap.h @@ -2435,7 +2435,7 @@ typedef struct _slapdFrontendConfig int localssf; /* the security strength factor to assign to local conns (ldapi) */ int minssf; /* minimum security strength factor (for SASL and SSL/TLS) */ slapi_onoff_t minssf_exclude_rootdse; /* ON: minssf is ignored when searching rootdse */ - size_t maxsasliosize; /* limit incoming SASL IO packet size */ + int32_t maxsasliosize; /* limit incoming SASL IO packet size */ char *anon_limits_dn; /* template entry for anonymous resource limits */ slapi_int_t listen_backlog_size; /* size of backlog parameter to PR_Listen */ struct passwd *localuserinfo; /* userinfo of localuser */ @@ -2450,7 +2450,7 @@ typedef struct _slapdFrontendConfig
/* disk monitoring */ slapi_onoff_t disk_monitoring; - PRInt64 disk_threshold; + uint64_t disk_threshold; int disk_grace_period; slapi_onoff_t disk_logging_critical;
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h index 33e2b95..e862382 100644 --- a/ldap/servers/slapd/slapi-plugin.h +++ b/ldap/servers/slapd/slapi-plugin.h @@ -29,7 +29,6 @@ extern "C" {
/* Provides our int types and platform specific requirements. */ #include "slapi_pal.h" - #include "prtypes.h" #include "ldap.h" #include "prprf.h" @@ -5834,7 +5833,7 @@ char *slapi_ch_malloc(unsigned long size); * \param alignment The alignment. MUST be a power of 2! * \return Pointer to the allocated memory aligned by alignment. */ -char *slapi_ch_memalign(size_t size, size_t alignment); +char *slapi_ch_memalign(uint32_t size, uint32_t alignment); char *slapi_ch_realloc(char *block, unsigned long size); char *slapi_ch_calloc(unsigned long nelem, unsigned long size); char *slapi_ch_strdup(const char *s); diff --git a/ldap/servers/slapd/slapi-private.h b/ldap/servers/slapd/slapi-private.h index c28c6e7..9c90dfb 100644 --- a/ldap/servers/slapd/slapi-private.h +++ b/ldap/servers/slapd/slapi-private.h @@ -376,7 +376,7 @@ char *slapi_dn_normalize_case_original(char *dn); int32_t ndn_cache_init(void); void ndn_cache_destroy(void); int ndn_cache_started(void); -void ndn_cache_get_stats(PRUint64 *hits, PRUint64 *tries, size_t *size, size_t *max_size, size_t *thread_size, size_t *evicts, size_t *slots, long *count); +void ndn_cache_get_stats(uint64_t *hits, uint64_t *tries, uint64_t *size, uint64_t *max_size, uint64_t *thread_size, uint64_t *evicts, uint64_t *slots, uint64_t *count); #define NDN_DEFAULT_SIZE 20971520 /* 20mb - size of normalized dn cache */
/* filter.c */ diff --git a/ldap/servers/slapd/tools/dbscan.c b/ldap/servers/slapd/tools/dbscan.c index f4001d2..53cdb89 100644 --- a/ldap/servers/slapd/tools/dbscan.c +++ b/ldap/servers/slapd/tools/dbscan.c @@ -81,13 +81,13 @@ #include <getopt.h> #endif
-typedef PRUint32 ID; +typedef uint32_t ID;
typedef struct { - PRUint32 max; - PRUint32 used; - PRUint32 id[1]; + uint32_t max; + uint32_t used; + uint32_t id[1]; } IDL;
#define RDN_BULK_FETCH_BUFFER_SIZE (8 * 1024) @@ -109,9 +109,9 @@ static void display_entryrdn_self(DB *db, ID id, const char *nrdn, int indent); static void display_entryrdn_children(DB *db, ID id, const char *nrdn, int indent); static void display_entryrdn_item(DB *db, DBC *cursor, DBT *key);
-PRUint32 file_type = 0; -PRUint32 min_display = 0; -PRUint32 display_mode = 0; +uint32_t file_type = 0; +uint32_t min_display = 0; +uint32_t display_mode = 0; int truncatesiz = 0; long pres_cnt = 0; long eq_cnt = 0; @@ -145,15 +145,15 @@ db_printfln(char *fmt, ...) fprintf(stdout, "\n"); }
-size_t MAX_BUFFER = 4096; -size_t MIN_BUFFER = 20; +uint32_t MAX_BUFFER = 4096; +uint32_t MIN_BUFFER = 20;
static IDL * idl_make(DBT *data) { IDL *idl = NULL, *xidl;
- if (data->size < 2 * sizeof(PRUint32)) { + if (data->size < 2 * sizeof(uint32_t)) { idl = (IDL *)malloc(sizeof(IDL) + 64 * sizeof(ID)); if (!idl) return NULL; @@ -283,7 +283,7 @@ idl_format(IDL *idl, int isfirsttime, int *done) for (; i < idl->used; i++) { sprintf((char *)buf + strlen(buf), "%d ", idl->id[i]);
- if (strlen(buf) > (size_t)MAX_BUFFER - MIN_BUFFER) { + if (strlen(buf) > MAX_BUFFER - MIN_BUFFER) { i++; done = 0; return (char *)buf; @@ -360,7 +360,7 @@ _cl5ReadMods(char **buff) { char *pos = *buff; ID i; - PRUint32 mod_count; + uint32_t mod_count;
/* need to copy first, to skirt around alignment problems on certain architectures */ @@ -384,7 +384,7 @@ void print_ber_attr(char *attrname, char **buff) { char *val = NULL; - PRUint32 bv_len; + uint32_t bv_len;
memcpy((char *)&bv_len, *buff, sizeof(bv_len)); bv_len = ntohl(bv_len); @@ -447,8 +447,8 @@ void _cl5ReadMod(char **buff) { char *pos = *buff; - PRUint32 i; - PRUint32 val_count; + uint32_t i; + uint32_t val_count; char *type = NULL;
pos++; @@ -458,7 +458,7 @@ _cl5ReadMod(char **buff) certain architectures */ memcpy((char *)&val_count, pos, sizeof(val_count)); val_count = ntohl(val_count); - pos += sizeof(PRUint32); + pos += sizeof(uint32_t);
for (i = 0; i < val_count; i++) { print_ber_attr(type, &pos); @@ -473,14 +473,14 @@ void print_ruv(unsigned char *buff) { char *pos = (char *)buff; - PRUint32 i; - PRUint32 val_count; + uint32_t i; + uint32_t val_count;
/* need to do the copy first, to skirt around alignment problems on certain architectures */ memcpy((char *)&val_count, pos, sizeof(val_count)); val_count = ntohl(val_count); - pos += sizeof(PRUint32); + pos += sizeof(uint32_t);
for (i = 0; i < val_count; i++) { print_ber_attr(NULL, &pos); @@ -491,11 +491,11 @@ print_ruv(unsigned char *buff) *** Copied from cl5_api:cl5DBData2Entry *** Data in db format: ------------------ - <1 byte version><1 byte change_type><sizeof PRUint32 time><null terminated dbid> + <1 byte version><1 byte change_type><sizeof uint32_t time><null terminated dbid> <null terminated csn><null terminated uniqueid><null terminated targetdn> [<null terminated newrdn><1 byte deleteoldrdn>][<4 byte mod count><mod1><mod2>....]
-Note: the length of time is set PRUint32 instead of time_t. Regardless of the +Note: the length of time is set uint32_t instead of time_t. Regardless of the width of long (32-bit or 64-bit), it's stored using 4bytes by the server [153306].
mod format: @@ -509,9 +509,9 @@ print_changelog(unsigned char *data, int len __attribute__((unused))) uint8_t version; unsigned long operation_type; char *pos = (char *)data; - PRUint32 thetime32; + uint32_t thetime32; time_t thetime; - PRUint32 replgen; + uint32_t replgen;
/* read byte of version */ version = *((uint8_t *)pos); @@ -530,7 +530,7 @@ print_changelog(unsigned char *data, int len __attribute__((unused))) memcpy((char *)&thetime32, pos, sizeof(thetime32));
replgen = ntohl(thetime32); - pos += sizeof(PRUint32); + pos += sizeof(uint32_t); thetime = (time_t)replgen; db_printf("\treplgen: %ld %s", replgen, ctime((time_t *)&thetime));
@@ -608,7 +608,7 @@ display_index_item(DBC *cursor, DBT *key, DBT *data, unsigned char *buf, int buf while (ret == 0) { ret = cursor->c_get(cursor, key, data, DB_NEXT_DUP); if (ret == 0) - idl = idl_append(idl, *(PRUint32 *)(data->data)); + idl = idl_append(idl, *(uint32_t *)(data->data)); } if (ret == DB_NOTFOUND) ret = 0; @@ -944,7 +944,7 @@ display_entryrdn_item(DB *db, DBC *cursor, DBT *key) int indent = 2; DBT data; int rc; - PRUint32 flags = 0; + uint32_t flags = 0; char buffer[RDN_BULK_FETCH_BUFFER_SIZE]; DBT dataret; int find_key_flag = 0; @@ -1102,7 +1102,7 @@ usage(char *argv0) printf(" index file options:\n"); printf(" -k <key> lookup only a specific key\n"); printf(" -l <size> max length of dumped id list\n"); - printf(" (default %lu; 40 bytes <= size <= 1048576 bytes)\n", MAX_BUFFER); + printf(" (default %" PRIu32 "; 40 bytes <= size <= 1048576 bytes)\n", MAX_BUFFER); printf(" -G <n> only display index entries with more than <n> ids\n"); printf(" -n display ID list lengths\n"); printf(" -r display the conents of ID list\n"); @@ -1132,7 +1132,7 @@ main(int argc, char **argv) DBT key = {0}, data = {0}; int ret; char *find_key = NULL; - PRUint32 entry_id = 0xffffffff; + uint32_t entry_id = 0xffffffff; int c;
key.flags = DB_DBT_REALLOC; @@ -1146,7 +1146,7 @@ main(int argc, char **argv) display_mode |= RAWDATA; break; case 'l': { - PRUint32 tmpmaxbufsz = atoi(optarg); + uint32_t tmpmaxbufsz = atoi(optarg); if (tmpmaxbufsz > ONEMEG) { tmpmaxbufsz = ONEMEG; printf("WARNING: max length of dumped id list too long, " diff --git a/ldap/servers/snmp/main.c b/ldap/servers/snmp/main.c index 95cc261..1e64705 100644 --- a/ldap/servers/snmp/main.c +++ b/ldap/servers/snmp/main.c @@ -71,7 +71,7 @@ main(int argc, char *argv[]) } else if (secs > 3600) { secs = 3600; } - printf("%s pid is %d - sleeping for %ld\n", argv[0], getpid(), secs); + printf("%s pid is %d - sleeping for %" PRId64 "\n", argv[0], getpid(), secs); sleep(secs); } } diff --git a/src/libsds/sds/bpt/map.c b/src/libsds/sds/bpt/map.c index 096a38b..ae528f3 100644 --- a/src/libsds/sds/bpt/map.c +++ b/src/libsds/sds/bpt/map.c @@ -294,8 +294,8 @@ sds_node_to_dot(sds_bptree_instance *binst __attribute__((unused)), sds_bptree_n // Given the node write it out as: fprintf(fp, "subgraph c%" PRIu32 " { \n rank="same";\n", node->level); fprintf(fp, " node_%p [label =" { node=%p items=%d txn=%" PRIu64 " parent=%p | { <f0> ", node, node, node->item_count, node->txn_id, node->parent); - for (size_t i = 0; i < SDS_BPTREE_DEFAULT_CAPACITY; i++) { - fprintf(fp, "| %" PRIu64 " | <f%" PRIu64 "> ", (uint64_t)node->keys[i], i + 1); + for (uint64_t i = 0; i < SDS_BPTREE_DEFAULT_CAPACITY; i++) { + fprintf(fp, "| %" PRIu64 " | <f%" PRIu64 "> ", (uint64_t)((uintptr_t)node->keys[i]), i + 1); } fprintf(fp, "}}"]; \n}\n"); return SDS_SUCCESS; @@ -312,7 +312,7 @@ sds_node_ptrs_to_dot(sds_bptree_instance *binst __attribute__((unused)), sds_bpt fprintf(fp, ""node_%p" -> "node_%p"; \n", node, node->values[SDS_BPTREE_DEFAULT_CAPACITY]); } } else { - for (size_t i = 0; i < SDS_BPTREE_BRANCH; i++) { + for (uint64_t i = 0; i < SDS_BPTREE_BRANCH; i++) { if (node->values[i] != NULL) { if (i == SDS_BPTREE_DEFAULT_CAPACITY) { // Work around a graphviz display issue, with Left and Right pointers @@ -332,7 +332,7 @@ sds_bptree_display(sds_bptree_instance *binst) { sds_result result = SDS_SUCCESS;
- char *path = malloc(sizeof(char) * 20); + char *path = malloc(sizeof(char) * 21); #ifdef SDS_DEBUG sds_log("sds_bptree_display", "Writing step %03d\n", binst->print_iter); #endif diff --git a/src/libsds/sds/bpt_cow/bpt_cow.c b/src/libsds/sds/bpt_cow/bpt_cow.c index 0b6f229..c2ab607 100644 --- a/src/libsds/sds/bpt_cow/bpt_cow.c +++ b/src/libsds/sds/bpt_cow/bpt_cow.c @@ -527,8 +527,8 @@ sds_node_to_dot(sds_bptree_instance *binst __attribute__((unused)), sds_bptree_n // Given the node write it out as: fprintf(fp, "subgraph c%" PRIu32 " { \n rank="same";\n", node->level); fprintf(fp, " node_%p [label =" { node=%p items=%d txn=%" PRIu64 " parent=%p | { <f0> ", node, node, node->item_count, node->txn_id, node->parent); - for (size_t i = 0; i < SDS_BPTREE_DEFAULT_CAPACITY; i++) { - fprintf(fp, "| %" PRIu64 " | <f%" PRIu64 "> ", (uint64_t)node->keys[i], i + 1); + for (uint64_t i = 0; i < SDS_BPTREE_DEFAULT_CAPACITY; i++) { + fprintf(fp, "| %" PRIu64 " | <f%" PRIu64 "> ", (uint64_t)((uintptr_t)node->keys[i]), i + 1); } fprintf(fp, "}}"]; \n}\n"); return SDS_SUCCESS; @@ -545,7 +545,7 @@ sds_node_ptrs_to_dot(sds_bptree_instance *binst __attribute__((unused)), sds_bpt fprintf(fp, ""node_%p" -> "node_%p"; \n", node, node->values[SDS_BPTREE_DEFAULT_CAPACITY]); } } else { - for (size_t i = 0; i < SDS_BPTREE_BRANCH; i++) { + for (uint64_t i = 0; i < SDS_BPTREE_BRANCH; i++) { if (node->values[i] != NULL) { if (i == SDS_BPTREE_DEFAULT_CAPACITY) { // Work around a graphviz display issue, with Left and Right pointers @@ -566,7 +566,7 @@ sds_bptree_cow_display(sds_bptree_transaction *btxn) { sds_result result = SDS_SUCCESS;
- char *path = malloc(sizeof(char) * 20); + char *path = malloc(sizeof(char) * 36); print_iter += 1; #ifdef SDS_DEBUG sds_log("sds_bptree_cow_display", "Writing step %03d\n", print_iter);
389-commits@lists.fedoraproject.org