Open implements kernfs.Inode.Open.
(ctx context.Context, rp *vfs.ResolvingPath, d *kernfs.Dentry, opts vfs.OpenOptions)
| 683 | |
| 684 | // Open implements kernfs.Inode.Open. |
| 685 | func (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 | // |