From 13c5f90b932aa68c59271c720ced1733457946ae Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Thu, 31 Aug 2017 18:35:09 +0800 Subject: [PATCH] Setup /dev/shm for the initial namespace Although hyperstart itself doesn't use posix ipc(shm), the programs invoked by hyperstart may use it. So it is better to setup it. Signed-off-by: Lai Jiangshan --- src/init.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/init.c b/src/init.c index 0dc9e6b5..e380de04 100644 --- a/src/init.c +++ b/src/init.c @@ -1521,6 +1521,16 @@ static int hyper_setup_init_process(void) return -1; } + if (hyper_mkdir("/dev/shm", 0755) < 0) { + fprintf(stderr, "create basic directory /dev/shm failed\n"); + return -1; + } + + if (mount("tmpfs", "/dev/shm/", "tmpfs", MS_NOSUID| MS_NODEV, NULL) < 0) { + perror("mount shm failed"); + return -1; + } + if (hyper_mkdir("/dev/pts", 0755) < 0) { perror("create basic directory failed"); return -1;