tty_io.c (5fd8c2d3de3dd3cc6d36a0c7a08e44cd5bf173e6) tty_io.c (83efeeeb3d04b22aaed1df99bc70a48fe9d22c4d)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 1991, 1992 Linus Torvalds
4 */
5
6/*
7 * 'tty_io.c' gives an orthogonal feeling to tty's, be they consoles
8 * or rs-channels. It also implements echoing, cooked mode etc.

--- 2254 unchanged lines hidden (view full) ---

2263 * Fake input to a tty device. Does the necessary locking and input management.
2264 *
2265 * FIXME: does not honour flow control ??
2266 *
2267 * Locking:
2268 * * Called functions take tty_ldiscs_lock
2269 * * current->signal->tty check is safe without locks
2270 */
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 1991, 1992 Linus Torvalds
4 */
5
6/*
7 * 'tty_io.c' gives an orthogonal feeling to tty's, be they consoles
8 * or rs-channels. It also implements echoing, cooked mode etc.

--- 2254 unchanged lines hidden (view full) ---

2263 * Fake input to a tty device. Does the necessary locking and input management.
2264 *
2265 * FIXME: does not honour flow control ??
2266 *
2267 * Locking:
2268 * * Called functions take tty_ldiscs_lock
2269 * * current->signal->tty check is safe without locks
2270 */
2271static bool tty_legacy_tiocsti __read_mostly = IS_ENABLED(CONFIG_LEGACY_TIOCSTI);
2271static int tiocsti(struct tty_struct *tty, char __user *p)
2272{
2273 char ch, mbz = 0;
2274 struct tty_ldisc *ld;
2275
2272static int tiocsti(struct tty_struct *tty, char __user *p)
2273{
2274 char ch, mbz = 0;
2275 struct tty_ldisc *ld;
2276
2277 if (!tty_legacy_tiocsti)
2278 return -EIO;
2279
2276 if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN))
2277 return -EPERM;
2278 if (get_user(ch, p))
2279 return -EFAULT;
2280 tty_audit_tiocsti(tty, ch);
2281 ld = tty_ldisc_ref_wait(tty);
2282 if (!ld)
2283 return -EIO;

--- 1285 unchanged lines hidden (view full) ---

3569void console_sysfs_notify(void)
3570{
3571 if (consdev)
3572 sysfs_notify(&consdev->kobj, NULL, "active");
3573}
3574
3575static struct ctl_table tty_table[] = {
3576 {
2280 if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN))
2281 return -EPERM;
2282 if (get_user(ch, p))
2283 return -EFAULT;
2284 tty_audit_tiocsti(tty, ch);
2285 ld = tty_ldisc_ref_wait(tty);
2286 if (!ld)
2287 return -EIO;

--- 1285 unchanged lines hidden (view full) ---

3573void console_sysfs_notify(void)
3574{
3575 if (consdev)
3576 sysfs_notify(&consdev->kobj, NULL, "active");
3577}
3578
3579static struct ctl_table tty_table[] = {
3580 {
3581 .procname = "legacy_tiocsti",
3582 .data = &tty_legacy_tiocsti,
3583 .maxlen = sizeof(tty_legacy_tiocsti),
3584 .mode = 0644,
3585 .proc_handler = proc_dobool,
3586 },
3587 {
3577 .procname = "ldisc_autoload",
3578 .data = &tty_ldisc_autoload,
3579 .maxlen = sizeof(tty_ldisc_autoload),
3580 .mode = 0644,
3581 .proc_handler = proc_dointvec,
3582 .extra1 = SYSCTL_ZERO,
3583 .extra2 = SYSCTL_ONE,
3584 },

--- 49 unchanged lines hidden ---
3588 .procname = "ldisc_autoload",
3589 .data = &tty_ldisc_autoload,
3590 .maxlen = sizeof(tty_ldisc_autoload),
3591 .mode = 0644,
3592 .proc_handler = proc_dointvec,
3593 .extra1 = SYSCTL_ZERO,
3594 .extra2 = SYSCTL_ONE,
3595 },

--- 49 unchanged lines hidden ---