* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
+ * Copyright (c) 1999-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
if (entering(tcp))
tprintf("%u, ", (unsigned int) tcp->u_arg[0]);
else
- printnum_ulong(tcp, tcp->u_arg[1]);
+ printnum_ptr(tcp, tcp->u_arg[1]);
return 0;
}
SYS_FUNC(io_destroy)
{
- tprintf("%lu", tcp->u_arg[0]);
+ printaddr(tcp->u_arg[0]);
return RVAL_DECODED;
}
tprints(cmds[cmd].name);
return cmds[cmd].sub;
}
- tprintf("%u /* SUB_??? */", cmd);
+ tprintf("%u", cmd);
+ tprints_comment("SUB_???");
return SUB_NONE;
}
static void
-print_common_flags(const struct iocb *cb)
+print_common_flags(struct tcb *tcp, const struct iocb *cb)
{
/* IOCB_FLAG_RESFD is available since v2.6.22-rc1~47 */
#ifdef IOCB_FLAG_RESFD
- if (cb->aio_flags & IOCB_FLAG_RESFD)
- tprintf(", resfd=%d", cb->aio_resfd);
+ if (cb->aio_flags & IOCB_FLAG_RESFD) {
+ tprints(", resfd=");
+ printfd(tcp, cb->aio_resfd);
+ }
if (cb->aio_flags & ~IOCB_FLAG_RESFD)
- tprintf(", flags=%x", cb->aio_flags);
+ tprintf(", flags=%#x", cb->aio_flags);
#endif
}
}
static enum iocb_sub
-print_iocb_header(const struct iocb *cb)
+print_iocb_header(struct tcb *tcp, const struct iocb *cb)
{
enum iocb_sub sub;
if (cb->aio_reqprio)
tprintf(", reqprio=%hd", cb->aio_reqprio);
- tprintf(", fildes=%d", cb->aio_fildes);
+ tprints(", fildes=");
+ printfd(tcp, cb->aio_fildes);
return sub;
}
static void
print_iocb(struct tcb *tcp, const struct iocb *cb)
{
- enum iocb_sub sub = print_iocb_header(cb);
+ enum iocb_sub sub = print_iocb_header(tcp, cb);
switch (sub) {
case SUB_COMMON:
if (cb->aio_lio_opcode == 1 && iocb_is_valid(cb)) {
tprints(", str=");
- printstr(tcp, (unsigned long) cb->aio_buf,
- (unsigned long) cb->aio_nbytes);
+ printstrn(tcp, cb->aio_buf, cb->aio_nbytes);
} else {
tprintf(", buf=%#" PRIx64, (uint64_t) cb->aio_buf);
}
tprintf(", nbytes=%" PRIu64 ", offset=%" PRId64,
(uint64_t) cb->aio_nbytes, (int64_t) cb->aio_offset);
- print_common_flags(cb);
+ print_common_flags(tcp, cb);
break;
case SUB_VECTOR:
if (iocb_is_valid(cb)) {
tprints(", iovec=");
tprint_iov(tcp, cb->aio_nbytes, cb->aio_buf,
- cb->aio_lio_opcode == 8);
+ cb->aio_lio_opcode == 8
+ ? IOV_DECODE_STR
+ : IOV_DECODE_ADDR);
} else {
tprintf(", buf=%#" PRIx64 ", nbytes=%" PRIu64,
(uint64_t) cb->aio_buf,
(uint64_t) cb->aio_nbytes);
}
tprintf(", offset=%" PRId64, (int64_t) cb->aio_offset);
- print_common_flags(cb);
+ print_common_flags(tcp, cb);
break;
case SUB_NONE:
break;
static bool
print_iocbp(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
- unsigned long addr;
+ kernel_ulong_t addr;
struct iocb cb;
- if (elem_size < sizeof(long)) {
- addr = * (unsigned int *) elem_buf;
+ if (elem_size < sizeof(kernel_ulong_t)) {
+ addr = *(unsigned int *) elem_buf;
} else {
- addr = * (unsigned long *) elem_buf;
+ addr = *(kernel_ulong_t *) elem_buf;
}
tprints("{");
SYS_FUNC(io_submit)
{
- const long nr = widen_to_long(tcp->u_arg[1]);
- const unsigned long addr = tcp->u_arg[2];
- unsigned long iocbp;
+ const kernel_long_t nr =
+ truncate_klong_to_current_wordsize(tcp->u_arg[1]);
+ const kernel_ulong_t addr = tcp->u_arg[2];
+ kernel_ulong_t iocbp;
- tprintf("%lu, %ld, ", tcp->u_arg[0], nr);
+ printaddr(tcp->u_arg[0]);
+ tprintf(", %" PRI_kld ", ", nr);
if (nr < 0)
printaddr(addr);
SYS_FUNC(io_cancel)
{
if (entering(tcp)) {
- tprintf("%lu, ", tcp->u_arg[0]);
+ printaddr(tcp->u_arg[0]);
+ tprints(", ");
+
struct iocb cb;
if (!umove_or_printaddr(tcp, tcp->u_arg[1], &cb)) {
tprints("{");
- print_iocb_header(&cb);
+ print_iocb_header(tcp, &cb);
tprints("}");
}
tprints(", ");
SYS_FUNC(io_getevents)
{
if (entering(tcp)) {
- tprintf("%lu, %ld, %ld, ",
- tcp->u_arg[0],
- widen_to_long(tcp->u_arg[1]),
- widen_to_long(tcp->u_arg[2]));
+ printaddr(tcp->u_arg[0]);
+ tprintf(", %" PRI_kld ", %" PRI_kld ", ",
+ truncate_klong_to_current_wordsize(tcp->u_arg[1]),
+ truncate_klong_to_current_wordsize(tcp->u_arg[2]));
} else {
struct io_event buf;
print_array(tcp, tcp->u_arg[3], tcp->u_rval, &buf, sizeof(buf),