2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +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

@@ -32,6 +32,7 @@
#include "eventpoll.h"
#include "fsnotify.h"
#include "signalfd.h"
#include "namespaces.h"
#include "parasite.h"
#include "parasite-syscall.h"
@@ -267,7 +268,13 @@ static int dump_one_file(struct parasite_ctl *ctl, int fd, int lfd, struct fd_op
return -1;
p.link = &link;
return dump_reg_file(&p, lfd, fdinfo);
if (link.name[1] == '/')
return dump_reg_file(&p, lfd, fdinfo);
if (check_ns_proc(&link))
return dump_ns_file(&p, lfd, fdinfo);
return dump_unsupp_fd(&p);
}
if (S_ISFIFO(p.stat.st_mode)) {