mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-26 18:44:47 +01:00
Updated the agent vendoring for `StartTracing` and `StopTracing`. This only changed a single file - the auto-generated gRPC protocol buffer file. This change resolves four vendoring issues: - The github.com/kubernetes-incubator/cri-o project was renamed to github.com/cri-o/cri-o. Although github redirects, `dep` complains that it cannot find the old `github.com/kubernetes-incubator/cri-o` files under `vendor/` so remove the old config, relying on the existing (and in other respects identical) `dep` config. - There was a stale dependency on `github.com/clearcontainers/proxy` which should have been removed when the Clear Containers code was excised. - The latest version of the agent code vendored into the runtime prior to this commit was a merge commit (commit `48dd1c031530fce9bf16b0f6a7305979cedd8fc9`). This somehow confused `dep` which did *not* correctly pull in the latest version of the auto-generated gRPC code (`vendor/github.com/kata-containers/agent/protocols/grpc/agent.pb.go`). This is clear because commit `48dd1c031530fce9bf16b0f6a7305979cedd8fc9` is newer than the agent commit that introduced the `StartTracing` and `StopTracing` APIs (`00cf907afcb7c8e56f077cf45ae3615f612fdc9d`). Resolving the other two issues above seems to have resolved this issue as the correct version of this file has now been included in the vendoring, however note there is no change to the `dep` files as this version of `agent.pb.go` should already have been included (!) - Updating `agent.pb.go` also removed the `AddInterface` and `RemoveInterface` API calls which should again also have been removed already. Updated tests to remove these redundant calls. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
46 lines
1.4 KiB
Go
46 lines
1.4 KiB
Go
package vsock
|
|
|
|
import (
|
|
"os"
|
|
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// A fd is an interface for a file descriptor, used to perform system
|
|
// calls or swap them out for tests.
|
|
type fd interface {
|
|
Accept4(flags int) (fd, unix.Sockaddr, error)
|
|
Bind(sa unix.Sockaddr) error
|
|
Close() error
|
|
Connect(sa unix.Sockaddr) error
|
|
Getsockname() (unix.Sockaddr, error)
|
|
Listen(n int) error
|
|
NewFile(name string) *os.File
|
|
SetNonblock(nonblocking bool) error
|
|
}
|
|
|
|
var _ fd = &sysFD{}
|
|
|
|
// sysFD is the system call implementation of fd.
|
|
type sysFD struct {
|
|
fd int
|
|
}
|
|
|
|
func (fd *sysFD) Accept4(flags int) (fd, unix.Sockaddr, error) {
|
|
// Returns a regular file descriptor, must be wrapped in another
|
|
// sysFD for it to work properly.
|
|
nfd, sa, err := unix.Accept4(fd.fd, flags)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
return &sysFD{fd: nfd}, sa, nil
|
|
}
|
|
func (fd *sysFD) Bind(sa unix.Sockaddr) error { return unix.Bind(fd.fd, sa) }
|
|
func (fd *sysFD) Close() error { return unix.Close(fd.fd) }
|
|
func (fd *sysFD) Connect(sa unix.Sockaddr) error { return unix.Connect(fd.fd, sa) }
|
|
func (fd *sysFD) Getsockname() (unix.Sockaddr, error) { return unix.Getsockname(fd.fd) }
|
|
func (fd *sysFD) Listen(n int) error { return unix.Listen(fd.fd, n) }
|
|
func (fd *sysFD) NewFile(name string) *os.File { return os.NewFile(uintptr(fd.fd), name) }
|
|
func (fd *sysFD) SetNonblock(nonblocking bool) error { return unix.SetNonblock(fd.fd, nonblocking) }
|