Print this page
8527 tty buffer/queue sizes should be larger

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/ldterm.c
          +++ new/usr/src/uts/common/io/ldterm.c
↓ open down ↓ 558 lines elided ↑ open up ↑
 559  559   * relatively small input queue, so that blockages above us get
 560  560   * reflected fairly quickly to the module below us.  We also have a
 561  561   * small maximum packet size, since you can put a message of that
 562  562   * size on an empty queue no matter how much bigger than the high
 563  563   * water mark it is.
 564  564   */
 565  565  static struct module_info ldtermmiinfo = {
 566  566          0x0bad,
 567  567          "ldterm",
 568  568          0,
 569      -        256,
 570      -        HIWAT,
      569 +        _TTY_BUFSIZ,
      570 +        _TTY_BUFSIZ,
 571  571          LOWAT
 572  572  };
 573  573  
 574  574  
 575  575  static struct qinit ldtermrinit = {
 576  576          (int (*)())ldtermrput,
 577  577          (int (*)())ldtermrsrv,
 578  578          ldtermopen,
 579  579          ldtermclose,
 580  580          NULL,
↓ open down ↓ 205 lines elided ↑ open up ↑
 786  786           * to values appropriate for a terminal.  Also set the "vmin"
 787  787           * and "vtime" values to 1 and 0, turn on message-nondiscard
 788  788           * mode (as we're in ICANON mode), and turn on "old-style
 789  789           * NODELAY" mode.
 790  790           */
 791  791          if ((bp = open_mblk(q, sizeof (struct stroptions))) == NULL)
 792  792                  goto open_abort;
 793  793          strop = (struct stroptions *)bp->b_wptr;
 794  794          strop->so_flags = SO_READOPT|SO_HIWAT|SO_LOWAT|SO_NDELON|SO_ISTTY;
 795  795          strop->so_readopt = RMSGN;
 796      -        strop->so_hiwat = HIWAT;
      796 +        strop->so_hiwat = _TTY_BUFSIZ;
 797  797          strop->so_lowat = LOWAT;
 798  798          bp->b_wptr += sizeof (struct stroptions);
 799  799          bp->b_datap->db_type = M_SETOPTS;
 800  800          putnext(q, bp);
 801  801  
 802  802          return (0);             /* this can become a controlling TTY */
 803  803  
 804  804  open_abort:
 805  805          qprocsoff(q);
 806  806          q->q_ptr = NULL;
↓ open down ↓ 1081 lines elided ↑ open up ↑
1888 1888  escaped:
1889 1889          /*
1890 1890           * First, make sure we can fit one WHOLE multi-byte char in the
1891 1891           * buffer.  This is one place where we have overhead even if
1892 1892           * not in multi-byte mode; the overhead is subtracting
1893 1893           * tp->t_maxeuc from MAX_CANON before checking.
1894 1894           *
1895 1895           * Allows MAX_CANON bytes in the buffer before throwing awaying
1896 1896           * the the overflow of characters.
1897 1897           */
1898      -        if ((tp->t_msglen > ((MAX_CANON + 1) - (int)tp->t_maxeuc)) &&
     1898 +        if ((tp->t_msglen > ((_TTY_BUFSIZ + 1) - (int)tp->t_maxeuc)) &&
1899 1899              !((tp->t_state & TS_MEUC) && tp->t_eucleft)) {
1900 1900  
1901 1901                  /*
1902 1902                   * Byte will cause line to overflow, or the next EUC
1903 1903                   * won't fit: Ring the bell or discard all input, and
1904 1904                   * don't save the byte away.
1905 1905                   */
1906 1906                  if (tp->t_modes.c_iflag & IMAXBEL) {
1907 1907                          if (canputnext(wrq))
1908 1908                                  ldterm_outchar(CTRL('g'), wrq, ebsize, tp);
↓ open down ↓ 2467 lines elided ↑ open up ↑
4376 4376                           * set!
4377 4377                           */
4378 4378                          for (i = 0; i < 4; i++) {
4379 4379                                  if (tp->eucwioc.eucw[i] > tp->t_maxeuc)
4380 4380                                          tp->t_maxeuc = tp->eucwioc.eucw[i];
4381 4381                                  if (tp->eucwioc.scrw[i] > 1)
4382 4382                                          tp->t_state |= TS_MEUC;
4383 4383                          }
4384 4384                          if ((tp->t_maxeuc > 1) || (tp->t_state & TS_MEUC)) {
4385 4385                                  if (!tp->t_eucp_mp) {
4386      -                                        if (!(tp->t_eucp_mp = allocb(CANBSIZ,
4387      -                                            BPRI_HI))) {
     4386 +                                        if ((tp->t_eucp_mp = allocb(_TTY_BUFSIZ,
     4387 +                                            BPRI_HI)) == NULL) {
4388 4388                                                  tp->t_maxeuc = 1;
4389 4389                                                  tp->t_state &= ~TS_MEUC;
4390 4390                                                  cmn_err(CE_WARN,
4391 4391                                                      "Can't allocate eucp_mp");
4392 4392                                                  miocnak(q, mp, 0, ENOSR);
4393 4393                                                  return;
4394 4394                                          }
4395 4395                                          /*
4396 4396                                           * here, if there's junk in
4397 4397                                           * the canonical buffer, then
↓ open down ↓ 207 lines elided ↑ open up ↑
4605 4605                  if (maxbytelen <= 0 || maxscreenlen <= 0) {
4606 4606                          miocnak(q, mp, 0, ERANGE);
4607 4607                          return;
4608 4608                  }
4609 4609  
4610 4610                  /* Do the switching. */
4611 4611                  tp->t_maxeuc = maxbytelen;
4612 4612                  tp->t_state &= ~TS_MEUC;
4613 4613                  if (maxbytelen > 1 || maxscreenlen > 1) {
4614 4614                          if (!tp->t_eucp_mp) {
4615      -                                if (!(tp->t_eucp_mp = allocb(CANBSIZ,
     4615 +                                if (!(tp->t_eucp_mp = allocb(_TTY_BUFSIZ,
4616 4616                                      BPRI_HI))) {
4617 4617                                          cmn_err(CE_WARN,
4618 4618                                              "Can't allocate eucp_mp");
4619 4619                                          miocnak(q, mp, 0, ENOSR);
4620 4620                                          return;
4621 4621                                  }
4622 4622                                  /*
4623 4623                                   * If there's junk in the canonical buffer,
4624 4624                                   * then move the eucp pointer past it,
4625 4625                                   * so we don't run off the beginning. This is
↓ open down ↓ 884 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX