Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Enhance ptyfs to handle multiple instances.



On Mon, Mar 24, 2014 at 10:49:15AM -0400, Christos Zoulas wrote:
> On Mar 24,  5:46pm, netbsd%izyk.ru@localhost (Ilya Zykov) wrote:
> -- Subject: Re: Enhance ptyfs to handle multiple instances.
> 
> | Hello!
> | 
> | Please, tell me know if I wrong.
> | In general case I can't find(easy), from driver, where its device file 
> located on file system,
> | its vnode or its directory vnode where this file located.
> | Such files can be many and I can't find what file used for current 
> operation.
> | Maybe anybody had being attempted get this info from the driver?
> 
> You can't find from the driver where the device node file is located
> in the filesystem, as well as you cannot reliably find from the
> vnode of the device node the filesystem path. There could be many
> device nodes that satisfy the criteria (you can make your own tty
> node with mknod)....

FWIW SYSV ptys (etc) would be created as a 'clone', a /dev entry
created/found with the required path and the correct major/minor,
and then reopened through the filesystem entry.
stat() on the /dev entry and fstat() on the fd would then agree
(probably disk partition and inode?).

This didn't help you find the entry - but it would tell you when
you'd found the correct one.

OTOH ttyname(3) is probably best implemented with a pair of ioctls.
Although chroot() probably complicates things.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index