Print this page
5880 Increase IOV_MAX to at least 1024
Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/cons.c
          +++ new/usr/src/uts/common/io/cons.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 1982, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2015, Joyent, Inc. All rights reserved.
  24   25   */
  25   26  
  26   27  /*
  27   28   * Indirect console driver for Sun.
  28   29   *
  29   30   * Redirects all I/O to the device designated as the underlying "hardware"
  30   31   * console, as given by the value of rconsvp.  The implementation assumes that
  31   32   * rconsvp denotes a STREAMS device; the assumption is justified since
  32   33   * consoles must be capable of effecting tty semantics.
  33   34   *
↓ open down ↓ 12 lines elided ↑ open up ↑
  46   47  #include <sys/cred.h>
  47   48  #include <sys/user.h>
  48   49  #include <sys/proc.h>
  49   50  #include <sys/disp.h>
  50   51  #include <sys/file.h>
  51   52  #include <sys/taskq.h>
  52   53  #include <sys/log.h>
  53   54  #include <sys/vnode.h>
  54   55  #include <sys/uio.h>
  55   56  #include <sys/stat.h>
       57 +#include <sys/limits.h>
  56   58  
  57   59  #include <sys/console.h>
  58   60  #include <sys/consdev.h>
  59   61  
  60   62  #include <sys/stream.h>
  61   63  #include <sys/strsubr.h>
  62   64  #include <sys/poll.h>
  63   65  
  64   66  #include <sys/debug.h>
  65   67  
↓ open down ↓ 341 lines elided ↑ open up ↑
 407  409          if (rconsvp == NULL) {
 408  410                  uio->uio_resid = 0;
 409  411                  return (0);
 410  412          }
 411  413  
 412  414          /*
 413  415           * Output to virtual console for logging if enabled.
 414  416           */
 415  417          if (vsconsvp != NULL && vsconsvp->v_stream != NULL) {
 416  418                  struiod_t uiod;
      419 +                struct iovec buf[IOV_MAX_STACK];
      420 +                int iovlen = 0;
 417  421  
      422 +                if (uio->uio_iovcnt > IOV_MAX_STACK) {
      423 +                        iovlen = uio->uio_iovcnt * sizeof (iovec_t);
      424 +                        uiod.d_iov = kmem_alloc(iovlen, KM_SLEEP);
      425 +                } else {
      426 +                        uiod.d_iov = buf;
      427 +                }
      428 +
 418  429                  /*
 419  430                   * strwrite modifies uio so need to make copy.
 420  431                   */
 421      -                (void) uiodup(uio, &uiod.d_uio, uiod.d_iov,
 422      -                    sizeof (uiod.d_iov) / sizeof (*uiod.d_iov));
      432 +                (void) uiodup(uio, &uiod.d_uio, uiod.d_iov, uio->uio_iovcnt);
 423  433  
 424  434                  (void) strwrite(vsconsvp, &uiod.d_uio, cred);
      435 +                if (iovlen != 0)
      436 +                        kmem_free(uiod.d_iov, iovlen);
 425  437          }
 426  438  
 427  439          if (rconsvp->v_stream != NULL)
 428  440                  return (strwrite(rconsvp, uio, cred));
 429  441          else
 430  442                  return (cdev_write(rconsdev, uio, cred));
 431  443  }
 432  444  
 433  445  /* ARGSUSED */
 434  446  static int
↓ open down ↓ 65 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX