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

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