From: Dmitry V. Levin Date: Sun, 23 Sep 2018 09:54:55 +0000 (+0000) Subject: xlat: print _IOC_NONE in symbolic form even if it is equal to 0 X-Git-Tag: v4.25~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e78becf8b93d7cc7649864a1344ed1db0b86e50e;p=strace xlat: print _IOC_NONE in symbolic form even if it is equal to 0 On some architectures _IOC_NONE equals to 1, on others it is 0. Change the way how ioctl direction flags are printed so that _IOC_NONE is printed in symbolic form even if it is equal to 0. * xlat/ioctl_dirs.in (_IOC_NONE): Move to the head of the list. * tests/ioctl_inotify.c (main): Update expected output. * tests/ioctl_loop. (main): Likewise.c * tests/ioctl_perf.c (main): Likewise. * tests/ioctl_scsi.c (main): Likewise. --- diff --git a/tests/ioctl_inotify.c b/tests/ioctl_inotify.c index 0650c624..27e0a868 100644 --- a/tests/ioctl_inotify.c +++ b/tests/ioctl_inotify.c @@ -56,10 +56,10 @@ main(void) /* Unknown inotify commands */ sys_ioctl(-1, unknown_inotify_cmd, magic); - printf("ioctl(-1, _IOC(_IOC_READ|_IOC_WRITE%s, 0x49, %#x, %#x), " + printf("ioctl(-1, _IOC(%s_IOC_READ|_IOC_WRITE, 0x49, %#x, %#x), " "%#lx) = -1 EBADF (%m)\n", _IOC_DIR((unsigned int) unknown_inotify_cmd) & _IOC_NONE ? - "|_IOC_NONE" : "", + "_IOC_NONE|" : "", _IOC_NR((unsigned int) unknown_inotify_cmd), _IOC_SIZE((unsigned int) unknown_inotify_cmd), (unsigned long) magic); diff --git a/tests/ioctl_loop.c b/tests/ioctl_loop.c index 10b7dc34..06c99ae4 100644 --- a/tests/ioctl_loop.c +++ b/tests/ioctl_loop.c @@ -187,24 +187,26 @@ main(void) /* Unknown loop commands */ sys_ioctl(-1, unknown_loop_cmd, magic); - printf("ioctl(-1, _IOC(_IOC_READ|_IOC_WRITE%s, 0x4c, %#x, %#x), " + printf("ioctl(-1, _IOC(%s_IOC_READ|_IOC_WRITE, 0x4c, %#x, %#x), " "%#lx) = -1 EBADF (%m)\n", _IOC_DIR((unsigned int) unknown_loop_cmd) & _IOC_NONE ? - "|_IOC_NONE" : "", + "_IOC_NONE|" : "", _IOC_NR((unsigned int) unknown_loop_cmd), _IOC_SIZE((unsigned int) unknown_loop_cmd), (unsigned long) magic); sys_ioctl(-1, LOOP_SET_BLOCK_SIZE + 1, magic); - printf("ioctl(-1, _IOC(0, 0x4c, %#x, %#x), %#lx) = " + printf("ioctl(-1, _IOC(%s, 0x4c, %#x, %#x), %#lx) = " "-1 EBADF (%m)\n", + _IOC_NONE ? "0" : "_IOC_NONE", _IOC_NR(LOOP_SET_BLOCK_SIZE + 1), _IOC_SIZE(LOOP_SET_BLOCK_SIZE + 1), (unsigned long) magic); sys_ioctl(-1, LOOP_CTL_GET_FREE + 1, magic); - printf("ioctl(-1, _IOC(0, 0x4c, %#x, %#x), %#lx) = " + printf("ioctl(-1, _IOC(%s, 0x4c, %#x, %#x), %#lx) = " "-1 EBADF (%m)\n", + _IOC_NONE ? "0" : "_IOC_NONE", _IOC_NR(LOOP_CTL_GET_FREE + 1), _IOC_SIZE(LOOP_CTL_GET_FREE + 1), (unsigned long) magic); diff --git a/tests/ioctl_perf.c b/tests/ioctl_perf.c index 7db01dbc..18f59faf 100644 --- a/tests/ioctl_perf.c +++ b/tests/ioctl_perf.c @@ -91,10 +91,10 @@ main(void) /* Unknown perf commands */ sys_ioctl(-1, unknown_perf_cmd, magic); - printf("ioctl(-1, _IOC(_IOC_READ|_IOC_WRITE%s, 0x24, %#x, %#x), " + printf("ioctl(-1, _IOC(%s_IOC_READ|_IOC_WRITE, 0x24, %#x, %#x), " "%#lx) = -1 EBADF (%m)\n", _IOC_DIR((unsigned int) unknown_perf_cmd) & _IOC_NONE ? - "|_IOC_NONE" : "", + "_IOC_NONE|" : "", _IOC_NR((unsigned int) unknown_perf_cmd), _IOC_SIZE((unsigned int) unknown_perf_cmd), (unsigned long) magic); diff --git a/tests/ioctl_scsi.c b/tests/ioctl_scsi.c index a9ecf288..b15c54d9 100644 --- a/tests/ioctl_scsi.c +++ b/tests/ioctl_scsi.c @@ -137,13 +137,14 @@ main(void) "SG_SCSI_RESET"); ioctl(-1, 0x22ff, 0); - printf("ioctl(-1, _IOC(0, 0x22, 0xff, 0), 0) = -1 EBADF (%m)\n"); + printf("ioctl(-1, _IOC(%s, 0x22, 0xff, 0), 0) = -1 EBADF (%m)\n", + _IOC_NONE ? "0" : "_IOC_NONE"); static const unsigned long magic = (unsigned long) 0xdeadbeeffacefeedULL; ioctl(-1, 0x22ff, magic); - printf("ioctl(-1, _IOC(0, 0x22, 0xff, 0), %#lx) = -1 EBADF (%m)\n", - magic); + printf("ioctl(-1, _IOC(%s, 0x22, 0xff, 0), %#lx) = -1 EBADF (%m)\n", + _IOC_NONE ? "0" : "_IOC_NONE", magic); puts("+++ exited with 0 +++"); return 0; diff --git a/xlat/ioctl_dirs.in b/xlat/ioctl_dirs.in index 4c97a869..c069dd73 100644 --- a/xlat/ioctl_dirs.in +++ b/xlat/ioctl_dirs.in @@ -1,3 +1,3 @@ +_IOC_NONE _IOC_READ _IOC_WRITE -_IOC_NONE