mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-06 12:58:22 +03:00
test: introduce `get_cgroup_hierarchy() helper
which returns the host's cgroup hierarchy (unified, hybrid, or legacy).
This commit is contained in:
parent
bab29f2ab7
commit
f723740871
@ -2010,6 +2010,24 @@ import_initdir() {
|
||||
export initdir
|
||||
}
|
||||
|
||||
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
|
||||
;;
|
||||
*)
|
||||
dfatal "Failed to determine host's cgroup hierarchy"
|
||||
exit 1
|
||||
esac
|
||||
}
|
||||
|
||||
## @brief Converts numeric logging level to the first letter of level name.
|
||||
#
|
||||
# @param lvl Numeric logging level in range from 1 to 6.
|
||||
|
Loading…
x
Reference in New Issue
Block a user