b63c92bf24
Signed-off-by: John Howard <jhoward@microsoft.com>
30 lines
709 B
Go
30 lines
709 B
Go
package daemon
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"syscall"
|
|
|
|
"github.com/Sirupsen/logrus"
|
|
"github.com/docker/docker/pkg/signal"
|
|
"github.com/docker/docker/pkg/system"
|
|
)
|
|
|
|
func setupDumpStackTrap(root string) {
|
|
// Windows does not support signals like *nix systems. So instead of
|
|
// trapping on SIGUSR1 to dump stacks, we wait on a Win32 event to be
|
|
// signaled.
|
|
go func() {
|
|
sa := syscall.SecurityAttributes{
|
|
Length: 0,
|
|
}
|
|
ev := "Global\\docker-daemon-" + fmt.Sprint(os.Getpid())
|
|
if h, _ := system.CreateEvent(&sa, false, false, ev); h != 0 {
|
|
logrus.Debugf("Stackdump - waiting signal at %s", ev)
|
|
for {
|
|
syscall.WaitForSingleObject(h, syscall.INFINITE)
|
|
signal.DumpStacks(root)
|
|
}
|
|
}
|
|
}()
|
|
}
|