diff options
Diffstat (limited to 'rt')
-rw-r--r-- | rt/tst-clock.c | 9 | ||||
-rw-r--r-- | rt/tst-cpuclock1.c | 38 | ||||
-rw-r--r-- | rt/tst-cpuclock2.c | 22 | ||||
-rw-r--r-- | rt/tst-mqueue1.c | 10 | ||||
-rw-r--r-- | rt/tst-mqueue3.c | 8 | ||||
-rw-r--r-- | rt/tst-mqueue4.c | 14 | ||||
-rw-r--r-- | rt/tst-timer4.c | 25 |
7 files changed, 68 insertions, 58 deletions
diff --git a/rt/tst-clock.c b/rt/tst-clock.c index f6133f5dde..1cfdcfe04d 100644 --- a/rt/tst-clock.c +++ b/rt/tst-clock.c @@ -20,6 +20,7 @@ #include <stdio.h> #include <string.h> #include <time.h> +#include <stdint.h> /* We want to see output immediately. */ @@ -51,8 +52,8 @@ clock_test (clockid_t cl) result = 1; } else - printf ("clock %d: resolution = %ld.%09ld secs\n", - cl, ts.tv_sec, ts.tv_nsec); + printf ("clock %d: resolution = %jd.%09jd secs\n", + cl, (intmax_t) ts.tv_sec, (intmax_t) ts.tv_nsec); } else { @@ -76,8 +77,8 @@ clock_test (clockid_t cl) } else { - printf ("clock %d: time = %ld.%09ld secs\n", - cl, ts.tv_sec, ts.tv_nsec); + printf ("clock %d: time = %jd.%09jd secs\n", + cl, (intmax_t) ts.tv_sec, (intmax_t) ts.tv_nsec); if (memcmp (&ts, &old_ts, sizeof ts) == 0) { diff --git a/rt/tst-cpuclock1.c b/rt/tst-cpuclock1.c index f503bc28bf..ef140fdcc1 100644 --- a/rt/tst-cpuclock1.c +++ b/rt/tst-cpuclock1.c @@ -24,6 +24,7 @@ #include <string.h> #include <errno.h> #include <signal.h> +#include <stdint.h> #include <sys/wait.h> /* This function is intended to rack up both user and system time. */ @@ -119,8 +120,9 @@ do_test (void) result = 1; goto done; } - printf ("live PID %d clock %lx resolution %lu.%.9lu\n", - child, (unsigned long int) child_clock, res.tv_sec, res.tv_nsec); + printf ("live PID %d clock %lx resolution %ju.%.9ju\n", + child, (unsigned long int) child_clock, + (uintmax_t) res.tv_sec, (uintmax_t) res.tv_nsec); struct timespec before, after; if (clock_gettime (child_clock, &before) < 0) @@ -131,8 +133,8 @@ do_test (void) goto done; } /* Should be close to 0.0. */ - printf ("live PID %d before sleep => %lu.%.9lu\n", - child, before.tv_sec, before.tv_nsec); + printf ("live PID %d before sleep => %ju.%.9ju\n", + child, (uintmax_t) before.tv_sec, (uintmax_t) before.tv_nsec); struct timespec sleeptime = { .tv_nsec = 500000000 }; if (nanosleep (&sleeptime, NULL) != 0) @@ -150,8 +152,8 @@ do_test (void) goto done; } /* Should be close to 0.5. */ - printf ("live PID %d after sleep => %lu.%.9lu\n", - child, after.tv_sec, after.tv_nsec); + printf ("live PID %d after sleep => %ju.%.9ju\n", + child, (uintmax_t) after.tv_sec, (uintmax_t) after.tv_nsec); struct timespec diff = { .tv_sec = after.tv_sec - before.tv_sec, .tv_nsec = after.tv_nsec - before.tv_nsec }; @@ -164,8 +166,8 @@ do_test (void) || diff.tv_nsec > 600000000 || diff.tv_nsec < 100000000) { - printf ("before - after %lu.%.9lu outside reasonable range\n", - diff.tv_sec, diff.tv_nsec); + printf ("before - after %ju.%.9ju outside reasonable range\n", + (uintmax_t) diff.tv_sec, (uintmax_t) diff.tv_nsec); result = 1; } @@ -203,8 +205,8 @@ do_test (void) || d.tv_nsec < sleeptime.tv_nsec || d.tv_nsec > sleeptime.tv_nsec * 2) { - printf ("nanosleep time %lu.%.9lu outside reasonable range\n", - d.tv_sec, d.tv_nsec); + printf ("nanosleep time %ju.%.9ju outside reasonable range\n", + (uintmax_t) d.tv_sec, (uintmax_t) d.tv_nsec); result = 1; } } @@ -236,8 +238,8 @@ do_test (void) goto done; } /* Should be close to 0.6. */ - printf ("dead PID %d => %lu.%.9lu\n", - child, dead.tv_sec, dead.tv_nsec); + printf ("dead PID %d => %ju.%.9ju\n", + child, (uintmax_t) dead.tv_sec, (uintmax_t) dead.tv_nsec); diff.tv_sec = dead.tv_sec - after.tv_sec; diff.tv_nsec = dead.tv_nsec - after.tv_nsec; @@ -248,8 +250,8 @@ do_test (void) } if (diff.tv_sec != 0 || diff.tv_nsec > 200000000) { - printf ("dead - after %lu.%.9lu outside reasonable range\n", - diff.tv_sec, diff.tv_nsec); + printf ("dead - after %ju.%.9ju outside reasonable range\n", + (uintmax_t) diff.tv_sec, (uintmax_t) diff.tv_nsec); result = 1; } @@ -265,9 +267,9 @@ do_test (void) if (clock_gettime (child_clock, &dead) == 0) { - printf ("clock_gettime on reaped PID %d clock %lx => %lu%.9lu\n", + printf ("clock_gettime on reaped PID %d clock %lx => %ju%.9ju\n", child, (unsigned long int) child_clock, - dead.tv_sec, dead.tv_nsec); + (uintmax_t) dead.tv_sec, (uintmax_t) dead.tv_nsec); result = 1; } else @@ -280,9 +282,9 @@ do_test (void) if (clock_getres (child_clock, &dead) == 0) { - printf ("clock_getres on reaped PID %d clock %lx => %lu%.9lu\n", + printf ("clock_getres on reaped PID %d clock %lx => %ju%.9ju\n", child, (unsigned long int) child_clock, - dead.tv_sec, dead.tv_nsec); + (uintmax_t) dead.tv_sec, (uintmax_t) dead.tv_nsec); result = 1; } else diff --git a/rt/tst-cpuclock2.c b/rt/tst-cpuclock2.c index 8a447e15ab..caaa94fc99 100644 --- a/rt/tst-cpuclock2.c +++ b/rt/tst-cpuclock2.c @@ -17,6 +17,7 @@ <http://www.gnu.org/licenses/>. */ #include <unistd.h> +#include <stdint.h> #if (_POSIX_THREADS - 0) <= 0 @@ -221,8 +222,9 @@ do_test (void) result = 1; return 1; } - printf ("live thread clock %lx resolution %lu.%.9lu\n", - (unsigned long int) th_clock, res.tv_sec, res.tv_nsec); + printf ("live thread clock %lx resolution %ju.%.9ju\n", + (unsigned long int) th_clock, + (uintmax_t) res.tv_sec, (uintmax_t) res.tv_nsec); struct timespec process_before, process_after; if (clock_gettime (process_clock, &process_before) < 0) @@ -239,8 +241,8 @@ do_test (void) (unsigned long int) th_clock, strerror (errno)); return 1; } - printf ("live thread before sleep => %lu.%.9lu\n", - before.tv_sec, before.tv_nsec); + printf ("live thread before sleep => %ju.%.9ju\n", + (uintmax_t) before.tv_sec, (uintmax_t) before.tv_nsec); struct timespec me_before, me_after; if (clock_gettime (my_thread_clock, &me_before) < 0) @@ -249,8 +251,8 @@ do_test (void) (unsigned long int) my_thread_clock, strerror (errno)); return 1; } - printf ("self thread before sleep => %lu.%.9lu\n", - me_before.tv_sec, me_before.tv_nsec); + printf ("self thread before sleep => %ju.%.9ju\n", + (uintmax_t) me_before.tv_sec, (uintmax_t) me_before.tv_nsec); struct timespec sleeptime = { .tv_nsec = 500000000 }; if (nanosleep (&sleeptime, NULL) != 0) @@ -265,8 +267,8 @@ do_test (void) (unsigned long int) th_clock, strerror (errno)); return 1; } - printf ("live thread after sleep => %lu.%.9lu\n", - after.tv_sec, after.tv_nsec); + printf ("live thread after sleep => %ju.%.9ju\n", + (uintmax_t) after.tv_sec, (uintmax_t) after.tv_nsec); if (clock_gettime (process_clock, &process_after) < 0) { @@ -281,8 +283,8 @@ do_test (void) (unsigned long int) my_thread_clock, strerror (errno)); return 1; } - printf ("self thread after sleep => %lu.%.9lu\n", - me_after.tv_sec, me_after.tv_nsec); + printf ("self thread after sleep => %ju.%.9ju\n", + (uintmax_t) me_after.tv_sec, (uintmax_t) me_after.tv_nsec); unsigned long long int th_diff = tsdiff (&before, &after); unsigned long long int pdiff = tsdiff (&process_before, &process_after); diff --git a/rt/tst-mqueue1.c b/rt/tst-mqueue1.c index c242c37733..e310fb3049 100644 --- a/rt/tst-mqueue1.c +++ b/rt/tst-mqueue1.c @@ -26,6 +26,7 @@ #include <sys/wait.h> #include <time.h> #include <unistd.h> +#include <stdint.h> #include "tst-mqueue.h" static int @@ -46,20 +47,21 @@ check_attrs (struct mq_attr *attr, int nonblock, long cnt) if (attr->mq_maxmsg != 10 || attr->mq_msgsize != 1) { printf ("attributes don't match those passed to mq_open\n" - "mq_maxmsg %ld, mq_msgsize %ld\n", - attr->mq_maxmsg, attr->mq_msgsize); + "mq_maxmsg %jd, mq_msgsize %jd\n", + (intmax_t) attr->mq_maxmsg, (intmax_t) attr->mq_msgsize); result = 1; } if ((attr->mq_flags & O_NONBLOCK) != nonblock) { - printf ("mq_flags %lx != %x\n", (attr->mq_flags & O_NONBLOCK), nonblock); + printf ("mq_flags %jx != %x\n", + (intmax_t) (attr->mq_flags & O_NONBLOCK), nonblock); result = 1; } if (attr->mq_curmsgs != cnt) { - printf ("mq_curmsgs %ld != %ld\n", attr->mq_curmsgs, cnt); + printf ("mq_curmsgs %jd != %ld\n", (intmax_t) attr->mq_curmsgs, cnt); result = 1; } diff --git a/rt/tst-mqueue3.c b/rt/tst-mqueue3.c index 4607e1b088..c7270a1639 100644 --- a/rt/tst-mqueue3.c +++ b/rt/tst-mqueue3.c @@ -61,14 +61,14 @@ fct (union sigval s) /* Check the values. */ if (attr.mq_maxmsg != MAXMSG) { - printf ("%s: mq_maxmsg wrong: is %ld, expecte %d\n", - __FUNCTION__, attr.mq_maxmsg, MAXMSG); + printf ("%s: mq_maxmsg wrong: is %jd, expecte %d\n", + __FUNCTION__, (intmax_t) attr.mq_maxmsg, MAXMSG); exit (1); } if (attr.mq_msgsize != MAXMSG) { - printf ("%s: mq_msgsize wrong: is %ld, expecte %d\n", - __FUNCTION__, attr.mq_msgsize, MSGSIZE); + printf ("%s: mq_msgsize wrong: is %jd, expecte %d\n", + __FUNCTION__, (intmax_t) attr.mq_msgsize, MSGSIZE); exit (1); } diff --git a/rt/tst-mqueue4.c b/rt/tst-mqueue4.c index 60603bec09..d6733c23c2 100644 --- a/rt/tst-mqueue4.c +++ b/rt/tst-mqueue4.c @@ -139,9 +139,10 @@ do_test (void) || attr.mq_msgsize != 2 || attr.mq_curmsgs != 2) { - printf ("mq_getattr returned unexpected { .mq_flags = %ld,\n" - ".mq_maxmsg = %ld, .mq_msgsize = %ld, .mq_curmsgs = %ld }\n", - attr.mq_flags, attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs); + printf ("mq_getattr returned unexpected { .mq_flags = %jd,\n" + ".mq_maxmsg = %jd, .mq_msgsize = %jd, .mq_curmsgs = %jd }\n", + (intmax_t) attr.mq_flags, (intmax_t) attr.mq_maxmsg, + (intmax_t) attr.mq_msgsize, (intmax_t) attr.mq_curmsgs); result = 1; } @@ -215,9 +216,10 @@ do_test (void) || attr.mq_msgsize != 2 || attr.mq_curmsgs != 1) { - printf ("mq_getattr returned unexpected { .mq_flags = %ld,\n" - ".mq_maxmsg = %ld, .mq_msgsize = %ld, .mq_curmsgs = %ld }\n", - attr.mq_flags, attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs); + printf ("mq_getattr returned unexpected { .mq_flags = %jd,\n" + ".mq_maxmsg = %jd, .mq_msgsize = %jd, .mq_curmsgs = %jd }\n", + (intmax_t) attr.mq_flags, (intmax_t) attr.mq_maxmsg, + (intmax_t) attr.mq_msgsize, (intmax_t) attr.mq_curmsgs); result = 1; } diff --git a/rt/tst-timer4.c b/rt/tst-timer4.c index f64fadd28a..a397663374 100644 --- a/rt/tst-timer4.c +++ b/rt/tst-timer4.c @@ -23,6 +23,7 @@ #include <string.h> #include <time.h> #include <unistd.h> +#include <stdint.h> #if _POSIX_THREADS # include <pthread.h> @@ -168,9 +169,9 @@ check_ts (const char *name, const struct timespec *start, || (end->tv_sec == ts.tv_sec && end->tv_nsec < ts.tv_nsec)) { printf ("\ -*** timer %s invoked too soon: %ld.%09ld instead of expected %ld.%09ld\n", - name, (long) end->tv_sec, end->tv_nsec, - (long) ts.tv_sec, ts.tv_nsec); +*** timer %s invoked too soon: %ld.%09jd instead of expected %ld.%09jd\n", + name, (long) end->tv_sec, (intmax_t) end->tv_nsec, + (long) ts.tv_sec, (intmax_t) ts.tv_nsec); return 1; } else @@ -200,8 +201,8 @@ do_test (void) result = 1; } else - printf ("clock_gettime returned timespec = { %ld, %ld }\n", - (long) ts.tv_sec, ts.tv_nsec); + printf ("clock_gettime returned timespec = { %ld, %jd }\n", + (long) ts.tv_sec, (intmax_t) ts.tv_nsec); if (clock_getres (TEST_CLOCK, &ts) != 0) { @@ -209,8 +210,8 @@ do_test (void) result = 1; } else - printf ("clock_getres returned timespec = { %ld, %ld }\n", - (long) ts.tv_sec, ts.tv_nsec); + printf ("clock_getres returned timespec = { %ld, %jd }\n", + (long) ts.tv_sec, (intmax_t) ts.tv_nsec); struct sigevent ev; memset (&ev, 0x11, sizeof (ev)); @@ -488,9 +489,9 @@ do_test (void) || it.it_interval.tv_sec || it.it_interval.tv_nsec) { printf ("\ -*** timer_gettime timer_none returned { %ld.%09ld, %ld.%09ld }\n", - (long) it.it_value.tv_sec, it.it_value.tv_nsec, - (long) it.it_interval.tv_sec, it.it_interval.tv_nsec); +*** timer_gettime timer_none returned { %ld.%09jd, %ld.%09jd }\n", + (long) it.it_value.tv_sec, (intmax_t) it.it_value.tv_nsec, + (long) it.it_interval.tv_sec, (intmax_t) it.it_interval.tv_nsec); result = 1; } @@ -603,8 +604,8 @@ do_test (void) else if (it.it_interval.tv_sec || it.it_interval.tv_nsec != 100000000) { printf ("\ -!!! second timer_gettime timer_none returned it_interval %ld.%09ld\n", - (long) it.it_interval.tv_sec, it.it_interval.tv_nsec); +!!! second timer_gettime timer_none returned it_interval %ld.%09jd\n", + (long) it.it_interval.tv_sec, (intmax_t) it.it_interval.tv_nsec); /* FIXME: For now disabled. result = 1; */ } |