mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Move lockthread to package level
Move this to be one of the first things that is done in the main if we are executing the init. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -85,12 +85,17 @@ command(s) that get executed on start, edit the args parameter of the spec. See
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if len(os.Args) > 1 && os.Args[1] == "init" {
|
||||||
|
runtime.GOMAXPROCS(1)
|
||||||
|
runtime.LockOSThread()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var initCommand = cli.Command{
|
var initCommand = cli.Command{
|
||||||
Name: "init",
|
Name: "init",
|
||||||
Usage: `initialize the namespaces and launch the process (do not call it outside of runc)`,
|
Usage: `initialize the namespaces and launch the process (do not call it outside of runc)`,
|
||||||
Action: func(context *cli.Context) {
|
Action: func(context *cli.Context) {
|
||||||
runtime.GOMAXPROCS(1)
|
|
||||||
runtime.LockOSThread()
|
|
||||||
factory, _ := libcontainer.New("")
|
factory, _ := libcontainer.New("")
|
||||||
if err := factory.StartInitialization(); err != nil {
|
if err := factory.StartInitialization(); err != nil {
|
||||||
// as the error is sent back to the parent there is no need to log
|
// as the error is sent back to the parent there is no need to log
|
||||||
|
|||||||
Reference in New Issue
Block a user