diff options
Diffstat (limited to 'tools/meson-get-cg-controller.sh')
-rwxr-xr-x | tools/meson-get-cg-controller.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/meson-get-cg-controller.sh b/tools/meson-get-cg-controller.sh new file mode 100755 index 000000000..98ba37a7f --- /dev/null +++ b/tools/meson-get-cg-controller.sh @@ -0,0 +1,18 @@ +#!/bin/sh -eu + +if test -f /proc/self/cgroup; then + # If the init system is a cgroup controler, it will be position 1. + # Secondary controllers, like cgmanager, do not work. + with_cgroupctrl=$(grep "^1:name=" /proc/self/cgroup | \ + sed -n 's/.*=//p' | sed -e 's/:.*$//') + if test -z "$with_cgroupctrl"; then + # Try to be our own cgroup controller + with_cgroupctrl="elogind" + fi +else + # 'auto' but no cgroup fs is a problem. + with_cgroupctrl="" +fi + +echo "$with_cgroupctrl" +exit 0 |