From cd6b9038255be10d827972ea66c8878cf1d228dc Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Mon, 4 Aug 2014 11:41:59 -0700 Subject: [PATCH] Ensure thread is locked in sysinit for docker Signed-off-by: Michael Crosby --- sysinit/sysinit.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sysinit/sysinit.go b/sysinit/sysinit.go index 9da6a5fc5d..65d7bf4e7c 100644 --- a/sysinit/sysinit.go +++ b/sysinit/sysinit.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "os" + "runtime" "github.com/docker/docker/daemon/execdriver" _ "github.com/docker/docker/daemon/execdriver/lxc" @@ -23,6 +24,10 @@ func executeProgram(args *execdriver.InitArgs) error { // This code is run INSIDE the container and is responsible for setting // up the environment before running the actual process func SysInit() { + // The very first thing that we should do is lock the thread so that other + // system level options will work and not have issues, i.e. setns + runtime.LockOSThread() + if len(os.Args) <= 1 { fmt.Println("You should not invoke dockerinit manually") os.Exit(1)