MCPcopy
hub / github.com/opencontainers/runc / WithProcfdFile

Function WithProcfdFile

libcontainer/utils/utils_unix.go:156–161  ·  view source on GitHub ↗

WithProcfdFile is a very minimal wrapper around [ProcThreadSelfFd]. The caller is responsible for making sure that the provided file handle is actually safe to operate on. NOTE: THIS FUNCTION IS INTERNAL TO RUNC, DO NOT USE IT. TODO: Migrate the mount logic towards a more move_mount(2)-friendly de

(file *os.File, fn func(procfd string) error)

Source from the content-addressed store, hash-verified

154// where this is kind of /proc/self/... tomfoolery is only done in a fallback
155// path for old kernels.
156func WithProcfdFile(file *os.File, fn func(procfd string) error) error {
157 fdpath, closer := ProcThreadSelfFd(file.Fd())
158 defer closer()
159
160 return fn(fdpath)
161}
162
163type ProcThreadSelfCloser func()
164

Callers 8

mountCgroupV1Function · 0.92
mountCgroupV2Function · 0.92
doTmpfsCopyUpFunction · 0.92
mountToRootfsFunction · 0.92
bindMountDeviceNodeFunction · 0.92
mountPropagateMethod · 0.92
setRecAttrFunction · 0.92

Calls 1

ProcThreadSelfFdFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…