[Devel] [PATCH 5/7] kdat: Add test for ctty inheritance
Cyrill Gorcunov
gorcunov at gmail.com
Thu Feb 15 23:30:28 MSK 2018
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
criu/include/kerndat.h | 1 +
criu/kerndat.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/criu/include/kerndat.h b/criu/include/kerndat.h
index f3af32df1..a3fe7efd6 100644
--- a/criu/include/kerndat.h
+++ b/criu/include/kerndat.h
@@ -55,6 +55,7 @@ struct kerndat_s {
unsigned long files_stat_max_files;
bool can_map_vdso;
bool has_inotify_setnextwd;
+ bool ve_can_inherit_ctty;
};
extern struct kerndat_s kdat;
diff --git a/criu/kerndat.c b/criu/kerndat.c
index 5176c274f..064d14343 100644
--- a/criu/kerndat.c
+++ b/criu/kerndat.c
@@ -837,6 +837,22 @@ int kerndat_has_inotify_setnextwd(void)
return ret;
}
+void kerndat_ve(void)
+{
+ static const char path[] = "/sys/fs/cgroup/ve/ve.ctty";
+
+ if (access(path, F_OK) < 0) {
+ if (errno == ENOENT) {
+ pr_debug("ve.ctty is disabled\n");
+ kdat.ve_can_inherit_ctty = false;
+ }
+ pr_perror("Unable to access %s", path);
+ return;
+ }
+
+ kdat.ve_can_inherit_ctty = true;
+}
+
int kerndat_init(void)
{
int ret;
@@ -883,6 +899,7 @@ int kerndat_init(void)
kerndat_lsm();
kerndat_mmap_min_addr();
kerndat_files_stat(false);
+ kerndat_ve();
if (!ret)
kerndat_save_cache();
--
2.14.3
More information about the Devel
mailing list