ns: Introduce collect_net_namespaces

And move sockets collection there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov 2014-09-29 22:03:55 +04:00
parent 01f6f890c2
commit 7327ffe6a7
4 changed files with 13 additions and 5 deletions

View file

@ -41,7 +41,6 @@
#include "syscall.h"
#include "ptrace.h"
#include "util.h"
#include "sockets.h"
#include "namespaces.h"
#include "image.h"
#include "proc_parse.h"
@ -1802,9 +1801,6 @@ int cr_dump_tasks(pid_t pid)
if (collect_namespaces() < 0)
goto err;
if (collect_sockets(pid))
goto err;
glob_imgset = cr_glob_imgset_open(O_DUMP);
if (!glob_imgset)
goto err;

View file

@ -14,6 +14,8 @@ struct veth_pair {
char *outside;
};
extern int collect_net_namespaces(void);
extern int network_lock(void);
extern void network_unlock(void);

View file

@ -536,6 +536,10 @@ int collect_namespaces(void)
if (ret < 0)
return ret;
ret = collect_net_namespaces();
if (ret < 0)
return ret;
return 0;
}

8
net.c
View file

@ -19,7 +19,8 @@
#include "util-pie.h"
#include "plugin.h"
#include "action-scripts.h"
#include "sockets.h"
#include "pstree.h"
#include "protobuf.h"
#include "protobuf/netdev.pb-c.h"
@ -625,4 +626,9 @@ int veth_pair_add(char *in, char *out)
return 0;
}
int collect_net_namespaces(void)
{
return collect_sockets(root_item->pid.real);
}
struct ns_desc net_ns_desc = NS_DESC_ENTRY(CLONE_NEWNET, "net");