Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 1 | /* |
| 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> |
Elliott Hughes | 03a418e | 2018-06-15 13:11:40 -0700 | [diff] [blame] | 6 | * Copyright (c) 1999-2018 The strace developers. |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 7 | * All rights reserved. |
| 8 | * |
| 9 | * Redistribution and use in source and binary forms, with or without |
| 10 | * modification, are permitted provided that the following conditions |
| 11 | * are met: |
| 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer in the |
| 16 | * documentation and/or other materials provided with the distribution. |
| 17 | * 3. The name of the author may not be used to endorse or promote products |
| 18 | * derived from this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 23 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #include "defs.h" |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 33 | #include "print_fields.h" |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 34 | #include <linux/aio_abi.h> |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 35 | |
Elliott Hughes | c187376 | 2018-12-19 15:13:36 -0800 | [diff] [blame] | 36 | #include "xlat/aio_cmds.h" |
| 37 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 38 | SYS_FUNC(io_setup) |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 39 | { |
| 40 | if (entering(tcp)) |
Elvira Khabirova | afac9f0 | 2015-08-18 18:02:20 +0300 | [diff] [blame] | 41 | tprintf("%u, ", (unsigned int) tcp->u_arg[0]); |
Dmitry V. Levin | 07eaf50 | 2015-07-20 18:40:46 +0000 | [diff] [blame] | 42 | else |
Dmitry V. Levin | ed292f6 | 2016-09-07 11:22:51 +0000 | [diff] [blame] | 43 | printnum_ptr(tcp, tcp->u_arg[1]); |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 44 | return 0; |
| 45 | } |
| 46 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 47 | SYS_FUNC(io_destroy) |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 48 | { |
Dmitry V. Levin | ed292f6 | 2016-09-07 11:22:51 +0000 | [diff] [blame] | 49 | printaddr(tcp->u_arg[0]); |
Dmitry V. Levin | 07eaf50 | 2015-07-20 18:40:46 +0000 | [diff] [blame] | 50 | |
| 51 | return RVAL_DECODED; |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 52 | } |
| 53 | |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 54 | enum iocb_sub { |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 55 | SUB_NONE, SUB_COMMON, SUB_VECTOR |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | static enum iocb_sub |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 59 | tprint_lio_opcode(unsigned int cmd) |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 60 | { |
Elliott Hughes | c187376 | 2018-12-19 15:13:36 -0800 | [diff] [blame] | 61 | static const enum iocb_sub subs[] = { |
| 62 | [IOCB_CMD_PREAD] = SUB_COMMON, |
| 63 | [IOCB_CMD_PWRITE] = SUB_COMMON, |
| 64 | [IOCB_CMD_FSYNC] = SUB_NONE, |
| 65 | [IOCB_CMD_FDSYNC] = SUB_NONE, |
| 66 | [IOCB_CMD_PREADX] = SUB_NONE, |
| 67 | [IOCB_CMD_POLL] = SUB_NONE, |
| 68 | [IOCB_CMD_NOOP] = SUB_NONE, |
| 69 | [IOCB_CMD_PREADV] = SUB_VECTOR, |
| 70 | [IOCB_CMD_PWRITEV] = SUB_VECTOR, |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 71 | }; |
| 72 | |
Elliott Hughes | c187376 | 2018-12-19 15:13:36 -0800 | [diff] [blame] | 73 | printxval_indexn_ex(ARRSZ_PAIR(aio_cmds), cmd, "IOCB_CMD_???", |
| 74 | XLAT_STYLE_FMT_U); |
| 75 | |
| 76 | return cmd < ARRAY_SIZE(subs) ? subs[cmd] : SUB_NONE; |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | static void |
Eugene Syromyatnikov | 2b962b2 | 2016-09-05 04:32:16 +0300 | [diff] [blame] | 80 | print_common_flags(struct tcb *tcp, const struct iocb *cb) |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 81 | { |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 82 | /* IOCB_FLAG_RESFD is available since v2.6.22-rc1~47 */ |
| 83 | #ifdef IOCB_FLAG_RESFD |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 84 | if (cb->aio_flags & IOCB_FLAG_RESFD) |
| 85 | PRINT_FIELD_FD(", ", *cb, aio_resfd, tcp); |
| 86 | |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 87 | if (cb->aio_flags & ~IOCB_FLAG_RESFD) |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 88 | PRINT_FIELD_X(", ", *cb, aio_flags); |
Dmitry V. Levin | b7dd5e6 | 2014-09-08 15:20:10 +0000 | [diff] [blame] | 89 | #endif |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 90 | } |
| 91 | |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 92 | static bool |
| 93 | iocb_is_valid(const struct iocb *cb) |
| 94 | { |
| 95 | return cb->aio_buf == (unsigned long) cb->aio_buf && |
| 96 | cb->aio_nbytes == (size_t) cb->aio_nbytes && |
| 97 | (ssize_t) cb->aio_nbytes >= 0; |
| 98 | } |
| 99 | |
| 100 | static enum iocb_sub |
Eugene Syromyatnikov | 2b962b2 | 2016-09-05 04:32:16 +0300 | [diff] [blame] | 101 | print_iocb_header(struct tcb *tcp, const struct iocb *cb) |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 102 | { |
| 103 | enum iocb_sub sub; |
| 104 | |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 105 | if (cb->aio_data){ |
| 106 | PRINT_FIELD_X("", *cb, aio_data); |
| 107 | tprints(", "); |
| 108 | } |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 109 | |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 110 | if (cb->aio_key) { |
| 111 | PRINT_FIELD_U("", *cb, aio_key); |
| 112 | tprints(", "); |
| 113 | } |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 114 | |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 115 | tprints("aio_lio_opcode="); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 116 | sub = tprint_lio_opcode(cb->aio_lio_opcode); |
| 117 | if (cb->aio_reqprio) |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 118 | PRINT_FIELD_D(", ", *cb, aio_reqprio); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 119 | |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 120 | PRINT_FIELD_FD(", ", *cb, aio_fildes, tcp); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 121 | |
| 122 | return sub; |
| 123 | } |
| 124 | |
| 125 | static void |
| 126 | print_iocb(struct tcb *tcp, const struct iocb *cb) |
| 127 | { |
Elliott Hughes | c187376 | 2018-12-19 15:13:36 -0800 | [diff] [blame] | 128 | tprints("{"); |
| 129 | |
Eugene Syromyatnikov | 2b962b2 | 2016-09-05 04:32:16 +0300 | [diff] [blame] | 130 | enum iocb_sub sub = print_iocb_header(tcp, cb); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 131 | |
| 132 | switch (sub) { |
| 133 | case SUB_COMMON: |
| 134 | if (cb->aio_lio_opcode == 1 && iocb_is_valid(cb)) { |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 135 | PRINT_FIELD_STRN(", ", *cb, aio_buf, |
| 136 | cb->aio_nbytes, tcp); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 137 | } else { |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 138 | PRINT_FIELD_X(", ", *cb, aio_buf); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 139 | } |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 140 | PRINT_FIELD_U(", ", *cb, aio_nbytes); |
| 141 | PRINT_FIELD_D(", ", *cb, aio_offset); |
Eugene Syromyatnikov | 2b962b2 | 2016-09-05 04:32:16 +0300 | [diff] [blame] | 142 | print_common_flags(tcp, cb); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 143 | break; |
| 144 | case SUB_VECTOR: |
| 145 | if (iocb_is_valid(cb)) { |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 146 | tprints(", aio_buf="); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 147 | tprint_iov(tcp, cb->aio_nbytes, cb->aio_buf, |
Fabien Siron | 2a54d8b | 2016-06-22 13:27:03 +0000 | [diff] [blame] | 148 | cb->aio_lio_opcode == 8 |
| 149 | ? IOV_DECODE_STR |
| 150 | : IOV_DECODE_ADDR); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 151 | } else { |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 152 | PRINT_FIELD_X(", ", *cb, aio_buf); |
| 153 | PRINT_FIELD_U(", ", *cb, aio_nbytes); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 154 | } |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 155 | PRINT_FIELD_D(", ", *cb, aio_offset); |
Eugene Syromyatnikov | 2b962b2 | 2016-09-05 04:32:16 +0300 | [diff] [blame] | 156 | print_common_flags(tcp, cb); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 157 | break; |
| 158 | case SUB_NONE: |
| 159 | break; |
| 160 | } |
Elliott Hughes | c187376 | 2018-12-19 15:13:36 -0800 | [diff] [blame] | 161 | |
| 162 | tprints("}"); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 163 | } |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 164 | |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 165 | static bool |
| 166 | print_iocbp(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) |
| 167 | { |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 168 | kernel_ulong_t addr; |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 169 | struct iocb cb; |
| 170 | |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 171 | if (elem_size < sizeof(kernel_ulong_t)) { |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 172 | addr = *(unsigned int *) elem_buf; |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 173 | } else { |
Elliott Hughes | dc75b01 | 2017-07-05 13:54:44 -0700 | [diff] [blame] | 174 | addr = *(kernel_ulong_t *) elem_buf; |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 175 | } |
| 176 | |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 177 | if (!umove_or_printaddr(tcp, addr, &cb)) |
| 178 | print_iocb(tcp, &cb); |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 179 | |
| 180 | return true; |
| 181 | } |
| 182 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 183 | SYS_FUNC(io_submit) |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 184 | { |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 185 | const kernel_long_t nr = |
| 186 | truncate_klong_to_current_wordsize(tcp->u_arg[1]); |
| 187 | const kernel_ulong_t addr = tcp->u_arg[2]; |
| 188 | kernel_ulong_t iocbp; |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 189 | |
Dmitry V. Levin | ed292f6 | 2016-09-07 11:22:51 +0000 | [diff] [blame] | 190 | printaddr(tcp->u_arg[0]); |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 191 | tprintf(", %" PRI_kld ", ", nr); |
Dmitry V. Levin | 13c2173 | 2015-08-26 12:49:07 +0000 | [diff] [blame] | 192 | |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 193 | if (nr < 0) |
| 194 | printaddr(addr); |
| 195 | else |
| 196 | print_array(tcp, addr, nr, &iocbp, current_wordsize, |
Elliott Hughes | 03a418e | 2018-06-15 13:11:40 -0700 | [diff] [blame] | 197 | tfetch_mem, print_iocbp, 0); |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 198 | |
Dmitry V. Levin | 07eaf50 | 2015-07-20 18:40:46 +0000 | [diff] [blame] | 199 | return RVAL_DECODED; |
| 200 | } |
| 201 | |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 202 | static bool |
| 203 | print_io_event(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) |
Dmitry V. Levin | 07eaf50 | 2015-07-20 18:40:46 +0000 | [diff] [blame] | 204 | { |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 205 | struct io_event *event = elem_buf; |
Dmitry V. Levin | 07eaf50 | 2015-07-20 18:40:46 +0000 | [diff] [blame] | 206 | |
Elliott Hughes | 77c3ff8 | 2017-09-08 17:11:00 -0700 | [diff] [blame] | 207 | PRINT_FIELD_X("{", *event, data); |
| 208 | PRINT_FIELD_X(", ", *event, obj); |
| 209 | PRINT_FIELD_D(", ", *event, res); |
| 210 | PRINT_FIELD_D(", ", *event, res2); |
| 211 | tprints("}"); |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 212 | |
| 213 | return true; |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 214 | } |
| 215 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 216 | SYS_FUNC(io_cancel) |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 217 | { |
| 218 | if (entering(tcp)) { |
Dmitry V. Levin | ed292f6 | 2016-09-07 11:22:51 +0000 | [diff] [blame] | 219 | printaddr(tcp->u_arg[0]); |
| 220 | tprints(", "); |
| 221 | |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 222 | struct iocb cb; |
Dmitry V. Levin | 07eaf50 | 2015-07-20 18:40:46 +0000 | [diff] [blame] | 223 | |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 224 | if (!umove_or_printaddr(tcp, tcp->u_arg[1], &cb)) { |
| 225 | tprints("{"); |
Eugene Syromyatnikov | 2b962b2 | 2016-09-05 04:32:16 +0300 | [diff] [blame] | 226 | print_iocb_header(tcp, &cb); |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 227 | tprints("}"); |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 228 | } |
Dmitry V. Levin | f56046e | 2015-08-26 17:48:40 +0000 | [diff] [blame] | 229 | tprints(", "); |
Dmitry V. Levin | 07eaf50 | 2015-07-20 18:40:46 +0000 | [diff] [blame] | 230 | } else { |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 231 | struct io_event event; |
| 232 | |
| 233 | if (!umove_or_printaddr(tcp, tcp->u_arg[2], &event)) |
| 234 | print_io_event(tcp, &event, sizeof(event), 0); |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 235 | } |
| 236 | return 0; |
| 237 | } |
| 238 | |
Elliott Hughes | 03a418e | 2018-06-15 13:11:40 -0700 | [diff] [blame] | 239 | static int |
| 240 | print_io_getevents(struct tcb *tcp, bool has_usig) |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 241 | { |
| 242 | if (entering(tcp)) { |
Dmitry V. Levin | ed292f6 | 2016-09-07 11:22:51 +0000 | [diff] [blame] | 243 | printaddr(tcp->u_arg[0]); |
Elliott Hughes | d35df49 | 2017-02-15 15:19:05 -0800 | [diff] [blame] | 244 | tprintf(", %" PRI_kld ", %" PRI_kld ", ", |
| 245 | truncate_klong_to_current_wordsize(tcp->u_arg[1]), |
| 246 | truncate_klong_to_current_wordsize(tcp->u_arg[2])); |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 247 | } else { |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 248 | struct io_event buf; |
| 249 | print_array(tcp, tcp->u_arg[3], tcp->u_rval, &buf, sizeof(buf), |
Elliott Hughes | 03a418e | 2018-06-15 13:11:40 -0700 | [diff] [blame] | 250 | tfetch_mem, print_io_event, 0); |
Dmitry V. Levin | 2868e2b | 2016-05-07 22:40:06 +0000 | [diff] [blame] | 251 | tprints(", "); |
Dmitry V. Levin | 3858b93 | 2015-09-18 01:54:59 +0000 | [diff] [blame] | 252 | /* |
Elliott Hughes | 03a418e | 2018-06-15 13:11:40 -0700 | [diff] [blame] | 253 | * Since the timeout and usig parameters are read by the kernel |
Dmitry V. Levin | 3858b93 | 2015-09-18 01:54:59 +0000 | [diff] [blame] | 254 | * on entering syscall, it has to be decoded the same way |
| 255 | * whether the syscall has failed or not. |
| 256 | */ |
| 257 | temporarily_clear_syserror(tcp); |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 258 | print_timespec(tcp, tcp->u_arg[4]); |
Elliott Hughes | 03a418e | 2018-06-15 13:11:40 -0700 | [diff] [blame] | 259 | if (has_usig) { |
| 260 | tprints(", "); |
| 261 | print_aio_sigset(tcp, tcp->u_arg[5]); |
| 262 | } |
Dmitry V. Levin | 3858b93 | 2015-09-18 01:54:59 +0000 | [diff] [blame] | 263 | restore_cleared_syserror(tcp); |
Dmitry V. Levin | 2b64034 | 2013-11-11 15:06:18 +0000 | [diff] [blame] | 264 | } |
| 265 | return 0; |
| 266 | } |
Elliott Hughes | 03a418e | 2018-06-15 13:11:40 -0700 | [diff] [blame] | 267 | |
| 268 | SYS_FUNC(io_getevents) |
| 269 | { |
| 270 | return print_io_getevents(tcp, false); |
| 271 | } |
| 272 | |
| 273 | SYS_FUNC(io_pgetevents) |
| 274 | { |
| 275 | return print_io_getevents(tcp, true); |
| 276 | } |