[PATCH] LXC: create directory /dev/shm automatically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now we mount /dev as tmpfs and haven't created directory
/dev/shm,so the glibc api such as shm_open/sem_open will
create files under dir /dev.(since /dev is mounted as tmpfs)

Through these api still useable in container,but this cause
directory /dev looks a little chaos.

This patch create directory /dev/shm automatically,the files
created by shm_open/sem_open will stay in this directroy.

Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx>
---
 src/lxc/lxc_container.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 497539c..5150564 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -586,6 +586,13 @@ static int lxcContainerMountBasicFS(bool pivotRoot,
                                  "devfs", "/dev", "tmpfs", opts);
             goto cleanup;
         }
+
+        VIR_DEBUG("create directory /dev/shm for POSIX shared memory and named semphore");
+        if (virFileMakePath("/dev/shm") < 0) {
+            virReportSystemError(errno, "%s",
+                                 _("Failed to mkdir /dev/shm"));
+            goto cleanup;
+        }
     }
 
     rc = 0;
-- 
1.7.11.7

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]