MCPcopy
hub / github.com/google/gvisor / Open

Method Open

pkg/sentry/fsimpl/host/host.go:685–696  ·  view source on GitHub ↗

Open implements kernfs.Inode.Open.

(ctx context.Context, rp *vfs.ResolvingPath, d *kernfs.Dentry, opts vfs.OpenOptions)

Source from the content-addressed store, hash-verified

683
684// Open implements kernfs.Inode.Open.
685func (i *inode) Open(ctx context.Context, rp *vfs.ResolvingPath, d *kernfs.Dentry, opts vfs.OpenOptions) (*vfs.FileDescription, error) {
686 // Once created, we cannot re-open a socket fd through /proc/[pid]/fd/.
687 if i.Mode().FileType() == linux.S_IFSOCK {
688 return nil, linuxerr.ENXIO
689 }
690 var stat unix.Stat_t
691 if err := i.stat(&stat); err != nil {
692 return nil, err
693 }
694 fileType := linux.FileMode(stat.Mode).FileType()
695 return i.open(ctx, d, rp.Mount(), fileType, opts.Flags)
696}
697
698// Supported flags for Open.
699//

Callers

nothing calls this directly

Calls 6

ModeMethod · 0.95
statMethod · 0.95
openMethod · 0.95
FileModeTypeAlias · 0.92
MountMethod · 0.65
FileTypeMethod · 0.45

Tested by

no test coverage detected