"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "stress-kill.c" between
stress-ng-0.13.04.tar.xz and stress-ng-0.13.05.tar.xz

About: stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.

stress-kill.c  (stress-ng-0.13.04.tar.xz):stress-kill.c  (stress-ng-0.13.05.tar.xz)
skipping to change at line 34 skipping to change at line 34
*/ */
#include "stress-ng.h" #include "stress-ng.h"
static const stress_help_t help[] = { static const stress_help_t help[] = {
{ NULL, "kill N", "start N workers killing with SIGUSR1" }, { NULL, "kill N", "start N workers killing with SIGUSR1" },
{ NULL, "kill-ops N", "stop after N kill bogo operations" }, { NULL, "kill-ops N", "stop after N kill bogo operations" },
{ NULL, NULL, NULL } { NULL, NULL, NULL }
}; };
/* /*
* stress_kill_handle_sigusr1()
* handle SIGUSR1
*/
static void stress_kill_handle_sigusr1(int sig)
{
(void)sig;
}
/*
* stress on sched_kill() * stress on sched_kill()
* stress system by rapid kills * stress system by rapid kills
*/ */
static int stress_kill(const stress_args_t *args) static int stress_kill(const stress_args_t *args)
{ {
uint64_t udelay = 5000; uint64_t udelay = 5000;
pid_t pid;
const pid_t ppid = getpid();
int ret;
if (stress_sighandler(args->name, SIGUSR1, SIG_IGN, NULL) < 0) if (stress_sighandler(args->name, SIGUSR1, SIG_IGN, NULL) < 0)
return EXIT_FAILURE; return EXIT_FAILURE;
pid = fork();
if (pid == 0) {
ret = stress_sighandler(args->name, SIGUSR1, stress_kill_handle_s
igusr1, NULL);
(void)ret;
while (keep_stressing(args)) {
if (kill(ppid, 0) < 0)
break;
pause();
}
_exit(0);
}
stress_set_proc_state(args->name, STRESS_STATE_RUN); stress_set_proc_state(args->name, STRESS_STATE_RUN);
do { do {
int ret;
/* /*
* With many kill stressors we get into a state * With many kill stressors we get into a state
* where they all hammer on kill system calls and * where they all hammer on kill system calls and
* this stops the parent from getting scheduling * this stops the parent from getting scheduling
* time to spawn off the rest of the kill stressors * time to spawn off the rest of the kill stressors
* causing some lag in getting all the stressors * causing some lag in getting all the stressors
* running. Ease this pressure off to being with * running. Ease this pressure off to being with
* with some small sleeps that shrink to zero over * with some small sleeps that shrink to zero over
* time. The alternative was to re-nice all the * time. The alternative was to re-nice all the
* processes, but even then one gets the child * processes, but even then one gets the child
skipping to change at line 107 skipping to change at line 130
ret = kill(0, INT_MIN); ret = kill(0, INT_MIN);
(void)ret; (void)ret;
/* /*
* Exercise the kernel by sending illegal pid INT_MIN, * Exercise the kernel by sending illegal pid INT_MIN,
* should return -ESRCH but not sure if that is portable * should return -ESRCH but not sure if that is portable
*/ */
ret = kill(INT_MIN, 0); ret = kill(INT_MIN, 0);
(void)ret; (void)ret;
/*
* Send child process some signals to keep it busy
*/
if (pid > 1) {
ret = kill(pid, 0);
(void)pid;
#if defined(SIGSTOP) && \
defined(SIGCONT)
ret = kill(pid, SIGSTOP);
(void)ret;
ret = kill(pid, SIGCONT);
(void)ret;
#endif
ret = kill(pid, SIGUSR1);
(void)ret;
}
inc_counter(args); inc_counter(args);
} while (keep_stressing(args)); } while (keep_stressing(args));
stress_set_proc_state(args->name, STRESS_STATE_DEINIT); stress_set_proc_state(args->name, STRESS_STATE_DEINIT);
if (pid != -1) {
int status;
ret = kill(pid, SIGKILL);
(void)ret;
ret = waitpid(pid, &status, 0);
(void)ret;
}
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
stressor_info_t stress_kill_info = { stressor_info_t stress_kill_info = {
.stressor = stress_kill, .stressor = stress_kill,
.class = CLASS_INTERRUPT | CLASS_SCHEDULER | CLASS_OS, .class = CLASS_INTERRUPT | CLASS_SCHEDULER | CLASS_OS,
.help = help .help = help
}; };
 End of changes. 6 change blocks. 
2 lines changed or deleted 52 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)