On Tue, Jun 03, 2014 at 09:02:39AM +0530, zubin.mit...@gmail.com wrote:
> From: Zubin Mithra <zubin.mit...@gmail.com>
> 
> * defs.h (RVAL_FD): New macro.
> * defs.h (RVAL_MASK, RVAL_STR, RVAL_NONE): Macro values modified.
> * desc.c (sys_dup): New function.
> * desc.c (sys_delete_module): New function.
> * desc.c (sys_open, sys_dup2, sys_dup3, sys_creat): Modified to return
>   RVAL_FD
> * linux/dummy.h (sys_delete_module, sys_dup): Macros removed
> * linux/syscall.h (sys_close, sys_delete_module, sys_dup): New prototype
> * syscall.c (trace_syscall_exiting): Modified to handle RVAL_FD return
>   value
> 
> Signed-off-by: Zubin Mithra <zubin.mit...@gmail.com>
> ---
>  defs.h          |  7 ++++---
>  desc.c          | 15 +++++++++++++--
>  file.c          |  8 +++++++-
>  linux/dummy.h   |  2 --
>  linux/syscall.h |  2 ++
>  syscall.c       |  8 ++++++++
>  6 files changed, 34 insertions(+), 8 deletions(-)
> 
> diff --git a/defs.h b/defs.h
> index c862de5..99493b3 100644
> --- a/defs.h
> +++ b/defs.h
> @@ -533,10 +533,11 @@ extern const struct xlat whence_codes[];
>  # endif
>  # define RVAL_LUDECIMAL      007     /* long unsigned decimal format */
>  #endif
> -#define RVAL_MASK    007     /* mask for these values */
> +#define RVAL_FD      010     /* file descriptors */
> +#define RVAL_MASK    017     /* mask for these values */
>  
> -#define RVAL_STR     010     /* Print `auxstr' field after return val */
> -#define RVAL_NONE    020     /* Print nothing */
> +#define RVAL_STR     020     /* Print `auxstr' field after return val */
> +#define RVAL_NONE    040     /* Print nothing */
>  
>  #define TRACE_FILE   001     /* Trace file-related syscalls. */
>  #define TRACE_IPC    002     /* Trace IPC-related syscalls. */
> diff --git a/desc.c b/desc.c
> index 0c9a817..5bb1b21 100644
> --- a/desc.c
> +++ b/desc.c
> @@ -265,6 +265,15 @@ sys_close(struct tcb *tcp)
>       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)
>  {
> @@ -283,13 +292,15 @@ do_dup2(struct tcb *tcp, int flags_arg)
>  int
>  sys_dup2(struct tcb *tcp)
>  {
> -     return do_dup2(tcp, -1);
> +     do_dup2(tcp, -1);
> +     return RVAL_FD;
>  }
>  
>  int
>  sys_dup3(struct tcb *tcp)
>  {
> -     return do_dup2(tcp, 2);
> +     do_dup2(tcp, 2);
> +     return RVAL_FD;
>  }

I'd rather change do_dup2 to return RVAL_FD rather than change its users.

>  
>  #if defined(ALPHA)
> diff --git a/file.c b/file.c
> index c322242..92a5873 100644
> --- a/file.c
> +++ b/file.c
> @@ -309,6 +309,12 @@ decode_open(struct tcb *tcp, int offset)
>  int
>  sys_open(struct tcb *tcp)
>  {
> +     decode_open(tcp, 0);
> +     return RVAL_FD;
> +}
> +

Same here, lets change decode_open to return RVAL_FD instead.

> +int sys_delete_module(struct tcb *tcp)
> +{
>       return decode_open(tcp, 0);
>  }

btw, it's not right for sys_delete_module to use decode_open,
but that's a subject for another patch.


-- 
ldv

Attachment: pgpKh8EU45WTF.pgp
Description: PGP signature

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to