Print this page
9042 multiples of tty streams modules cause weirdness
Reviewed by: Randy Fishel <randyf@sibernet.com>
Reviewed by: Carlos Neira <cneirabustos@gmail.com>
Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
re #13613 rb4516 Tunables needs volatile keyword
        
*** 19,34 ****
   * CDDL HEADER END
   */
  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  /*        All Rights Reserved   */
  
- 
  /*
   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
   * Use is subject to license terms.
   * Copyright (c) 2016 by Delphix. All rights reserved.
   */
  
  #include <sys/types.h>
  #include <sys/sysmacros.h>
  #include <sys/param.h>
  #include <sys/errno.h>
--- 19,37 ----
   * CDDL HEADER END
   */
  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  /*        All Rights Reserved   */
  
  /*
   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
   * Use is subject to license terms.
   * Copyright (c) 2016 by Delphix. All rights reserved.
+  * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
   */
+ /*
+  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
+  */
  
  #include <sys/types.h>
  #include <sys/sysmacros.h>
  #include <sys/param.h>
  #include <sys/errno.h>
*** 218,228 ****
   * consumer - IP is no longer D_MTPERMOD, but there may be other
   * modules/drivers depend on this syncq flow control, we prefer to
   * choose a large number as the default value. For potential
   * performance gain, this value is tunable in /etc/system.
   */
! int sq_max_size = 10000;
  
  /*
   * The number of ciputctrl structures per syncq and stream we create when
   * needed.
   */
--- 221,231 ----
   * consumer - IP is no longer D_MTPERMOD, but there may be other
   * modules/drivers depend on this syncq flow control, we prefer to
   * choose a large number as the default value. For potential
   * performance gain, this value is tunable in /etc/system.
   */
! volatile int sq_max_size = 10000;
  
  /*
   * The number of ciputctrl structures per syncq and stream we create when
   * needed.
   */
*** 2462,2471 ****
--- 2465,2485 ----
                  if ((qflag & QMT_TYPEMASK) != QMTSAFE)
                          goto bad;
                  qflag |= _QDIRECT;
          }
  
+         /*
+          * Private flag used to indicate that a streams module should only
+          * be pushed once. The TTY streams modules have this flag since if
+          * libc believes itself to be an xpg4 process then it will
+          * automatically and unconditionally push them when a PTS device is
+          * opened. If an application is not aware of this then without this
+          * flag we would end up with duplicate modules.
+          */
+         if (devflag & _D_SINGLE_INSTANCE)
+                 qflag |= _QSINGLE_INSTANCE;
+ 
          *qflagp = qflag;
          *sqtypep = sqtype;
          return (0);
  
  bad: