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.
40 #ifdef HAVE_LONG_LONG_OFF_T
42 * Hacks for systems that have a long long off_t
45 #define sys_pread64 sys_pread
46 #define sys_pwrite64 sys_pwrite
54 tprintf("%ld, ", tcp->u_arg[0]);
57 tprintf("%#lx", tcp->u_arg[1]);
59 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
60 tprintf(", %lu", tcp->u_arg[2]);
70 tprintf("%ld, ", tcp->u_arg[0]);
71 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
72 tprintf(", %lu", tcp->u_arg[2]);
79 tprint_iov(tcp, len, addr)
85 unsigned long size, cur, end, abbrev_end;
92 size = len * sizeof(iov);
94 if (!verbose(tcp) || size / sizeof(iov) != len || end < addr) {
95 tprintf("%#lx", addr);
99 abbrev_end = addr + max_strlen * sizeof(iov);
100 if (abbrev_end < addr)
106 for (cur = addr; cur < end; cur += sizeof(iov)) {
109 if (cur >= abbrev_end) {
113 if (umoven(tcp, cur, sizeof iov, (char *) &iov) < 0) {
119 printstr(tcp, (long) iov.iov_base, iov.iov_len);
120 tprintf(", %lu}", (unsigned long)iov.iov_len);
124 tprintf(" %#lx", addr);
132 tprintf("%ld, ", tcp->u_arg[0]);
136 tcp->u_arg[1], tcp->u_arg[2]);
139 tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
140 tprintf(", %lu", tcp->u_arg[2]);
150 tprintf("%ld, ", tcp->u_arg[0]);
151 tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
152 tprintf(", %lu", tcp->u_arg[2]);
165 tprintf("%ld, ", tcp->u_arg[0]);
168 tprintf("%#lx", tcp->u_arg[1]);
170 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
172 /* off_t is signed int */
173 tprintf(", %lu, %ld", tcp->u_arg[2], tcp->u_arg[3]);
175 tprintf(", %lu, %llu", tcp->u_arg[2],
176 LONG_LONG(tcp->u_arg[3], tcp->u_arg[4]));
187 tprintf("%ld, ", tcp->u_arg[0]);
188 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
190 /* off_t is signed int */
191 tprintf(", %lu, %ld", tcp->u_arg[2], tcp->u_arg[3]);
193 tprintf(", %lu, %llu", tcp->u_arg[2],
194 LONG_LONG(tcp->u_arg[3], tcp->u_arg[4]));
202 #include <sys/types.h>
203 #include <sys/socket.h>
210 tprintf("%ld, %ld, %llu, %lu", tcp->u_arg[0], tcp->u_arg[1],
211 LONG_LONG(tcp->u_arg[2], tcp->u_arg[3]),
221 if (umove(tcp, tcp->u_arg[5], &hdtr) < 0)
222 tprintf(", %#lx", tcp->u_arg[5]);
225 tprint_iov(tcp, hdtr.hdr_cnt, hdtr.headers);
226 tprintf(", %u, ", hdtr.hdr_cnt);
227 tprint_iov(tcp, hdtr.trl_cnt, hdtr.trailers);
228 tprintf(", %u }", hdtr.hdr_cnt);
233 else if (umove(tcp, tcp->u_arg[6], &offset) < 0)
234 tprintf(", %#lx", tcp->u_arg[6]);
236 tprintf(", [%llu]", offset);
237 tprintf(", %lu", tcp->u_arg[7]);
245 /* The SH4 ABI does allow long longs in odd-numbered registers, but
246 does not allow them to be split between registers and memory - and
247 there are only four argument registers for normal functions. As a
248 result pread takes an extra padding argument before the offset. This
249 was changed late in the 2.4 series (around 2.4.20). */
251 #define PREAD_OFFSET_ARG 4
253 #define PREAD_OFFSET_ARG 3
261 tprintf("%ld, ", tcp->u_arg[0]);
264 tprintf("%#lx", tcp->u_arg[1]);
266 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
267 ALIGN64 (tcp, PREAD_OFFSET_ARG); /* PowerPC alignment restriction */
268 tprintf(", %lu, %llu", tcp->u_arg[2],
269 *(unsigned long long *)&tcp->u_arg[PREAD_OFFSET_ARG]);
279 tprintf("%ld, ", tcp->u_arg[0]);
280 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
281 ALIGN64 (tcp, PREAD_OFFSET_ARG); /* PowerPC alignment restriction */
282 tprintf(", %lu, %llu", tcp->u_arg[2],
283 *(unsigned long long *)&tcp->u_arg[PREAD_OFFSET_ARG]);
295 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
298 else if (umove(tcp, tcp->u_arg[2], &offset) < 0)
299 tprintf("%#lx", tcp->u_arg[2]);
301 tprintf("[%lu]", offset);
302 tprintf(", %lu", tcp->u_arg[3]);
314 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
317 else if (umove(tcp, tcp->u_arg[2], &offset) < 0)
318 tprintf("%#lx", tcp->u_arg[2]);
320 tprintf("[%llu]", (unsigned long long int) offset);
321 tprintf(", %lu", tcp->u_arg[3]);
328 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
334 tprintf("%ld, ", tcp->u_arg[0]);
338 tprintf("%#lx", tcp->u_arg[1]);
340 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
341 tprintf(", %lu, %#llx", tcp->u_arg[2],
342 LONG_LONG(tcp->u_arg[3], tcp->u_arg[4]));
353 tprintf("%ld, ", tcp->u_arg[0]);
354 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
355 tprintf(", %lu, %#llx", tcp->u_arg[2],
356 LONG_LONG(tcp->u_arg[3], tcp->u_arg[4]));
366 const struct ioctlent *iop;
369 tprintf("%ld, ", tcp->u_arg[0]);
370 iop = ioctl_lookup(tcp->u_arg[1]);
372 tprintf("%s", iop->symbol);
373 while ((iop = ioctl_next_match(iop)))
374 tprintf(" or %s", iop->symbol);
376 tprintf("%#lx", tcp->u_arg[1]);
377 ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2]);
381 if (!(ret = ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2])))
382 tprintf(", %#lx", tcp->u_arg[2]);