For some ioctls, like from drm, the identification of the correct ioctl
is done with custom code. Specifying IOCTL_NUMBER_STOP_LOOKUP on
return of ioctl_decode_command_number() disable further calls to
ioctl_lookup()

* defs.h: add macros IOCTL_NUMBER_* to represent ioctl number state decoding
* ioctl.c (SYS_FUNC(ioctl)): use IOCTL_NUMBER_* to stop the decoding

Signed-off-by: Gabriel Laskar <gabr...@lse.epita.fr>
Suggested-by: Patrik Jakobsson <patrik.r.jakobs...@gmail.com>
---
 defs.h  |  4 ++++
 ioctl.c | 20 +++++++++++---------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/defs.h b/defs.h
index 5086e1d..d0bef94 100644
--- a/defs.h
+++ b/defs.h
@@ -450,6 +450,10 @@ extern const struct xlat whence_codes[];
 #define STACKTRACE_CAPTURE_ON_ENTER 01000 /* Capture stacktrace on "entering" 
stage */
 #define TRACE_INDIRECT_SUBCALL 02000   /* Syscall is an indirect socket/ipc 
subcall. */
 
+#define IOCTL_NUMBER_UNKNOWN 0
+#define IOCTL_NUMBER_HANDLED 1
+#define IOCTL_NUMBER_STOP_LOOKUP 010
+
 #define indirect_ipccall(tcp) (tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL)
 
 #if defined(ARM) || defined(AARCH64) \
diff --git a/ioctl.c b/ioctl.c
index adce986..f70dc44 100644
--- a/ioctl.c
+++ b/ioctl.c
@@ -278,15 +278,17 @@ SYS_FUNC(ioctl)
                printfd(tcp, tcp->u_arg[0]);
                tprints(", ");
                ret = ioctl_decode_command_number(tcp);
-               iop = ioctl_lookup(tcp->u_arg[1]);
-               if (iop) {
-                       if (ret)
-                               tprints(" or ");
-                       tprints(iop->symbol);
-                       while ((iop = ioctl_next_match(iop)))
-                               tprintf(" or %s", iop->symbol);
-               } else if (!ret) {
-                       ioctl_print_code(tcp->u_arg[1]);
+               if (!(ret & IOCTL_NUMBER_STOP_LOOKUP)) {
+                       iop = ioctl_lookup(tcp->u_arg[1]);
+                       if (iop) {
+                               if (ret)
+                                       tprints(" or ");
+                               tprints(iop->symbol);
+                               while ((iop = ioctl_next_match(iop)))
+                                       tprintf(" or %s", iop->symbol);
+                       } else if (!ret) {
+                               ioctl_print_code(tcp->u_arg[1]);
+                       }
                }
                ret = ioctl_decode(tcp);
        } else {
-- 
2.6.3


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to