"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core-out-of-memory.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.

core-out-of-memory.c  (stress-ng-0.13.04.tar.xz):core-out-of-memory.c  (stress-ng-0.13.05.tar.xz)
skipping to change at line 131 skipping to change at line 131
* if we have root privileges then try and make process * if we have root privileges then try and make process
* unkillable by oom killer * unkillable by oom killer
*/ */
void stress_set_oom_adjustment(const char *name, const bool killable) void stress_set_oom_adjustment(const char *name, const bool killable)
{ {
bool high_priv; bool high_priv;
bool make_killable = killable; bool make_killable = killable;
char *str; char *str;
int ret; int ret;
/*
* --no-oom-adjust option ignores any oom adjustments
*/
if (g_opt_flags & OPT_FLAGS_NO_OOM_ADJUST)
return;
high_priv = (getuid() == 0) && (geteuid() == 0); high_priv = (getuid() == 0) && (geteuid() == 0);
/* /*
* main cannot be killable; if OPT_FLAGS_OOMABLE set make * main cannot be killable; if OPT_FLAGS_OOMABLE set make
* all child procs easily OOMable * all child procs easily OOMable
*/ */
if (!strcmp(name, "main") && (g_opt_flags & OPT_FLAGS_OOMABLE)) if (strcmp(name, "main") && (g_opt_flags & OPT_FLAGS_OOMABLE))
make_killable = true; make_killable = true;
/* /*
* Try modern oom interface * Try modern oom interface
*/ */
if (make_killable) if (make_killable)
str = OOM_SCORE_ADJ_MAX; str = OOM_SCORE_ADJ_MAX;
else else
str = high_priv ? OOM_SCORE_ADJ_MIN : "0"; str = high_priv ? OOM_SCORE_ADJ_MIN : "0";
ret = stress_set_adjustment("/proc/self/oom_score_adj", name, str); ret = stress_set_adjustment("/proc/self/oom_score_adj", name, str);
 End of changes. 2 change blocks. 
1 lines changed or deleted 7 lines changed or added

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