diff options
author | Andy Fiddaman <omnios@citrus-it.co.uk> | 2018-05-30 00:15:35 +0000 |
---|---|---|
committer | Hans Rosenfeld <hans.rosenfeld@joyent.com> | 2018-06-04 10:34:36 +0200 |
commit | 6cfa0a7079eb1baa0a742f1e4def7cdabc8dcdab (patch) | |
tree | 0abc842f0bdd6820328ce59299ac350a9438aa16 /usr/src/uts/common/os/streamio.c | |
parent | 207bc6d049369709a154c840750e0a74a9ff0a76 (diff) | |
download | illumos-gate-6cfa0a7079eb1baa0a742f1e4def7cdabc8dcdab.tar.gz |
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>
Diffstat (limited to 'usr/src/uts/common/os/streamio.c')
-rw-r--r-- | usr/src/uts/common/os/streamio.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/usr/src/uts/common/os/streamio.c b/usr/src/uts/common/os/streamio.c index 62569eefed..509a3cfd40 100644 --- a/usr/src/uts/common/os/streamio.c +++ b/usr/src/uts/common/os/streamio.c @@ -25,6 +25,7 @@ /* * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2017 Joyent, Inc. + * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. */ #include <sys/types.h> @@ -3783,6 +3784,30 @@ strioctl(struct vnode *vp, int cmd, intptr_t arg, int flag, int copyflag, TRACE_2(TR_FAC_STREAMS_FR, TR_I_PUSH, "I_PUSH:fp %p stp %p", fp, stp); + /* + * If the module is flagged as single-instance, then check + * to see if the module is already pushed. If it is, return + * as if the push was successful. + */ + if (fp->f_qflag & _QSINGLE_INSTANCE) { + queue_t *q; + + claimstr(stp->sd_wrq); + for (q = stp->sd_wrq->q_next; q; q = q->q_next) { + if (q->q_flag & QREADR) { + q = NULL; + break; + } + if (strcmp(mname, Q2NAME(q)) == 0) + break; + } + releasestr(stp->sd_wrq); + if (q != NULL) { + fmodsw_rele(fp); + return (0); + } + } + if (error = strstartplumb(stp, flag, cmd)) { fmodsw_rele(fp); return (error); |