diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-03-15 16:41:40 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-03-15 16:49:08 +0100 |
commit | 66e411811b8090d1bfd6620fc84472d83f723fa1 (patch) | |
tree | 3762cd014c5bd2b0ba771661ac08975ab43a05dd /man | |
parent | 961e4526925b7b1e1d3582f2fc9fb38035e2b5fb (diff) |
sd-booted: update sd_booted() check a bit
Previously we were testing whether /sys/fs/cgroup/systemd/ was a mount
point. This might be problematic however, when the cgroup trees are bind
mounted into a container from the host (which should be absolutely
valid), which might create the impression that the container was running
systemd, but only the host actually is.
Replace this by a check for the existance of the directory
/run/systemd/system/, which should work unconditionally, since /run can
never be a bind mount but *must* be a tmpfs on systemd systems, which is
flushed at boots. This means that data in /run always reflects
information about the current boot, and only of the local container,
which makes it the perfect choice for a check like this.
(As side effect this is nice to Ubuntu people who now use logind with
the systemd cgroup hierarchy, where the old sd_booted() check misdetects
systemd, even though they still run legacy Upstart.)
Diffstat (limited to 'man')
-rw-r--r-- | man/sd_booted.xml | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/man/sd_booted.xml b/man/sd_booted.xml index 34f2cbfbc8..ce5a34dc86 100644 --- a/man/sd_booted.xml +++ b/man/sd_booted.xml @@ -85,11 +85,10 @@ implementation.</para> <para>Internally, this function checks whether the - <filename>/sys/fs/cgroup/systemd</filename> virtual file - system is mounted, by comparing the st_dev value of - the <function>stat()</function> data of - <filename>/sys/fs/cgroup</filename> and - <filename>/sys/fs/cgroup/systemd</filename>.</para> + directory <filename>/run/systemd/system/</filename> + exists. A simple check like this can also be + implemented trivially in shell or any other + language.</para> <para>For details about the algorithm check the liberally licensed reference implementation sources: |