tty: add an argument to tty_setup
authorAlan Cox <alan@linux.intel.com>
Fri, 28 Sep 2018 20:18:44 +0000 (21:18 +0100)
committerAlan Cox <alan@linux.intel.com>
Fri, 28 Sep 2018 20:18:44 +0000 (21:18 +0100)
We need this to allow platforms to choose to implement tty output buffering

Kernel/include/tty.h
Kernel/tty.c

index 115e600..3d3ac4e 100644 (file)
@@ -258,7 +258,7 @@ extern struct s_queue ttyinq[NUM_DEV_TTY + 1];
 extern ttyready_t tty_writeready(uint8_t minor);
 extern void tty_sleeping(uint8_t minor);
 extern void tty_putc(uint8_t minor, unsigned char c);
-extern void tty_setup(uint8_t minor);
+extern void tty_setup(uint8_t minor, uint8_t flags);
 extern int tty_carrier(uint8_t minor);
 extern void tty_data_consumed(uint8_t minor);
 /* PTY pieces: 8 ptys both sides of */
index 1116c4b..b28b9d5 100644 (file)
@@ -177,7 +177,7 @@ int tty_open(uint8_t minor, uint16_t flag)
                t->users++;
                return 0;
         }
-       tty_setup(minor);
+       tty_setup(minor, 0);
        if ((t->termios.c_cflag & CLOCAL) || (flag & O_NDELAY))
                goto out;
 
@@ -254,6 +254,7 @@ void tty_exit(void)
 int tty_ioctl(uint8_t minor, uarg_t request, char *data)
 {                              /* Data in User Space */
         struct tty *t;
+        uint8_t waito = 0;
 
         t = &ttydata[minor];
 
@@ -274,17 +275,15 @@ int tty_ioctl(uint8_t minor, uarg_t request, char *data)
        switch (request) {
        case TCGETS:
                return uput(&t->termios, data, sizeof(struct termios));
-               break;
        case TCSETSF:
                clrq(&ttyinq[minor]);
                /* Fall through for now */
        case TCSETSW:
-               /* We don't have an output queue really so for now drop
-                  through */
+               waito = 1;
        case TCSETS:
                if (uget(data, &t->termios, sizeof(struct termios)) == -1)
                        return -1;
-                tty_setup(minor);
+                tty_setup(minor, waito);
                 tty_selwake(minor, SELECT_IN|SELECT_OUT);
                break;
        case TIOCINQ: