Revert "Revert "Fix the race between configuring cbr0 and restarting static pods""

This reverts commit fd0a95dd12.
This commit is contained in:
Dawn Chen
2015-06-24 11:10:10 -07:00
parent cf2bd9a18d
commit 6ddfa512de
11 changed files with 147 additions and 40 deletions

View File

@@ -198,6 +198,20 @@ func CompileRegexps(regexpStrings []string) ([]*regexp.Regexp, error) {
return regexps, nil
}
// Detects if using systemd as the init system
// Please note that simply reading /proc/1/cmdline can be misleading because
// some installation of various init programs can automatically make /sbin/init
// a symlink or even a renamed version of their main program.
// TODO(dchen1107): realiably detects the init system using on the system:
// systemd, upstart, initd, etc.
func UsingSystemdInitSystem() bool {
if _, err := os.Stat("/run/systemd/system"); err != nil {
return true
}
return false
}
// Writes 'value' to /proc/<pid>/oom_score_adj. PID = 0 means self
func ApplyOomScoreAdj(pid int, value int) error {
if value < -1000 || value > 1000 {