summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2015-05-07 21:46:38 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2015-05-07 21:46:38 +0000
commit734281d35e64e35c0f0e0f42a791cf48604c2bbe (patch)
treed5d90a8720e448c748749f397f057aebbec8c3cf
parentbc66da53b44008a295c992adc181bac3502612c2 (diff)
downloadillumos-joyent-734281d35e64e35c0f0e0f42a791cf48604c2bbe.tar.gz
OS-4259 make systemd's detect_container work for a zone
-rw-r--r--usr/src/lib/brand/lx/lx_init/lxinit.c9
-rw-r--r--usr/src/lib/brand/lx/zone/platform.xml1
2 files changed, 9 insertions, 1 deletions
diff --git a/usr/src/lib/brand/lx/lx_init/lxinit.c b/usr/src/lib/brand/lx/lx_init/lxinit.c
index e6cdea9650..508c9f940a 100644
--- a/usr/src/lib/brand/lx/lx_init/lxinit.c
+++ b/usr/src/lib/brand/lx/lx_init/lxinit.c
@@ -468,8 +468,15 @@ static void
lxi_init_exec()
{
char *cmd[] = {"/sbin/init", "init", NULL};
+ char *env[] = {"container=zone", NULL};
- execv(cmd[0], cmd + 1);
+ /*
+ * systemd uses the 'container' env var to determine it is running
+ * inside a container. It only supports a few well-known types and
+ * treats anything else as 'other' but this is enough to make it
+ * behave better inside a zone. See 'detect_container' in systemd.
+ */
+ execve(cmd[0], cmd + 1, env);
}
int
diff --git a/usr/src/lib/brand/lx/zone/platform.xml b/usr/src/lib/brand/lx/zone/platform.xml
index 038dc4a2b5..f841795530 100644
--- a/usr/src/lib/brand/lx/zone/platform.xml
+++ b/usr/src/lib/brand/lx/zone/platform.xml
@@ -65,6 +65,7 @@
<mount special="objfs" directory="/system/object" type="objfs" />
<mount special="ctfs" directory="/system/contract" type="ctfs" />
<mount special="mnttab" directory="/etc/mnttab" type="mntfs" />
+ <mount special="lxproc" directory="/proc" type="lx_proc" />
<!-- Devices to create under /dev -->
<device match="arp" />