Lines Matching defs:tty
372 /* We use inotify to be notified when the tty is closed. We
378 * tty loses its controlling process. However, unless some
379 * rogue process uses TIOCNOTTY on /dev/tty *after* closing
380 * its tty otherwise this will not become a problem. As long
382 * on the same tty as an untrusted user this should not be a
416 * successfully became the controlling process of the tty */
422 * if we already own the tty. */
425 /* First, try to get the tty */
490 /* We close the tty fd here since if the old session
518 fd = open("/dev/tty", O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK);
581 if (!startswith(name, "/dev/tty"))
639 bool tty_is_vc(const char *tty) {
640 assert(tty);
642 return vtnr_from_tty(tty) >= 0;
645 bool tty_is_console(const char *tty) {
646 assert(tty);
648 if (startswith(tty, "/dev/"))
649 tty += 5;
651 return streq(tty, "console");
654 int vtnr_from_tty(const char *tty) {
657 assert(tty);
659 if (startswith(tty, "/dev/"))
660 tty += 5;
662 if (!startswith(tty, "tty") )
665 if (tty[3] < '0' || tty[3] > '9')
668 r = safe_atoi(tty+3, &i);
679 char *tty;
687 if (read_one_line_file("/sys/class/tty/console/active", active) < 0)
692 tty = strrchr(*active, ' ');
693 if (tty)
694 tty++;
696 tty = *active;
698 if (streq(tty, "tty0")) {
702 if (read_one_line_file("/sys/class/tty/tty0/active", &tmp) >= 0) {
704 tty = *active = tmp;
708 return tty;
711 bool tty_is_vc_resolve(const char *tty) {
714 assert(tty);
716 if (startswith(tty, "/dev/"))
717 tty += 5;
719 if (streq(tty, "console")) {
720 tty = resolve_dev_console(&active);
721 if (!tty)
725 return tty_is_vc(tty);
728 const char *default_term_for_tty(const char *tty) {
729 return tty && tty_is_vc_resolve(tty) ? "TERM=linux" : "TERM=vt220";
890 if (streq(s, "tty")) {