github.com/jwhonce/docker@v0.6.7-0.20190327063223-da823cf3a5a3/libcontainerd/remote/client_windows.go (about) 1 package remote // import "github.com/docker/docker/libcontainerd/remote" 2 3 import ( 4 "context" 5 "fmt" 6 "os" 7 "path/filepath" 8 9 "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/options" 10 "github.com/containerd/containerd/cio" 11 12 libcontainerdtypes "github.com/docker/docker/libcontainerd/types" 13 specs "github.com/opencontainers/runtime-spec/specs-go" 14 "github.com/pkg/errors" 15 ) 16 17 const runtimeName = "io.containerd.runhcs.v1" 18 19 func summaryFromInterface(i interface{}) (*libcontainerdtypes.Summary, error) { 20 switch pd := i.(type) { 21 case *options.ProcessDetails: 22 return &libcontainerdtypes.Summary{ 23 ImageName: pd.ImageName, 24 CreatedAt: pd.CreatedAt, 25 KernelTime_100Ns: pd.KernelTime_100Ns, 26 MemoryCommitBytes: pd.MemoryCommitBytes, 27 MemoryWorkingSetPrivateBytes: pd.MemoryWorkingSetPrivateBytes, 28 MemoryWorkingSetSharedBytes: pd.MemoryWorkingSetSharedBytes, 29 ProcessID: pd.ProcessID, 30 UserTime_100Ns: pd.UserTime_100Ns, 31 ExecID: pd.ExecID, 32 }, nil 33 default: 34 return nil, errors.Errorf("Unknown process details type %T", pd) 35 } 36 } 37 38 func prepareBundleDir(bundleDir string, ociSpec *specs.Spec) (string, error) { 39 // TODO: (containerd) Determine if we need to use system.MkdirAllWithACL here 40 return bundleDir, os.MkdirAll(bundleDir, 0755) 41 } 42 43 func pipeName(containerID, processID, name string) string { 44 return fmt.Sprintf(`\\.\pipe\containerd-%s-%s-%s`, containerID, processID, name) 45 } 46 47 func newFIFOSet(bundleDir, processID string, withStdin, withTerminal bool) *cio.FIFOSet { 48 containerID := filepath.Base(bundleDir) 49 config := cio.Config{ 50 Terminal: withTerminal, 51 Stdout: pipeName(containerID, processID, "stdout"), 52 } 53 54 if withStdin { 55 config.Stdin = pipeName(containerID, processID, "stdin") 56 } 57 58 if !config.Terminal { 59 config.Stderr = pipeName(containerID, processID, "stderr") 60 } 61 62 return cio.NewFIFOSet(config, nil) 63 } 64 65 func (c *client) newDirectIO(ctx context.Context, fifos *cio.FIFOSet) (*cio.DirectIO, error) { 66 pipes, err := c.newStdioPipes(fifos) 67 if err != nil { 68 return nil, err 69 } 70 return cio.NewDirectIOFromFIFOSet(ctx, pipes.stdin, pipes.stdout, pipes.stderr, fifos), nil 71 } 72 73 func (c *client) UpdateResources(ctx context.Context, containerID string, resources *libcontainerdtypes.Resources) error { 74 // TODO: (containerd): Not implemented, but don't error. 75 return nil 76 } 77 78 func getSpecUser(ociSpec *specs.Spec) (int, int) { 79 // TODO: (containerd): Not implemented, but don't error. 80 // Not clear if we can even do this for LCOW. 81 return 0, 0 82 }