Release 4.11 fs/proc/proc_tty.c
/*
* proc_tty.c -- handles /proc/tty
*
* Copyright 1997, Theodore Ts'o
*/
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/time.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/tty.h>
#include <linux/seq_file.h>
#include <linux/bitops.h>
/*
* The /proc/tty directory inodes...
*/
static struct proc_dir_entry *proc_tty_driver;
/*
* This is the handler for /proc/tty/drivers
*/
static void show_tty_range(struct seq_file *m, struct tty_driver *p,
dev_t from, int num)
{
seq_printf(m, "%-20s ", p->driver_name ? p->driver_name : "unknown");
seq_printf(m, "/dev/%-8s ", p->name);
if (p->num > 1) {
seq_printf(m, "%3d %d-%d ", MAJOR(from), MINOR(from),
MINOR(from) + num - 1);
} else {
seq_printf(m, "%3d %7d ", MAJOR(from), MINOR(from));
}
switch (p->type) {
case TTY_DRIVER_TYPE_SYSTEM:
seq_puts(m, "system");
if (p->subtype == SYSTEM_TYPE_TTY)
seq_puts(m, ":/dev/tty");
else if (p->subtype == SYSTEM_TYPE_SYSCONS)
seq_puts(m, ":console");
else if (p->subtype == SYSTEM_TYPE_CONSOLE)
seq_puts(m, ":vtmaster");
break;
case TTY_DRIVER_TYPE_CONSOLE:
seq_puts(m, "console");
break;
case TTY_DRIVER_TYPE_SERIAL:
seq_puts(m, "serial");
break;
case TTY_DRIVER_TYPE_PTY:
if (p->subtype == PTY_TYPE_MASTER)
seq_puts(m, "pty:master");
else if (p->subtype == PTY_TYPE_SLAVE)
seq_puts(m, "pty:slave");
else
seq_puts(m, "pty");
break;
default:
seq_printf(m, "type:%d.%d", p->type, p->subtype);
}
seq_putc(m, '\n');
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 127 | 48.85% | 3 | 33.33% |
Al Viro | 112 | 43.08% | 3 | 33.33% |
Alexey Dobriyan | 9 | 3.46% | 1 | 11.11% |
Domen Puncer | 8 | 3.08% | 1 | 11.11% |
Brian Gerst | 4 | 1.54% | 1 | 11.11% |
Total | 260 | 100.00% | 9 | 100.00% |
static int show_tty_driver(struct seq_file *m, void *v)
{
struct tty_driver *p = list_entry(v, struct tty_driver, tty_drivers);
dev_t from = MKDEV(p->major, p->minor_start);
dev_t to = from + p->num;
if (&p->tty_drivers == tty_drivers.next) {
/* pseudo-drivers first */
seq_printf(m, "%-20s /dev/%-8s ", "/dev/tty", "tty");
seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 0);
seq_puts(m, "system:/dev/tty\n");
seq_printf(m, "%-20s /dev/%-8s ", "/dev/console", "console");
seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 1);
seq_puts(m, "system:console\n");
#ifdef CONFIG_UNIX98_PTYS
seq_printf(m, "%-20s /dev/%-8s ", "/dev/ptmx", "ptmx");
seq_printf(m, "%3d %7d ", TTYAUX_MAJOR, 2);
seq_puts(m, "system\n");
#endif
#ifdef CONFIG_VT
seq_printf(m, "%-20s /dev/%-8s ", "/dev/vc/0", "vc/0");
seq_printf(m, "%3d %7d ", TTY_MAJOR, 0);
seq_puts(m, "system:vtmaster\n");
#endif
}
while (MAJOR(from) < MAJOR(to)) {
dev_t next = MKDEV(MAJOR(from)+1, 0);
show_tty_range(m, p, from, next - from);
from = next;
}
if (from != to)
show_tty_range(m, p, from, to - from);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Al Viro | 247 | 94.64% | 2 | 40.00% |
Pavel Emelyanov | 8 | 3.07% | 1 | 20.00% |
Alexey Dobriyan | 4 | 1.53% | 1 | 20.00% |
Linus Torvalds (pre-git) | 2 | 0.77% | 1 | 20.00% |
Total | 261 | 100.00% | 5 | 100.00% |
/* iterator */
static void *t_start(struct seq_file *m, loff_t *pos)
{
mutex_lock(&tty_mutex);
return seq_list_start(&tty_drivers, *pos);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Al Viro | 20 | 62.50% | 1 | 25.00% |
Alexey Dobriyan | 6 | 18.75% | 1 | 25.00% |
Pavel Emelyanov | 5 | 15.62% | 1 | 25.00% |
Linus Torvalds (pre-git) | 1 | 3.12% | 1 | 25.00% |
Total | 32 | 100.00% | 4 | 100.00% |
static void *t_next(struct seq_file *m, void *v, loff_t *pos)
{
return seq_list_next(v, &tty_drivers, pos);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Al Viro | 23 | 74.19% | 1 | 33.33% |
Pavel Emelyanov | 5 | 16.13% | 1 | 33.33% |
Linus Torvalds (pre-git) | 3 | 9.68% | 1 | 33.33% |
Total | 31 | 100.00% | 3 | 100.00% |
static void t_stop(struct seq_file *m, void *v)
{
mutex_unlock(&tty_mutex);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Al Viro | 13 | 61.90% | 1 | 50.00% |
Alexey Dobriyan | 8 | 38.10% | 1 | 50.00% |
Total | 21 | 100.00% | 2 | 100.00% |
static const struct seq_operations tty_drivers_op = {
.start = t_start,
.next = t_next,
.stop = t_stop,
.show = show_tty_driver
};
static int tty_drivers_open(struct inode *inode, struct file *file)
{
return seq_open(file, &tty_drivers_op);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Al Viro | 25 | 100.00% | 1 | 100.00% |
Total | 25 | 100.00% | 1 | 100.00% |
static const struct file_operations proc_tty_drivers_operations = {
.open = tty_drivers_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
/*
* This function is called by tty_register_driver() to handle
* registering the driver's /proc handler into /proc/tty/driver/<foo>
*/
void proc_tty_register_driver(struct tty_driver *driver)
{
struct proc_dir_entry *ent;
if (!driver->driver_name || driver->proc_entry ||
!driver->ops->proc_fops)
return;
ent = proc_create_data(driver->driver_name, 0, proc_tty_driver,
driver->ops->proc_fops, driver);
driver->proc_entry = ent;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds | 33 | 54.10% | 1 | 20.00% |
Linus Torvalds (pre-git) | 12 | 19.67% | 1 | 20.00% |
Werner Fink | 9 | 14.75% | 1 | 20.00% |
Alexey Dobriyan | 7 | 11.48% | 2 | 40.00% |
Total | 61 | 100.00% | 5 | 100.00% |
/*
* This function is called by tty_unregister_driver()
*/
void proc_tty_unregister_driver(struct tty_driver *driver)
{
struct proc_dir_entry *ent;
ent = driver->proc_entry;
if (!ent)
return;
remove_proc_entry(driver->driver_name, proc_tty_driver);
driver->proc_entry = NULL;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds | 31 | 73.81% | 1 | 50.00% |
Linus Torvalds (pre-git) | 11 | 26.19% | 1 | 50.00% |
Total | 42 | 100.00% | 2 | 100.00% |
/*
* Called by proc_root_init() to initialize the /proc/tty subtree
*/
void __init proc_tty_init(void)
{
if (!proc_mkdir("tty", NULL))
return;
proc_mkdir("tty/ldisc", NULL); /* Preserved: it's userspace visible */
/*
* /proc/tty/driver/serial reveals the exact character counts for
* serial links which is just too easy to abuse for inferring
* password lengths and inter-keystroke timings during password
* entry.
*/
proc_tty_driver = proc_mkdir_mode("tty/driver", S_IRUSR|S_IXUSR, NULL);
proc_create("tty/ldiscs", 0, NULL, &tty_ldiscs_proc_fops);
proc_create("tty/drivers", 0, NULL, &proc_tty_drivers_operations);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds | 31 | 47.69% | 1 | 20.00% |
Werner Fink | 20 | 30.77% | 1 | 20.00% |
Linus Torvalds (pre-git) | 13 | 20.00% | 2 | 40.00% |
Alexey Dobriyan | 1 | 1.54% | 1 | 20.00% |
Total | 65 | 100.00% | 5 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Al Viro | 498 | 55.52% | 3 | 12.50% |
Linus Torvalds (pre-git) | 199 | 22.19% | 5 | 20.83% |
Linus Torvalds | 99 | 11.04% | 2 | 8.33% |
Alexey Dobriyan | 38 | 4.24% | 6 | 25.00% |
Werner Fink | 29 | 3.23% | 1 | 4.17% |
Pavel Emelyanov | 18 | 2.01% | 1 | 4.17% |
Domen Puncer | 8 | 0.89% | 1 | 4.17% |
Brian Gerst | 4 | 0.45% | 1 | 4.17% |
Dave Jones | 1 | 0.11% | 1 | 4.17% |
Adrian Bunk | 1 | 0.11% | 1 | 4.17% |
Jan Engelhardt | 1 | 0.11% | 1 | 4.17% |
Arjan van de Ven | 1 | 0.11% | 1 | 4.17% |
Total | 897 | 100.00% | 24 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.