mirror of
https://github.com/systemd/systemd
synced 2024-10-15 20:45:09 +00:00
test: introduce get_cgroup_hierarchy()
This commit is contained in:
parent
cb153b4fe9
commit
5ff1c6fcde
|
@ -56,3 +56,21 @@ assert_rc() {(
|
|||
rc=$?
|
||||
assert_eq "$rc" "$exp"
|
||||
)}
|
||||
|
||||
get_cgroup_hierarchy() {
|
||||
case "$(stat -c '%T' -f /sys/fs/cgroup)" in
|
||||
cgroup2fs)
|
||||
echo "unified"
|
||||
;;
|
||||
tmpfs)
|
||||
if [[ -d /sys/fs/cgroup/unified && "$(stat -c '%T' -f /sys/fs/cgroup/unified)" == cgroup2fs ]]; then
|
||||
echo "hybrid"
|
||||
else
|
||||
echo "legacy"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo >&2 "Failed to determine host's cgroup hierarchy"
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue