mdbx: portability fixes for SunOS/Solaris/OpenIndiana.

Change-Id: I0442367e798903598d706c65b536a127ca982fce
This commit is contained in:
Leonid Yuriev
2019-11-09 10:50:43 +03:00
parent bb2d2877c4
commit 5af02290e6
9 changed files with 80 additions and 57 deletions

View File

@@ -133,9 +133,9 @@ void output_nocheckloglevel_ap(const logging::loglevel priority,
last = stdout;
fprintf(last,
"[ %02d%02d%02d-%02d:%02d:%02d.%06d_%05u %-10s %.4s ] %s" /* TODO */,
"[ %02d%02d%02d-%02d:%02d:%02d.%06d_%05lu %-10s %.4s ] %s" /* TODO */,
tm.tm_year - 100, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min,
tm.tm_sec, chrono::fractional2us(now.fractional), osal_getpid(),
tm.tm_sec, chrono::fractional2us(now.fractional), (long)osal_getpid(),
prefix.c_str(), level2str(priority), suffix.c_str());
va_list ones;
@@ -169,8 +169,8 @@ void output_nocheckloglevel_ap(const logging::loglevel priority,
if (same_or_higher(priority, error)) {
if (last != stderr) {
fprintf(stderr, "[ %05u %-10s %.4s ] %s", osal_getpid(), prefix.c_str(),
level2str(priority), suffix.c_str());
fprintf(stderr, "[ %05lu %-10s %.4s ] %s", (long)osal_getpid(),
prefix.c_str(), level2str(priority), suffix.c_str());
vfprintf(stderr, format, ones);
if (end == '\n')
fflush(stderr);

View File

@@ -565,8 +565,8 @@ int main(int argc, char *const argv[]) {
if (!actor)
continue;
log_verbose("actor #%u, id %d, pid %u: %s\n", actor->actor_id,
actor->space_id, pid, status2str(status));
log_verbose("actor #%u, id %d, pid %ld: %s\n", actor->actor_id,
actor->space_id, (long)pid, status2str(status));
if (status > as_running) {
left -= 1;
if (status != as_successful) {
@@ -603,10 +603,18 @@ int main(int argc, char *const argv[]) {
#if defined(__linux__) || defined(__gnu_linux__) || defined(__FreeBSD__) || \
defined(__NetBSD__) || defined(__OpenBSD__) || defined(__BSD__) || \
defined(__bsdi__) || defined(__DragonFly__) || defined(__APPLE__) || \
defined(__MACH__)
defined(__MACH__) || defined(__sun)
log_notice("%6s: read %ld, write %ld", "IOPs", spent.ru_inblock,
spent.ru_oublock);
log_notice("%6s: %ld Kb", "RAM", spent.ru_maxrss);
if (spent.ru_maxrss > 0)
log_notice("%6s: %ld Kb", "RAM",
spent.ru_maxrss
#if defined(__sun)
* getpagesize() / 1024u
#elif defined(__APPLE__)
/ 1024u
#endif
);
log_notice("%6s: reclaims %ld, faults %ld, swaps %ld", "Paging",
spent.ru_minflt, spent.ru_majflt, spent.ru_nswap);
#endif /* Linux */

View File

@@ -298,7 +298,8 @@ int osal_actor_start(const actor_config &config, mdbx_pid_t &pid) {
if (pid < 0)
return errno;
log_trace("osal_actor_start: fork pid %i for %u", pid, config.actor_id);
log_trace("osal_actor_start: fork pid %ld for %u", (long)pid,
config.actor_id);
childs[pid] = as_running;
return 0;
}

View File

@@ -85,9 +85,9 @@ int testcase::oom_callback(MDBX_env *env, mdbx_pid_t pid, mdbx_tid_t tid,
testcase *self = (testcase *)mdbx_env_get_userctx(env);
if (retry == 0)
log_notice("oom_callback: waitfor pid %u, thread %" PRIuPTR
log_notice("oom_callback: waitfor pid %lu, thread %" PRIuPTR
", txn #%" PRIu64 ", gap %d, scape %zu",
pid, (size_t)tid, txn, gap, space);
(long)pid, (size_t)tid, txn, gap, space);
if (self->should_continue(true)) {
osal_yield();