/*
* Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org>
+ * Copyright (c) 2016-2018 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include MPERS_DEFS
+#include "xstring.h"
+
static const char timeval_fmt[] = "{tv_sec=%lld, tv_usec=%llu}";
static void
print_timeval_t(arg);
}
+MPERS_PRINTER_DECL(bool, print_struct_timeval_data_size,
+ const void *arg, const size_t size)
+{
+ if (size < sizeof(timeval_t)) {
+ tprints("?");
+ return false;
+ }
+
+ print_timeval_t(arg);
+ return true;
+}
+
MPERS_PRINTER_DECL(void, print_timeval,
struct tcb *const tcp, const kernel_ulong_t addr)
{
strcpy(buf, "NULL");
} else if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) ||
umove(tcp, addr, &t)) {
- snprintf(buf, sizeof(buf), "%#" PRI_klx, addr);
+ xsprintf(buf, "%#" PRI_klx, addr);
} else {
- snprintf(buf, sizeof(buf), timeval_fmt,
+ xsprintf(buf, timeval_fmt,
(long long) t.tv_sec,
zero_extend_signed_to_ull(t.tv_usec));
}
strcpy(buf, "NULL");
} else if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)) ||
umove(tcp, addr, &t)) {
- snprintf(buf, sizeof(buf), "%#" PRI_klx, addr);
+ xsprintf(buf, "%#" PRI_klx, addr);
} else {
- snprintf(buf, sizeof(buf), timeval_fmt,
+ xsprintf(buf, timeval_fmt,
(long long) t.tv_sec,
zero_extend_signed_to_ull(t.tv_usec));
}