summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasatake YAMATO <yamato@redhat.com>2023-02-12 15:34:49 +0900
committerDmitry V. Levin <ldv@strace.io>2023-02-20 08:00:00 +0000
commit765bee80024a6a33ca7724884ab0aaad8e2ddc06 (patch)
tree82d6cc73d471a18d87ef4f747c722048d5e15b0e
parent6a0c56322626a33b368795e66a8bd8e70fe05e5a (diff)
downloadstrace-765bee80024a6a33ca7724884ab0aaad8e2ddc06.tar.gz
ioctl: pass finfo to ioctl_decode() as hints for decoding
Just pass the data, a real use case comes in subsequent commits. * src/ioctl.c (ioctl_decode): Add "finfo" argument. (SYS_FUNC(ioctl)): Pass the finfo for the target fd to ioctl_decode. Signed-off-by: Masatake YAMATO <yamato@redhat.com> Signed-off-by: Dmitry V. Levin <ldv@strace.io>
-rw-r--r--src/ioctl.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ioctl.c b/src/ioctl.c
index 20e1f3230..0d3cbe69f 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -321,6 +321,11 @@ f_ioctl(struct tcb *tcp, const unsigned int code, const kernel_ulong_t arg)
/**
* Decode arg parameter of the ioctl call.
*
+ * @param finfo The target file descriptor related information.
+ * finfo is NULL when
+ * - ioctl_decode() is called in leaving stages, or
+ * - the file descriptor is not valid (e.g. -1).
+ *
* @return There are two flags of the return value important for the purposes of
* processing by SYS_FUNC(ioctl):
* - RVAL_IOCTL_DECODED: indicates that ioctl decoder code
@@ -346,7 +351,7 @@ f_ioctl(struct tcb *tcp, const unsigned int code, const kernel_ulong_t arg)
* and passes all other bits of ioctl_decode return value unchanged.
*/
static int
-ioctl_decode(struct tcb *tcp)
+ioctl_decode(struct tcb *tcp, const struct finfo *finfo)
{
const unsigned int code = tcp->u_arg[1];
const kernel_ulong_t arg = tcp->u_arg[2];
@@ -486,9 +491,9 @@ SYS_FUNC(ioctl)
if (xlat_verbosity == XLAT_STYLE_VERBOSE)
tprint_comment_end();
- ret = ioctl_decode(tcp);
+ ret = ioctl_decode(tcp, finfo);
} else {
- ret = ioctl_decode(tcp) | RVAL_DECODED;
+ ret = ioctl_decode(tcp, NULL) | RVAL_DECODED;
}
if (ret & RVAL_IOCTL_DECODED) {