summaryrefslogtreecommitdiff
path: root/tools/meson-get-cg-controller.sh
blob: 98ba37a7fba63413f8fb30680faa43598aeea5f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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