Bladeren bron

Revendor hcsshim to v0.5.1

Signed-off-by: Darren Stahl <darst@microsoft.com>
Darren Stahl 8 jaren geleden
bovenliggende
commit
267c04aa36

+ 1 - 1
hack/vendor.sh

@@ -48,7 +48,7 @@ esac
 
 # the following lines are in sorted order, FYI
 clone git github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62
-clone git github.com/Microsoft/hcsshim v0.4.5
+clone git github.com/Microsoft/hcsshim v0.5.1
 clone git github.com/Microsoft/go-winio v0.3.4
 clone git github.com/Sirupsen/logrus v0.10.0 # logrus is a common dependency among multiple deps
 clone git github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a

+ 2 - 2
libcontainerd/client_windows.go

@@ -278,8 +278,8 @@ func (clnt *client) AddProcess(ctx context.Context, containerID, processFriendly
 		CreateStdOutPipe: true,
 		CreateStdErrPipe: !procToAdd.Terminal,
 	}
-	createProcessParms.ConsoleSize[0] = int(procToAdd.ConsoleSize.Height)
-	createProcessParms.ConsoleSize[1] = int(procToAdd.ConsoleSize.Width)
+	createProcessParms.ConsoleSize[0] = uint(procToAdd.ConsoleSize.Height)
+	createProcessParms.ConsoleSize[1] = uint(procToAdd.ConsoleSize.Width)
 
 	// Take working directory from the process to add if it is defined,
 	// otherwise take from the first process.

+ 2 - 2
libcontainerd/container_windows.go

@@ -73,8 +73,8 @@ func (ctr *container) start() error {
 		CreateStdOutPipe: !isServicing,
 		CreateStdErrPipe: !ctr.ociSpec.Process.Terminal && !isServicing,
 	}
-	createProcessParms.ConsoleSize[0] = int(ctr.ociSpec.Process.ConsoleSize.Height)
-	createProcessParms.ConsoleSize[1] = int(ctr.ociSpec.Process.ConsoleSize.Width)
+	createProcessParms.ConsoleSize[0] = uint(ctr.ociSpec.Process.ConsoleSize.Height)
+	createProcessParms.ConsoleSize[1] = uint(ctr.ociSpec.Process.ConsoleSize.Width)
 
 	// Configure the environment for the process
 	createProcessParms.Environment = setupEnvironmentVariables(ctr.ociSpec.Process.Env)

+ 92 - 75
vendor/src/github.com/Microsoft/hcsshim/container.go

@@ -3,6 +3,7 @@ package hcsshim
 import (
 	"encoding/json"
 	"runtime"
+	"sync"
 	"syscall"
 	"time"
 
@@ -20,6 +21,7 @@ const (
 )
 
 type container struct {
+	handleLock     sync.RWMutex
 	handle         hcsSystem
 	id             string
 	callbackNumber uintptr
@@ -116,20 +118,15 @@ func CreateContainer(id string, c *ContainerConfig) (Container, error) {
 	logrus.Debugf(title+" id=%s config=%s", id, configuration)
 
 	var (
-		resultp     *uint16
-		createError error
+		resultp  *uint16
+		identity syscall.Handle
 	)
-	if hcsCallbacksSupported {
-		var identity syscall.Handle
-		createError = hcsCreateComputeSystem(id, configuration, identity, &container.handle, &resultp)
-
-		if createError == nil || IsPending(createError) {
-			if err := container.registerCallback(); err != nil {
-				return nil, makeContainerError(container, operation, "", err)
-			}
+	createError := hcsCreateComputeSystem(id, configuration, identity, &container.handle, &resultp)
+
+	if createError == nil || IsPending(createError) {
+		if err := container.registerCallback(); err != nil {
+			return nil, makeContainerError(container, operation, "", err)
 		}
-	} else {
-		createError = hcsCreateComputeSystemTP5(id, configuration, &container.handle, &resultp)
 	}
 
 	err = processAsyncHcsResult(createError, resultp, container.callbackNumber, hcsNotificationSystemCreateCompleted, &defaultTimeout)
@@ -171,12 +168,18 @@ func OpenContainer(id string) (Container, error) {
 
 // Start synchronously starts the container.
 func (container *container) Start() error {
+	container.handleLock.RLock()
+	defer container.handleLock.RUnlock()
 	operation := "Start"
 	title := "HCSShim::Container::" + operation
 	logrus.Debugf(title+" id=%s", container.id)
 
+	if container.handle == 0 {
+		return makeContainerError(container, operation, "", ErrInvalidHandle)
+	}
+
 	var resultp *uint16
-	err := hcsStartComputeSystemTP5(container.handle, nil, &resultp)
+	err := hcsStartComputeSystem(container.handle, "", &resultp)
 	err = processAsyncHcsResult(err, resultp, container.callbackNumber, hcsNotificationSystemStartCompleted, &defaultTimeout)
 	if err != nil {
 		return makeContainerError(container, operation, "", err)
@@ -189,12 +192,18 @@ func (container *container) Start() error {
 // Shutdown requests a container shutdown, if IsPending() on the error returned is true,
 // it may not actually be shut down until Wait() succeeds.
 func (container *container) Shutdown() error {
+	container.handleLock.RLock()
+	defer container.handleLock.RUnlock()
 	operation := "Shutdown"
 	title := "HCSShim::Container::" + operation
 	logrus.Debugf(title+" id=%s", container.id)
 
+	if container.handle == 0 {
+		return makeContainerError(container, operation, "", ErrInvalidHandle)
+	}
+
 	var resultp *uint16
-	err := hcsShutdownComputeSystemTP5(container.handle, nil, &resultp)
+	err := hcsShutdownComputeSystem(container.handle, "", &resultp)
 	err = processHcsResult(err, resultp)
 	if err != nil {
 		return makeContainerError(container, operation, "", err)
@@ -207,12 +216,18 @@ func (container *container) Shutdown() error {
 // Terminate requests a container terminate, if IsPending() on the error returned is true,
 // it may not actually be shut down until Wait() succeeds.
 func (container *container) Terminate() error {
+	container.handleLock.RLock()
+	defer container.handleLock.RUnlock()
 	operation := "Terminate"
 	title := "HCSShim::Container::" + operation
 	logrus.Debugf(title+" id=%s", container.id)
 
+	if container.handle == 0 {
+		return makeContainerError(container, operation, "", ErrInvalidHandle)
+	}
+
 	var resultp *uint16
-	err := hcsTerminateComputeSystemTP5(container.handle, nil, &resultp)
+	err := hcsTerminateComputeSystem(container.handle, "", &resultp)
 	err = processHcsResult(err, resultp)
 	if err != nil {
 		return makeContainerError(container, operation, "", err)
@@ -228,26 +243,15 @@ func (container *container) Wait() error {
 	title := "HCSShim::Container::" + operation
 	logrus.Debugf(title+" id=%s", container.id)
 
-	if hcsCallbacksSupported {
-		err := waitForNotification(container.callbackNumber, hcsNotificationSystemExited, nil)
-		if err != nil {
-			return makeContainerError(container, operation, "", err)
-		}
-	} else {
-		_, err := container.waitTimeoutInternal(syscall.INFINITE)
-		if err != nil {
-			return makeContainerError(container, operation, "", err)
-		}
+	err := waitForNotification(container.callbackNumber, hcsNotificationSystemExited, nil)
+	if err != nil {
+		return makeContainerError(container, operation, "", err)
 	}
 
 	logrus.Debugf(title+" succeeded id=%s", container.id)
 	return nil
 }
 
-func (container *container) waitTimeoutInternal(timeout uint32) (bool, error) {
-	return waitTimeoutInternalHelper(container, timeout)
-}
-
 // WaitTimeout synchronously waits for the container to terminate or the duration to elapse.
 // If the timeout expires, IsTimeout(err) == true
 func (container *container) WaitTimeout(timeout time.Duration) error {
@@ -255,41 +259,15 @@ func (container *container) WaitTimeout(timeout time.Duration) error {
 	title := "HCSShim::Container::" + operation
 	logrus.Debugf(title+" id=%s", container.id)
 
-	if hcsCallbacksSupported {
-		err := waitForNotification(container.callbackNumber, hcsNotificationSystemExited, &timeout)
-		if err != nil {
-			return makeContainerError(container, operation, "", err)
-		}
-	} else {
-		finished, err := waitTimeoutHelper(container, timeout)
-		if !finished {
-			err = ErrTimeout
-		}
-		if err != nil {
-			return makeContainerError(container, operation, "", err)
-		}
+	err := waitForNotification(container.callbackNumber, hcsNotificationSystemExited, &timeout)
+	if err != nil {
+		return makeContainerError(container, operation, "", err)
 	}
 
 	logrus.Debugf(title+" succeeded id=%s", container.id)
 	return nil
 }
 
-func (container *container) hcsWait(timeout uint32) (bool, error) {
-	var (
-		resultp   *uint16
-		exitEvent syscall.Handle
-	)
-
-	err := hcsCreateComputeSystemWait(container.handle, &exitEvent, &resultp)
-	err = processHcsResult(err, resultp)
-	if err != nil {
-		return false, err
-	}
-	defer syscall.CloseHandle(exitEvent)
-
-	return waitForSingleObject(exitEvent, timeout)
-}
-
 func (container *container) properties(query string) (*containerProperties, error) {
 	var (
 		resultp     *uint16
@@ -314,9 +292,16 @@ func (container *container) properties(query string) (*containerProperties, erro
 
 // HasPendingUpdates returns true if the container has updates pending to install
 func (container *container) HasPendingUpdates() (bool, error) {
+	container.handleLock.RLock()
+	defer container.handleLock.RUnlock()
 	operation := "HasPendingUpdates"
 	title := "HCSShim::Container::" + operation
 	logrus.Debugf(title+" id=%s", container.id)
+
+	if container.handle == 0 {
+		return false, makeContainerError(container, operation, "", ErrInvalidHandle)
+	}
+
 	properties, err := container.properties(pendingUpdatesQuery)
 	if err != nil {
 		return false, makeContainerError(container, operation, "", err)
@@ -328,9 +313,16 @@ func (container *container) HasPendingUpdates() (bool, error) {
 
 // Statistics returns statistics for the container
 func (container *container) Statistics() (Statistics, error) {
+	container.handleLock.RLock()
+	defer container.handleLock.RUnlock()
 	operation := "Statistics"
 	title := "HCSShim::Container::" + operation
 	logrus.Debugf(title+" id=%s", container.id)
+
+	if container.handle == 0 {
+		return Statistics{}, makeContainerError(container, operation, "", ErrInvalidHandle)
+	}
+
 	properties, err := container.properties(statisticsQuery)
 	if err != nil {
 		return Statistics{}, makeContainerError(container, operation, "", err)
@@ -342,9 +334,16 @@ func (container *container) Statistics() (Statistics, error) {
 
 // ProcessList returns an array of ProcessListItems for the container
 func (container *container) ProcessList() ([]ProcessListItem, error) {
+	container.handleLock.RLock()
+	defer container.handleLock.RUnlock()
 	operation := "ProcessList"
 	title := "HCSShim::Container::" + operation
 	logrus.Debugf(title+" id=%s", container.id)
+
+	if container.handle == 0 {
+		return nil, makeContainerError(container, operation, "", ErrInvalidHandle)
+	}
+
 	properties, err := container.properties(processListQuery)
 	if err != nil {
 		return nil, makeContainerError(container, operation, "", err)
@@ -356,12 +355,18 @@ func (container *container) ProcessList() ([]ProcessListItem, error) {
 
 // Pause pauses the execution of the container. This feature is not enabled in TP5.
 func (container *container) Pause() error {
+	container.handleLock.RLock()
+	defer container.handleLock.RUnlock()
 	operation := "Pause"
 	title := "HCSShim::Container::" + operation
 	logrus.Debugf(title+" id=%s", container.id)
 
+	if container.handle == 0 {
+		return makeContainerError(container, operation, "", ErrInvalidHandle)
+	}
+
 	var resultp *uint16
-	err := hcsPauseComputeSystemTP5(container.handle, nil, &resultp)
+	err := hcsPauseComputeSystem(container.handle, "", &resultp)
 	err = processAsyncHcsResult(err, resultp, container.callbackNumber, hcsNotificationSystemPauseCompleted, &defaultTimeout)
 	if err != nil {
 		return makeContainerError(container, operation, "", err)
@@ -373,14 +378,18 @@ func (container *container) Pause() error {
 
 // Resume resumes the execution of the container. This feature is not enabled in TP5.
 func (container *container) Resume() error {
+	container.handleLock.RLock()
+	defer container.handleLock.RUnlock()
 	operation := "Resume"
 	title := "HCSShim::Container::" + operation
 	logrus.Debugf(title+" id=%s", container.id)
-	var (
-		resultp *uint16
-	)
 
-	err := hcsResumeComputeSystemTP5(container.handle, nil, &resultp)
+	if container.handle == 0 {
+		return makeContainerError(container, operation, "", ErrInvalidHandle)
+	}
+
+	var resultp *uint16
+	err := hcsResumeComputeSystem(container.handle, "", &resultp)
 	err = processAsyncHcsResult(err, resultp, container.callbackNumber, hcsNotificationSystemResumeCompleted, &defaultTimeout)
 	if err != nil {
 		return makeContainerError(container, operation, "", err)
@@ -392,6 +401,8 @@ func (container *container) Resume() error {
 
 // CreateProcess launches a new process within the container.
 func (container *container) CreateProcess(c *ProcessConfig) (Process, error) {
+	container.handleLock.RLock()
+	defer container.handleLock.RUnlock()
 	operation := "CreateProcess"
 	title := "HCSShim::Container::" + operation
 	var (
@@ -400,6 +411,10 @@ func (container *container) CreateProcess(c *ProcessConfig) (Process, error) {
 		resultp       *uint16
 	)
 
+	if container.handle == 0 {
+		return nil, makeContainerError(container, operation, "", ErrInvalidHandle)
+	}
+
 	// If we are not emulating a console, ignore any console size passed to us
 	if !c.EmulateConsole {
 		c.ConsoleSize[0] = 0
@@ -431,10 +446,8 @@ func (container *container) CreateProcess(c *ProcessConfig) (Process, error) {
 		},
 	}
 
-	if hcsCallbacksSupported {
-		if err := process.registerCallback(); err != nil {
-			return nil, makeContainerError(container, operation, "", err)
-		}
+	if err := process.registerCallback(); err != nil {
+		return nil, makeContainerError(container, operation, "", err)
 	}
 
 	logrus.Debugf(title+" succeeded id=%s processid=%s", container.id, process.processID)
@@ -444,6 +457,8 @@ func (container *container) CreateProcess(c *ProcessConfig) (Process, error) {
 
 // OpenProcess gets an interface to an existing process within the container.
 func (container *container) OpenProcess(pid int) (Process, error) {
+	container.handleLock.RLock()
+	defer container.handleLock.RUnlock()
 	operation := "OpenProcess"
 	title := "HCSShim::Container::" + operation
 	logrus.Debugf(title+" id=%s, processid=%d", container.id, pid)
@@ -452,6 +467,10 @@ func (container *container) OpenProcess(pid int) (Process, error) {
 		resultp       *uint16
 	)
 
+	if container.handle == 0 {
+		return nil, makeContainerError(container, operation, "", ErrInvalidHandle)
+	}
+
 	err := hcsOpenProcess(container.handle, uint32(pid), &processHandle, &resultp)
 	err = processHcsResult(err, resultp)
 	if err != nil {
@@ -464,10 +483,8 @@ func (container *container) OpenProcess(pid int) (Process, error) {
 		container: container,
 	}
 
-	if hcsCallbacksSupported {
-		if err := process.registerCallback(); err != nil {
-			return nil, makeContainerError(container, operation, "", err)
-		}
+	if err := process.registerCallback(); err != nil {
+		return nil, makeContainerError(container, operation, "", err)
 	}
 
 	logrus.Debugf(title+" succeeded id=%s processid=%s", container.id, process.processID)
@@ -477,6 +494,8 @@ func (container *container) OpenProcess(pid int) (Process, error) {
 
 // Close cleans up any state associated with the container but does not terminate or wait for it.
 func (container *container) Close() error {
+	container.handleLock.Lock()
+	defer container.handleLock.Unlock()
 	operation := "Close"
 	title := "HCSShim::Container::" + operation
 	logrus.Debugf(title+" id=%s", container.id)
@@ -486,10 +505,8 @@ func (container *container) Close() error {
 		return nil
 	}
 
-	if hcsCallbacksSupported {
-		if err := container.unregisterCallback(); err != nil {
-			return makeContainerError(container, operation, "", err)
-		}
+	if err := container.unregisterCallback(); err != nil {
+		return makeContainerError(container, operation, "", err)
 	}
 
 	if err := hcsCloseComputeSystem(container.handle); err != nil {

+ 13 - 5
vendor/src/github.com/Microsoft/hcsshim/errors.go

@@ -16,6 +16,9 @@ var (
 	// ErrHandleClose is an error encountered when the handle generating the notification being waited on has been closed
 	ErrHandleClose = errors.New("hcsshim: the handle generating this notification has been closed")
 
+	// ErrInvalidHandle is an error encountered when using an invalid handle
+	ErrInvalidHandle = errors.New("hcsshim: the handle is invalid")
+
 	// ErrInvalidNotificationType is an error encountered when an invalid notification type is used
 	ErrInvalidNotificationType = errors.New("hcsshim: invalid notification type")
 
@@ -80,8 +83,13 @@ func (e *ContainerError) Error() string {
 		s += " encountered an error during " + e.Operation
 	}
 
-	if e.Err != nil {
-		s += fmt.Sprintf(" failed in Win32: %s (0x%x)", e.Err, win32FromError(e.Err))
+	switch e.Err.(type) {
+	case nil:
+		break
+	case syscall.Errno:
+		s += fmt.Sprintf(": failure in a Windows system call: %s (0x%x)", e.Err, win32FromError(e.Err))
+	default:
+		s += fmt.Sprintf(": %s", e.Err.Error())
 	}
 
 	if e.ExtraInfo != "" {
@@ -116,16 +124,16 @@ func (e *ProcessError) Error() string {
 	}
 
 	if e.Operation != "" {
-		s += " " + e.Operation
+		s += " encountered an error during " + e.Operation
 	}
 
 	switch e.Err.(type) {
 	case nil:
 		break
 	case syscall.Errno:
-		s += fmt.Sprintf(" failed in Win32: %s (0x%x)", e.Err, win32FromError(e.Err))
+		s += fmt.Sprintf(": failure in a Windows system call: %s (0x%x)", e.Err, win32FromError(e.Err))
 	default:
-		s += fmt.Sprintf(" failed: %s", e.Error())
+		s += fmt.Sprintf(": %s", e.Err.Error())
 	}
 
 	return s

+ 5 - 22
vendor/src/github.com/Microsoft/hcsshim/hcsshim.go

@@ -44,16 +44,6 @@ import (
 //sys exportLayerRead(context uintptr, buffer []byte, bytesRead *uint32) (hr error) = vmcompute.ExportLayerRead?
 //sys exportLayerEnd(context uintptr) (hr error) = vmcompute.ExportLayerEnd?
 
-//sys createComputeSystem(id string, configuration string) (hr error) = vmcompute.CreateComputeSystem?
-//sys createProcessWithStdHandlesInComputeSystem(id string, paramsJson string, pid *uint32, stdin *syscall.Handle, stdout *syscall.Handle, stderr *syscall.Handle) (hr error) = vmcompute.CreateProcessWithStdHandlesInComputeSystem?
-//sys resizeConsoleInComputeSystem(id string, pid uint32, height uint16, width uint16, flags uint32) (hr error) = vmcompute.ResizeConsoleInComputeSystem?
-//sys shutdownComputeSystem(id string, timeout uint32) (hr error) = vmcompute.ShutdownComputeSystem?
-//sys startComputeSystem(id string) (hr error) = vmcompute.StartComputeSystem?
-//sys terminateComputeSystem(id string) (hr error) = vmcompute.TerminateComputeSystem?
-//sys terminateProcessInComputeSystem(id string, pid uint32) (hr error) = vmcompute.TerminateProcessInComputeSystem?
-//sys waitForProcessInComputeSystem(id string, pid uint32, timeout uint32, exitCode *uint32) (hr error) = vmcompute.WaitForProcessInComputeSystem?
-//sys getComputeSystemProperties(id string, flags uint32, properties **uint16) (hr error) = vmcompute.GetComputeSystemProperties?
-
 //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?
@@ -65,7 +55,9 @@ import (
 //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 hcsCreateComputeSystemWait(computeSystem hcsSystem, exitEvent *syscall.Handle, result **uint16) (hr error) = vmcompute.HcsCreateComputeSystemWait?
+//sys hcsRegisterComputeSystemCallback(computeSystem hcsSystem, callback uintptr, context uintptr, callbackHandle *hcsCallback) (hr error) = vmcompute.HcsRegisterComputeSystemCallback?
+//sys hcsUnregisterComputeSystemCallback(callbackHandle hcsCallback) (hr error) = vmcompute.HcsUnregisterComputeSystemCallback?
+
 //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?
@@ -73,21 +65,12 @@ import (
 //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 hcsCreateProcessWait(process hcsProcess, settings *syscall.Handle, result **uint16) (hr error) = vmcompute.HcsCreateProcessWait?
 //sys hcsGetServiceProperties(propertyQuery string, properties **uint16, result **uint16) (hr error) = vmcompute.HcsGetServiceProperties?
-//sys hcsModifyServiceSettings(settings string, result **uint16) (hr error) = vmcompute.HcsModifyServiceSettings?
-
-//sys hcsCreateComputeSystemTP5(id string, configuration string, computeSystem *hcsSystem, result **uint16) (hr error) = vmcompute.HcsCreateComputeSystem?
-//sys hcsStartComputeSystemTP5(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) = vmcompute.HcsStartComputeSystem?
-//sys hcsShutdownComputeSystemTP5(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) = vmcompute.HcsShutdownComputeSystem?
-//sys hcsTerminateComputeSystemTP5(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) = vmcompute.HcsTerminateComputeSystem?
-//sys hcsPauseComputeSystemTP5(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) = vmcompute.HcsPauseComputeSystem?
-//sys hcsResumeComputeSystemTP5(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) = vmcompute.HcsResumeComputeSystem?
-//sys hcsRegisterComputeSystemCallback(computeSystem hcsSystem, callback uintptr, context uintptr, callbackHandle *hcsCallback) (hr error) = vmcompute.HcsRegisterComputeSystemCallback?
-//sys hcsUnregisterComputeSystemCallback(callbackHandle hcsCallback) (hr error) = vmcompute.HcsUnregisterComputeSystemCallback?
 //sys hcsRegisterProcessCallback(process hcsProcess, callback uintptr, context uintptr, callbackHandle *hcsCallback) (hr error) = vmcompute.HcsRegisterProcessCallback?
 //sys hcsUnregisterProcessCallback(callbackHandle hcsCallback) (hr error) = vmcompute.HcsUnregisterProcessCallback?
 
+//sys hcsModifyServiceSettings(settings string, result **uint16) (hr error) = vmcompute.HcsModifyServiceSettings?
+
 //sys _hnsCall(method string, path string, object string, response **uint16) (hr error) = vmcompute.HNSCall?
 
 const (

+ 11 - 9
vendor/src/github.com/Microsoft/hcsshim/interface.go

@@ -16,7 +16,7 @@ type ProcessConfig struct {
 	CreateStdInPipe  bool
 	CreateStdOutPipe bool
 	CreateStdErrPipe bool
-	ConsoleSize      [2]int
+	ConsoleSize      [2]uint
 }
 
 type Layer struct {
@@ -25,9 +25,11 @@ type Layer struct {
 }
 
 type MappedDir struct {
-	HostPath      string
-	ContainerPath string
-	ReadOnly      bool
+	HostPath         string
+	ContainerPath    string
+	ReadOnly         bool
+	BandwidthMaximum uint64
+	IOPSMaximum      uint64
 }
 
 type HvRuntime struct {
@@ -42,10 +44,10 @@ type ContainerConfig struct {
 	Name                     string      // Name of the container. We use the docker ID.
 	Owner                    string      // The management platform that created this container
 	IsDummy                  bool        // Used for development purposes.
-	VolumePath               string      // Windows volume path for scratch space
+	VolumePath               string      `json:",omitempty"` // Windows volume path for scratch space. Used by Windows Server Containers only. Format \\?\\Volume{GUID}
 	IgnoreFlushesDuringBoot  bool        // Optimization hint for container startup in Windows
-	LayerFolderPath          string      // Where the layer folders are located
-	Layers                   []Layer     // List of storage layers
+	LayerFolderPath          string      `json:",omitempty"` // Where the layer folders are located. Used by Windows Server Containers only. Format  %root%\windowsfilter\containerID
+	Layers                   []Layer     // List of storage layers. Required for Windows Server and Hyper-V Containers. Format ID=GUID;Path=%root%\windowsfilter\layerID
 	Credentials              string      `json:",omitempty"` // Credentials information
 	ProcessorCount           uint32      `json:",omitempty"` // Number of processors to assign to the container.
 	ProcessorWeight          uint64      `json:",omitempty"` // CPU Shares 0..10000 on Windows; where 0 will be omitted and HCS will default.
@@ -56,10 +58,10 @@ type ContainerConfig struct {
 	MemoryMaximumInMB        int64       `json:",omitempty"` // Maximum memory available to the container in Megabytes
 	HostName                 string      // Hostname
 	MappedDirectories        []MappedDir // List of mapped directories (volumes/mounts)
-	SandboxPath              string      // Location of unmounted sandbox (used for Hyper-V containers)
+	SandboxPath              string      `json:",omitempty"` // Location of unmounted sandbox. Used by Hyper-V containers only. Format %root%\windowsfilter
 	HvPartition              bool        // True if it a Hyper-V Container
 	EndpointList             []string    // List of networking endpoints to be attached to container
-	HvRuntime                *HvRuntime  // Hyper-V container settings
+	HvRuntime                *HvRuntime  `json:",omitempty"` // Hyper-V container settings. Used by Hyper-V containers only. Format ImagePath=%root%\BaseLayerID\UtilityVM
 	Servicing                bool        // True if this container is for servicing
 	AllowUnqualifiedDNSQuery bool        // True to allow unqualified DNS name resolution
 }

+ 46 - 46
vendor/src/github.com/Microsoft/hcsshim/process.go

@@ -3,6 +3,7 @@ package hcsshim
 import (
 	"encoding/json"
 	"io"
+	"sync"
 	"syscall"
 	"time"
 
@@ -11,6 +12,7 @@ import (
 
 // ContainerError is an error encountered in HCS
 type process struct {
+	handleLock     sync.RWMutex
 	handle         hcsProcess
 	processID      int
 	container      *container
@@ -64,10 +66,16 @@ func (process *process) Pid() int {
 
 // Kill signals the process to terminate but does not wait for it to finish terminating.
 func (process *process) Kill() error {
+	process.handleLock.RLock()
+	defer process.handleLock.RUnlock()
 	operation := "Kill"
 	title := "HCSShim::Process::" + operation
 	logrus.Debugf(title+" processid=%d", process.processID)
 
+	if process.handle == 0 {
+		return makeProcessError(process, operation, "", ErrInvalidHandle)
+	}
+
 	var resultp *uint16
 	err := hcsTerminateProcess(process.handle, &resultp)
 	err = processHcsResult(err, resultp)
@@ -85,16 +93,9 @@ func (process *process) Wait() error {
 	title := "HCSShim::Process::" + operation
 	logrus.Debugf(title+" processid=%d", process.processID)
 
-	if hcsCallbacksSupported {
-		err := waitForNotification(process.callbackNumber, hcsNotificationProcessExited, nil)
-		if err != nil {
-			return makeProcessError(process, operation, "", err)
-		}
-	} else {
-		_, err := process.waitTimeoutInternal(syscall.INFINITE)
-		if err != nil {
-			return makeProcessError(process, operation, "", err)
-		}
+	err := waitForNotification(process.callbackNumber, hcsNotificationProcessExited, nil)
+	if err != nil {
+		return makeProcessError(process, operation, "", err)
 	}
 
 	logrus.Debugf(title+" succeeded processid=%d", process.processID)
@@ -108,51 +109,28 @@ func (process *process) WaitTimeout(timeout time.Duration) error {
 	title := "HCSShim::Process::" + operation
 	logrus.Debugf(title+" processid=%d", process.processID)
 
-	if hcsCallbacksSupported {
-		err := waitForNotification(process.callbackNumber, hcsNotificationProcessExited, &timeout)
-		if err != nil {
-			return makeProcessError(process, operation, "", err)
-		}
-	} else {
-		finished, err := waitTimeoutHelper(process, timeout)
-		if !finished {
-			err = ErrTimeout
-		}
-		if err != nil {
-			return makeProcessError(process, operation, "", err)
-		}
+	err := waitForNotification(process.callbackNumber, hcsNotificationProcessExited, &timeout)
+	if err != nil {
+		return makeProcessError(process, operation, "", err)
 	}
 
 	logrus.Debugf(title+" succeeded processid=%d", process.processID)
 	return nil
 }
 
-func (process *process) hcsWait(timeout uint32) (bool, error) {
-	var (
-		resultp   *uint16
-		exitEvent syscall.Handle
-	)
-	err := hcsCreateProcessWait(process.handle, &exitEvent, &resultp)
-	err = processHcsResult(err, resultp)
-	if err != nil {
-		return false, err
-	}
-	defer syscall.CloseHandle(exitEvent)
-
-	return waitForSingleObject(exitEvent, timeout)
-}
-
-func (process *process) waitTimeoutInternal(timeout uint32) (bool, error) {
-	return waitTimeoutInternalHelper(process, timeout)
-}
-
 // ExitCode returns the exit code of the process. The process must have
 // already terminated.
 func (process *process) ExitCode() (int, error) {
+	process.handleLock.RLock()
+	defer process.handleLock.RUnlock()
 	operation := "ExitCode"
 	title := "HCSShim::Process::" + operation
 	logrus.Debugf(title+" processid=%d", process.processID)
 
+	if process.handle == 0 {
+		return 0, makeProcessError(process, operation, "", ErrInvalidHandle)
+	}
+
 	properties, err := process.properties()
 	if err != nil {
 		return 0, makeProcessError(process, operation, "", err)
@@ -162,16 +140,26 @@ func (process *process) ExitCode() (int, error) {
 		return 0, makeProcessError(process, operation, "", ErrInvalidProcessState)
 	}
 
+	if properties.LastWaitResult != 0 {
+		return 0, makeProcessError(process, operation, "", syscall.Errno(properties.LastWaitResult))
+	}
+
 	logrus.Debugf(title+" succeeded processid=%d exitCode=%d", process.processID, properties.ExitCode)
 	return int(properties.ExitCode), nil
 }
 
 // ResizeConsole resizes the console of the process.
 func (process *process) ResizeConsole(width, height uint16) error {
+	process.handleLock.RLock()
+	defer process.handleLock.RUnlock()
 	operation := "ResizeConsole"
 	title := "HCSShim::Process::" + operation
 	logrus.Debugf(title+" processid=%d", process.processID)
 
+	if process.handle == 0 {
+		return makeProcessError(process, operation, "", ErrInvalidHandle)
+	}
+
 	modifyRequest := processModifyRequest{
 		Operation: modifyConsoleSize,
 		ConsoleSize: &consoleSize{
@@ -231,10 +219,16 @@ func (process *process) properties() (*processStatus, error) {
 // these pipes does not close the underlying pipes; it should be possible to
 // call this multiple times to get multiple interfaces.
 func (process *process) Stdio() (io.WriteCloser, io.ReadCloser, io.ReadCloser, error) {
+	process.handleLock.RLock()
+	defer process.handleLock.RUnlock()
 	operation := "Stdio"
 	title := "HCSShim::Process::" + operation
 	logrus.Debugf(title+" processid=%d", process.processID)
 
+	if process.handle == 0 {
+		return nil, nil, nil, makeProcessError(process, operation, "", ErrInvalidHandle)
+	}
+
 	var stdIn, stdOut, stdErr syscall.Handle
 
 	if process.cachedPipes == nil {
@@ -269,10 +263,16 @@ func (process *process) Stdio() (io.WriteCloser, io.ReadCloser, io.ReadCloser, e
 // CloseStdin closes the write side of the stdin pipe so that the process is
 // notified on the read side that there is no more data in stdin.
 func (process *process) CloseStdin() error {
+	process.handleLock.RLock()
+	defer process.handleLock.RUnlock()
 	operation := "CloseStdin"
 	title := "HCSShim::Process::" + operation
 	logrus.Debugf(title+" processid=%d", process.processID)
 
+	if process.handle == 0 {
+		return makeProcessError(process, operation, "", ErrInvalidHandle)
+	}
+
 	modifyRequest := processModifyRequest{
 		Operation: modifyCloseHandle,
 		CloseHandle: &closeHandle{
@@ -301,6 +301,8 @@ func (process *process) CloseStdin() error {
 // Close cleans up any state associated with the process but does not kill
 // or wait on it.
 func (process *process) Close() error {
+	process.handleLock.Lock()
+	defer process.handleLock.Unlock()
 	operation := "Close"
 	title := "HCSShim::Process::" + operation
 	logrus.Debugf(title+" processid=%d", process.processID)
@@ -310,10 +312,8 @@ func (process *process) Close() error {
 		return nil
 	}
 
-	if hcsCallbacksSupported {
-		if err := process.unregisterCallback(); err != nil {
-			return makeProcessError(process, operation, "", err)
-		}
+	if err := process.unregisterCallback(); err != nil {
+		return makeProcessError(process, operation, "", err)
 	}
 
 	if err := hcsCloseProcess(process.handle); err != nil {

+ 0 - 6
vendor/src/github.com/Microsoft/hcsshim/utils.go

@@ -7,12 +7,6 @@ import (
 	"github.com/Microsoft/go-winio"
 )
 
-var (
-	vmcomputedll          = syscall.NewLazyDLL("vmcompute.dll")
-	hcsCallbackAPI        = vmcomputedll.NewProc("HcsRegisterComputeSystemCallback")
-	hcsCallbacksSupported = hcsCallbackAPI.Find() == nil
-)
-
 // makeOpenFiles calls winio.MakeOpenFile for each handle in a slice but closes all the handles
 // if there is an error.
 func makeOpenFiles(hs []syscall.Handle) (_ []io.ReadWriteCloser, err error) {

+ 2 - 44
vendor/src/github.com/Microsoft/hcsshim/waithelper.go

@@ -1,52 +1,10 @@
 package hcsshim
 
 import (
-	"github.com/Sirupsen/logrus"
-	"syscall"
 	"time"
-)
-
-type waitable interface {
-	waitTimeoutInternal(timeout uint32) (bool, error)
-	hcsWait(timeout uint32) (bool, error)
-}
-
-func waitTimeoutHelper(object waitable, timeout time.Duration) (bool, error) {
-	var (
-		millis uint32
-	)
-
-	for totalMillis := uint64(timeout / time.Millisecond); totalMillis > 0; totalMillis = totalMillis - uint64(millis) {
-		if totalMillis >= syscall.INFINITE {
-			millis = syscall.INFINITE - 1
-		} else {
-			millis = uint32(totalMillis)
-		}
-
-		result, err := object.waitTimeoutInternal(millis)
-
-		if err != nil {
-			return result, err
-		}
-	}
-	return true, nil
-}
-
-func waitTimeoutInternalHelper(object waitable, timeout uint32) (bool, error) {
-	return object.hcsWait(timeout)
-}
 
-func waitForSingleObject(handle syscall.Handle, timeout uint32) (bool, error) {
-	s, e := syscall.WaitForSingleObject(handle, timeout)
-	switch s {
-	case syscall.WAIT_OBJECT_0:
-		return true, nil
-	case syscall.WAIT_TIMEOUT:
-		return false, nil
-	default:
-		return false, e
-	}
-}
+	"github.com/Sirupsen/logrus"
+)
 
 func processAsyncHcsResult(err error, resultp *uint16, callbackNumber uintptr, expectedNotification hcsNotification, timeout *time.Duration) error {
 	err = processHcsResult(err, resultp)

+ 75 - 379
vendor/src/github.com/Microsoft/hcsshim/zhcsshim.go

@@ -13,69 +13,57 @@ var (
 	modiphlpapi  = syscall.NewLazyDLL("iphlpapi.dll")
 	modvmcompute = syscall.NewLazyDLL("vmcompute.dll")
 
-	procCoTaskMemFree                              = modole32.NewProc("CoTaskMemFree")
-	procSetCurrentThreadCompartmentId              = modiphlpapi.NewProc("SetCurrentThreadCompartmentId")
-	procActivateLayer                              = modvmcompute.NewProc("ActivateLayer")
-	procCopyLayer                                  = modvmcompute.NewProc("CopyLayer")
-	procCreateLayer                                = modvmcompute.NewProc("CreateLayer")
-	procCreateSandboxLayer                         = modvmcompute.NewProc("CreateSandboxLayer")
-	procExpandSandboxSize                          = modvmcompute.NewProc("ExpandSandboxSize")
-	procDeactivateLayer                            = modvmcompute.NewProc("DeactivateLayer")
-	procDestroyLayer                               = modvmcompute.NewProc("DestroyLayer")
-	procExportLayer                                = modvmcompute.NewProc("ExportLayer")
-	procGetLayerMountPath                          = modvmcompute.NewProc("GetLayerMountPath")
-	procGetBaseImages                              = modvmcompute.NewProc("GetBaseImages")
-	procImportLayer                                = modvmcompute.NewProc("ImportLayer")
-	procLayerExists                                = modvmcompute.NewProc("LayerExists")
-	procNameToGuid                                 = modvmcompute.NewProc("NameToGuid")
-	procPrepareLayer                               = modvmcompute.NewProc("PrepareLayer")
-	procUnprepareLayer                             = modvmcompute.NewProc("UnprepareLayer")
-	procProcessBaseImage                           = modvmcompute.NewProc("ProcessBaseImage")
-	procProcessUtilityImage                        = modvmcompute.NewProc("ProcessUtilityImage")
-	procImportLayerBegin                           = modvmcompute.NewProc("ImportLayerBegin")
-	procImportLayerNext                            = modvmcompute.NewProc("ImportLayerNext")
-	procImportLayerWrite                           = modvmcompute.NewProc("ImportLayerWrite")
-	procImportLayerEnd                             = modvmcompute.NewProc("ImportLayerEnd")
-	procExportLayerBegin                           = modvmcompute.NewProc("ExportLayerBegin")
-	procExportLayerNext                            = modvmcompute.NewProc("ExportLayerNext")
-	procExportLayerRead                            = modvmcompute.NewProc("ExportLayerRead")
-	procExportLayerEnd                             = modvmcompute.NewProc("ExportLayerEnd")
-	procCreateComputeSystem                        = modvmcompute.NewProc("CreateComputeSystem")
-	procCreateProcessWithStdHandlesInComputeSystem = modvmcompute.NewProc("CreateProcessWithStdHandlesInComputeSystem")
-	procResizeConsoleInComputeSystem               = modvmcompute.NewProc("ResizeConsoleInComputeSystem")
-	procShutdownComputeSystem                      = modvmcompute.NewProc("ShutdownComputeSystem")
-	procStartComputeSystem                         = modvmcompute.NewProc("StartComputeSystem")
-	procTerminateComputeSystem                     = modvmcompute.NewProc("TerminateComputeSystem")
-	procTerminateProcessInComputeSystem            = modvmcompute.NewProc("TerminateProcessInComputeSystem")
-	procWaitForProcessInComputeSystem              = modvmcompute.NewProc("WaitForProcessInComputeSystem")
-	procGetComputeSystemProperties                 = modvmcompute.NewProc("GetComputeSystemProperties")
-	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")
-	procHcsCreateComputeSystemWait                 = modvmcompute.NewProc("HcsCreateComputeSystemWait")
-	procHcsCreateProcess                           = modvmcompute.NewProc("HcsCreateProcess")
-	procHcsOpenProcess                             = modvmcompute.NewProc("HcsOpenProcess")
-	procHcsCloseProcess                            = modvmcompute.NewProc("HcsCloseProcess")
-	procHcsTerminateProcess                        = modvmcompute.NewProc("HcsTerminateProcess")
-	procHcsGetProcessInfo                          = modvmcompute.NewProc("HcsGetProcessInfo")
-	procHcsGetProcessProperties                    = modvmcompute.NewProc("HcsGetProcessProperties")
-	procHcsModifyProcess                           = modvmcompute.NewProc("HcsModifyProcess")
-	procHcsCreateProcessWait                       = modvmcompute.NewProc("HcsCreateProcessWait")
-	procHcsGetServiceProperties                    = modvmcompute.NewProc("HcsGetServiceProperties")
-	procHcsModifyServiceSettings                   = modvmcompute.NewProc("HcsModifyServiceSettings")
-
+	procCoTaskMemFree                      = modole32.NewProc("CoTaskMemFree")
+	procSetCurrentThreadCompartmentId      = modiphlpapi.NewProc("SetCurrentThreadCompartmentId")
+	procActivateLayer                      = modvmcompute.NewProc("ActivateLayer")
+	procCopyLayer                          = modvmcompute.NewProc("CopyLayer")
+	procCreateLayer                        = modvmcompute.NewProc("CreateLayer")
+	procCreateSandboxLayer                 = modvmcompute.NewProc("CreateSandboxLayer")
+	procExpandSandboxSize                  = modvmcompute.NewProc("ExpandSandboxSize")
+	procDeactivateLayer                    = modvmcompute.NewProc("DeactivateLayer")
+	procDestroyLayer                       = modvmcompute.NewProc("DestroyLayer")
+	procExportLayer                        = modvmcompute.NewProc("ExportLayer")
+	procGetLayerMountPath                  = modvmcompute.NewProc("GetLayerMountPath")
+	procGetBaseImages                      = modvmcompute.NewProc("GetBaseImages")
+	procImportLayer                        = modvmcompute.NewProc("ImportLayer")
+	procLayerExists                        = modvmcompute.NewProc("LayerExists")
+	procNameToGuid                         = modvmcompute.NewProc("NameToGuid")
+	procPrepareLayer                       = modvmcompute.NewProc("PrepareLayer")
+	procUnprepareLayer                     = modvmcompute.NewProc("UnprepareLayer")
+	procProcessBaseImage                   = modvmcompute.NewProc("ProcessBaseImage")
+	procProcessUtilityImage                = modvmcompute.NewProc("ProcessUtilityImage")
+	procImportLayerBegin                   = modvmcompute.NewProc("ImportLayerBegin")
+	procImportLayerNext                    = modvmcompute.NewProc("ImportLayerNext")
+	procImportLayerWrite                   = modvmcompute.NewProc("ImportLayerWrite")
+	procImportLayerEnd                     = modvmcompute.NewProc("ImportLayerEnd")
+	procExportLayerBegin                   = modvmcompute.NewProc("ExportLayerBegin")
+	procExportLayerNext                    = modvmcompute.NewProc("ExportLayerNext")
+	procExportLayerRead                    = modvmcompute.NewProc("ExportLayerRead")
+	procExportLayerEnd                     = modvmcompute.NewProc("ExportLayerEnd")
+	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")
 	procHcsRegisterComputeSystemCallback   = modvmcompute.NewProc("HcsRegisterComputeSystemCallback")
 	procHcsUnregisterComputeSystemCallback = modvmcompute.NewProc("HcsUnregisterComputeSystemCallback")
+	procHcsCreateProcess                   = modvmcompute.NewProc("HcsCreateProcess")
+	procHcsOpenProcess                     = modvmcompute.NewProc("HcsOpenProcess")
+	procHcsCloseProcess                    = modvmcompute.NewProc("HcsCloseProcess")
+	procHcsTerminateProcess                = modvmcompute.NewProc("HcsTerminateProcess")
+	procHcsGetProcessInfo                  = modvmcompute.NewProc("HcsGetProcessInfo")
+	procHcsGetProcessProperties            = modvmcompute.NewProc("HcsGetProcessProperties")
+	procHcsModifyProcess                   = modvmcompute.NewProc("HcsModifyProcess")
+	procHcsGetServiceProperties            = modvmcompute.NewProc("HcsGetServiceProperties")
 	procHcsRegisterProcessCallback         = modvmcompute.NewProc("HcsRegisterProcessCallback")
 	procHcsUnregisterProcessCallback       = modvmcompute.NewProc("HcsUnregisterProcessCallback")
+	procHcsModifyServiceSettings           = modvmcompute.NewProc("HcsModifyServiceSettings")
 	procHNSCall                            = modvmcompute.NewProc("HNSCall")
 )
 
@@ -599,196 +587,6 @@ func exportLayerEnd(context uintptr) (hr error) {
 	return
 }
 
-func createComputeSystem(id string, configuration string) (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 _createComputeSystem(_p0, _p1)
-}
-
-func _createComputeSystem(id *uint16, configuration *uint16) (hr error) {
-	if hr = procCreateComputeSystem.Find(); hr != nil {
-		return
-	}
-	r0, _, _ := syscall.Syscall(procCreateComputeSystem.Addr(), 2, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(configuration)), 0)
-	if int32(r0) < 0 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func createProcessWithStdHandlesInComputeSystem(id string, paramsJson string, pid *uint32, stdin *syscall.Handle, stdout *syscall.Handle, stderr *syscall.Handle) (hr error) {
-	var _p0 *uint16
-	_p0, hr = syscall.UTF16PtrFromString(id)
-	if hr != nil {
-		return
-	}
-	var _p1 *uint16
-	_p1, hr = syscall.UTF16PtrFromString(paramsJson)
-	if hr != nil {
-		return
-	}
-	return _createProcessWithStdHandlesInComputeSystem(_p0, _p1, pid, stdin, stdout, stderr)
-}
-
-func _createProcessWithStdHandlesInComputeSystem(id *uint16, paramsJson *uint16, pid *uint32, stdin *syscall.Handle, stdout *syscall.Handle, stderr *syscall.Handle) (hr error) {
-	if hr = procCreateProcessWithStdHandlesInComputeSystem.Find(); hr != nil {
-		return
-	}
-	r0, _, _ := syscall.Syscall6(procCreateProcessWithStdHandlesInComputeSystem.Addr(), 6, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(paramsJson)), uintptr(unsafe.Pointer(pid)), uintptr(unsafe.Pointer(stdin)), uintptr(unsafe.Pointer(stdout)), uintptr(unsafe.Pointer(stderr)))
-	if int32(r0) < 0 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func resizeConsoleInComputeSystem(id string, pid uint32, height uint16, width uint16, flags uint32) (hr error) {
-	var _p0 *uint16
-	_p0, hr = syscall.UTF16PtrFromString(id)
-	if hr != nil {
-		return
-	}
-	return _resizeConsoleInComputeSystem(_p0, pid, height, width, flags)
-}
-
-func _resizeConsoleInComputeSystem(id *uint16, pid uint32, height uint16, width uint16, flags uint32) (hr error) {
-	if hr = procResizeConsoleInComputeSystem.Find(); hr != nil {
-		return
-	}
-	r0, _, _ := syscall.Syscall6(procResizeConsoleInComputeSystem.Addr(), 5, uintptr(unsafe.Pointer(id)), uintptr(pid), uintptr(height), uintptr(width), uintptr(flags), 0)
-	if int32(r0) < 0 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func shutdownComputeSystem(id string, timeout uint32) (hr error) {
-	var _p0 *uint16
-	_p0, hr = syscall.UTF16PtrFromString(id)
-	if hr != nil {
-		return
-	}
-	return _shutdownComputeSystem(_p0, timeout)
-}
-
-func _shutdownComputeSystem(id *uint16, timeout uint32) (hr error) {
-	if hr = procShutdownComputeSystem.Find(); hr != nil {
-		return
-	}
-	r0, _, _ := syscall.Syscall(procShutdownComputeSystem.Addr(), 2, uintptr(unsafe.Pointer(id)), uintptr(timeout), 0)
-	if int32(r0) < 0 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func startComputeSystem(id string) (hr error) {
-	var _p0 *uint16
-	_p0, hr = syscall.UTF16PtrFromString(id)
-	if hr != nil {
-		return
-	}
-	return _startComputeSystem(_p0)
-}
-
-func _startComputeSystem(id *uint16) (hr error) {
-	if hr = procStartComputeSystem.Find(); hr != nil {
-		return
-	}
-	r0, _, _ := syscall.Syscall(procStartComputeSystem.Addr(), 1, uintptr(unsafe.Pointer(id)), 0, 0)
-	if int32(r0) < 0 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func terminateComputeSystem(id string) (hr error) {
-	var _p0 *uint16
-	_p0, hr = syscall.UTF16PtrFromString(id)
-	if hr != nil {
-		return
-	}
-	return _terminateComputeSystem(_p0)
-}
-
-func _terminateComputeSystem(id *uint16) (hr error) {
-	if hr = procTerminateComputeSystem.Find(); hr != nil {
-		return
-	}
-	r0, _, _ := syscall.Syscall(procTerminateComputeSystem.Addr(), 1, uintptr(unsafe.Pointer(id)), 0, 0)
-	if int32(r0) < 0 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func terminateProcessInComputeSystem(id string, pid uint32) (hr error) {
-	var _p0 *uint16
-	_p0, hr = syscall.UTF16PtrFromString(id)
-	if hr != nil {
-		return
-	}
-	return _terminateProcessInComputeSystem(_p0, pid)
-}
-
-func _terminateProcessInComputeSystem(id *uint16, pid uint32) (hr error) {
-	if hr = procTerminateProcessInComputeSystem.Find(); hr != nil {
-		return
-	}
-	r0, _, _ := syscall.Syscall(procTerminateProcessInComputeSystem.Addr(), 2, uintptr(unsafe.Pointer(id)), uintptr(pid), 0)
-	if int32(r0) < 0 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func waitForProcessInComputeSystem(id string, pid uint32, timeout uint32, exitCode *uint32) (hr error) {
-	var _p0 *uint16
-	_p0, hr = syscall.UTF16PtrFromString(id)
-	if hr != nil {
-		return
-	}
-	return _waitForProcessInComputeSystem(_p0, pid, timeout, exitCode)
-}
-
-func _waitForProcessInComputeSystem(id *uint16, pid uint32, timeout uint32, exitCode *uint32) (hr error) {
-	if hr = procWaitForProcessInComputeSystem.Find(); hr != nil {
-		return
-	}
-	r0, _, _ := syscall.Syscall6(procWaitForProcessInComputeSystem.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(pid), uintptr(timeout), uintptr(unsafe.Pointer(exitCode)), 0, 0)
-	if int32(r0) < 0 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func getComputeSystemProperties(id string, flags uint32, properties **uint16) (hr error) {
-	var _p0 *uint16
-	_p0, hr = syscall.UTF16PtrFromString(id)
-	if hr != nil {
-		return
-	}
-	return _getComputeSystemProperties(_p0, flags, properties)
-}
-
-func _getComputeSystemProperties(id *uint16, flags uint32, properties **uint16) (hr error) {
-	if hr = procGetComputeSystemProperties.Find(); hr != nil {
-		return
-	}
-	r0, _, _ := syscall.Syscall(procGetComputeSystemProperties.Addr(), 3, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(unsafe.Pointer(properties)))
-	if int32(r0) < 0 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
 func hcsEnumerateComputeSystems(query string, computeSystems **uint16, result **uint16) (hr error) {
 	var _p0 *uint16
 	_p0, hr = syscall.UTF16PtrFromString(query)
@@ -1005,11 +803,22 @@ func _hcsModifyComputeSystem(computeSystem hcsSystem, configuration *uint16, res
 	return
 }
 
-func hcsCreateComputeSystemWait(computeSystem hcsSystem, exitEvent *syscall.Handle, result **uint16) (hr error) {
-	if hr = procHcsCreateComputeSystemWait.Find(); hr != nil {
+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 {
+		hr = syscall.Errno(win32FromHresult(r0))
+	}
+	return
+}
+
+func hcsUnregisterComputeSystemCallback(callbackHandle hcsCallback) (hr error) {
+	if hr = procHcsUnregisterComputeSystemCallback.Find(); hr != nil {
 		return
 	}
-	r0, _, _ := syscall.Syscall(procHcsCreateComputeSystemWait.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(exitEvent)), uintptr(unsafe.Pointer(result)))
+	r0, _, _ := syscall.Syscall(procHcsUnregisterComputeSystemCallback.Addr(), 1, uintptr(callbackHandle), 0, 0)
 	if int32(r0) < 0 {
 		hr = syscall.Errno(win32FromHresult(r0))
 	}
@@ -1111,17 +920,6 @@ func _hcsModifyProcess(process hcsProcess, settings *uint16, result **uint16) (h
 	return
 }
 
-func hcsCreateProcessWait(process hcsProcess, settings *syscall.Handle, result **uint16) (hr error) {
-	if hr = procHcsCreateProcessWait.Find(); hr != nil {
-		return
-	}
-	r0, _, _ := syscall.Syscall(procHcsCreateProcessWait.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(settings)), uintptr(unsafe.Pointer(result)))
-	if int32(r0) < 0 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
 func hcsGetServiceProperties(propertyQuery string, properties **uint16, result **uint16) (hr error) {
 	var _p0 *uint16
 	_p0, hr = syscall.UTF16PtrFromString(propertyQuery)
@@ -1142,144 +940,42 @@ func _hcsGetServiceProperties(propertyQuery *uint16, properties **uint16, result
 	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 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func hcsCreateComputeSystemTP5(id string, configuration string, 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 _hcsCreateComputeSystemTP5(_p0, _p1, computeSystem, result)
-}
-
-func _hcsCreateComputeSystemTP5(id *uint16, configuration *uint16, computeSystem *hcsSystem, result **uint16) (hr error) {
-	if hr = procHcsCreateComputeSystem.Find(); hr != nil {
-		return
-	}
-	r0, _, _ := syscall.Syscall6(procHcsCreateComputeSystem.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(configuration)), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result)), 0, 0)
-	if int32(r0) < 0 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func hcsStartComputeSystemTP5(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 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func hcsShutdownComputeSystemTP5(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 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func hcsTerminateComputeSystemTP5(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 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func hcsPauseComputeSystemTP5(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 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func hcsResumeComputeSystemTP5(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 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
-}
-
-func hcsRegisterComputeSystemCallback(computeSystem hcsSystem, callback uintptr, context uintptr, callbackHandle *hcsCallback) (hr error) {
-	if hr = procHcsRegisterComputeSystemCallback.Find(); hr != nil {
+func hcsRegisterProcessCallback(process hcsProcess, callback uintptr, context uintptr, callbackHandle *hcsCallback) (hr error) {
+	if hr = procHcsRegisterProcessCallback.Find(); hr != nil {
 		return
 	}
-	r0, _, _ := syscall.Syscall6(procHcsRegisterComputeSystemCallback.Addr(), 4, uintptr(computeSystem), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0)
+	r0, _, _ := syscall.Syscall6(procHcsRegisterProcessCallback.Addr(), 4, uintptr(process), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0)
 	if int32(r0) < 0 {
 		hr = syscall.Errno(win32FromHresult(r0))
 	}
 	return
 }
 
-func hcsUnregisterComputeSystemCallback(callbackHandle hcsCallback) (hr error) {
-	if hr = procHcsUnregisterComputeSystemCallback.Find(); hr != nil {
+func hcsUnregisterProcessCallback(callbackHandle hcsCallback) (hr error) {
+	if hr = procHcsUnregisterProcessCallback.Find(); hr != nil {
 		return
 	}
-	r0, _, _ := syscall.Syscall(procHcsUnregisterComputeSystemCallback.Addr(), 1, uintptr(callbackHandle), 0, 0)
+	r0, _, _ := syscall.Syscall(procHcsUnregisterProcessCallback.Addr(), 1, uintptr(callbackHandle), 0, 0)
 	if int32(r0) < 0 {
 		hr = syscall.Errno(win32FromHresult(r0))
 	}
 	return
 }
 
-func hcsRegisterProcessCallback(process hcsProcess, callback uintptr, context uintptr, callbackHandle *hcsCallback) (hr error) {
-	if hr = procHcsRegisterProcessCallback.Find(); hr != nil {
+func hcsModifyServiceSettings(settings string, result **uint16) (hr error) {
+	var _p0 *uint16
+	_p0, hr = syscall.UTF16PtrFromString(settings)
+	if 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 {
-		hr = syscall.Errno(win32FromHresult(r0))
-	}
-	return
+	return _hcsModifyServiceSettings(_p0, result)
 }
 
-func hcsUnregisterProcessCallback(callbackHandle hcsCallback) (hr error) {
-	if hr = procHcsUnregisterProcessCallback.Find(); hr != nil {
+func _hcsModifyServiceSettings(settings *uint16, result **uint16) (hr error) {
+	if hr = procHcsModifyServiceSettings.Find(); hr != nil {
 		return
 	}
-	r0, _, _ := syscall.Syscall(procHcsUnregisterProcessCallback.Addr(), 1, uintptr(callbackHandle), 0, 0)
+	r0, _, _ := syscall.Syscall(procHcsModifyServiceSettings.Addr(), 2, uintptr(unsafe.Pointer(settings)), uintptr(unsafe.Pointer(result)), 0)
 	if int32(r0) < 0 {
 		hr = syscall.Errno(win32FromHresult(r0))
 	}