2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-01 14:55:39 +00:00

ns: Add c/r for /proc/$pid/ns/$ids references

Based on work done by Cyrill Corcunov (many thanks for that).

In this commit we implement c/r for files which have opened
/proc/$pid/ns/$ids entries.

The idea is rather simple one

Checkpoint
==========

- Check if the file name is the one of known to be ns ref
- If match then write protobuf entry

Restore
=======

- Read all ns entries from the image
- When criu tries to open one we lookup over process
  tree to figure out which PID should be used in path
  and then just open it

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2013-05-18 04:00:05 +04:00
parent a49325b524
commit ec50a07727
5 changed files with 219 additions and 7 deletions

View File

@@ -3,6 +3,7 @@
#include "crtools.h"
#include "pstree.h"
#include "files.h"
struct cr_options;
@@ -19,10 +20,15 @@ struct ns_desc {
.len = sizeof(_str) - 1, \
}
extern bool check_ns_proc(struct fd_link *link);
extern struct ns_desc pid_ns_desc;
extern struct ns_desc user_ns_desc;
extern unsigned long current_ns_mask;
extern int dump_ns_file(struct fd_parms *p, int lfd, const int fdinfo);
extern int collect_ns_files(void);
int dump_namespaces(struct pid *pid, unsigned int ns_flags);
int prepare_namespace(int pid, unsigned long clone_flags);
int try_show_namespaces(int pid, struct cr_options *o);