Files
containerd/vendor/github.com/mdlayher/vsock/fd_linux.go
T
dependabot[bot] 3fdb9abcab build(deps): bump github.com/mdlayher/vsock from 1.2.1 to 1.3.0
Bumps [github.com/mdlayher/vsock](https://github.com/mdlayher/vsock) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/mdlayher/vsock/releases)
- [Changelog](https://github.com/mdlayher/vsock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mdlayher/vsock/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/mdlayher/vsock
  dependency-version: 1.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-24 21:32:37 -07:00

37 lines
722 B
Go

package vsock
import (
"fmt"
"os"
"golang.org/x/sys/unix"
)
// contextID retrieves the local context ID for this system.
func contextID() (uint32, error) {
f, err := os.Open(devVsock)
if err != nil {
return 0, err
}
defer f.Close()
return unix.IoctlGetUint32(int(f.Fd()), unix.IOCTL_VM_SOCKETS_GET_LOCAL_CID)
}
// isErrno determines if an error a matches UNIX error number.
func isErrno(err error, errno int) bool {
switch errno {
case ebadf:
return err == unix.EBADF
case enotconn:
return err == unix.ENOTCONN
default:
panicf("vsock: isErrno called with unhandled error number parameter: %d", errno)
return false
}
}
func panicf(format string, a ...any) {
panic(fmt.Sprintf(format, a...))
}