diff options
author | Masatake YAMATO <yamato@redhat.com> | 2017-07-18 06:27:59 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-08-28 20:51:23 +0200 |
commit | d01c3289e7d68162e32bc08c2b65dd1a216a7ef8 (patch) | |
tree | 34177b1e85f857b838fa75b08153d091472eb775 /drivers/tty/tty_io.c | |
parent | 199e717f252be0e31c97b9c7861dd6e2abfaa936 (diff) | |
download | op-kernel-dev-d01c3289e7d68162e32bc08c2b65dd1a216a7ef8.zip op-kernel-dev-d01c3289e7d68162e32bc08c2b65dd1a216a7ef8.tar.gz |
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>
Diffstat (limited to 'drivers/tty/tty_io.c')
-rw-r--r-- | drivers/tty/tty_io.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 974b13d..c3c8fd0 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -462,6 +462,14 @@ static int hung_up_tty_fasync(int fd, struct file *file, int on) return -ENOTTY; } +static void tty_show_fdinfo(struct seq_file *m, struct file *file) +{ + struct tty_struct *tty = file_tty(file); + + if (tty && tty->ops && tty->ops->show_fdinfo) + tty->ops->show_fdinfo(tty, m); +} + static const struct file_operations tty_fops = { .llseek = no_llseek, .read = tty_read, @@ -472,6 +480,7 @@ static const struct file_operations tty_fops = { .open = tty_open, .release = tty_release, .fasync = tty_fasync, + .show_fdinfo = tty_show_fdinfo, }; static const struct file_operations console_fops = { |