[CRIU] [PATCH] ns: Move all CLONE_FOO into namespaces.h

Tycho Andersen tycho.andersen at canonical.com
Wed Apr 27 07:16:01 PDT 2016


On Wed, Apr 27, 2016 at 02:29:38PM +0300, Pavel Emelyanov wrote:
> This removes double declaration of CLONE_NEWCGROUP. Also -- removes
> re-declaration of the CLONE_ALLNS in pstree.c.
> 
> Tycho, the two CLONE_ALLNS-s we had differ from each other :) The one
> in pstree.c doesn't have CLONE_NEWCGROUP. I believe this was just a
> misprint :) tests seem to pass.

Yes, I think it is :)

Acked-by: Tycho Andersen <tycho.andersen at canonical.com>

> Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
> 
> ---
>  criu/include/namespaces.h    | 32 ++++++++++++++++++++++++++++++--
>  criu/include/syscall-types.h | 32 --------------------------------
>  criu/pstree.c                |  2 --
>  3 files changed, 30 insertions(+), 36 deletions(-)
> 
> diff --git a/criu/include/namespaces.h b/criu/include/namespaces.h
> index 5879b7a..e2b529c 100644
> --- a/criu/include/namespaces.h
> +++ b/criu/include/namespaces.h
> @@ -5,14 +5,42 @@
>  #include "files.h"
>  #include "list.h"
>  
> -/* including syscall-types.h gives another weird error; do we really need to
> - * define this twice? */
> +#ifndef CLONE_NEWNS
> +#define CLONE_NEWNS	0x00020000
> +#endif
> +
> +#ifndef CLONE_NEWPID
> +#define CLONE_NEWPID	0x20000000
> +#endif
> +
> +#ifndef CLONE_NEWUTS
> +#define CLONE_NEWUTS	0x04000000
> +#endif
> +
> +#ifndef CLONE_NEWIPC
> +#define CLONE_NEWIPC	0x08000000
> +#endif
> +
> +#ifndef CLONE_NEWNET
> +#define CLONE_NEWNET	0x40000000
> +#endif
> +
> +#ifndef CLONE_NEWUSER
> +#define CLONE_NEWUSER	0x10000000
> +#endif
> +
>  #ifndef CLONE_NEWCGROUP
>  #define CLONE_NEWCGROUP	0x02000000
>  #endif
>  
> +#define CLONE_ALLNS	(CLONE_NEWPID | CLONE_NEWNET | CLONE_NEWIPC | CLONE_NEWUTS | CLONE_NEWNS | CLONE_NEWUSER | CLONE_NEWCGROUP)
> +
>  /* Nested namespaces are supported only for these types */
>  #define CLONE_SUBNS	(CLONE_NEWNS)
> +
> +/* Special flag for additional --unshare feature */
> +#define UNSHARE_MOUNT_PROC	0x1
> +
>  #define EXTRA_SIZE	20
>  
>  struct ns_desc {
> diff --git a/criu/include/syscall-types.h b/criu/include/syscall-types.h
> index c5fad75..49798fa 100644
> --- a/criu/include/syscall-types.h
> +++ b/criu/include/syscall-types.h
> @@ -42,38 +42,6 @@ struct itimerspec;
>  #define F_GETFD 1
>  #endif
>  
> -#ifndef CLONE_NEWNS
> -#define CLONE_NEWNS	0x00020000
> -#endif
> -
> -#ifndef CLONE_NEWPID
> -#define CLONE_NEWPID	0x20000000
> -#endif
> -
> -#ifndef CLONE_NEWUTS
> -#define CLONE_NEWUTS	0x04000000
> -#endif
> -
> -#ifndef CLONE_NEWIPC
> -#define CLONE_NEWIPC	0x08000000
> -#endif
> -
> -#ifndef CLONE_NEWNET
> -#define CLONE_NEWNET	0x40000000
> -#endif
> -
> -#ifndef CLONE_NEWUSER
> -#define CLONE_NEWUSER	0x10000000
> -#endif
> -
> -#ifndef CLONE_NEWCGROUP
> -#define CLONE_NEWCGROUP	0x02000000
> -#endif
> -
> -#define CLONE_ALLNS	(CLONE_NEWPID | CLONE_NEWNET | CLONE_NEWIPC | CLONE_NEWUTS | CLONE_NEWNS | CLONE_NEWUSER | CLONE_NEWCGROUP)
> -
> -#define UNSHARE_MOUNT_PROC	0x1
> -
>  struct krlimit {
>  	unsigned long rlim_cur;
>  	unsigned long rlim_max;
> diff --git a/criu/pstree.c b/criu/pstree.c
> index b49c9a0..408ce2b 100644
> --- a/criu/pstree.c
> +++ b/criu/pstree.c
> @@ -22,8 +22,6 @@
>  struct pstree_item *root_item;
>  static struct rb_root pid_root_rb;
>  
> -#define CLONE_ALLNS     (CLONE_NEWPID | CLONE_NEWNET | CLONE_NEWIPC | CLONE_NEWUTS | CLONE_NEWNS | CLONE_NEWUSER)
> -
>  void core_entry_free(CoreEntry *core)
>  {
>  	if (core->tc && core->tc->timers)
> -- 
> 2.1.4


More information about the CRIU mailing list