Revendor github.com/Microsoft/hcsshim
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
This commit is contained in:
		
							
								
								
									
										34
									
								
								vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										34
									
								
								vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -8,6 +8,7 @@ import (
 | 
			
		||||
	"syscall"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/Microsoft/hcsshim/internal/guestrequest"
 | 
			
		||||
	"github.com/Microsoft/hcsshim/internal/interop"
 | 
			
		||||
	"github.com/sirupsen/logrus"
 | 
			
		||||
)
 | 
			
		||||
@@ -71,6 +72,39 @@ func (process *Process) SystemID() string {
 | 
			
		||||
	return process.system.ID()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Signal signals the process with `options`.
 | 
			
		||||
func (process *Process) Signal(options guestrequest.SignalProcessOptions) error {
 | 
			
		||||
	process.handleLock.RLock()
 | 
			
		||||
	defer process.handleLock.RUnlock()
 | 
			
		||||
	operation := "Signal"
 | 
			
		||||
	title := "hcsshim::Process::" + operation
 | 
			
		||||
	logrus.Debugf(title+" processid=%d", process.processID)
 | 
			
		||||
 | 
			
		||||
	if process.handle == 0 {
 | 
			
		||||
		return makeProcessError(process, operation, ErrAlreadyClosed, nil)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	optionsb, err := json.Marshal(options)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	optionsStr := string(optionsb)
 | 
			
		||||
 | 
			
		||||
	var resultp *uint16
 | 
			
		||||
	completed := false
 | 
			
		||||
	go syscallWatcher(fmt.Sprintf("SignalProcess %s: %d", process.SystemID(), process.Pid()), &completed)
 | 
			
		||||
	err = hcsSignalProcess(process.handle, optionsStr, &resultp)
 | 
			
		||||
	completed = true
 | 
			
		||||
	events := processHcsResult(resultp)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return makeProcessError(process, operation, err, events)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	logrus.Debugf(title+" succeeded processid=%d", process.processID)
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Kill signals the process to terminate but does not wait for it to finish terminating.
 | 
			
		||||
func (process *Process) Kill() error {
 | 
			
		||||
	process.handleLock.RLock()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user