403Webshell
Server IP : 172.67.216.182  /  Your IP : 162.158.108.135
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/src/linux-headers-5.15.0-142/tools/testing/selftests/cgroup/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/src/linux-headers-5.15.0-142/tools/testing/selftests/cgroup/with_stress.sh
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4

stress_fork()
{
	while true ; do
		/usr/bin/true
		sleep 0.01
	done
}

stress_subsys()
{
	local verb=+
	while true ; do
		echo $verb$subsys_ctrl >$sysfs/cgroup.subtree_control
		[ $verb = "+" ] && verb=- || verb=+
		# incommensurable period with other stresses
		sleep 0.011
	done
}

init_and_check()
{
	sysfs=`mount -t cgroup2 | head -1 | awk '{ print $3 }'`
	if [ ! -d "$sysfs" ]; then
		echo "Skipping: cgroup2 is not mounted" >&2
		exit $ksft_skip
	fi

	if ! echo +$subsys_ctrl >$sysfs/cgroup.subtree_control ; then
		echo "Skipping: cannot enable $subsys_ctrl in $sysfs" >&2
		exit $ksft_skip
	fi

	if ! echo -$subsys_ctrl >$sysfs/cgroup.subtree_control ; then
		echo "Skipping: cannot disable $subsys_ctrl in $sysfs" >&2
		exit $ksft_skip
	fi
}

declare -a stresses
declare -a stress_pids
duration=5
rc=0
subsys_ctrl=cpuset
sysfs=

while getopts c:d:hs: opt; do
	case $opt in
	c)
		subsys_ctrl=$OPTARG
		;;
	d)
		duration=$OPTARG
		;;
	h)
		echo "Usage $0 [ -s stress ] ... [ -d duration ] [-c controller] cmd args .."
		echo -e "\t default duration $duration seconds"
		echo -e "\t default controller $subsys_ctrl"
		exit
		;;
	s)
		func=stress_$OPTARG
		if [ "x$(type -t $func)" != "xfunction" ] ; then
			echo "Unknown stress $OPTARG"
			exit 1
		fi
		stresses+=($func)
		;;
	esac
done
shift $((OPTIND - 1))

init_and_check

for s in ${stresses[*]} ; do
	$s &
	stress_pids+=($!)
done


time=0
start=$(date +%s)

while [ $time -lt $duration ] ; do
	$*
	rc=$?
	[ $rc -eq 0 ] || break
	time=$(($(date +%s) - $start))
done

for pid in ${stress_pids[*]} ; do
	kill -SIGTERM $pid
	wait $pid
done

exit $rc

Youez - 2016 - github.com/yon3zu
LinuXploit