2016-07-27 18:17:44 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2016-07-28 15:58:06 +00:00
|
|
|
"fmt"
|
2016-07-27 18:17:44 +00:00
|
|
|
"strconv"
|
|
|
|
"syscall"
|
|
|
|
"unsafe"
|
2016-08-23 23:50:15 +00:00
|
|
|
|
|
|
|
"github.com/go-check/check"
|
2016-11-21 22:35:06 +00:00
|
|
|
"golang.org/x/sys/windows"
|
2016-07-27 18:17:44 +00:00
|
|
|
)
|
|
|
|
|
2016-11-21 22:35:06 +00:00
|
|
|
func openEvent(desiredAccess uint32, inheritHandle bool, name string, proc *windows.LazyProc) (handle syscall.Handle, err error) {
|
2016-07-27 18:17:44 +00:00
|
|
|
namep, _ := syscall.UTF16PtrFromString(name)
|
|
|
|
var _p2 uint32
|
|
|
|
if inheritHandle {
|
|
|
|
_p2 = 1
|
|
|
|
}
|
|
|
|
r0, _, e1 := proc.Call(uintptr(desiredAccess), uintptr(_p2), uintptr(unsafe.Pointer(namep)))
|
|
|
|
handle = syscall.Handle(r0)
|
|
|
|
if handle == syscall.InvalidHandle {
|
|
|
|
err = e1
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2016-11-21 22:35:06 +00:00
|
|
|
func pulseEvent(handle syscall.Handle, proc *windows.LazyProc) (err error) {
|
2016-07-27 18:17:44 +00:00
|
|
|
r0, _, _ := proc.Call(uintptr(handle))
|
|
|
|
if r0 != 0 {
|
|
|
|
err = syscall.Errno(r0)
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func signalDaemonDump(pid int) {
|
2016-11-21 22:35:06 +00:00
|
|
|
modkernel32 := windows.NewLazySystemDLL("kernel32.dll")
|
2016-07-27 18:17:44 +00:00
|
|
|
procOpenEvent := modkernel32.NewProc("OpenEventW")
|
|
|
|
procPulseEvent := modkernel32.NewProc("PulseEvent")
|
|
|
|
|
|
|
|
ev := "Global\\docker-daemon-" + strconv.Itoa(pid)
|
|
|
|
h2, _ := openEvent(0x0002, false, ev, procOpenEvent)
|
|
|
|
if h2 == 0 {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
pulseEvent(h2, procPulseEvent)
|
|
|
|
}
|
2016-07-28 15:58:06 +00:00
|
|
|
|
|
|
|
func signalDaemonReload(pid int) error {
|
|
|
|
return fmt.Errorf("daemon reload not supported")
|
|
|
|
}
|
2016-08-23 23:50:15 +00:00
|
|
|
|
|
|
|
func cleanupExecRoot(c *check.C, execRoot string) {
|
|
|
|
}
|