[PATCH] sys_setns: decode nstype, the second argument

Masatake YAMATO yamato at redhat.com
Tue May 13 17:10:11 UTC 2014


You can test my patch with ip command:

    $ sudo ip netns add test        
    $ sudo ./strace -e'setns' ip netns exec test echo > /dev/null
    setns(4, CLONE_NEWNET)                  = 0
    +++ exited with 0 +++

Masatake YAMATO

> * process.c (sys_setns): New function. Use `clone_flags'
>   to decode the seconde argument.
> 
> * linux/dummy.h (sys_setns): Remove the macro.
> 
> Signed-off-by: Masatake YAMATO <yamato at redhat.com>
> ---
>  linux/dummy.h |  1 -
>  process.c     | 11 +++++++++++
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/linux/dummy.h b/linux/dummy.h
> index 2fc3498..ac844c6 100644
> --- a/linux/dummy.h
> +++ b/linux/dummy.h
> @@ -79,7 +79,6 @@
>  #define	sys_set_robust_list	sys_munmap
>  #define	sys_setfsgid		sys_setfsuid
>  #define	sys_setgid		sys_setuid
> -#define	sys_setns		sys_inotify_rm_watch
>  #define	sys_setregid		sys_setreuid
>  #define	sys_setresgid		sys_setresuid
>  #define	sys_swapoff		sys_chdir
> diff --git a/process.c b/process.c
> index af203ea..58fef83 100644
> --- a/process.c
> +++ b/process.c
> @@ -585,6 +585,17 @@ sys_clone(struct tcb *tcp)
>  }
>  
>  int
> +sys_setns(struct tcb *tcp)
> +{
> +	if (entering(tcp)) {
> +		printfd(tcp, tcp->u_arg[0]);
> +		tprints(", ");
> +		printflags(clone_flags, tcp->u_arg[1], "CLONE_???");
> +	}
> +	return 0;
> +}
> +
> +int
>  sys_unshare(struct tcb *tcp)
>  {
>  	if (entering(tcp))
> -- 
> 1.9.0
> 




More information about the Strace-devel mailing list