go.mod github.com/Microsoft/hcsshim v0.8.16
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
610
vendor/github.com/Microsoft/hcsshim/internal/vmcompute/vmcompute.go
generated
vendored
Normal file
610
vendor/github.com/Microsoft/hcsshim/internal/vmcompute/vmcompute.go
generated
vendored
Normal file
@ -0,0 +1,610 @@
|
||||
package vmcompute
|
||||
|
||||
import (
|
||||
gcontext "context"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/Microsoft/hcsshim/internal/interop"
|
||||
"github.com/Microsoft/hcsshim/internal/log"
|
||||
"github.com/Microsoft/hcsshim/internal/logfields"
|
||||
"github.com/Microsoft/hcsshim/internal/oc"
|
||||
"github.com/Microsoft/hcsshim/internal/timeout"
|
||||
"go.opencensus.io/trace"
|
||||
)
|
||||
|
||||
//go:generate go run ../../mksyscall_windows.go -output zsyscall_windows.go vmcompute.go
|
||||
|
||||
//sys hcsEnumerateComputeSystems(query string, computeSystems **uint16, result **uint16) (hr error) = vmcompute.HcsEnumerateComputeSystems?
|
||||
//sys hcsCreateComputeSystem(id string, configuration string, identity syscall.Handle, computeSystem *HcsSystem, result **uint16) (hr error) = vmcompute.HcsCreateComputeSystem?
|
||||
//sys hcsOpenComputeSystem(id string, computeSystem *HcsSystem, result **uint16) (hr error) = vmcompute.HcsOpenComputeSystem?
|
||||
//sys hcsCloseComputeSystem(computeSystem HcsSystem) (hr error) = vmcompute.HcsCloseComputeSystem?
|
||||
//sys hcsStartComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsStartComputeSystem?
|
||||
//sys hcsShutdownComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsShutdownComputeSystem?
|
||||
//sys hcsTerminateComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsTerminateComputeSystem?
|
||||
//sys hcsPauseComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsPauseComputeSystem?
|
||||
//sys hcsResumeComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsResumeComputeSystem?
|
||||
//sys hcsGetComputeSystemProperties(computeSystem HcsSystem, propertyQuery string, properties **uint16, result **uint16) (hr error) = vmcompute.HcsGetComputeSystemProperties?
|
||||
//sys hcsModifyComputeSystem(computeSystem HcsSystem, configuration string, result **uint16) (hr error) = vmcompute.HcsModifyComputeSystem?
|
||||
//sys hcsModifyServiceSettings(settings string, result **uint16) (hr error) = vmcompute.HcsModifyServiceSettings?
|
||||
//sys hcsRegisterComputeSystemCallback(computeSystem HcsSystem, callback uintptr, context uintptr, callbackHandle *HcsCallback) (hr error) = vmcompute.HcsRegisterComputeSystemCallback?
|
||||
//sys hcsUnregisterComputeSystemCallback(callbackHandle HcsCallback) (hr error) = vmcompute.HcsUnregisterComputeSystemCallback?
|
||||
//sys hcsSaveComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) = vmcompute.HcsSaveComputeSystem?
|
||||
|
||||
//sys hcsCreateProcess(computeSystem HcsSystem, processParameters string, processInformation *HcsProcessInformation, process *HcsProcess, result **uint16) (hr error) = vmcompute.HcsCreateProcess?
|
||||
//sys hcsOpenProcess(computeSystem HcsSystem, pid uint32, process *HcsProcess, result **uint16) (hr error) = vmcompute.HcsOpenProcess?
|
||||
//sys hcsCloseProcess(process HcsProcess) (hr error) = vmcompute.HcsCloseProcess?
|
||||
//sys hcsTerminateProcess(process HcsProcess, result **uint16) (hr error) = vmcompute.HcsTerminateProcess?
|
||||
//sys hcsSignalProcess(process HcsProcess, options string, result **uint16) (hr error) = vmcompute.HcsSignalProcess?
|
||||
//sys hcsGetProcessInfo(process HcsProcess, processInformation *HcsProcessInformation, result **uint16) (hr error) = vmcompute.HcsGetProcessInfo?
|
||||
//sys hcsGetProcessProperties(process HcsProcess, processProperties **uint16, result **uint16) (hr error) = vmcompute.HcsGetProcessProperties?
|
||||
//sys hcsModifyProcess(process HcsProcess, settings string, result **uint16) (hr error) = vmcompute.HcsModifyProcess?
|
||||
//sys hcsGetServiceProperties(propertyQuery string, properties **uint16, result **uint16) (hr error) = vmcompute.HcsGetServiceProperties?
|
||||
//sys hcsRegisterProcessCallback(process HcsProcess, callback uintptr, context uintptr, callbackHandle *HcsCallback) (hr error) = vmcompute.HcsRegisterProcessCallback?
|
||||
//sys hcsUnregisterProcessCallback(callbackHandle HcsCallback) (hr error) = vmcompute.HcsUnregisterProcessCallback?
|
||||
|
||||
// errVmcomputeOperationPending is an error encountered when the operation is being completed asynchronously
|
||||
const errVmcomputeOperationPending = syscall.Errno(0xC0370103)
|
||||
|
||||
// HcsSystem is the handle associated with a created compute system.
|
||||
type HcsSystem syscall.Handle
|
||||
|
||||
// HcsProcess is the handle associated with a created process in a compute
|
||||
// system.
|
||||
type HcsProcess syscall.Handle
|
||||
|
||||
// HcsCallback is the handle associated with the function to call when events
|
||||
// occur.
|
||||
type HcsCallback syscall.Handle
|
||||
|
||||
// HcsProcessInformation is the structure used when creating or getting process
|
||||
// info.
|
||||
type HcsProcessInformation struct {
|
||||
// ProcessId is the pid of the created process.
|
||||
ProcessId uint32
|
||||
reserved uint32 //nolint:structcheck
|
||||
// StdInput is the handle associated with the stdin of the process.
|
||||
StdInput syscall.Handle
|
||||
// StdOutput is the handle associated with the stdout of the process.
|
||||
StdOutput syscall.Handle
|
||||
// StdError is the handle associated with the stderr of the process.
|
||||
StdError syscall.Handle
|
||||
}
|
||||
|
||||
func execute(ctx gcontext.Context, timeout time.Duration, f func() error) error {
|
||||
if timeout > 0 {
|
||||
var cancel gcontext.CancelFunc
|
||||
ctx, cancel = gcontext.WithTimeout(ctx, timeout)
|
||||
defer cancel()
|
||||
}
|
||||
|
||||
done := make(chan error, 1)
|
||||
go func() {
|
||||
done <- f()
|
||||
}()
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
if ctx.Err() == gcontext.DeadlineExceeded {
|
||||
log.G(ctx).WithField(logfields.Timeout, timeout).
|
||||
Warning("Syscall did not complete within operation timeout. This may indicate a platform issue. If it appears to be making no forward progress, obtain the stacks and see if there is a syscall stuck in the platform API for a significant length of time.")
|
||||
}
|
||||
return ctx.Err()
|
||||
case err := <-done:
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
func HcsEnumerateComputeSystems(ctx gcontext.Context, query string) (computeSystems, result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsEnumerateComputeSystems")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("query", query))
|
||||
|
||||
return computeSystems, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var (
|
||||
computeSystemsp *uint16
|
||||
resultp *uint16
|
||||
)
|
||||
err := hcsEnumerateComputeSystems(query, &computeSystemsp, &resultp)
|
||||
if computeSystemsp != nil {
|
||||
computeSystems = interop.ConvertAndFreeCoTaskMemString(computeSystemsp)
|
||||
}
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsCreateComputeSystem(ctx gcontext.Context, id string, configuration string, identity syscall.Handle) (computeSystem HcsSystem, result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsCreateComputeSystem")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
if hr != errVmcomputeOperationPending {
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}
|
||||
}()
|
||||
span.AddAttributes(
|
||||
trace.StringAttribute("id", id),
|
||||
trace.StringAttribute("configuration", configuration))
|
||||
|
||||
return computeSystem, result, execute(ctx, timeout.SystemCreate, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsCreateComputeSystem(id, configuration, identity, &computeSystem, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsOpenComputeSystem(ctx gcontext.Context, id string) (computeSystem HcsSystem, result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsOpenComputeSystem")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
|
||||
return computeSystem, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsOpenComputeSystem(id, &computeSystem, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsCloseComputeSystem(ctx gcontext.Context, computeSystem HcsSystem) (hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsCloseComputeSystem")
|
||||
defer span.End()
|
||||
defer func() { oc.SetSpanStatus(span, hr) }()
|
||||
|
||||
return execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
return hcsCloseComputeSystem(computeSystem)
|
||||
})
|
||||
}
|
||||
|
||||
func HcsStartComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, options string) (result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsStartComputeSystem")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
if hr != errVmcomputeOperationPending {
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("options", options))
|
||||
|
||||
return result, execute(ctx, timeout.SystemStart, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsStartComputeSystem(computeSystem, options, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsShutdownComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, options string) (result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsShutdownComputeSystem")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
if hr != errVmcomputeOperationPending {
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("options", options))
|
||||
|
||||
return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsShutdownComputeSystem(computeSystem, options, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsTerminateComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, options string) (result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsTerminateComputeSystem")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
if hr != errVmcomputeOperationPending {
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("options", options))
|
||||
|
||||
return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsTerminateComputeSystem(computeSystem, options, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsPauseComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, options string) (result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsPauseComputeSystem")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
if hr != errVmcomputeOperationPending {
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("options", options))
|
||||
|
||||
return result, execute(ctx, timeout.SystemPause, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsPauseComputeSystem(computeSystem, options, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsResumeComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, options string) (result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsResumeComputeSystem")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
if hr != errVmcomputeOperationPending {
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("options", options))
|
||||
|
||||
return result, execute(ctx, timeout.SystemResume, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsResumeComputeSystem(computeSystem, options, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsGetComputeSystemProperties(ctx gcontext.Context, computeSystem HcsSystem, propertyQuery string) (properties, result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsGetComputeSystemProperties")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("propertyQuery", propertyQuery))
|
||||
|
||||
return properties, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var (
|
||||
propertiesp *uint16
|
||||
resultp *uint16
|
||||
)
|
||||
err := hcsGetComputeSystemProperties(computeSystem, propertyQuery, &propertiesp, &resultp)
|
||||
if propertiesp != nil {
|
||||
properties = interop.ConvertAndFreeCoTaskMemString(propertiesp)
|
||||
}
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsModifyComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, configuration string) (result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsModifyComputeSystem")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("configuration", configuration))
|
||||
|
||||
return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsModifyComputeSystem(computeSystem, configuration, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsModifyServiceSettings(ctx gcontext.Context, settings string) (result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsModifyServiceSettings")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("settings", settings))
|
||||
|
||||
return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsModifyServiceSettings(settings, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsRegisterComputeSystemCallback(ctx gcontext.Context, computeSystem HcsSystem, callback uintptr, context uintptr) (callbackHandle HcsCallback, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsRegisterComputeSystemCallback")
|
||||
defer span.End()
|
||||
defer func() { oc.SetSpanStatus(span, hr) }()
|
||||
|
||||
return callbackHandle, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
return hcsRegisterComputeSystemCallback(computeSystem, callback, context, &callbackHandle)
|
||||
})
|
||||
}
|
||||
|
||||
func HcsUnregisterComputeSystemCallback(ctx gcontext.Context, callbackHandle HcsCallback) (hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsUnregisterComputeSystemCallback")
|
||||
defer span.End()
|
||||
defer func() { oc.SetSpanStatus(span, hr) }()
|
||||
|
||||
return execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
return hcsUnregisterComputeSystemCallback(callbackHandle)
|
||||
})
|
||||
}
|
||||
|
||||
func HcsCreateProcess(ctx gcontext.Context, computeSystem HcsSystem, processParameters string) (processInformation HcsProcessInformation, process HcsProcess, result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsCreateProcess")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("processParameters", processParameters))
|
||||
|
||||
return processInformation, process, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsCreateProcess(computeSystem, processParameters, &processInformation, &process, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsOpenProcess(ctx gcontext.Context, computeSystem HcsSystem, pid uint32) (process HcsProcess, result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsOpenProcess")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
span.AddAttributes(trace.Int64Attribute("pid", int64(pid)))
|
||||
|
||||
return process, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsOpenProcess(computeSystem, pid, &process, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsCloseProcess(ctx gcontext.Context, process HcsProcess) (hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsCloseProcess")
|
||||
defer span.End()
|
||||
defer func() { oc.SetSpanStatus(span, hr) }()
|
||||
|
||||
return execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
return hcsCloseProcess(process)
|
||||
})
|
||||
}
|
||||
|
||||
func HcsTerminateProcess(ctx gcontext.Context, process HcsProcess) (result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsTerminateProcess")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
|
||||
return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsTerminateProcess(process, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsSignalProcess(ctx gcontext.Context, process HcsProcess, options string) (result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsSignalProcess")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("options", options))
|
||||
|
||||
return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsSignalProcess(process, options, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsGetProcessInfo(ctx gcontext.Context, process HcsProcess) (processInformation HcsProcessInformation, result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsGetProcessInfo")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
|
||||
return processInformation, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsGetProcessInfo(process, &processInformation, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsGetProcessProperties(ctx gcontext.Context, process HcsProcess) (processProperties, result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsGetProcessProperties")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
|
||||
return processProperties, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var (
|
||||
processPropertiesp *uint16
|
||||
resultp *uint16
|
||||
)
|
||||
err := hcsGetProcessProperties(process, &processPropertiesp, &resultp)
|
||||
if processPropertiesp != nil {
|
||||
processProperties = interop.ConvertAndFreeCoTaskMemString(processPropertiesp)
|
||||
}
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsModifyProcess(ctx gcontext.Context, process HcsProcess, settings string) (result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsModifyProcess")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("settings", settings))
|
||||
|
||||
return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsModifyProcess(process, settings, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsGetServiceProperties(ctx gcontext.Context, propertyQuery string) (properties, result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsGetServiceProperties")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}()
|
||||
span.AddAttributes(trace.StringAttribute("propertyQuery", propertyQuery))
|
||||
|
||||
return properties, result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var (
|
||||
propertiesp *uint16
|
||||
resultp *uint16
|
||||
)
|
||||
err := hcsGetServiceProperties(propertyQuery, &propertiesp, &resultp)
|
||||
if propertiesp != nil {
|
||||
properties = interop.ConvertAndFreeCoTaskMemString(propertiesp)
|
||||
}
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func HcsRegisterProcessCallback(ctx gcontext.Context, process HcsProcess, callback uintptr, context uintptr) (callbackHandle HcsCallback, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsRegisterProcessCallback")
|
||||
defer span.End()
|
||||
defer func() { oc.SetSpanStatus(span, hr) }()
|
||||
|
||||
return callbackHandle, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
return hcsRegisterProcessCallback(process, callback, context, &callbackHandle)
|
||||
})
|
||||
}
|
||||
|
||||
func HcsUnregisterProcessCallback(ctx gcontext.Context, callbackHandle HcsCallback) (hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsUnregisterProcessCallback")
|
||||
defer span.End()
|
||||
defer func() { oc.SetSpanStatus(span, hr) }()
|
||||
|
||||
return execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
return hcsUnregisterProcessCallback(callbackHandle)
|
||||
})
|
||||
}
|
||||
|
||||
func HcsSaveComputeSystem(ctx gcontext.Context, computeSystem HcsSystem, options string) (result string, hr error) {
|
||||
ctx, span := trace.StartSpan(ctx, "HcsSaveComputeSystem")
|
||||
defer span.End()
|
||||
defer func() {
|
||||
if result != "" {
|
||||
span.AddAttributes(trace.StringAttribute("result", result))
|
||||
}
|
||||
if hr != errVmcomputeOperationPending {
|
||||
oc.SetSpanStatus(span, hr)
|
||||
}
|
||||
}()
|
||||
|
||||
return result, execute(ctx, timeout.SyscallWatcher, func() error {
|
||||
var resultp *uint16
|
||||
err := hcsSaveComputeSystem(computeSystem, options, &resultp)
|
||||
if resultp != nil {
|
||||
result = interop.ConvertAndFreeCoTaskMemString(resultp)
|
||||
}
|
||||
return err
|
||||
})
|
||||
}
|
581
vendor/github.com/Microsoft/hcsshim/internal/vmcompute/zsyscall_windows.go
generated
vendored
Normal file
581
vendor/github.com/Microsoft/hcsshim/internal/vmcompute/zsyscall_windows.go
generated
vendored
Normal file
@ -0,0 +1,581 @@
|
||||
// Code generated mksyscall_windows.exe DO NOT EDIT
|
||||
|
||||
package vmcompute
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
var _ unsafe.Pointer
|
||||
|
||||
// Do the interface allocations only once for common
|
||||
// Errno values.
|
||||
const (
|
||||
errnoERROR_IO_PENDING = 997
|
||||
)
|
||||
|
||||
var (
|
||||
errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
|
||||
)
|
||||
|
||||
// errnoErr returns common boxed Errno values, to prevent
|
||||
// allocations at runtime.
|
||||
func errnoErr(e syscall.Errno) error {
|
||||
switch e {
|
||||
case 0:
|
||||
return nil
|
||||
case errnoERROR_IO_PENDING:
|
||||
return errERROR_IO_PENDING
|
||||
}
|
||||
// TODO: add more here, after collecting data on the common
|
||||
// error values see on Windows. (perhaps when running
|
||||
// all.bat?)
|
||||
return e
|
||||
}
|
||||
|
||||
var (
|
||||
modvmcompute = windows.NewLazySystemDLL("vmcompute.dll")
|
||||
|
||||
procHcsEnumerateComputeSystems = modvmcompute.NewProc("HcsEnumerateComputeSystems")
|
||||
procHcsCreateComputeSystem = modvmcompute.NewProc("HcsCreateComputeSystem")
|
||||
procHcsOpenComputeSystem = modvmcompute.NewProc("HcsOpenComputeSystem")
|
||||
procHcsCloseComputeSystem = modvmcompute.NewProc("HcsCloseComputeSystem")
|
||||
procHcsStartComputeSystem = modvmcompute.NewProc("HcsStartComputeSystem")
|
||||
procHcsShutdownComputeSystem = modvmcompute.NewProc("HcsShutdownComputeSystem")
|
||||
procHcsTerminateComputeSystem = modvmcompute.NewProc("HcsTerminateComputeSystem")
|
||||
procHcsPauseComputeSystem = modvmcompute.NewProc("HcsPauseComputeSystem")
|
||||
procHcsResumeComputeSystem = modvmcompute.NewProc("HcsResumeComputeSystem")
|
||||
procHcsGetComputeSystemProperties = modvmcompute.NewProc("HcsGetComputeSystemProperties")
|
||||
procHcsModifyComputeSystem = modvmcompute.NewProc("HcsModifyComputeSystem")
|
||||
procHcsModifyServiceSettings = modvmcompute.NewProc("HcsModifyServiceSettings")
|
||||
procHcsRegisterComputeSystemCallback = modvmcompute.NewProc("HcsRegisterComputeSystemCallback")
|
||||
procHcsUnregisterComputeSystemCallback = modvmcompute.NewProc("HcsUnregisterComputeSystemCallback")
|
||||
procHcsSaveComputeSystem = modvmcompute.NewProc("HcsSaveComputeSystem")
|
||||
procHcsCreateProcess = modvmcompute.NewProc("HcsCreateProcess")
|
||||
procHcsOpenProcess = modvmcompute.NewProc("HcsOpenProcess")
|
||||
procHcsCloseProcess = modvmcompute.NewProc("HcsCloseProcess")
|
||||
procHcsTerminateProcess = modvmcompute.NewProc("HcsTerminateProcess")
|
||||
procHcsSignalProcess = modvmcompute.NewProc("HcsSignalProcess")
|
||||
procHcsGetProcessInfo = modvmcompute.NewProc("HcsGetProcessInfo")
|
||||
procHcsGetProcessProperties = modvmcompute.NewProc("HcsGetProcessProperties")
|
||||
procHcsModifyProcess = modvmcompute.NewProc("HcsModifyProcess")
|
||||
procHcsGetServiceProperties = modvmcompute.NewProc("HcsGetServiceProperties")
|
||||
procHcsRegisterProcessCallback = modvmcompute.NewProc("HcsRegisterProcessCallback")
|
||||
procHcsUnregisterProcessCallback = modvmcompute.NewProc("HcsUnregisterProcessCallback")
|
||||
)
|
||||
|
||||
func hcsEnumerateComputeSystems(query string, computeSystems **uint16, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(query)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsEnumerateComputeSystems(_p0, computeSystems, result)
|
||||
}
|
||||
|
||||
func _hcsEnumerateComputeSystems(query *uint16, computeSystems **uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsEnumerateComputeSystems.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsEnumerateComputeSystems.Addr(), 3, uintptr(unsafe.Pointer(query)), uintptr(unsafe.Pointer(computeSystems)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsCreateComputeSystem(id string, configuration string, identity syscall.Handle, computeSystem *HcsSystem, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(id)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *uint16
|
||||
_p1, hr = syscall.UTF16PtrFromString(configuration)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsCreateComputeSystem(_p0, _p1, identity, computeSystem, result)
|
||||
}
|
||||
|
||||
func _hcsCreateComputeSystem(id *uint16, configuration *uint16, identity syscall.Handle, computeSystem *HcsSystem, result **uint16) (hr error) {
|
||||
if hr = procHcsCreateComputeSystem.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procHcsCreateComputeSystem.Addr(), 5, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(configuration)), uintptr(identity), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result)), 0)
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsOpenComputeSystem(id string, computeSystem *HcsSystem, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(id)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsOpenComputeSystem(_p0, computeSystem, result)
|
||||
}
|
||||
|
||||
func _hcsOpenComputeSystem(id *uint16, computeSystem *HcsSystem, result **uint16) (hr error) {
|
||||
if hr = procHcsOpenComputeSystem.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsOpenComputeSystem.Addr(), 3, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsCloseComputeSystem(computeSystem HcsSystem) (hr error) {
|
||||
if hr = procHcsCloseComputeSystem.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsCloseComputeSystem.Addr(), 1, uintptr(computeSystem), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsStartComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(options)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsStartComputeSystem(computeSystem, _p0, result)
|
||||
}
|
||||
|
||||
func _hcsStartComputeSystem(computeSystem HcsSystem, options *uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsStartComputeSystem.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsStartComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsShutdownComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(options)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsShutdownComputeSystem(computeSystem, _p0, result)
|
||||
}
|
||||
|
||||
func _hcsShutdownComputeSystem(computeSystem HcsSystem, options *uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsShutdownComputeSystem.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsShutdownComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsTerminateComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(options)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsTerminateComputeSystem(computeSystem, _p0, result)
|
||||
}
|
||||
|
||||
func _hcsTerminateComputeSystem(computeSystem HcsSystem, options *uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsTerminateComputeSystem.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsTerminateComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsPauseComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(options)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsPauseComputeSystem(computeSystem, _p0, result)
|
||||
}
|
||||
|
||||
func _hcsPauseComputeSystem(computeSystem HcsSystem, options *uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsPauseComputeSystem.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsPauseComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsResumeComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(options)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsResumeComputeSystem(computeSystem, _p0, result)
|
||||
}
|
||||
|
||||
func _hcsResumeComputeSystem(computeSystem HcsSystem, options *uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsResumeComputeSystem.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsResumeComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsGetComputeSystemProperties(computeSystem HcsSystem, propertyQuery string, properties **uint16, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(propertyQuery)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsGetComputeSystemProperties(computeSystem, _p0, properties, result)
|
||||
}
|
||||
|
||||
func _hcsGetComputeSystemProperties(computeSystem HcsSystem, propertyQuery *uint16, properties **uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsGetComputeSystemProperties.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procHcsGetComputeSystemProperties.Addr(), 4, uintptr(computeSystem), uintptr(unsafe.Pointer(propertyQuery)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result)), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsModifyComputeSystem(computeSystem HcsSystem, configuration string, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(configuration)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsModifyComputeSystem(computeSystem, _p0, result)
|
||||
}
|
||||
|
||||
func _hcsModifyComputeSystem(computeSystem HcsSystem, configuration *uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsModifyComputeSystem.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsModifyComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(configuration)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsModifyServiceSettings(settings string, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(settings)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsModifyServiceSettings(_p0, result)
|
||||
}
|
||||
|
||||
func _hcsModifyServiceSettings(settings *uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsModifyServiceSettings.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsModifyServiceSettings.Addr(), 2, uintptr(unsafe.Pointer(settings)), uintptr(unsafe.Pointer(result)), 0)
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsRegisterComputeSystemCallback(computeSystem HcsSystem, callback uintptr, context uintptr, callbackHandle *HcsCallback) (hr error) {
|
||||
if hr = procHcsRegisterComputeSystemCallback.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procHcsRegisterComputeSystemCallback.Addr(), 4, uintptr(computeSystem), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsUnregisterComputeSystemCallback(callbackHandle HcsCallback) (hr error) {
|
||||
if hr = procHcsUnregisterComputeSystemCallback.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsUnregisterComputeSystemCallback.Addr(), 1, uintptr(callbackHandle), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsSaveComputeSystem(computeSystem HcsSystem, options string, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(options)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsSaveComputeSystem(computeSystem, _p0, result)
|
||||
}
|
||||
|
||||
func _hcsSaveComputeSystem(computeSystem HcsSystem, options *uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsSaveComputeSystem.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsSaveComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsCreateProcess(computeSystem HcsSystem, processParameters string, processInformation *HcsProcessInformation, process *HcsProcess, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(processParameters)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsCreateProcess(computeSystem, _p0, processInformation, process, result)
|
||||
}
|
||||
|
||||
func _hcsCreateProcess(computeSystem HcsSystem, processParameters *uint16, processInformation *HcsProcessInformation, process *HcsProcess, result **uint16) (hr error) {
|
||||
if hr = procHcsCreateProcess.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procHcsCreateProcess.Addr(), 5, uintptr(computeSystem), uintptr(unsafe.Pointer(processParameters)), uintptr(unsafe.Pointer(processInformation)), uintptr(unsafe.Pointer(process)), uintptr(unsafe.Pointer(result)), 0)
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsOpenProcess(computeSystem HcsSystem, pid uint32, process *HcsProcess, result **uint16) (hr error) {
|
||||
if hr = procHcsOpenProcess.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procHcsOpenProcess.Addr(), 4, uintptr(computeSystem), uintptr(pid), uintptr(unsafe.Pointer(process)), uintptr(unsafe.Pointer(result)), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsCloseProcess(process HcsProcess) (hr error) {
|
||||
if hr = procHcsCloseProcess.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsCloseProcess.Addr(), 1, uintptr(process), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsTerminateProcess(process HcsProcess, result **uint16) (hr error) {
|
||||
if hr = procHcsTerminateProcess.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsTerminateProcess.Addr(), 2, uintptr(process), uintptr(unsafe.Pointer(result)), 0)
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsSignalProcess(process HcsProcess, options string, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(options)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsSignalProcess(process, _p0, result)
|
||||
}
|
||||
|
||||
func _hcsSignalProcess(process HcsProcess, options *uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsSignalProcess.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsSignalProcess.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsGetProcessInfo(process HcsProcess, processInformation *HcsProcessInformation, result **uint16) (hr error) {
|
||||
if hr = procHcsGetProcessInfo.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsGetProcessInfo.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(processInformation)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsGetProcessProperties(process HcsProcess, processProperties **uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsGetProcessProperties.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsGetProcessProperties.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(processProperties)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsModifyProcess(process HcsProcess, settings string, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(settings)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsModifyProcess(process, _p0, result)
|
||||
}
|
||||
|
||||
func _hcsModifyProcess(process HcsProcess, settings *uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsModifyProcess.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsModifyProcess.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(settings)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsGetServiceProperties(propertyQuery string, properties **uint16, result **uint16) (hr error) {
|
||||
var _p0 *uint16
|
||||
_p0, hr = syscall.UTF16PtrFromString(propertyQuery)
|
||||
if hr != nil {
|
||||
return
|
||||
}
|
||||
return _hcsGetServiceProperties(_p0, properties, result)
|
||||
}
|
||||
|
||||
func _hcsGetServiceProperties(propertyQuery *uint16, properties **uint16, result **uint16) (hr error) {
|
||||
if hr = procHcsGetServiceProperties.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsGetServiceProperties.Addr(), 3, uintptr(unsafe.Pointer(propertyQuery)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result)))
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsRegisterProcessCallback(process HcsProcess, callback uintptr, context uintptr, callbackHandle *HcsCallback) (hr error) {
|
||||
if hr = procHcsRegisterProcessCallback.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall6(procHcsRegisterProcessCallback.Addr(), 4, uintptr(process), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func hcsUnregisterProcessCallback(callbackHandle HcsCallback) (hr error) {
|
||||
if hr = procHcsUnregisterProcessCallback.Find(); hr != nil {
|
||||
return
|
||||
}
|
||||
r0, _, _ := syscall.Syscall(procHcsUnregisterProcessCallback.Addr(), 1, uintptr(callbackHandle), 0, 0)
|
||||
if int32(r0) < 0 {
|
||||
if r0&0x1fff0000 == 0x00070000 {
|
||||
r0 &= 0xffff
|
||||
}
|
||||
hr = syscall.Errno(r0)
|
||||
}
|
||||
return
|
||||
}
|
Reference in New Issue
Block a user