From afe23600d286cf0879717cb8b55c52ef432fce7a Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 22 Aug 2025 22:00:40 +0900 Subject: container/path: use syscall dispatcher This allows path and mount functions to be instrumented. Signed-off-by: Ophestra --- container/path.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'container/path.go') diff --git a/container/path.go b/container/path.go index be3cd384..09db97a6 100644 --- a/container/path.go +++ b/container/path.go @@ -131,13 +131,14 @@ func ensureFile(name string, perm, pperm os.FileMode) error { return err } -var hostProc = newProcPaths(hostPath) +var hostProc = newProcPaths(direct{}, hostPath) -func newProcPaths(prefix string) *procPaths { - return &procPaths{prefix + "/proc", prefix + "/proc/self"} +func newProcPaths(k syscallDispatcher, prefix string) *procPaths { + return &procPaths{k, prefix + "/proc", prefix + "/proc/self"} } type procPaths struct { + k syscallDispatcher prefix string self string } @@ -145,7 +146,7 @@ type procPaths struct { func (p *procPaths) stdout() string { return p.self + "/fd/1" } func (p *procPaths) fd(fd int) string { return p.self + "/fd/" + strconv.Itoa(fd) } func (p *procPaths) mountinfo(f func(d *vfs.MountInfoDecoder) error) error { - if r, err := os.Open(p.self + "/mountinfo"); err != nil { + if r, err := p.k.openNew(p.self + "/mountinfo"); err != nil { return wrapErrSelf(err) } else { d := vfs.NewMountInfoDecoder(r) -- cgit v1.3.1