* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-2001 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
static int
compare(const void *a, const void *b)
{
- const unsigned int code1 = (const unsigned long) a;
+ const unsigned int code1 = (const uintptr_t) a;
const unsigned int code2 = ((struct_ioctlent *) b)->code;
return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
}
{
struct_ioctlent *iop;
- iop = bsearch((const void *) (const unsigned long) code, ioctlent,
+ iop = bsearch((const void *) (const uintptr_t) code, ioctlent,
nioctlents, sizeof(ioctlent[0]), compare);
while (iop > ioctlent) {
iop--;
{
tprints("_IOC(");
printflags(ioctl_dirs, _IOC_DIR(code), "_IOC_???");
- tprintf(", 0x%02x, 0x%02x, 0x%02x)",
+ tprintf(", %#x, %#x, %#x)",
_IOC_TYPE(code), _IOC_NR(code), _IOC_SIZE(code));
}
if (_IOC_DIR(code) == _IOC_WRITE) {
if (nr >= 0xc0 && nr <= 0xc0 + 0x3f) {
tprints("EVIOCSABS(");
- printxval(evdev_abs, nr - 0xc0, "EV_???");
+ printxval(evdev_abs, nr - 0xc0, "ABS_???");
tprints(")");
return 1;
}
ioctl_decode(struct tcb *tcp)
{
const unsigned int code = tcp->u_arg[1];
- const long arg = tcp->u_arg[2];
+ const kernel_ulong_t arg = tcp->u_arg[2];
switch (_IOC_TYPE(code)) {
#if defined(ALPHA) || defined(POWERPC)
- case 'f': case 't': case 'T':
+ case 'f': {
+ int ret = file_ioctl(tcp, code, arg);
+ if (ret != RVAL_DECODED)
+ return ret;
+ }
+ case 't':
+ case 'T':
+ return term_ioctl(tcp, code, arg);
#else /* !ALPHA */
+ case 'f':
+ return file_ioctl(tcp, code, arg);
case 0x54:
#endif /* !ALPHA */
return term_ioctl(tcp, code, arg);
case 'p':
return rtc_ioctl(tcp, code, arg);
case 0x03:
+ return hdio_ioctl(tcp, code, arg);
case 0x12:
- case 'X':
return block_ioctl(tcp, code, arg);
-#ifdef HAVE_SCSI_SG_H
+ case 'X':
+ return fs_x_ioctl(tcp, code, arg);
case 0x22:
return scsi_ioctl(tcp, code, arg);
-#endif
case 'L':
return loop_ioctl(tcp, code, arg);
case 'M':
#ifdef HAVE_LINUX_BTRFS_H
case 0x94:
return btrfs_ioctl(tcp, code, arg);
+#endif
+ case 0xb7:
+ return nsfs_ioctl(tcp, code, arg);
+#ifdef HAVE_LINUX_DM_IOCTL_H
+ case 0xfd:
+ return dm_ioctl(tcp, code, arg);
#endif
default:
break;
if (ret)
--ret;
else
- tprintf(", %#lx", tcp->u_arg[2]);
+ tprintf(", %#" PRI_klx, tcp->u_arg[2]);
ret |= RVAL_DECODED;
} else {
if (ret)