2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

util: Add make_yard helper

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2015-09-22 14:50:20 +03:00
parent c5054f959d
commit 9b3189fed1
4 changed files with 20 additions and 14 deletions

17
util.c
View File

@@ -14,7 +14,7 @@
#include <sys/sendfile.h>
#include <fcntl.h>
#include <poll.h>
#include <sys/mount.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/ptrace.h>
@@ -845,3 +845,18 @@ int fd_has_data(int lfd)
return ret;
}
int make_yard(char *path)
{
if (mount("none", path, "tmpfs", 0, NULL)) {
pr_perror("Unable to mount tmpfs in %s", path);
return -1;
}
if (mount("none", path, NULL, MS_PRIVATE, NULL)) {
pr_perror("Unable to mark yard as private");
return -1;
}
return 0;
}