OSDN Git Service

pty: show associative slave of ptmx in fdinfo
authorMasatake YAMATO <yamato@redhat.com>
Mon, 17 Jul 2017 21:27:59 +0000 (06:27 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Aug 2017 18:51:23 +0000 (20:51 +0200)
commitd01c3289e7d68162e32bc08c2b65dd1a216a7ef8
tree34177b1e85f857b838fa75b08153d091472eb775
parent199e717f252be0e31c97b9c7861dd6e2abfaa936
pty: show associative slave of ptmx in fdinfo

This patch adds "tty-index" field to /proc/PID/fdinfo/N if N
specifies /dev/ptmx. The field shows the index of associative
slave pts.

Though a minor number is given for each pts instance, ptmx is not.
It means there is no way in user-space to know the association between
file descriptors for pts/n and ptmx. (n = 0, 1, ...)

This is different from pipe. About pipe such association can be solved
by inode of pipefs.

Providing the way to know the association between pts/n and ptmx helps
users understand the status of running system. lsof can utilize this field.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/pty.c
drivers/tty/tty_io.c
include/linux/tty_driver.h