github.com/Microsoft/hcsshim to v0.8.25
This commit is contained in:
6
vendor/github.com/Microsoft/hcsshim/internal/cow/cow.go
generated
vendored
6
vendor/github.com/Microsoft/hcsshim/internal/cow/cow.go
generated
vendored
@@ -86,6 +86,12 @@ type Container interface {
|
||||
// container to be terminated by some error condition (including calling
|
||||
// Close).
|
||||
Wait() error
|
||||
// WaitChannel returns the wait channel of the container
|
||||
WaitChannel() <-chan struct{}
|
||||
// WaitError returns the container termination error.
|
||||
// This function should only be called after the channel in WaitChannel()
|
||||
// is closed. Otherwise it is not thread safe.
|
||||
WaitError() error
|
||||
// Modify sends a request to modify container resources
|
||||
Modify(ctx context.Context, config interface{}) error
|
||||
}
|
||||
|
12
vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
generated
vendored
12
vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
generated
vendored
@@ -275,11 +275,19 @@ func (computeSystem *System) waitBackground() {
|
||||
oc.SetSpanStatus(span, err)
|
||||
}
|
||||
|
||||
func (computeSystem *System) WaitChannel() <-chan struct{} {
|
||||
return computeSystem.waitBlock
|
||||
}
|
||||
|
||||
func (computeSystem *System) WaitError() error {
|
||||
return computeSystem.waitError
|
||||
}
|
||||
|
||||
// Wait synchronously waits for the compute system to shutdown or terminate. If
|
||||
// the compute system has already exited returns the previous error (if any).
|
||||
func (computeSystem *System) Wait() error {
|
||||
<-computeSystem.waitBlock
|
||||
return computeSystem.waitError
|
||||
<-computeSystem.WaitChannel()
|
||||
return computeSystem.WaitError()
|
||||
}
|
||||
|
||||
// ExitError returns an error describing the reason the compute system terminated.
|
||||
|
25
vendor/github.com/Microsoft/hcsshim/internal/winapi/utils.go
generated
vendored
25
vendor/github.com/Microsoft/hcsshim/internal/winapi/utils.go
generated
vendored
@@ -20,36 +20,41 @@ func Uint16BufferToSlice(buffer *uint16, bufferLength int) (result []uint16) {
|
||||
return
|
||||
}
|
||||
|
||||
// UnicodeString corresponds to UNICODE_STRING win32 struct defined here
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/ntdef/ns-ntdef-_unicode_string
|
||||
type UnicodeString struct {
|
||||
Length uint16
|
||||
MaximumLength uint16
|
||||
Buffer *uint16
|
||||
}
|
||||
|
||||
// NTSTRSAFE_UNICODE_STRING_MAX_CCH is a constant defined in ntstrsafe.h. This value
|
||||
// denotes the maximum number of wide chars a path can have.
|
||||
const NTSTRSAFE_UNICODE_STRING_MAX_CCH = 32767
|
||||
|
||||
//String converts a UnicodeString to a golang string
|
||||
func (uni UnicodeString) String() string {
|
||||
// UnicodeString is not guaranteed to be null terminated, therefore
|
||||
// use the UnicodeString's Length field
|
||||
return syscall.UTF16ToString(Uint16BufferToSlice(uni.Buffer, int(uni.Length/2)))
|
||||
return windows.UTF16ToString(Uint16BufferToSlice(uni.Buffer, int(uni.Length/2)))
|
||||
}
|
||||
|
||||
// NewUnicodeString allocates a new UnicodeString and copies `s` into
|
||||
// the buffer of the new UnicodeString.
|
||||
func NewUnicodeString(s string) (*UnicodeString, error) {
|
||||
// Get length of original `s` to use in the UnicodeString since the `buf`
|
||||
// created later will have an additional trailing null character
|
||||
length := len(s)
|
||||
if length > 32767 {
|
||||
return nil, syscall.ENAMETOOLONG
|
||||
}
|
||||
|
||||
buf, err := windows.UTF16FromString(s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(buf) > NTSTRSAFE_UNICODE_STRING_MAX_CCH {
|
||||
return nil, syscall.ENAMETOOLONG
|
||||
}
|
||||
|
||||
uni := &UnicodeString{
|
||||
Length: uint16(length * 2),
|
||||
MaximumLength: uint16(length * 2),
|
||||
// The length is in bytes and should not include the trailing null character.
|
||||
Length: uint16((len(buf) - 1) * 2),
|
||||
MaximumLength: uint16((len(buf) - 1) * 2),
|
||||
Buffer: &buf[0],
|
||||
}
|
||||
return uni, nil
|
||||
|
Reference in New Issue
Block a user