Decode paths associated with file descriptors returned by syscalls
* defs.h (RVAL_FD): New macro.
(RVAL_MASK, RVAL_STR, RVAL_NONE): Update.
* desc.c (sys_dup, sys_delete_module): New functions.
(do_dup2, decode_open, sys_creat): Change return value to RVAL_FD.
* linux/dummy.h (sys_delete_module, sys_dup): Remove.
* linux/syscall.h (sys_delete_module, sys_dup): New prototypes.
* syscall.c (trace_syscall_exiting): Handle RVAL_FD.
Signed-off-by: Zubin Mithra <zubin.mithra@gmail.com>
diff --git a/desc.c b/desc.c
index 0c9a817..5b8869b 100644
--- a/desc.c
+++ b/desc.c
@@ -265,6 +265,15 @@
return 0;
}
+int
+sys_dup(struct tcb *tcp)
+{
+ if (entering(tcp)) {
+ printfd(tcp, tcp->u_arg[0]);
+ }
+ return RVAL_FD;
+}
+
static int
do_dup2(struct tcb *tcp, int flags_arg)
{
@@ -277,7 +286,7 @@
printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
}
}
- return 0;
+ return RVAL_FD;
}
int