/
githubmirror
/
ignition
Обзор
Документация
Войти
/
githubmirror
/
ignition
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
vendor/github.com/mdlayher/vsock/fd_linux.go
36 строк
722 B
dependabot[bot]
build(deps): bump the build group across 1 directory with 14 updates
09 июл 2026, 16:56
Не верифицирован
09 июл 2026, 16:56
479f436
Код
Авторство
О чём код?
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...)) }