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)
84 #if defined(LINUX) && SUPPORTED_PERSONALITIES > 1
86 struct { u_int32_t base; u_int32_t len; } iov32;
87 struct { u_int64_t base; u_int64_t len; } iov64;
90 (personality_wordsize[current_personality] == 4 \
91 ? sizeof(iov.iov32) : sizeof(iov.iov64))
92 #define iov_iov_base \
93 (personality_wordsize[current_personality] == 4 \
94 ? (u_int64_t) iov.iov32.base : iov.iov64.base)
96 (personality_wordsize[current_personality] == 4 \
97 ? (u_int64_t) iov.iov32.len : iov.iov64.len)
100 #define sizeof_iov sizeof(iov)
101 #define iov_iov_base iov.iov_base
102 #define iov_iov_len iov.iov_len
104 unsigned long size, cur, end, abbrev_end;
111 size = len * sizeof_iov;
113 if (!verbose(tcp) || size / sizeof_iov != len || end < addr) {
114 tprintf("%#lx", addr);
118 abbrev_end = addr + max_strlen * sizeof_iov;
119 if (abbrev_end < addr)
125 for (cur = addr; cur < end; cur += sizeof_iov) {
128 if (cur >= abbrev_end) {
132 if (umoven(tcp, cur, sizeof_iov, (char *) &iov) < 0) {
138 printstr(tcp, (long) iov_iov_base, iov_iov_len);
139 tprintf(", %lu}", (unsigned long)iov_iov_len);
143 tprintf(" %#lx", addr);
154 tprintf("%ld, ", tcp->u_arg[0]);
158 tcp->u_arg[1], tcp->u_arg[2]);
161 tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
162 tprintf(", %lu", tcp->u_arg[2]);
172 tprintf("%ld, ", tcp->u_arg[0]);
173 tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
174 tprintf(", %lu", tcp->u_arg[2]);
187 tprintf("%ld, ", tcp->u_arg[0]);
190 tprintf("%#lx", tcp->u_arg[1]);
192 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
194 /* off_t is signed int */
195 tprintf(", %lu, %ld", tcp->u_arg[2], tcp->u_arg[3]);
197 tprintf(", %lu, %llu", tcp->u_arg[2],
198 LONG_LONG(tcp->u_arg[3], tcp->u_arg[4]));
209 tprintf("%ld, ", tcp->u_arg[0]);
210 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
212 /* off_t is signed int */
213 tprintf(", %lu, %ld", tcp->u_arg[2], tcp->u_arg[3]);
215 tprintf(", %lu, %llu", tcp->u_arg[2],
216 LONG_LONG(tcp->u_arg[3], tcp->u_arg[4]));
224 #include <sys/types.h>
225 #include <sys/socket.h>
232 tprintf("%ld, %ld, %llu, %lu", tcp->u_arg[0], tcp->u_arg[1],
233 LONG_LONG(tcp->u_arg[2], tcp->u_arg[3]),
243 if (umove(tcp, tcp->u_arg[5], &hdtr) < 0)
244 tprintf(", %#lx", tcp->u_arg[5]);
247 tprint_iov(tcp, hdtr.hdr_cnt, hdtr.headers);
248 tprintf(", %u, ", hdtr.hdr_cnt);
249 tprint_iov(tcp, hdtr.trl_cnt, hdtr.trailers);
250 tprintf(", %u }", hdtr.hdr_cnt);
255 else if (umove(tcp, tcp->u_arg[6], &offset) < 0)
256 tprintf(", %#lx", tcp->u_arg[6]);
258 tprintf(", [%llu]", offset);
259 tprintf(", %lu", tcp->u_arg[7]);
267 /* The SH4 ABI does allow long longs in odd-numbered registers, but
268 does not allow them to be split between registers and memory - and
269 there are only four argument registers for normal functions. As a
270 result pread takes an extra padding argument before the offset. This
271 was changed late in the 2.4 series (around 2.4.20). */
273 #define PREAD_OFFSET_ARG 4
275 #define PREAD_OFFSET_ARG 3
283 tprintf("%ld, ", tcp->u_arg[0]);
286 tprintf("%#lx", tcp->u_arg[1]);
288 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
289 tprintf(", %lu, ", tcp->u_arg[2]);
290 printllval(tcp, "%llu", PREAD_OFFSET_ARG);
300 tprintf("%ld, ", tcp->u_arg[0]);
301 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
302 tprintf(", %lu, ", tcp->u_arg[2]);
303 printllval(tcp, "%llu", PREAD_OFFSET_ARG);
315 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
318 else if (umove(tcp, tcp->u_arg[2], &offset) < 0)
319 tprintf("%#lx", tcp->u_arg[2]);
321 tprintf("[%lu]", offset);
322 tprintf(", %lu", tcp->u_arg[3]);
334 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
337 else if (umove(tcp, tcp->u_arg[2], &offset) < 0)
338 tprintf("%#lx", tcp->u_arg[2]);
340 tprintf("[%llu]", (unsigned long long int) offset);
341 tprintf(", %lu", tcp->u_arg[3]);
348 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
354 tprintf("%ld, ", tcp->u_arg[0]);
357 tprintf("%#lx", tcp->u_arg[1]);
359 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
360 tprintf(", %lu, ", tcp->u_arg[2]);
361 printllval(tcp, "%#llx", 3);
371 tprintf("%ld, ", tcp->u_arg[0]);
372 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
373 tprintf(", %lu, ", tcp->u_arg[2]);
374 printllval(tcp, "%#llx", 3);
384 const struct ioctlent *iop;
387 tprintf("%ld, ", tcp->u_arg[0]);
388 iop = ioctl_lookup(tcp->u_arg[1]);
390 tprintf("%s", iop->symbol);
391 while ((iop = ioctl_next_match(iop)))
392 tprintf(" or %s", iop->symbol);
394 tprintf("%#lx", tcp->u_arg[1]);
395 ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2]);
399 if (!(ret = ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2])))
400 tprintf(", %#lx", tcp->u_arg[2]);