Move platformInit and plugin load to server

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-06-22 13:34:37 -07:00
parent a6e77432df
commit 003ad67375
8 changed files with 78 additions and 75 deletions

26
server/server_linux.go Normal file
View File

@@ -0,0 +1,26 @@
package server
import (
"context"
"os"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/sys"
)
// apply sets config settings on the server process
func apply(ctx context.Context, config *Config) error {
if config.Subreaper {
log.G(ctx).Info("setting subreaper...")
if err := sys.SetSubreaper(1); err != nil {
return err
}
}
if config.OOMScore != 0 {
log.G(ctx).Infof("changing OOM score to %d", config.OOMScore)
if err := sys.SetOOMScore(os.Getpid(), config.OOMScore); err != nil {
return err
}
}
return nil
}