• Home
  • Raw
  • Download

Lines Matching refs:tty

39 static void pty_close(struct tty_struct *tty, struct file *filp)  in pty_close()  argument
41 BUG_ON(!tty); in pty_close()
42 if (tty->driver->subtype == PTY_TYPE_MASTER) in pty_close()
43 WARN_ON(tty->count > 1); in pty_close()
45 if (tty->count > 2) in pty_close()
48 wake_up_interruptible(&tty->read_wait); in pty_close()
49 wake_up_interruptible(&tty->write_wait); in pty_close()
50 tty->packet = 0; in pty_close()
51 if (!tty->link) in pty_close()
53 tty->link->packet = 0; in pty_close()
54 set_bit(TTY_OTHER_CLOSED, &tty->link->flags); in pty_close()
55 wake_up_interruptible(&tty->link->read_wait); in pty_close()
56 wake_up_interruptible(&tty->link->write_wait); in pty_close()
57 if (tty->driver->subtype == PTY_TYPE_MASTER) { in pty_close()
58 set_bit(TTY_OTHER_CLOSED, &tty->flags); in pty_close()
60 if (tty->driver == ptm_driver) in pty_close()
61 devpts_pty_kill(tty->link); in pty_close()
63 tty_vhangup(tty->link); in pty_close()
77 static void pty_unthrottle(struct tty_struct *tty) in pty_unthrottle() argument
79 struct tty_struct *o_tty = tty->link; in pty_unthrottle()
85 set_bit(TTY_THROTTLED, &tty->flags); in pty_unthrottle()
102 static int pty_write(struct tty_struct *tty, const unsigned char *buf, in pty_write() argument
105 struct tty_struct *to = tty->link; in pty_write()
108 if (!to || tty->stopped) in pty_write()
119 static int pty_write_room(struct tty_struct *tty) in pty_write_room() argument
121 struct tty_struct *to = tty->link; in pty_write_room()
123 if (!to || tty->stopped) in pty_write_room()
146 static int pty_chars_in_buffer(struct tty_struct *tty) in pty_chars_in_buffer() argument
148 struct tty_struct *to = tty->link; in pty_chars_in_buffer()
158 if (tty->driver->subtype == PTY_TYPE_SLAVE) in pty_chars_in_buffer()
170 static int pty_set_lock(struct tty_struct *tty, int __user *arg) in pty_set_lock() argument
176 set_bit(TTY_PTY_LOCK, &tty->flags); in pty_set_lock()
178 clear_bit(TTY_PTY_LOCK, &tty->flags); in pty_set_lock()
182 static void pty_flush_buffer(struct tty_struct *tty) in pty_flush_buffer() argument
184 struct tty_struct *to = tty->link; in pty_flush_buffer()
194 spin_lock_irqsave(&tty->ctrl_lock, flags); in pty_flush_buffer()
195 tty->ctrl_status |= TIOCPKT_FLUSHWRITE; in pty_flush_buffer()
197 spin_unlock_irqrestore(&tty->ctrl_lock, flags); in pty_flush_buffer()
201 static int pty_open(struct tty_struct *tty, struct file *filp) in pty_open() argument
205 if (!tty || !tty->link) in pty_open()
209 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) in pty_open()
211 if (test_bit(TTY_PTY_LOCK, &tty->link->flags)) in pty_open()
213 if (tty->link->count != 1) in pty_open()
216 clear_bit(TTY_OTHER_CLOSED, &tty->link->flags); in pty_open()
217 set_bit(TTY_THROTTLED, &tty->flags); in pty_open()
223 static void pty_set_termios(struct tty_struct *tty, in pty_set_termios() argument
226 tty->termios->c_cflag &= ~(CSIZE | PARENB); in pty_set_termios()
227 tty->termios->c_cflag |= (CS8 | CREAD); in pty_set_termios()
239 int pty_resize(struct tty_struct *tty, struct winsize *ws) in pty_resize() argument
243 struct tty_struct *pty = tty->link; in pty_resize()
246 mutex_lock(&tty->termios_mutex); in pty_resize()
247 if (!memcmp(ws, &tty->winsize, sizeof(*ws))) in pty_resize()
254 spin_lock_irqsave(&tty->ctrl_lock, flags); in pty_resize()
255 pgrp = get_pid(tty->pgrp); in pty_resize()
256 spin_unlock_irqrestore(&tty->ctrl_lock, flags); in pty_resize()
270 tty->winsize = *ws; in pty_resize()
273 mutex_unlock(&tty->termios_mutex); in pty_resize()
277 static int pty_install(struct tty_driver *driver, struct tty_struct *tty) in pty_install() argument
280 int idx = tty->index; in pty_install()
295 retval = tty_init_termios(tty); in pty_install()
301 tty_free_termios(tty); in pty_install()
313 tty->link = o_tty; in pty_install()
314 o_tty->link = tty; in pty_install()
317 tty->count++; in pty_install()
318 driver->ttys[idx] = tty; in pty_install()
344 static int pty_bsd_ioctl(struct tty_struct *tty, struct file *file, in pty_bsd_ioctl() argument
349 return pty_set_lock(tty, (int __user *) arg); in pty_bsd_ioctl()
483 static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file, in pty_unix98_ioctl() argument
488 return pty_set_lock(tty, (int __user *)arg); in pty_unix98_ioctl()
490 return put_user(tty->index, (unsigned int __user *)arg); in pty_unix98_ioctl()
508 struct tty_struct *tty = devpts_get_tty(ptm_inode, idx); in ptm_unix98_lookup() local
509 if (tty) in ptm_unix98_lookup()
510 tty = tty->link; in ptm_unix98_lookup()
511 return tty; in ptm_unix98_lookup()
526 struct tty_struct *tty = devpts_get_tty(pts_inode, idx); in pts_unix98_lookup() local
528 if (!tty) in pts_unix98_lookup()
530 return tty; in pts_unix98_lookup()
533 static void pty_unix98_shutdown(struct tty_struct *tty) in pty_unix98_shutdown() argument
536 kfree(tty->termios); in pty_unix98_shutdown()
542 static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty) in pty_unix98_install() argument
545 int idx = tty->index; in pty_unix98_install()
557 tty->termios = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL); in pty_unix98_install()
558 if (tty->termios == NULL) in pty_unix98_install()
560 *tty->termios = driver->init_termios; in pty_unix98_install()
561 tty->termios_locked = tty->termios + 1; in pty_unix98_install()
573 tty->link = o_tty; in pty_unix98_install()
574 o_tty->link = tty; in pty_unix98_install()
581 tty->count++; in pty_unix98_install()
588 kfree(tty->termios); in pty_unix98_install()
592 static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) in pty_unix98_remove() argument
643 struct tty_struct *tty; in __ptmx_open() local
655 tty = tty_init_dev(ptm_driver, index, 1); in __ptmx_open()
658 if (IS_ERR(tty)) { in __ptmx_open()
659 retval = PTR_ERR(tty); in __ptmx_open()
663 set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */ in __ptmx_open()
664 filp->private_data = tty; in __ptmx_open()
665 file_move(filp, &tty->tty_files); in __ptmx_open()
667 retval = devpts_pty_new(inode, tty->link); in __ptmx_open()
671 retval = ptm_driver->ops->open(tty, filp); in __ptmx_open()