root/kernel/chr_drv/pty.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. pty_copy
  2. mpty_write
  3. spty_write

   1 /*
   2  *  linux/kernel/chr_drv/pty.c
   3  *
   4  *  (C) 1991  Linus Torvalds
   5  */
   6 
   7 /*
   8  *      pty.c
   9  *
  10  * This module implements the pty functions
  11  *      void mpty_write(struct tty_struct * queue);
  12  *      void spty_write(struct tty_struct * queue);
  13  */
  14 
  15 #include <linux/tty.h>
  16 #include <linux/sched.h>
  17 #include <asm/system.h>
  18 #include <asm/io.h>
  19 
  20 static inline void pty_copy(struct tty_struct * from, struct tty_struct * to)
     /* [previous][next][first][last][top][bottom][index][help] */
  21 {
  22         char c;
  23 
  24         while (!from->stopped && !EMPTY(from->write_q)) {
  25                 if (FULL(to->read_q)) {
  26                         if (FULL(to->secondary))
  27                                 break;
  28                         TTY_READ_FLUSH(to);
  29                         continue;
  30                 }
  31                 GETCH(from->write_q,c);
  32                 PUTCH(c,to->read_q);
  33                 if (current->signal & ~current->blocked)
  34                         break;
  35         }
  36         TTY_READ_FLUSH(to);
  37         wake_up(&from->write_q->proc_list);
  38 }
  39 
  40 /*
  41  * This routine gets called when tty_write has put something into
  42  * the write_queue. It copies the input to the output-queue of it's
  43  * slave.
  44  */
  45 void mpty_write(struct tty_struct * tty)
     /* [previous][next][first][last][top][bottom][index][help] */
  46 {
  47         int nr = tty - tty_table;
  48 
  49         if ((nr >> 6) != 2)
  50                 printk("bad mpty\n\r");
  51         else
  52                 pty_copy(tty,tty+64);
  53 }
  54 
  55 void spty_write(struct tty_struct * tty)
     /* [previous][next][first][last][top][bottom][index][help] */
  56 {
  57         int nr = tty - tty_table;
  58 
  59         if ((nr >> 6) != 3)
  60                 printk("bad spty\n\r");
  61         else
  62                 pty_copy(tty,tty-64);
  63 }

/* [previous][next][first][last][top][bottom][index][help] */