mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-22 08:44:25 +01:00
Currently we sometimes pass it as a pointer and other times not. As a result, the view of sandbox across virtcontainers may not be the same and it costs extra memory copy each time we pass it by value. Fix it by ensuring sandbox is always passed by pointers. Fixes: #262 Signed-off-by: Peng Tao <bergwolf@gmail.com>
44 lines
877 B
Go
44 lines
877 B
Go
// Copyright (c) 2017 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package virtcontainers
|
|
|
|
import (
|
|
"os/exec"
|
|
)
|
|
|
|
type ccProxy struct {
|
|
}
|
|
|
|
// start is the proxy start implementation for ccProxy.
|
|
func (p *ccProxy) start(sandbox *Sandbox, params proxyParams) (int, string, error) {
|
|
config, err := newProxyConfig(sandbox.config)
|
|
if err != nil {
|
|
return -1, "", err
|
|
}
|
|
|
|
// construct the socket path the proxy instance will use
|
|
proxyURL, err := defaultProxyURL(sandbox, SocketTypeUNIX)
|
|
if err != nil {
|
|
return -1, "", err
|
|
}
|
|
|
|
args := []string{config.Path, "-uri", proxyURL}
|
|
if config.Debug {
|
|
args = append(args, "-log", "debug")
|
|
}
|
|
|
|
cmd := exec.Command(args[0], args[1:]...)
|
|
if err := cmd.Start(); err != nil {
|
|
return -1, "", err
|
|
}
|
|
|
|
return cmd.Process.Pid, proxyURL, nil
|
|
}
|
|
|
|
func (p *ccProxy) stop(sandbox *Sandbox, pid int) error {
|
|
return nil
|
|
}
|