summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-11-28 15:48:31 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-11-30 09:53:39 +0100
commit1a2b9b054035605db496f0766d6955e8c0f82f4b (patch)
tree4b7af90d587e320c0ae5f91c66302c8349b75fb0
parent13590ca98ac2fd4939b683adbfdd63392b559f3f (diff)
downloadunitd-1a2b9b054035605db496f0766d6955e8c0f82f4b.tar
unitd-1a2b9b054035605db496f0766d6955e8c0f82f4b.zip
Correctly setup early mounts
-rw-r--r--early.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/early.c b/early.c
index 92ec6bd..c2c366b 100644
--- a/early.c
+++ b/early.c
@@ -56,13 +56,22 @@ early_mounts(void)
{
unsigned int oldumask = umask(0);
- mount("proc", "/proc", "proc", MS_NOATIME | MS_NODEV | MS_NOEXEC | MS_NOSUID, 0);
- mount("sys", "/sys", "sysfs", MS_NOATIME | MS_NODEV | MS_NOEXEC | MS_NOSUID, 0);
- mount("cgroup", "/sys/fs/cgroup", "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID, "none");
+ mount("proc", "/proc", "proc", MS_NOATIME | MS_NODEV | MS_NOEXEC | MS_NOSUID, NULL);
+ mount("sys", "/sys", "sysfs", MS_NOATIME | MS_NODEV | MS_NOEXEC | MS_NOSUID, NULL);
+ mount("cgroup", "/sys/fs/cgroup", "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID, NULL);
mount("dev", "/dev", "devtmpfs", MS_NOATIME | MS_NOSUID, "mode=0755,size=512K");
+
mkdir("/dev/pts", 0755);
mount("devpts", "/dev/pts", "devpts", MS_NOATIME | MS_NOEXEC | MS_NOSUID, "mode=600");
- mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 0);
+
+ mount("run", "/run", "tmpfs", MS_NOATIME, "mode=0755");
+
+ mkdir("/run/tmp", 01777);
+ mount("/run/tmp", "/tmp", NULL, MS_BIND, NULL);
+
+ mkdir("/run/shm", 01777);
+ mkdir("/dev/shm", 0755);
+ mount("/run/shm", "/dev/shm", NULL, MS_BIND, NULL);
umask(oldumask);
}