tests: use PRI__*64 macros in aio test

It was incorrectly assumed that __*64 types are long long on all
platforms, despite strace having specially crafted macros in order
to handle precisely this architecture discrepancy.
The commit fixes this oversight.

* tests/aio.c (main): Use PRI__*64 macros for correct format conversion
specifiers for __*64-typed values.
This commit is contained in:
Eugene Syromyatnikov 2016-09-08 21:26:17 +03:00 committed by Dmitry V. Levin
parent 047c42e7c8
commit 3351924396

View File

@ -237,16 +237,14 @@ main(void)
if (rc != (long) nr)
perror_msg_and_skip("io_submit");
printf("io_submit(%#lx, %u, ["
"{data=%#llx, pread, reqprio=11, fildes=0, "
"buf=%p, nbytes=%u, offset=%lld}, "
"{data=%#llx, pread, reqprio=22, fildes=0, "
"buf=%p, nbytes=%u, offset=%lld}"
"{data=%#" PRI__x64 ", pread, reqprio=11, fildes=0, "
"buf=%p, nbytes=%u, offset=%" PRI__d64 "}, "
"{data=%#" PRI__x64 ", pread, reqprio=22, fildes=0, "
"buf=%p, nbytes=%u, offset=%" PRI__d64 "}"
"]) = %s\n",
*ctx, nr,
(unsigned long long) cb[0].aio_data, data0,
sizeof_data0, (long long) cb[0].aio_offset,
(unsigned long long) cb[1].aio_data, data1,
sizeof_data1, (long long) cb[1].aio_offset,
cb[0].aio_data, data0, sizeof_data0, cb[0].aio_offset,
cb[1].aio_data, data1, sizeof_data1, cb[1].aio_offset,
sprintrc(rc));
rc = syscall(__NR_io_getevents, (long) 0xface1e55deadbeefLL,
@ -267,12 +265,12 @@ main(void)
rc = syscall(__NR_io_getevents, *ctx, nr, nr + 1, ev, ts);
printf("io_getevents(%#lx, %ld, %ld, ["
"{data=%#llx, obj=%p, res=%u, res2=0}, "
"{data=%#llx, obj=%p, res=%u, res2=0}"
"{data=%#" PRI__x64 ", obj=%p, res=%u, res2=0}, "
"{data=%#" PRI__x64 ", obj=%p, res=%u, res2=0}"
"], {0, 123456789}) = %s\n",
*ctx, (long) nr, (long) (nr + 1),
(unsigned long long) cb[0].aio_data, &cb[0], sizeof_data0,
(unsigned long long) cb[1].aio_data, &cb[1], sizeof_data1,
cb[0].aio_data, &cb[0], sizeof_data0,
cb[1].aio_data, &cb[1], sizeof_data1,
sprintrc(rc));
rc = syscall(__NR_io_cancel, *ctx, NULL, NULL);
@ -283,9 +281,9 @@ main(void)
sprintrc(rc));
rc = syscall(__NR_io_cancel, *ctx, cbc, ev);
printf("io_cancel(%#lx, {data=%#llx, pread, reqprio=99, fildes=-42}"
", %p) = %s\n",
*ctx, (unsigned long long) cbc->aio_data, ev, sprintrc(rc));
printf("io_cancel(%#lx, {data=%#" PRI__x64
", pread, reqprio=99, fildes=-42}, %p) = %s\n",
*ctx, cbc->aio_data, ev, sprintrc(rc));
rc = syscall(__NR_io_submit, (unsigned long) 0xfacef157beeff00dULL,
(long) 0xdeadc0defacefeedLL, NULL);
@ -299,23 +297,23 @@ main(void)
rc = syscall(__NR_io_submit, *ctx, 1057L, cbvs2);
printf("io_submit(%#lx, %ld, ["
"{data=%#llx, key=%u, %hu /* SUB_??? */, fildes=%d}, "
"{data=%#" PRI__x64 ", key=%u, %hu /* SUB_??? */, fildes=%d}, "
"{key=%u, pwrite, reqprio=%hd, fildes=%d, str=NULL"
", nbytes=%llu, offset=%lld"
", nbytes=%" PRI__u64 ", offset=%" PRI__d64
# ifdef IOCB_FLAG_RESFD
", resfd=%d, flags=%x"
# endif
"}, "
"{key=%u, pwrite, reqprio=%hd, fildes=%d, buf=%#llx"
", nbytes=%llu, offset=%lld}, "
"{key=%u, pwrite, reqprio=%hd, fildes=%d, buf=%#" PRI__x64
", nbytes=%" PRI__u64 ", offset=%" PRI__d64 "}, "
"{key=%u, pwrite, reqprio=%hd, fildes=%d"
", str=\"\\0\\1\\2\\3%.28s\"..."
", nbytes=%llu, offset=%lld}, "
"{key=%u, pwritev, reqprio=%hd, fildes=%d, buf=%#llx"
", nbytes=%llu, offset=%lld}"
", nbytes=%" PRI__u64 ", offset=%" PRI__d64 "}, "
"{key=%u, pwritev, reqprio=%hd, fildes=%d, buf=%#" PRI__x64
", nbytes=%" PRI__u64 ", offset=%" PRI__d64 "}"
", {NULL}, {%#lx}, %p]) = %s\n",
*ctx, 1057L,
(unsigned long long) cbv2[0].aio_data, cbv2[0].aio_key,
cbv2[0].aio_data, cbv2[0].aio_key,
cbv2[0].aio_lio_opcode, cbv2[0].aio_fildes,
cbv2[1].aio_key, cbv2[1].aio_reqprio, cbv2[1].aio_fildes,
cbv2[1].aio_nbytes, cbv2[1].aio_offset,
@ -334,22 +332,22 @@ main(void)
if (rc != (long) nr)
perror_msg_and_skip("io_submit");
printf("io_submit(%#lx, %u, ["
"{data=%#llx, preadv, reqprio=%hd, fildes=0, "
"{data=%#" PRI__x64 ", preadv, reqprio=%hd, fildes=0, "
"iovec=[{iov_base=%p, iov_len=%u}"
", {iov_base=%p, iov_len=%u}], offset=%lld}, "
"{data=%#llx, preadv, reqprio=%hd, fildes=0, "
", {iov_base=%p, iov_len=%u}], offset=%" PRI__d64 "}, "
"{data=%#" PRI__x64 ", preadv, reqprio=%hd, fildes=0, "
"iovec=[{iov_base=%p, iov_len=%u}"
", {iov_base=%p, iov_len=%u}], offset=%lld}"
", {iov_base=%p, iov_len=%u}], offset=%" PRI__d64 "}"
"]) = %s\n",
*ctx, nr,
(unsigned long long) cbv[0].aio_data, cbv[0].aio_reqprio,
cbv[0].aio_data, cbv[0].aio_reqprio,
iov0[0].iov_base, (unsigned int) iov0[0].iov_len,
iov0[1].iov_base, (unsigned int) iov0[1].iov_len,
(long long) cbv[0].aio_offset,
(unsigned long long) cbv[1].aio_data, cbv[1].aio_reqprio,
cbv[0].aio_offset,
cbv[1].aio_data, cbv[1].aio_reqprio,
iov1[0].iov_base, (unsigned int) iov1[0].iov_len,
iov1[1].iov_base, (unsigned int) iov1[1].iov_len,
(long long) cbv[1].aio_offset,
cbv[1].aio_offset,
sprintrc(rc));
rc = syscall(__NR_io_destroy, (unsigned long) 0xfacefeedb000b1e5ULL);