1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Ignore failure to set oom_score_adj, as happens in an unprivileged container.

Signed-off-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
This commit is contained in:
Michael Hudson-Doyle 2016-09-19 14:27:10 +12:00
parent 45a8f68026
commit 32f24bc3c5
2 changed files with 10 additions and 0 deletions

View file

@ -1148,6 +1148,11 @@ func setupOOMScoreAdj(score int) error {
return err return err
} }
_, err = f.WriteString(strconv.Itoa(score)) _, err = f.WriteString(strconv.Itoa(score))
if os.IsPermission(err) {
// Setting oom_score_adj does not work in an
// unprivileged container. Ignore the error.
return nil
}
f.Close() f.Close()
return err return err
} }

View file

@ -435,6 +435,11 @@ func setOOMScore(pid, score int) error {
} }
_, err = f.WriteString(strconv.Itoa(score)) _, err = f.WriteString(strconv.Itoa(score))
f.Close() f.Close()
if os.IsPermission(err) {
// Setting oom_score_adj does not work in an
// unprivileged container. Ignore the error.
return nil
}
return err return err
} }