2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 /* Not defined in libaio.h */
38 # define IOCB_RESFD (1 << 0)
44 tprintf("%u, ", (unsigned int) tcp->u_arg[0]);
46 printnum_ulong(tcp, tcp->u_arg[1]);
52 tprintf("%lu", tcp->u_arg[0]);
60 SUB_NONE, SUB_COMMON, SUB_POLL, SUB_VECTOR
64 tprint_lio_opcode(unsigned cmd)
70 { "pread", SUB_COMMON },
71 { "pwrite", SUB_COMMON },
72 { "fsync", SUB_NONE },
73 { "fdsync", SUB_NONE },
77 { "preadv", SUB_VECTOR },
78 { "pwritev", SUB_VECTOR },
81 if (cmd < ARRAY_SIZE(cmds)) {
82 tprints(cmds[cmd].name);
85 tprintf("%u /* SUB_??? */", cmd);
90 print_common_flags(struct iocb *iocb)
92 #ifdef HAVE_STRUCT_IOCB_U_C_FLAGS
93 if (iocb->u.c.flags & IOCB_RESFD)
94 tprintf(", resfd=%d", iocb->u.c.resfd);
95 if (iocb->u.c.flags & ~IOCB_RESFD)
96 tprintf(", flags=%x", iocb->u.c.flags);
98 # warning "libaio.h is too old => limited io_submit decoding"
102 #endif /* HAVE_LIBAIO_H */
107 long nr = tcp->u_arg[1];
108 /* if nr <= 0, we end up printing just "[]" */
109 tprintf("%lu, %ld, [", tcp->u_arg[0], tcp->u_arg[1]);
112 long iocbs = tcp->u_arg[2];
114 for (i = 0; i < nr; ++i, iocbs += current_wordsize) {
122 if (umove_long_or_printaddr(tcp, iocbs, &iocbp)) {
124 * No point in trying to read the whole array
125 * because nr can be ridiculously large.
131 if (umove_or_printaddr(tcp, iocbp, &iocb)) {
138 printaddr((long) iocb.data);
142 tprintf("key=%u, ", iocb.key);
143 sub = tprint_lio_opcode(iocb.aio_lio_opcode);
144 if (iocb.aio_reqprio)
145 tprintf(", reqprio=%d", iocb.aio_reqprio);
146 tprintf(", filedes=%d", iocb.aio_fildes);
149 #if HAVE_DECL_IO_CMD_PWRITE
150 if (iocb.aio_lio_opcode == IO_CMD_PWRITE) {
152 printstr(tcp, (unsigned long)iocb.u.c.buf,
158 printaddr((long) iocb.u.c.buf);
160 tprintf(", nbytes=%lu, offset=%lld",
163 print_common_flags(&iocb);
166 tprintf(", %lld", iocb.u.v.offset);
167 print_common_flags(&iocb);
169 tprint_iov(tcp, iocb.u.v.nr,
170 (unsigned long)iocb.u.v.vec,
171 #if HAVE_DECL_IO_CMD_PWRITEV
172 iocb.aio_lio_opcode == IO_CMD_PWRITEV
179 tprintf(", %x", iocb.u.poll.events);
189 # warning "libaio.h is not available => no io_submit decoding"
190 tprintf("%lu, %ld, %#lx", tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
196 print_io_event(struct tcb *tcp, const long addr)
199 struct io_event event;
201 if (umove_or_printaddr(tcp, addr, &event))
204 printaddr((long) event.data);
206 printaddr((long) event.obj);
207 tprintf(", res=%ld, res2=%ld}", event.res, event.res2);
209 printaddr(tcp->u_arg[2]);
217 tprintf("%lu, ", tcp->u_arg[0]);
221 if (!umove_or_printaddr(tcp, tcp->u_arg[1], &iocb)) {
222 tprintf("{%p, %u, %u, %u, %d}, ",
224 (unsigned)iocb.aio_lio_opcode,
225 (unsigned)iocb.aio_reqprio, iocb.aio_fildes);
228 printaddr(tcp->u_arg[1]);
231 print_io_event(tcp, tcp->u_arg[2]);
236 SYS_FUNC(io_getevents)
239 tprintf("%lu, %ld, %ld, ",
240 tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
242 if (tcp->u_rval == 0) {
246 struct io_event *events = (void *)tcp->u_arg[3];
247 long i, nr = tcp->u_rval;
249 for (i = 0; i < nr; i++, events++) {
255 if (print_io_event(tcp, (long)events))
260 printaddr(tcp->u_arg[3]);
264 print_timespec(tcp, tcp->u_arg[4]);