1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/integration-cli/daemon/daemon_windows.go
Christopher Jones 069fdc8a08
[project] change syscall to /x/sys/unix|windows
Changes most references of syscall to golang.org/x/sys/
Ones aren't changes include, Errno, Signal and SysProcAttr
as they haven't been implemented in /x/sys/.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>

[s390x] switch utsname from unsigned to signed

per 33267e036f
char in s390x in the /x/sys/unix package is now signed, so
change the buildtags

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2017-07-11 08:00:32 -04:00

54 lines
1.3 KiB
Go

package daemon
import (
"fmt"
"strconv"
"syscall"
"unsafe"
"github.com/go-check/check"
"golang.org/x/sys/windows"
)
func openEvent(desiredAccess uint32, inheritHandle bool, name string, proc *windows.LazyProc) (handle windows.Handle, err error) {
namep, _ := windows.UTF16PtrFromString(name)
var _p2 uint32
if inheritHandle {
_p2 = 1
}
r0, _, e1 := proc.Call(uintptr(desiredAccess), uintptr(_p2), uintptr(unsafe.Pointer(namep)))
handle = windows.Handle(r0)
if handle == windows.InvalidHandle {
err = e1
}
return
}
func pulseEvent(handle windows.Handle, proc *windows.LazyProc) (err error) {
r0, _, _ := proc.Call(uintptr(handle))
if r0 != 0 {
err = syscall.Errno(r0)
}
return
}
// SignalDaemonDump sends a signal to the daemon to write a dump file
func SignalDaemonDump(pid int) {
modkernel32 := windows.NewLazySystemDLL("kernel32.dll")
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)
}
func signalDaemonReload(pid int) error {
return fmt.Errorf("daemon reload not supported")
}
func cleanupExecRoot(c *check.C, execRoot string) {
}