Skip to content

Commit

Permalink
fix sub cgroup use
Browse files Browse the repository at this point in the history
  • Loading branch information
MelvinTo committed Mar 5, 2024
1 parent 34c6729 commit e1938a3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions scripts/test_wan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,24 @@ fi

test -z "$MARK" && echo invalid WAN $WAN_NAME && exit 2

CGROUP_MNT=/tmp/cgroup-test-wan-$WAN_NAME
CGROUP_MNT=/sys/fs/cgroup/cgroup-test-wan-$WAN_NAME-$RANDOM

cleanup() {
umount ${CGROUP_MNT}
${CGROUP_SOCK_MARK} -d ${CGROUP_MNT}
rmdir ${CGROUP_MNT}
}

trap 'cleanup; exit 1' INT

mkdir -p ${CGROUP_MNT}
mount -t cgroup2 none ${CGROUP_MNT}
mkdir $CGROUP_MNT || exit 3

${CGROUP_SOCK_MARK} -m ${MARK} ${CGROUP_MNT}
${CGROUP_SOCK_MARK} -m ${MARK} ${CGROUP_MNT} || exit 4

# run the command
bash -c "echo \$\$ > $CGROUP_MNT/cgroup.procs; $CMD"

RET=$?

${CGROUP_SOCK_MARK} -d ${CGROUP_MNT}

cleanup

exit $RET

0 comments on commit e1938a3

Please sign in to comment.