Open implements vfs.Device.Open.
(ctx context.Context, mnt *vfs.Mount, vfsd *vfs.Dentry, opts vfs.OpenOptions)
| 36 | |
| 37 | // Open implements vfs.Device.Open. |
| 38 | func (ttyDevice) Open(ctx context.Context, mnt *vfs.Mount, vfsd *vfs.Dentry, opts vfs.OpenOptions) (*vfs.FileDescription, error) { |
| 39 | t := kernel.TaskFromContext(ctx) |
| 40 | if t == nil { |
| 41 | return nil, linuxerr.ENXIO |
| 42 | } |
| 43 | tty := t.ThreadGroup().TTY() |
| 44 | if tty == nil { |
| 45 | return nil, linuxerr.ENXIO |
| 46 | } |
| 47 | // Opening /dev/tty does not set the controlling terminal. See Linux |
| 48 | // tty_open(). |
| 49 | opts.Flags |= linux.O_NOCTTY |
| 50 | return tty.OpenTTY(ctx, mnt, vfsd, opts) |
| 51 | } |
| 52 | |
| 53 | // Register registers all devices implemented by this package in vfsObj. |
| 54 | func Register(vfsObj *vfs.VirtualFilesystem) error { |
nothing calls this directly
no test coverage detected