diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-22 22:00:40 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-22 22:02:21 +0900 |
| commit | afe23600d286cf0879717cb8b55c52ef432fce7a (patch) | |
| tree | cabcc619666ba36c93a6bafc817f6f177338fa73 /container/path.go | |
| parent | 09d284498109b847da0da1e2c5f883268a7f2d46 (diff) | |
container/path: use syscall dispatcher
This allows path and mount functions to be instrumented.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/path.go')
| -rw-r--r-- | container/path.go | 9 |
1 files changed, 5 insertions, 4 deletions
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) |
