#include <ws2tcpip.h>
#endif
+#ifndef USE_WINSOCK
+#define ARG_LL "%ll"
+#else
+#define ARG_LL "%I64"
+#endif
+
#ifdef HAVE_ATTR_FORMAT
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
+
+#ifndef USE_WINSOCK
+#define ARG_LL "%ll"
+#else
+#define ARG_LL "%I64"
+#endif
]
AHX_CONFIG_FORMAT_ATTRIBUTE
if(d->ttl < now) return 1; /* expired */
/* meta line */
- if(!ssl_printf(ssl, ";rrset%s %lld %u %u %d %d\n",
+ if(!ssl_printf(ssl, ";rrset%s " ARG_LL "d %u %u %d %d\n",
(k->rk.flags & PACKED_RRSET_NSEC_AT_APEX)?" nsec_apex":"",
(long long)(d->ttl - now),
(unsigned)d->count, (unsigned)d->rrsig_count,
}
/* meta line */
- if(!ssl_printf(ssl, "msg %s %s %s %d %d %lld %d %u %u %u\n",
+ if(!ssl_printf(ssl, "msg %s %s %s %d %d " ARG_LL "d %d %u %u %u\n",
nm, cl, tp,
(int)d->flags, (int)d->qdcount,
(long long)(d->ttl-now), (int)d->security,
s += 10;
rk->rk.flags |= PACKED_RRSET_NSEC_AT_APEX;
}
- if(sscanf(s, " %lld %u %u %u %u", &ttl, &rr_count, &rrsig_count,
+ if(sscanf(s, " " ARG_LL "d %u %u %u %u", &ttl, &rr_count, &rrsig_count,
&trust, &security) != 5) {
log_warn("error bad rrset spec %s", s);
return 0;
}
/* read remainder of line */
- if(sscanf(s, " %u %u %lld %u %u %u %u", &flags, &qdcount, &ttl,
+ if(sscanf(s, " %u %u " ARG_LL "d %u %u %u %u", &flags, &qdcount, &ttl,
&security, &an, &ns, &ar) != 7) {
log_warn("error cannot parse numbers: %s", s);
return 0;
return;
continue; /* skip stuff not in infra cache */
}
- if(!ssl_printf(ssl, "%s%s%s%srto %d msec, ttl %lld, ping %d "
- "var %d rtt %d, tA %d, tAAAA %d, tother %d",
+ if(!ssl_printf(ssl, "%s%s%s%srto %d msec, ttl " ARG_LL "d, "
+ "ping %d var %d rtt %d, tA %d, tAAAA %d, tother %d",
lame?"LAME ":"", dlame?"NoDNSSEC ":"",
a->lame?"AddrWasParentSide ":"",
rlame?"NoAuthButRecursive ":"", rto, entry_ttl,
if(!ssl_printf(ssl, "%s.requestlist.current.user"SQ"%u\n", nm,
(unsigned)s->mesh_num_reply_states)) return 0;
timeval_divide(&avg, &s->mesh_replies_sum_wait, s->mesh_replies_sent);
- if(!ssl_printf(ssl, "%s.recursion.time.avg"SQ"%lld.%6.6d\n", nm,
+ if(!ssl_printf(ssl, "%s.recursion.time.avg"SQ ARG_LL "d.%6.6d\n", nm,
(long long)avg.tv_sec, (int)avg.tv_usec)) return 0;
if(!ssl_printf(ssl, "%s.recursion.time.median"SQ"%g\n", nm,
s->mesh_time_median)) return 0;
timeval_subtract(&dt, &now, &worker->daemon->time_last_stat);
if(reset)
worker->daemon->time_last_stat = now;
- if(!ssl_printf(ssl, "time.now"SQ"%lld.%6.6d\n",
+ if(!ssl_printf(ssl, "time.now"SQ ARG_LL "d.%6.6d\n",
(long long)now.tv_sec, (unsigned)now.tv_usec)) return 0;
- if(!ssl_printf(ssl, "time.up"SQ"%lld.%6.6d\n",
+ if(!ssl_printf(ssl, "time.up"SQ ARG_LL "d.%6.6d\n",
(long long)up.tv_sec, (unsigned)up.tv_usec)) return 0;
- if(!ssl_printf(ssl, "time.elapsed"SQ"%lld.%6.6d\n",
+ if(!ssl_printf(ssl, "time.elapsed"SQ ARG_LL "d.%6.6d\n",
(long long)dt.tv_sec, (unsigned)dt.tv_usec)) return 0;
return 1;
}
if(!ssl_printf(ssl, " ]\n"))
return;
uptime = (time_t)time(NULL) - (time_t)worker->daemon->time_boot.tv_sec;
- if(!ssl_printf(ssl, "uptime: %lld seconds\n", (long long)uptime))
+ if(!ssl_printf(ssl, "uptime: " ARG_LL "d seconds\n", (long long)uptime))
return;
if(!ssl_printf(ssl, "unbound (pid %d) is running...\n",
(int)getpid()))
while(r && r->next)
r = r->next;
timeval_subtract(&d, env->now_tv, &r->start_time);
- snprintf(buf, len, "%lld.%6.6d", (long long)d.tv_sec, (int)d.tv_usec);
+ snprintf(buf, len, ARG_LL "d.%6.6d",
+ (long long)d.tv_sec, (int)d.tv_usec);
} else {
snprintf(buf, len, "-");
}
16 January 2014: Wouter
- fix #544: Fixed +i causes segfault when running with module conf
"iterator".
+ - Windows port, adjust %lld to %I64d, and warning in win_event.c.
14 January 2014: Wouter
- iana portlist updated.
d4 = (*d)[4];
d5 = (*d)[5];
tsigtime = (d0<<40) | (d1<<32) | (d2<<24) | (d3<<16) | (d4<<8) | d5;
+#ifndef USE_WINSOCK
w = sldns_str_print(s, sl, "%llu", (long long)tsigtime);
+#else
+ w = sldns_str_print(s, sl, "%I64u", (long long)tsigtime);
+#endif
(*d)+=6;
(*dl)-=6;
return w;
if(error_code < llq_errors_num)
w += sldns_str_print(s, sl, " %s", llq_errors[error_code]);
else w += sldns_str_print(s, sl, " error %d", (int)error_code);
+#ifndef USE_WINSOCK
w += sldns_str_print(s, sl, " id %llx lease-life %lu",
(unsigned long long)llq_id, (unsigned long)lease_life);
+#else
+ w += sldns_str_print(s, sl, " id %I64x lease-life %lu",
+ (unsigned long long)llq_id, (unsigned long)lease_life);
+#endif
return w;
}
m->s.env->mesh->num_reply_addrs--;
end_time = *m->s.env->now_tv;
timeval_subtract(&duration, &end_time, &r->start_time);
- verbose(VERB_ALGO, "query took %lld.%6.6d sec",
+ verbose(VERB_ALGO, "query took " ARG_LL "d.%6.6d sec",
(long long)duration.tv_sec, (int)duration.tv_usec);
m->s.env->mesh->replies_sent++;
timeval_add(&m->s.env->mesh->replies_sum_wait, &duration);
timeval_divide(&avg, &mesh->replies_sum_wait,
mesh->replies_sent);
log_info("average recursion processing time "
- "%lld.%6.6d sec", (long long)avg.tv_sec, (int)avg.tv_usec);
+ ARG_LL "d.%6.6d sec",
+ (long long)avg.tv_sec, (int)avg.tv_usec);
log_info("histogram of recursion processing times");
timehist_log(mesh->histogram, "recursions");
}
char buf[102400];
if(!in)
fatal_exit("could not open %s: %s", fname, strerror(errno));
- printf("Reading %s of size %lld\n", fname, (long long)total);
+ printf("Reading %s of size " ARG_LL "d\n", fname, (long long)total);
while(fgets(buf, 102400, in)) {
buf[102400-1] = 0;
done += (off_t)strlen(buf);
/* check for functions */
if(strcmp(buf, "time") == 0) {
- snprintf(buf, sizeof(buf), "%lld", (long long)runtime->now_secs);
+ snprintf(buf, sizeof(buf), ARG_LL "d", (long long)runtime->now_secs);
*text += len;
return strdup(buf);
} else if(strcmp(buf, "timeout") == 0) {
struct fake_timer* t = first_timer(runtime);
if(t && (time_t)t->tv.tv_sec >= runtime->now_secs)
res = (time_t)t->tv.tv_sec - runtime->now_secs;
- snprintf(buf, sizeof(buf), "%lld", (long long)res);
+ snprintf(buf, sizeof(buf), ARG_LL "d", (long long)res);
*text += len;
return strdup(buf);
} else if(strncmp(buf, "ctime ", 6) == 0 ||
ident, (int)getpid(), tid?*tid:0, type, message);
} else
#endif
- fprintf(logfile, "[%lld] %s[%d:%x] %s: %s\n", (long long)now,
+ fprintf(logfile, "[" ARG_LL "d] %s[%d:%x] %s: %s\n", (long long)now,
ident, (int)getpid(), tid?*tid:0, type, message);
#ifdef UB_ON_WINDOWS
/* line buffering does not work on windows */
#include "config.h"
#ifdef USE_WINSOCK
#include <signal.h>
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
wait->tv_usec = p->ev_timeout.tv_usec
- now->tv_usec;
}
- verbose(VERB_CLIENT, "winsock_event wait=%lld.%6.6d",
+ verbose(VERB_CLIENT, "winsock_event wait=" ARG_LL "d.%6.6d",
(long long)wait->tv_sec, (int)wait->tv_usec);
return;
}
int event_add(struct event *ev, struct timeval *tv)
{
- verbose(VERB_ALGO, "event_add %p added=%d fd=%d tv=%lld %s%s%s",
+ verbose(VERB_ALGO, "event_add %p added=%d fd=%d tv=" ARG_LL "d %s%s%s",
ev, ev->added, ev->ev_fd,
(tv?(long long)tv->tv_sec*1000+(long long)tv->tv_usec/1000:-1),
(ev->ev_events&EV_READ)?" EV_READ":"",
int event_del(struct event *ev)
{
- verbose(VERB_ALGO, "event_del %p added=%d fd=%d tv=%lld %s%s%s",
+ verbose(VERB_ALGO, "event_del %p added=%d fd=%d tv=" ARG_LL "d %s%s%s",
ev, ev->added, ev->ev_fd,
(ev->ev_events&EV_TIMEOUT)?(long long)ev->ev_timeout.tv_sec*1000+
(long long)ev->ev_timeout.tv_usec/1000:-1,
if (elapsed > (time_t)holddown) {
return elapsed-(time_t)holddown;
}
- verbose_key(ta, VERB_ALGO, "holddown time %lld seconds to go",
+ verbose_key(ta, VERB_ALGO, "holddown time " ARG_LL "d seconds to go",
(long long) ((time_t)holddown-elapsed));
return 0;
}
time_t exceeded = check_holddown(env, anchor, env->cfg->add_holddown);
if (exceeded && anchor->s == AUTR_STATE_ADDPEND) {
verbose_key(anchor, VERB_ALGO, "add-holddown time exceeded "
- "%lld seconds ago, and pending-count %d",
+ ARG_LL "d seconds ago, and pending-count %d",
(long long)exceeded, anchor->pending_count);
if(anchor->pending_count >= MIN_PENDINGCOUNT) {
set_trustanchor_state(env, anchor, c, AUTR_STATE_VALID);
time_t exceeded = check_holddown(env, anchor, env->cfg->del_holddown);
if(exceeded && anchor->s == AUTR_STATE_REVOKED) {
verbose_key(anchor, VERB_ALGO, "del-holddown time exceeded "
- "%lld seconds ago", (long long)exceeded);
+ ARG_LL "d seconds ago", (long long)exceeded);
set_trustanchor_state(env, anchor, c, AUTR_STATE_REMOVED);
}
}
* one valid KSK: remove missing trust anchor */
if (exceeded && valid > 0) {
verbose_key(anchor, VERB_ALGO, "keep-missing time "
- "exceeded %lld seconds ago, [%d key(s) VALID]",
+ "exceeded " ARG_LL "d seconds ago, [%d key(s) VALID]",
(long long)exceeded, valid);
set_trustanchor_state(env, anchor, changed,
AUTR_STATE_REMOVED);
#endif
tv.tv_usec = 0;
comm_timer_set(env->probe_timer, &tv);
- verbose(VERB_ALGO, "scheduled next probe in %lld sec", (long long)tv.tv_sec);
+ verbose(VERB_ALGO, "scheduled next probe in " ARG_LL "d sec", (long long)tv.tv_sec);
}
/** set next probe for trust anchor */