* print_time.c (time_fmt): Remove.
(timeval_fmt): New constant.
(print_timeval_t, sprint_timeval, print_timeval32_t, sprint_timeval32):
Use it instead of time_fmt.
* print_timex.c (print_timex): Print field names of the time field.
* printrusage.c (printrusage, printrusage32): Print field names
of ru_utime and ru_stime fields.
* tests/adjtimex.c (main): Add field names to expected output.
* tests/clock_nanosleep.c (main): Likewise.
* tests/futimesat.c (main): Likewise.
* tests/getrusage.c (main): Likewise.
* tests/nanosleep.c (main): Likewise.
* tests/oldselect.expected: Likewise.
* tests/utimes.c (main): Likewise.
* tests/wait4.c (sprint_rusage): Likewise.
* tests/waitid.c (sprint_rusage): Likewise.
* tests/xetitimer.c (main): Likewise.
* tests/xettimeofday.c (main): Likewise.
* tests/xselect.c (main): Likewise.
#endif
static const char timespec_fmt[] = "{tv_sec=%jd, tv_nsec=%jd}";
-static const char time_fmt[] = "{%jd, %jd}";
+static const char timeval_fmt[] = "{tv_sec=%jd, tv_usec=%jd}";
static void
print_timespec_t(const timespec_t *t)
static void
print_timeval_t(const timeval_t *t)
{
- tprintf(time_fmt, (intmax_t) t->tv_sec, (intmax_t) t->tv_usec);
+ tprintf(timeval_fmt, (intmax_t) t->tv_sec, (intmax_t) t->tv_usec);
}
MPERS_PRINTER_DECL(void, print_timespec,
struct tcb *tcp, const long addr)
{
timeval_t t;
- static char buf[sizeof(time_fmt) + 3 * sizeof(t)];
+ static char buf[sizeof(timeval_fmt) + 3 * sizeof(t)];
if (!addr) {
strcpy(buf, "NULL");
umove(tcp, addr, &t)) {
snprintf(buf, sizeof(buf), "%#lx", addr);
} else {
- snprintf(buf, sizeof(buf), time_fmt,
+ snprintf(buf, sizeof(buf), timeval_fmt,
(intmax_t) t.tv_sec, (intmax_t) t.tv_usec);
}
static void
print_timeval32_t(const timeval32_t *t)
{
- tprintf(time_fmt, (intmax_t) t->tv_sec, (intmax_t) t->tv_usec);
+ tprintf(timeval_fmt, (intmax_t) t->tv_sec, (intmax_t) t->tv_usec);
}
void
sprint_timeval32(struct tcb *tcp, const long addr)
{
timeval32_t t;
- static char buf[sizeof(time_fmt) + 3 * sizeof(t)];
+ static char buf[sizeof(timeval_fmt) + 3 * sizeof(t)];
if (!addr) {
strcpy(buf, "NULL");
umove(tcp, addr, &t)) {
snprintf(buf, sizeof(buf), "%#lx", addr);
} else {
- snprintf(buf, sizeof(buf), time_fmt,
+ snprintf(buf, sizeof(buf), timeval_fmt,
(intmax_t) t.tv_sec, (intmax_t) t.tv_usec);
}
tprintf(", constant=%jd, precision=%ju, tolerance=%jd",
(intmax_t) tx.constant, (uintmax_t) tx.precision,
(intmax_t) tx.tolerance);
- tprintf(", time={%jd, %jd}",
+ tprintf(", time={tv_sec=%jd, tv_usec=%jd}",
(intmax_t) tx.time.tv_sec, (intmax_t) tx.time.tv_usec);
tprintf(", tick=%jd, ppsfreq=%jd, jitter=%jd",
(intmax_t) tx.tick, (intmax_t) tx.ppsfreq, (intmax_t) tx.jitter);
if (umove_or_printaddr(tcp, addr, &ru))
return;
- tprintf("{ru_utime={%llu, %llu}, ru_stime={%llu, %llu}, ",
+ tprintf("{ru_utime={tv_sec=%llu, tv_usec=%llu}, "
+ "ru_stime={tv_sec=%llu, tv_usec=%llu}, ",
zero_extend_signed_to_ull(ru.ru_utime.tv_sec),
zero_extend_signed_to_ull(ru.ru_utime.tv_usec),
zero_extend_signed_to_ull(ru.ru_stime.tv_sec),
if (umove_or_printaddr(tcp, addr, &ru))
return;
- tprintf("{ru_utime={%lu, %lu}, ru_stime={%lu, %lu}, ",
+ tprintf("{ru_utime={tv_sec=%lu, tv_usec=%lu}, "
+ "ru_stime={tv_sec=%lu, tv_usec=%lu}, ",
(long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
(long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec);
if (abbrev(tcp))
printf("adjtimex\\(\\{modes=0, offset=%jd, freq=%jd, maxerror=%jd"
", esterror=%jd, status=%s, constant=%jd, precision=%jd"
- ", tolerance=%jd, time=\\{%jd, %jd\\}, tick=%jd, ppsfreq=%jd"
- ", jitter=%jd, shift=%d, stabil=%jd, jitcnt=%jd, calcnt=%jd"
- ", errcnt=%jd, stbcnt=%jd"
+ ", tolerance=%jd, time=\\{tv_sec=%jd, tv_usec=%jd\\}, tick=%jd, "
+ "ppsfreq=%jd, jitter=%jd, shift=%d, stabil=%jd, jitcnt=%jd, "
+ "calcnt=%jd, errcnt=%jd, stbcnt=%jd"
#ifdef HAVE_STRUCT_TIMEX_TAI
", tai=%d"
#endif
if (setitimer(ITIMER_REAL, &itv, NULL))
perror_msg_and_skip("setitimer");
- printf("setitimer(ITIMER_REAL, {it_interval={%jd, %jd}"
- ", it_value={%jd, %jd}}, NULL) = 0\n",
+ printf("setitimer(ITIMER_REAL, {it_interval={tv_sec=%jd, tv_usec=%jd}"
+ ", it_value={tv_sec=%jd, tv_usec=%jd}}, NULL) = 0\n",
(intmax_t) itv.it_interval.tv_sec,
(intmax_t) itv.it_interval.tv_usec,
(intmax_t) itv.it_value.tv_sec,
(void) close(0);
rc = syscall(__NR_futimesat, 0, "", ts);
- printf("futimesat(0, \"\", [{%llu, %llu}, {%llu, %llu}])"
- " = %ld %s (%m)\n",
+ printf("futimesat(0, \"\", [{tv_sec=%llu, tv_usec=%llu}, "
+ "{tv_sec=%llu, tv_usec=%llu}]) = %ld %s (%m)\n",
CAST_NUM(ts[0].tv_sec), CAST_NUM(ts[0].tv_usec),
CAST_NUM(ts[1].tv_sec), CAST_NUM(ts[1].tv_usec),
rc, errno2name());
{
struct rusage *const usage = tail_alloc(sizeof(struct rusage));
int rc = syscall(__NR_getrusage, RUSAGE_SELF, usage);
- printf("getrusage(RUSAGE_SELF, {ru_utime={%ju, %ju}"
- ", ru_stime={%ju, %ju}, ru_maxrss=%lu, ru_ixrss=%lu"
- ", ru_idrss=%lu, ru_isrss=%lu, ru_minflt=%lu"
+ printf("getrusage(RUSAGE_SELF, {ru_utime={tv_sec=%ju, tv_usec=%ju}"
+ ", ru_stime={tv_sec=%ju, tv_usec=%ju}, ru_maxrss=%lu"
+ ", ru_ixrss=%lu, ru_idrss=%lu, ru_isrss=%lu, ru_minflt=%lu"
", ru_majflt=%lu, ru_nswap=%lu, ru_inblock=%lu"
", ru_oublock=%lu, ru_msgsnd=%lu, ru_msgrcv=%lu"
", ru_nsignals=%lu, ru_nvcsw=%lu, ru_nivcsw=%lu}) = %d\n",
if (setitimer(ITIMER_REAL, &itv, NULL))
perror_msg_and_skip("setitimer");
- printf("setitimer(ITIMER_REAL, {it_interval={%jd, %jd}"
- ", it_value={%jd, %jd}}, NULL) = 0\n",
+ printf("setitimer(ITIMER_REAL, {it_interval={tv_sec=%jd, tv_usec=%jd}"
+ ", it_value={tv_sec=%jd, tv_usec=%jd}}, NULL) = 0\n",
(intmax_t) itv.it_interval.tv_sec,
(intmax_t) itv.it_interval.tv_usec,
(intmax_t) itv.it_value.tv_sec,
-select(2, [1], [0], NULL, {0, 42}) = 0 (Timeout)
+select(2, [1], [0], NULL, {tv_sec=0, tv_usec=42}) = 0 (Timeout)
+++ exited with 0 +++
ts[1].tv_usec = tv.tv_usec + 1;
rc = syscall(__NR_utimes, "", ts);
- printf("utimes(\"\", [{%llu, %llu}, {%llu, %llu}])"
- " = %ld %s (%m)\n",
+ printf("utimes(\"\", [{tv_sec=%llu, tv_usec=%llu}, "
+ "{tv_sec=%llu, tv_usec=%llu}]) = %ld %s (%m)\n",
CAST_NUM(ts[0].tv_sec), CAST_NUM(ts[0].tv_usec),
CAST_NUM(ts[1].tv_sec), CAST_NUM(ts[1].tv_usec),
rc, errno2name());
{
static char buf[1024];
snprintf(buf, sizeof(buf),
- "{ru_utime={%lu, %lu}"
- ", ru_stime={%lu, %lu}"
+ "{ru_utime={tv_sec=%lu, tv_usec=%lu}"
+ ", ru_stime={tv_sec=%lu, tv_usec=%lu}"
#if VERBOSE
", ru_maxrss=%lu"
", ru_ixrss=%lu"
{
static char buf[1024];
snprintf(buf, sizeof(buf),
- "{ru_utime={%llu, %llu}"
- ", ru_stime={%llu, %llu}"
+ "{ru_utime={tv_sec=%llu, tv_usec=%llu}"
+ ", ru_stime={tv_sec=%llu, tv_usec=%llu}"
#if VERBOSE
", ru_maxrss=%llu"
", ru_ixrss=%llu"
if (setitimer(ITIMER_REAL, &new.itv, &old.itv))
perror_msg_and_skip("setitimer");
printf("setitimer(ITIMER_REAL"
- ", {it_interval={%jd, %jd}, it_value={%jd, %jd}}"
- ", {it_interval={%jd, %jd}, it_value={%jd, %jd}}"
- ") = 0\n",
+ ", {it_interval={tv_sec=%jd, tv_usec=%jd}, "
+ "it_value={tv_sec=%jd, tv_usec=%jd}}"
+ ", {it_interval={tv_sec=%jd, tv_usec=%jd}, "
+ "it_value={tv_sec=%jd, tv_usec=%jd}}) = 0\n",
(intmax_t) new.itv.it_interval.tv_sec,
(intmax_t) new.itv.it_interval.tv_usec,
(intmax_t) new.itv.it_value.tv_sec,
if (getitimer(ITIMER_REAL, &old.itv))
perror_msg_and_skip("getitimer");
printf("getitimer(ITIMER_REAL"
- ", {it_interval={%jd, %jd}, it_value={%jd, %jd}}"
- ") = 0\n",
+ ", {it_interval={tv_sec=%jd, tv_usec=%jd}, "
+ "it_value={tv_sec=%jd, tv_usec=%jd}}) = 0\n",
(intmax_t) old.itv.it_interval.tv_sec,
(intmax_t) old.itv.it_interval.tv_usec,
(intmax_t) old.itv.it_value.tv_sec,
if (syscall(__NR_gettimeofday, &t.tv, NULL))
perror_msg_and_skip("gettimeofday");
- printf("gettimeofday({%jd, %jd}, NULL) = 0\n",
+ printf("gettimeofday({tv_sec=%jd, tv_usec=%jd}, NULL) = 0\n",
(intmax_t) t.tv.tv_sec, (intmax_t) t.tv.tv_usec);
if (syscall(__NR_gettimeofday, &t.tv, &t.tz))
perror_msg_and_skip("gettimeofday");
- printf("gettimeofday({%jd, %jd}"
+ printf("gettimeofday({tv_sec=%jd, tv_usec=%jd}"
", {tz_minuteswest=%d, tz_dsttime=%d}) = 0\n",
(intmax_t) t.tv.tv_sec, (intmax_t) t.tv.tv_usec,
t.tz.tz_minuteswest, t.tz.tz_dsttime);
t.tv.tv_sec = -1;
t.tv.tv_usec = 1000000000;
assert(syscall(__NR_settimeofday, &t.tv, &t.tz) == -1);
- printf("settimeofday({%jd, %jd}"
+ printf("settimeofday({tv_sec=%jd, tv_usec=%jd}"
", {tz_minuteswest=%d, tz_dsttime=%d})"
" = -1 EINVAL (%m)\n",
(intmax_t) t.tv.tv_sec, (intmax_t) t.tv.tv_usec,
FD_SET(fds[0], set);
FD_SET(fds[1], set);
assert(syscall(TEST_SYSCALL_NR, fds[1] + 1, NULL, set, NULL, &tm.tv) == 3);
- printf("%s(%d, NULL, [1 2 %d %d], NULL, {%lld, %lld})"
- " = 3 (out [1 2 %d], left {%lld, %lld})\n",
+ printf("%s(%d, NULL, [1 2 %d %d], NULL, {tv_sec=%lld, tv_usec=%lld})"
+ " = 3 (out [1 2 %d], left {tv_sec=%lld, tv_usec=%lld})\n",
TEST_SYSCALL_STR, fds[1] + 1, fds[0], fds[1],
(long long) tm_in.tv.tv_sec, (long long) tm_in.tv.tv_usec,
fds[1],
tm.tv.tv_sec = 0;
tm.tv.tv_usec = 123;
assert(syscall(TEST_SYSCALL_NR, FD_SETSIZE + 1, set, set + 1, NULL, &tm.tv) == 0);
- printf("%s(%d, [%d], [], NULL, {0, 123}) = 0 (Timeout)\n",
+ printf("%s(%d, [%d], [], NULL, {tv_sec=0, tv_usec=123}) = 0 (Timeout)\n",
TEST_SYSCALL_STR, FD_SETSIZE + 1, fds[0]);
puts("+++ exited with 0 +++");