Lines Matching refs:stp
89 #define i_straccess(x, y) ((stp->sd_sidp == NULL) ? 0 : \
90 (stp->sd_vnode->v_type == VFIFO) ? 0 : \
193 push_mod(queue_t *qp, dev_t *devp, struct stdata *stp, const char *name, in push_mod() argument
199 if (stp->sd_flag & (STRHUP|STRDERR|STWRERR)) { in push_mod()
200 error = (stp->sd_flag & STRHUP) ? ENXIO : EIO; in push_mod()
203 if (stp->sd_pushcnt >= nstrpush) { in push_mod()
208 stp->sd_flag |= STREOPENFAIL; in push_mod()
222 mutex_enter(&stp->sd_lock); in push_mod()
223 if (anchor == stp->sd_pushcnt) { in push_mod()
224 stp->sd_anchor = stp->sd_pushcnt; in push_mod()
225 stp->sd_anchorzone = anchor_zoneid; in push_mod()
227 mutex_exit(&stp->sd_lock); in push_mod()
238 struct stdata *stp; in stropen() local
261 if ((stp = vp->v_stream) != NULL) { in stropen()
269 if (STRMATED(stp)) { in stropen()
270 struct stdata *strmatep = stp->sd_mate; in stropen()
272 STRLOCKMATES(stp); in stropen()
279 mutex_exit(&stp->sd_lock); in stropen()
284 mutex_enter(&stp->sd_lock); in stropen()
290 if (stp->sd_flag & (STWOPEN|STRCLOSE|STRPLUMB)) { in stropen()
297 if (!cv_wait_sig(&stp->sd_monitor, in stropen()
298 &stp->sd_lock)) { in stropen()
302 mutex_exit(&stp->sd_lock); in stropen()
306 if (stp->sd_flag & (STRDERR|STWRERR)) { in stropen()
312 stp->sd_flag |= STWOPEN; in stropen()
313 STRUNLOCKMATES(stp); in stropen()
315 mutex_enter(&stp->sd_lock); in stropen()
316 if (stp->sd_flag & (STWOPEN|STRCLOSE|STRPLUMB)) { in stropen()
321 if (!cv_wait_sig(&stp->sd_monitor, in stropen()
322 &stp->sd_lock)) { in stropen()
326 mutex_exit(&stp->sd_lock); in stropen()
330 if (stp->sd_flag & (STRDERR|STWRERR)) { in stropen()
335 stp->sd_flag |= STWOPEN; in stropen()
336 mutex_exit(&stp->sd_lock); in stropen()
345 claimstr(stp->sd_wrq); in stropen()
346 qp = stp->sd_wrq; in stropen()
352 releasestr(stp->sd_wrq); in stropen()
353 mutex_enter(&stp->sd_lock); in stropen()
354 stp->sd_flag &= ~(STRHUP|STWOPEN|STRDERR|STWRERR); in stropen()
355 stp->sd_rerror = 0; in stropen()
356 stp->sd_werror = 0; in stropen()
358 cv_broadcast(&stp->sd_monitor); in stropen()
359 mutex_exit(&stp->sd_lock); in stropen()
369 stp = shalloc(qp); in stropen()
376 stp->sd_flag = STWOPEN; in stropen()
377 stp->sd_siglist = NULL; in stropen()
378 stp->sd_pollist.ph_list = NULL; in stropen()
379 stp->sd_sigflags = 0; in stropen()
380 stp->sd_mark = NULL; in stropen()
381 stp->sd_closetime = STRTIMOUT; in stropen()
382 stp->sd_sidp = NULL; in stropen()
383 stp->sd_pgidp = NULL; in stropen()
384 stp->sd_vnode = vp; in stropen()
385 stp->sd_rerror = 0; in stropen()
386 stp->sd_werror = 0; in stropen()
387 stp->sd_wroff = 0; in stropen()
388 stp->sd_tail = 0; in stropen()
389 stp->sd_iocblk = NULL; in stropen()
390 stp->sd_cmdblk = NULL; in stropen()
391 stp->sd_pushcnt = 0; in stropen()
392 stp->sd_qn_minpsz = 0; in stropen()
393 stp->sd_qn_maxpsz = INFPSZ - 1; /* used to check for initialization */ in stropen()
394 stp->sd_maxblk = INFPSZ; in stropen()
395 qp->q_ptr = _WR(qp)->q_ptr = stp; in stropen()
396 STREAM(qp) = STREAM(_WR(qp)) = stp; in stropen()
397 vp->v_stream = stp; in stropen()
400 stp->sd_flag |= OLDNDELAY; in stropen()
408 stp->sd_wput_opt = SW_SIGPIPE; in stropen()
415 stp->sd_strtab = fifo_getinfo(); in stropen()
421 mutex_enter(&stp->sd_lock); in stropen()
427 stp->sd_qn_minpsz = qp->q_minpsz; in stropen()
428 stp->sd_qn_maxpsz = qp->q_maxpsz; in stropen()
429 stp->sd_flag &= ~STWOPEN; in stropen()
446 mutex_enter(&stp->sd_lock); in stropen()
447 cv_broadcast(&stp->sd_monitor); in stropen()
448 mutex_exit(&stp->sd_lock); in stropen()
450 shfree(stp); in stropen()
456 stp->sd_strtab = STREAMSTAB(getmajor(*devp)); in stropen()
473 if (push_mod(qp, &dummydev, stp, DRMODNAME, 0, crp, 0) != 0) in stropen()
502 error = push_mod(qp, &dummydev, stp, in stropen()
539 error = push_mod(qp, &dummydev, stp, ap->ap_list[s], in stropen()
553 mutex_enter(&stp->sd_lock); in stropen()
554 stp->sd_flag |= STREOPENFAIL; in stropen()
555 mutex_exit(&stp->sd_lock); in stropen()
561 mutex_enter(&stp->sd_lock); in stropen()
562 stp->sd_flag &= ~STWOPEN; in stropen()
569 mutex_enter(QLOCK(stp->sd_wrq->q_next)); in stropen()
570 rmin = stp->sd_wrq->q_next->q_minpsz; in stropen()
571 rmax = stp->sd_wrq->q_next->q_maxpsz; in stropen()
572 mutex_exit(QLOCK(stp->sd_wrq->q_next)); in stropen()
582 mutex_enter(QLOCK(stp->sd_wrq)); in stropen()
583 stp->sd_qn_minpsz = rmin; in stropen()
584 stp->sd_qn_maxpsz = rmax; in stropen()
585 mutex_exit(QLOCK(stp->sd_wrq)); in stropen()
588 cv_broadcast(&stp->sd_monitor); in stropen()
589 mutex_exit(&stp->sd_lock); in stropen()
613 struct stdata *stp; in strclose() local
623 stp = vp->v_stream; in strclose()
624 ASSERT(!(stp->sd_flag & STPLEX)); in strclose()
625 qp = stp->sd_wrq; in strclose()
631 mutex_enter(&stp->sd_lock); in strclose()
632 stp->sd_flag |= STRHUP; in strclose()
633 mutex_exit(&stp->sd_lock); in strclose()
641 if (stp->sd_siglist != NULL) in strclose()
644 ASSERT(stp->sd_siglist == NULL); in strclose()
645 ASSERT(stp->sd_sigflags == 0); in strclose()
647 if (STRMATED(stp)) { in strclose()
648 struct stdata *strmatep = stp->sd_mate; in strclose()
651 STRLOCKMATES(stp); in strclose()
654 while (stp->sd_flag & (STWOPEN|STRCLOSE|STRPLUMB)) { in strclose()
656 cv_wait(&stp->sd_monitor, &stp->sd_lock); in strclose()
657 mutex_exit(&stp->sd_lock); in strclose()
658 STRLOCKMATES(stp); in strclose()
663 mutex_exit(&stp->sd_lock); in strclose()
667 STRLOCKMATES(stp); in strclose()
671 stp->sd_flag |= STRCLOSE; in strclose()
672 STRUNLOCKMATES(stp); in strclose()
674 mutex_enter(&stp->sd_lock); in strclose()
675 stp->sd_flag |= STRCLOSE; in strclose()
676 mutex_exit(&stp->sd_lock); in strclose()
682 if (stp->sd_flag & STRHASLINKS) { in strclose()
691 (void) munlinkall(stp, LINKCLOSE|LINKNORMAL, crp, &rval, ss); in strclose()
700 mutex_enter(&stp->sd_lock); in strclose()
701 if (!(flag & (FNDELAY|FNONBLOCK)) && (stp->sd_closetime > 0)) { in strclose()
712 stp->sd_flag |= WSLEEP; in strclose()
718 if (str_cv_wait(&qp->q_wait, &stp->sd_lock, in strclose()
719 stp->sd_closetime, 0) <= 0) { in strclose()
723 stp->sd_flag &= ~WSLEEP; in strclose()
725 mutex_exit(&stp->sd_lock); in strclose()
744 if (stp->sd_pollist.ph_list != NULL) { in strclose()
745 pollwakeup(&stp->sd_pollist, POLLERR); in strclose()
746 pollhead_clean(&stp->sd_pollist); in strclose()
748 ASSERT(stp->sd_pollist.ph_list == NULL); in strclose()
749 ASSERT(stp->sd_sidp == NULL); in strclose()
750 ASSERT(stp->sd_pgidp == NULL); in strclose()
798 if (stp->sd_iocblk) { in strclose()
799 if (stp->sd_iocblk != (mblk_t *)-1) { in strclose()
800 freemsg(stp->sd_iocblk); in strclose()
802 stp->sd_iocblk = NULL; in strclose()
804 stp->sd_vnode = NULL; in strclose()
807 mutex_enter(&stp->sd_lock); in strclose()
808 freemsg(stp->sd_cmdblk); in strclose()
809 stp->sd_cmdblk = NULL; in strclose()
810 stp->sd_flag &= ~STRCLOSE; in strclose()
811 cv_broadcast(&stp->sd_monitor); in strclose()
812 mutex_exit(&stp->sd_lock); in strclose()
815 shfree(stp); in strclose()
896 stdata_t *stp; in strclean() local
901 stp = vp->v_stream; in strclean()
903 mutex_enter(&stp->sd_lock); in strclean()
904 ssp = stp->sd_siglist; in strclean()
911 stp->sd_siglist = tssp; in strclean()
924 stp->sd_sigflags = 0; in strclean()
925 for (ssp = stp->sd_siglist; ssp; ssp = ssp->ss_next) in strclean()
926 stp->sd_sigflags |= ssp->ss_events; in strclean()
928 mutex_exit(&stp->sd_lock); in strclean()
941 stdata_t *stp; in strcleanall() local
943 stp = vp->v_stream; in strcleanall()
944 mutex_enter(&stp->sd_lock); in strcleanall()
945 ssp = stp->sd_siglist; in strcleanall()
946 stp->sd_siglist = NULL; in strcleanall()
955 stp->sd_sigflags = 0; in strcleanall()
956 mutex_exit(&stp->sd_lock); in strcleanall()
967 strget(struct stdata *stp, queue_t *q, struct uio *uiop, int first, in strget() argument
975 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strget()
977 if (uiop != NULL && stp->sd_struiordq != NULL && in strget()
979 (!first || (stp->sd_wakeq & RSLEEP))) { in strget()
989 stp->sd_wakeq &= ~RSLEEP; in strget()
1000 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strget()
1001 stp->sd_struiodnak++; in strget()
1006 ASSERT(MUTEX_NOT_HELD(&stp->sd_lock)); in strget()
1007 mutex_enter(&stp->sd_lock); in strget()
1008 stp->sd_struiodnak--; in strget()
1009 while (stp->sd_struiodnak == 0 && in strget()
1010 ((bp = stp->sd_struionak) != NULL)) { in strget()
1011 stp->sd_struionak = bp->b_next; in strget()
1021 mutex_exit(&stp->sd_lock); in strget()
1023 mutex_enter(&stp->sd_lock); in strget()
1026 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strget()
1030 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strget()
1049 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strget()
1058 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strget()
1071 if ((uiop != NULL) && (stp->sd_vnode->v_type == VSOCK) && in strget()
1072 (stp->sd_rputdatafunc == NULL)) in strget()
1149 struct stdata *stp; in strread() local
1166 stp = vp->v_stream; in strread()
1168 mutex_enter(&stp->sd_lock); in strread()
1170 if ((error = i_straccess(stp, JCREAD)) != 0) { in strread()
1171 mutex_exit(&stp->sd_lock); in strread()
1175 if (stp->sd_flag & (STRDERR|STPLEX)) { in strread()
1176 error = strgeterr(stp, STRDERR|STPLEX, 0); in strread()
1178 mutex_exit(&stp->sd_lock); in strread()
1188 q = _RD(stp->sd_wrq); in strread()
1190 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strread()
1191 old_sd_flag = stp->sd_flag; in strread()
1195 while ((bp = strget(stp, q, uiop, first, &error)) == NULL) { in strread()
1198 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strread()
1203 if (stp->sd_flag & (STRHUP|STREOF)) { in strread()
1206 if (rflg && !(stp->sd_flag & STRDELIM)) { in strread()
1223 if ((error = strwaitq(stp, waitflag, uiop->uio_resid, in strread()
1229 (stp->sd_flag & OLDNDELAY) && in strread()
1236 if ((error = i_straccess(stp, JCREAD)) != 0) { in strread()
1242 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strread()
1260 if (mark != 0 && bp == stp->sd_mark) { in strread()
1262 putback(stp, q, bp, pri); in strread()
1266 stp->sd_mark = NULL; in strread()
1268 if ((stp->sd_flag & STRDELIM) && (bp->b_flag & MSGDELIM)) in strread()
1270 mutex_exit(&stp->sd_lock); in strread()
1272 if (STREAM_NEEDSERVICE(stp)) in strread()
1273 stream_runservice(stp); in strread()
1292 mutex_enter(&stp->sd_lock); in strread()
1293 putback(stp, q, bp, pri); in strread()
1294 mutex_exit(&stp->sd_lock); in strread()
1308 mutex_enter(&stp->sd_lock); in strread()
1314 if (stp->sd_read_opt & RD_MSGDIS) { in strread()
1319 (stp->sd_mark == NULL)) in strread()
1320 stp->sd_mark = bp; in strread()
1327 putback(stp, q, bp, pri); in strread()
1348 stp->sd_flag &= ~STRNOTATMARK; in strread()
1349 stp->sd_flag |= STRATMARK; in strread()
1351 stp->sd_flag &= ~STRATMARK; in strread()
1352 stp->sd_flag |= STRNOTATMARK; in strread()
1354 stp->sd_flag &= in strread()
1358 stp->sd_flag &= ~STRATMARK; in strread()
1376 strsignal_nolock(stp, *bp->b_rptr, bp->b_band); in strread()
1377 mutex_exit(&stp->sd_lock); in strread()
1379 if (STREAM_NEEDSERVICE(stp)) in strread()
1380 stream_runservice(stp); in strread()
1381 mutex_enter(&stp->sd_lock); in strread()
1386 (stp->sd_read_opt & (RD_MSGDIS|RD_MSGNODIS))) { in strread()
1392 strsignal(stp, *bp->b_rptr, (int32_t)bp->b_band); in strread()
1394 mutex_enter(&stp->sd_lock); in strread()
1404 if (stp->sd_read_opt & RD_PROTDAT) { in strread()
1420 mutex_enter(&stp->sd_lock); in strread()
1421 stp->sd_flag &= ~STRPRI; in strread()
1422 mutex_exit(&stp->sd_lock); in strread()
1425 } else if (stp->sd_read_opt & RD_PROTDIS) { in strread()
1441 mutex_enter(&stp->sd_lock); in strread()
1442 stp->sd_flag &= ~STRPRI; in strread()
1443 mutex_exit(&stp->sd_lock); in strread()
1455 (stp->sd_read_opt & RD_PROTDIS)) { in strread()
1459 mutex_enter(&stp->sd_lock); in strread()
1460 putback(stp, q, bp, pri); in strread()
1461 mutex_exit(&stp->sd_lock); in strread()
1475 mutex_enter(&stp->sd_lock); in strread()
1478 mutex_exit(&stp->sd_lock); in strread()
1546 struct stdata *stp; in strrput() local
1557 stp = (struct stdata *)q->q_ptr; in strrput()
1563 rput_opt = stp->sd_rput_opt; in strrput()
1582 if (stp->sd_flag == STREOF) { in strrput()
1595 mutex_enter(&stp->sd_lock); in strrput()
1605 stp->sd_flag &= ~STRNOTATMARK; in strrput()
1606 stp->sd_flag |= STRATMARK; in strrput()
1618 stp->sd_flag &= ~STRATMARK; in strrput()
1619 stp->sd_flag |= STRNOTATMARK; in strrput()
1622 if (stp->sd_flag & RSLEEP) { in strrput()
1623 stp->sd_flag &= ~RSLEEP; in strrput()
1626 mutex_exit(&stp->sd_lock); in strrput()
1643 mutex_enter(&stp->sd_lock); in strrput()
1714 mutex_enter(&stp->sd_lock); in strrput()
1719 ASSERT(stp->sd_rprotofunc != NULL); in strrput()
1720 bp = (stp->sd_rprotofunc)(stp->sd_vnode, bp, in strrput()
1732 mutex_enter(&stp->sd_lock); in strrput()
1736 ASSERT(stp->sd_rmiscfunc != NULL); in strrput()
1737 bp = (stp->sd_rmiscfunc)(stp->sd_vnode, bp, in strrput()
1745 mutex_enter(&stp->sd_lock); in strrput()
1748 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strrput()
1771 if (stp->sd_flag & STRPRI) { in strrput()
1775 mutex_exit(&stp->sd_lock); in strrput()
1778 stp->sd_flag |= STRPRI; in strrput()
1793 stp->sd_mark = bp; in strrput()
1806 (((stp->sd_flag & STRGETINPROG) == 0) && in strrput()
1814 mutex_exit(&stp->sd_lock); in strrput()
1816 mutex_enter(&stp->sd_lock); in strrput()
1820 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strrput()
1825 stp->sd_wakeq &= ~RSLEEP; in strrput()
1827 wakeups &= stp->sd_flag; in strrput()
1829 stp->sd_flag &= ~RSLEEP; in strrput()
1833 stp->sd_flag &= ~WSLEEP; in strrput()
1844 if (!(stp->sd_rput_opt & SR_POLLIN)) in strrput()
1846 stp->sd_rput_opt &= ~SR_POLLIN; in strrput()
1848 mutex_exit(&stp->sd_lock); in strrput()
1849 pollwakeup(&stp->sd_pollist, pollwakeups); in strrput()
1850 mutex_enter(&stp->sd_lock); in strrput()
1858 if (stp->sd_sigflags & signals) in strrput()
1859 strsendsig(stp->sd_siglist, signals, band, 0); in strrput()
1860 mutex_exit(&stp->sd_lock); in strrput()
1875 mutex_enter(&stp->sd_lock); in strrput()
1936 struct stdata *stp; in strrput_nondata() local
1944 stp = (struct stdata *)q->q_ptr; in strrput_nondata()
1946 ASSERT(!(stp->sd_flag & STPLEX)); in strrput_nondata()
1958 mutex_enter(&stp->sd_lock); in strrput_nondata()
1961 if (stp->sd_flag & STRDERR) in strrput_nondata()
1963 stp->sd_flag |= STRDERR; in strrput_nondata()
1966 stp->sd_flag &= ~STRDERR; in strrput_nondata()
1968 stp->sd_rerror = *bp->b_rptr; in strrput_nondata()
1973 if (stp->sd_flag & STWRERR) in strrput_nondata()
1975 stp->sd_flag |= STWRERR; in strrput_nondata()
1978 stp->sd_flag &= ~STWRERR; in strrput_nondata()
1980 stp->sd_werror = *bp->b_rptr; in strrput_nondata()
1988 cv_broadcast(&stp->sd_monitor); /* ioctllers */ in strrput_nondata()
1990 mutex_exit(&stp->sd_lock); in strrput_nondata()
1991 pollwakeup(&stp->sd_pollist, POLLERR); in strrput_nondata()
1992 mutex_enter(&stp->sd_lock); in strrput_nondata()
1994 if (stp->sd_sigflags & S_ERROR) in strrput_nondata()
1995 strsendsig(stp->sd_siglist, S_ERROR, 0, in strrput_nondata()
1996 ((rw & FLUSHR) ? stp->sd_rerror : in strrput_nondata()
1997 stp->sd_werror)); in strrput_nondata()
1998 mutex_exit(&stp->sd_lock); in strrput_nondata()
2023 mutex_exit(&stp->sd_lock); in strrput_nondata()
2025 if (stp->sd_flag & (STRDERR|STWRERR)) in strrput_nondata()
2027 mutex_enter(&stp->sd_lock); in strrput_nondata()
2028 stp->sd_flag |= (STRDERR|STWRERR); in strrput_nondata()
2029 stp->sd_rerror = *bp->b_rptr; in strrput_nondata()
2030 stp->sd_werror = *bp->b_rptr; in strrput_nondata()
2036 cv_broadcast(&stp->sd_monitor); /* ioctllers */ in strrput_nondata()
2038 mutex_exit(&stp->sd_lock); in strrput_nondata()
2039 pollwakeup(&stp->sd_pollist, POLLERR); in strrput_nondata()
2040 mutex_enter(&stp->sd_lock); in strrput_nondata()
2042 if (stp->sd_sigflags & S_ERROR) in strrput_nondata()
2043 strsendsig(stp->sd_siglist, S_ERROR, 0, in strrput_nondata()
2044 (stp->sd_werror ? stp->sd_werror : in strrput_nondata()
2045 stp->sd_rerror)); in strrput_nondata()
2046 mutex_exit(&stp->sd_lock); in strrput_nondata()
2074 mutex_enter(&stp->sd_lock); in strrput_nondata()
2075 stp->sd_werror = ENXIO; in strrput_nondata()
2076 stp->sd_flag |= STRHUP; in strrput_nondata()
2077 stp->sd_flag &= ~(WSLEEP|RSLEEP); in strrput_nondata()
2083 if (stp->sd_sidp) { in strrput_nondata()
2084 prsignal(stp->sd_sidp, SIGHUP); in strrput_nondata()
2085 if (stp->sd_sidp != stp->sd_pgidp) in strrput_nondata()
2086 pgsignal(stp->sd_pgidp, SIGTSTP); in strrput_nondata()
2095 cv_broadcast(&stp->sd_monitor); /* the ioctllers */ in strrput_nondata()
2096 strhup(stp); in strrput_nondata()
2097 mutex_exit(&stp->sd_lock); in strrput_nondata()
2102 mutex_enter(&stp->sd_lock); in strrput_nondata()
2103 stp->sd_werror = 0; in strrput_nondata()
2104 stp->sd_flag &= ~STRHUP; in strrput_nondata()
2105 mutex_exit(&stp->sd_lock); in strrput_nondata()
2120 mutex_enter(&stp->sd_lock); in strrput_nondata()
2122 !(stp->sd_flag & RSLEEP))) { in strrput_nondata()
2124 mutex_exit(&stp->sd_lock); in strrput_nondata()
2127 mutex_exit(&stp->sd_lock); in strrput_nondata()
2134 strsignal(stp, *bp->b_rptr, 0L); in strrput_nondata()
2144 mutex_enter(&stp->sd_lock); in strrput_nondata()
2145 if (stp->sd_flag & STRCMDWAIT) { in strrput_nondata()
2146 ASSERT(stp->sd_cmdblk == NULL); in strrput_nondata()
2147 stp->sd_cmdblk = bp; in strrput_nondata()
2148 cv_broadcast(&stp->sd_monitor); in strrput_nondata()
2149 mutex_exit(&stp->sd_lock); in strrput_nondata()
2151 mutex_exit(&stp->sd_lock); in strrput_nondata()
2169 mutex_enter(&stp->sd_lock); in strrput_nondata()
2175 stp->sd_read_opt & RFLUSHPCPROT); in strrput_nondata()
2178 stp->sd_flag &= ~STRPRI; in strrput_nondata()
2180 ASSERT(stp->sd_flag & STRPRI); in strrput_nondata()
2182 mutex_exit(&stp->sd_lock); in strrput_nondata()
2209 mutex_enter(&stp->sd_lock); in strrput_nondata()
2210 if ((stp->sd_flag & IOCWAIT) == 0 || stp->sd_iocblk || in strrput_nondata()
2211 (stp->sd_iocid != iocbp->ioc_id)) { in strrput_nondata()
2220 if ((stp->sd_iocid == iocbp->ioc_id) && in strrput_nondata()
2221 (stp->sd_iocblk != NULL)) { in strrput_nondata()
2225 mutex_exit(&stp->sd_lock); in strrput_nondata()
2232 stp->sd_iocblk = bp; in strrput_nondata()
2233 cv_broadcast(&stp->sd_monitor); in strrput_nondata()
2234 mutex_exit(&stp->sd_lock); in strrput_nondata()
2247 mutex_enter(&stp->sd_lock); in strrput_nondata()
2248 if ((stp->sd_flag & IOCWAIT) == 0 || stp->sd_iocblk || in strrput_nondata()
2249 (stp->sd_iocid != reqp->cq_id)) { in strrput_nondata()
2258 mutex_exit(&stp->sd_lock); in strrput_nondata()
2259 putnext(stp->sd_wrq, bp); in strrput_nondata()
2266 stp->sd_iocblk = bp; in strrput_nondata()
2267 cv_broadcast(&stp->sd_monitor); in strrput_nondata()
2268 mutex_exit(&stp->sd_lock); in strrput_nondata()
2280 mutex_enter(&stp->sd_lock); in strrput_nondata()
2284 stp->sd_read_opt &= ~(RD_MSGDIS | RD_MSGNODIS); in strrput_nondata()
2288 stp->sd_read_opt = in strrput_nondata()
2289 ((stp->sd_read_opt & ~RD_MSGNODIS) | in strrput_nondata()
2294 stp->sd_read_opt = in strrput_nondata()
2295 ((stp->sd_read_opt & ~RD_MSGDIS) | in strrput_nondata()
2301 stp->sd_read_opt &= ~(RD_PROTDAT | RD_PROTDIS); in strrput_nondata()
2305 stp->sd_read_opt = in strrput_nondata()
2306 ((stp->sd_read_opt & ~RD_PROTDIS) | in strrput_nondata()
2311 stp->sd_read_opt = in strrput_nondata()
2312 ((stp->sd_read_opt & ~RD_PROTDAT) | in strrput_nondata()
2322 stp->sd_read_opt |= RFLUSHPCPROT; in strrput_nondata()
2329 stp->sd_flag &= ~STRDERRNONPERSIST; in strrput_nondata()
2332 stp->sd_flag |= STRDERRNONPERSIST; in strrput_nondata()
2337 stp->sd_flag &= ~STWRERRNONPERSIST; in strrput_nondata()
2340 stp->sd_flag |= STWRERRNONPERSIST; in strrput_nondata()
2346 stp->sd_copyflag |= STZCVMSAFE; in strrput_nondata()
2347 stp->sd_copyflag &= ~STZCVMUNSAFE; in strrput_nondata()
2349 stp->sd_copyflag |= STZCVMUNSAFE; in strrput_nondata()
2350 stp->sd_copyflag &= ~STZCVMSAFE; in strrput_nondata()
2354 stp->sd_copyflag |= STRCOPYCACHED; in strrput_nondata()
2358 stp->sd_wroff = sop->so_wroff; in strrput_nondata()
2360 stp->sd_tail = sop->so_tail; in strrput_nondata()
2366 stp->sd_maxblk = sop->so_maxblk; in strrput_nondata()
2394 stp->sd_flag |= SNDMREAD; in strrput_nondata()
2396 stp->sd_flag &= ~SNDMREAD; in strrput_nondata()
2398 stp->sd_flag |= OLDNDELAY; in strrput_nondata()
2400 stp->sd_flag &= ~OLDNDELAY; in strrput_nondata()
2402 stp->sd_flag |= STRISTTY; in strrput_nondata()
2404 stp->sd_flag &= ~STRISTTY; in strrput_nondata()
2406 stp->sd_flag |= STRTOSTOP; in strrput_nondata()
2408 stp->sd_flag &= ~STRTOSTOP; in strrput_nondata()
2410 stp->sd_flag |= STRDELIM; in strrput_nondata()
2412 stp->sd_flag &= ~STRDELIM; in strrput_nondata()
2414 mutex_exit(&stp->sd_lock); in strrput_nondata()
2445 mutex_enter(&stp->sd_lock); in strrput_nondata()
2446 if (stp->sd_struiodnak != 0) { in strrput_nondata()
2451 mblk_t *mp = stp->sd_struionak; in strrput_nondata()
2458 stp->sd_struionak = bp; in strrput_nondata()
2460 mutex_exit(&stp->sd_lock); in strrput_nondata()
2463 mutex_exit(&stp->sd_lock); in strrput_nondata()
2496 strwriteable(struct stdata *stp, boolean_t eiohup, boolean_t sigpipeok) in strwriteable() argument
2500 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strwriteable()
2506 if (eiohup && (stp->sd_flag & (STPLEX|STRHUP)) == STRHUP) in strwriteable()
2509 error = strgeterr(stp, STRHUP|STPLEX|STWRERR, 0); in strwriteable()
2512 if (!(stp->sd_flag & STPLEX) && in strwriteable()
2513 (stp->sd_wput_opt & SW_SIGPIPE) && sigpipeok) { in strwriteable()
2542 strput(struct stdata *stp, mblk_t *mctl, struct uio *uiop, ssize_t *iosize, in strput() argument
2547 queue_t *wqp = stp->sd_wrq; in strput()
2551 ASSERT(MUTEX_NOT_HELD(&stp->sd_lock)); in strput()
2554 flags |= stp->sd_struiowrq ? STRUIO_POSTPONE : 0; in strput()
2572 if ((error = strmakedata(iosize, uiop, stp, flags, in strput()
2608 stream_willservice(stp); in strput()
2610 stream_runservice(stp); in strput()
2617 if ((error = strmakedata(iosize, uiop, stp, flags, &mp)) != 0) { in strput()
2691 stream_willservice(stp); in strput()
2693 stream_runservice(stp); in strput()
2728 struct stdata *stp; in strwrite_common() local
2738 stp = vp->v_stream; in strwrite_common()
2740 mutex_enter(&stp->sd_lock); in strwrite_common()
2742 if ((error = i_straccess(stp, JCWRITE)) != 0) { in strwrite_common()
2743 mutex_exit(&stp->sd_lock); in strwrite_common()
2747 if (stp->sd_flag & (STWRERR|STRHUP|STPLEX)) { in strwrite_common()
2748 error = strwriteable(stp, B_TRUE, B_TRUE); in strwrite_common()
2750 mutex_exit(&stp->sd_lock); in strwrite_common()
2755 mutex_exit(&stp->sd_lock); in strwrite_common()
2757 wqp = stp->sd_wrq; in strwrite_common()
2760 rmin = stp->sd_qn_minpsz; in strwrite_common()
2761 rmax = stp->sd_qn_maxpsz; in strwrite_common()
2793 if (stp->sd_flag & OLDNDELAY) in strwrite_common()
2819 if ((stp->sd_flag & STRDELIM) && (uiop->uio_resid == iosize)) in strwrite_common()
2827 error = strput(stp, NULL, uiop, &iosize, b_flag, 0, 0); in strwrite_common()
2833 mutex_enter(&stp->sd_lock); in strwrite_common()
2841 mutex_exit(&stp->sd_lock); in strwrite_common()
2846 if ((error = strwaitq(stp, waitflag, (ssize_t)0, in strwrite_common()
2848 mutex_exit(&stp->sd_lock); in strwrite_common()
2857 if ((error = i_straccess(stp, JCWRITE)) != 0) { in strwrite_common()
2858 mutex_exit(&stp->sd_lock); in strwrite_common()
2861 mutex_exit(&stp->sd_lock); in strwrite_common()
2868 if ((stp->sd_wput_opt & SW_RECHECK_ERR) && in strwrite_common()
2869 (stp->sd_flag & (STWRERR|STRHUP|STPLEX))) { in strwrite_common()
2870 mutex_enter(&stp->sd_lock); in strwrite_common()
2871 error = strwriteable(stp, B_FALSE, B_TRUE); in strwrite_common()
2872 mutex_exit(&stp->sd_lock); in strwrite_common()
2903 struct stdata *stp; in strwsrv() local
2913 stp = (struct stdata *)q->q_ptr; in strwsrv()
2915 mutex_enter(&stp->sd_lock); in strwsrv()
2916 ASSERT(!(stp->sd_flag & STPLEX)); in strwsrv()
2918 if (stp->sd_flag & WSLEEP) { in strwsrv()
2919 stp->sd_flag &= ~WSLEEP; in strwsrv()
2922 mutex_exit(&stp->sd_lock); in strwsrv()
2950 pollwakeup(&stp->sd_pollist, POLLWRNORM); in strwsrv()
2951 mutex_enter(&stp->sd_lock); in strwsrv()
2952 if (stp->sd_sigflags & S_WRNORM) in strwsrv()
2953 strsendsig(stp->sd_siglist, S_WRNORM, 0, 0); in strwsrv()
2954 mutex_exit(&stp->sd_lock); in strwsrv()
2987 pollwakeup(&stp->sd_pollist, POLLWRBAND); in strwsrv()
2988 mutex_enter(&stp->sd_lock); in strwsrv()
2989 if (stp->sd_sigflags & S_WRBAND) in strwsrv()
2990 strsendsig(stp->sd_siglist, S_WRBAND, in strwsrv()
2992 mutex_exit(&stp->sd_lock); in strwsrv()
3193 struct stdata *stp; in strioctl() local
3214 stp = vp->v_stream; in strioctl()
3217 "strioctl:stp %p cmd %X arg %lX", stp, cmd, arg); in strioctl()
3229 wrq = stp->sd_wrq; in strioctl()
3238 mutex_enter(&stp->sd_lock); in strioctl()
3239 if ((access != -1) && ((error = i_straccess(stp, access)) != 0)) { in strioctl()
3240 mutex_exit(&stp->sd_lock); in strioctl()
3243 mutex_exit(&stp->sd_lock); in strioctl()
3265 mutex_enter(&stp->sd_lock); in strioctl()
3277 if (stp->sd_flag & (STRDERR|STPLEX)) { in strioctl()
3278 error = strgeterr(stp, STRDERR|STPLEX, 0); in strioctl()
3280 mutex_exit(&stp->sd_lock); in strioctl()
3287 if (stp->sd_flag & (STRDERR|STWRERR|STPLEX)) { in strioctl()
3288 error = strgeterr(stp, STRDERR|STWRERR|STPLEX, 0); in strioctl()
3290 mutex_exit(&stp->sd_lock); in strioctl()
3296 mutex_exit(&stp->sd_lock); in strioctl()
3333 if (stp->sd_flag & STRHUP) in strioctl()
3348 return (strdoioctl(stp, &strioc, flag, in strioctl()
3357 return (strdoioctl(stp, &strioc, flag, in strioctl()
3365 return (strdoioctl(stp, &strioc, flag, in strioctl()
3371 return (strdoioctl(stp, &strioc, flag, in strioctl()
3377 return (strdoioctl(stp, &strioc, flag, in strioctl()
3385 mutex_enter(&stp->sd_lock); in strioctl()
3387 if (stp->sd_sidp != curproc->p_sessp->s_sidp && in strioctl()
3390 mutex_exit(&stp->sd_lock); in strioctl()
3394 mutex_exit(&stp->sd_lock); in strioctl()
3398 return (strdoioctl(stp, &strioc, flag, in strioctl()
3404 return (strdoioctl(stp, &strioc, flag, in strioctl()
3410 return (strdoioctl(stp, &strioc, flag, in strioctl()
3426 return (strdoioctl(stp, &strioc, flag, in strioctl()
3433 return (strdoioctl(stp, &strioc, flag, in strioctl()
3440 return (strdoioctl(stp, &strioc, flag, in strioctl()
3447 return (strdoioctl(stp, &strioc, flag, in strioctl()
3453 return (strdoioctl(stp, &strioc, flag, in strioctl()
3460 return (strdoioctl(stp, &strioc, flag, in strioctl()
3493 return (strdoioctl(stp, &strioc, flag, in strioctl()
3506 return (strdoioctl(stp, &strioc, flag, copyflag, crp, rvalp)); in strioctl()
3516 if (stp->sd_flag & STRHUP) in strioctl()
3528 mutex_enter(&stp->sd_lock); in strioctl()
3530 ((error = i_straccess(stp, access)) != 0)) { in strioctl()
3531 mutex_exit(&stp->sd_lock); in strioctl()
3534 mutex_exit(&stp->sd_lock); in strioctl()
3558 error = strdoioctl(stp, &strioc, flag, copyflag, crp, rvalp); in strioctl()
3570 if (stp->sd_flag & STRHUP) in strioctl()
3582 mutex_enter(&stp->sd_lock); in strioctl()
3583 if (access != -1 && (error = i_straccess(stp, access)) != 0) { in strioctl()
3584 mutex_exit(&stp->sd_lock); in strioctl()
3588 mutex_exit(&stp->sd_lock); in strioctl()
3591 if ((error = strdocmd(stp, scp, crp)) == 0) { in strioctl()
3616 if (stp->sd_struiordq) { in strioctl()
3658 if (stp->sd_struiordq) { in strioctl()
3695 if (stp->sd_struiordq) { in strioctl()
3739 claimstr(stp->sd_wrq); in strioctl()
3740 for (q = stp->sd_wrq->q_next; q; q = q->q_next) { in strioctl()
3748 releasestr(stp->sd_wrq); in strioctl()
3767 if (stp->sd_flag & STRHUP) in strioctl()
3783 "I_PUSH:fp %p stp %p", fp, stp); in strioctl()
3785 if (error = strstartplumb(stp, flag, cmd)) { in strioctl()
3796 mutex_enter(&stp->sd_lock); in strioctl()
3797 if (stp->sd_pushcnt >= nstrpush) { in strioctl()
3799 strendplumb(stp); in strioctl()
3800 mutex_exit(&stp->sd_lock); in strioctl()
3803 mutex_exit(&stp->sd_lock); in strioctl()
3814 (cmd == I_PUSH) && (stp->sd_flag & STRISTTY)) { in strioctl()
3818 (void) strctty(stp); in strioctl()
3822 mutex_enter(&stp->sd_lock); in strioctl()
3829 mutex_enter(QLOCK(stp->sd_wrq->q_next)); in strioctl()
3830 rmin = stp->sd_wrq->q_next->q_minpsz; in strioctl()
3831 rmax = stp->sd_wrq->q_next->q_maxpsz; in strioctl()
3832 mutex_exit(QLOCK(stp->sd_wrq->q_next)); in strioctl()
3846 stp->sd_qn_minpsz = rmin; in strioctl()
3847 stp->sd_qn_maxpsz = rmax; in strioctl()
3850 strendplumb(stp); in strioctl()
3851 mutex_exit(&stp->sd_lock); in strioctl()
3859 if (stp->sd_flag & STRHUP) in strioctl()
3864 if (error = strstartplumb(stp, flag, cmd)) in strioctl()
3875 (stp->sd_anchorzone != crgetzoneid(crp))) { in strioctl()
3876 mutex_enter(&stp->sd_lock); in strioctl()
3881 if (stp->sd_pushcnt > 0 && in strioctl()
3882 stp->sd_pushcnt == stp->sd_anchor && in strioctl()
3883 stp->sd_vnode->v_type != VFIFO) { in strioctl()
3884 strendplumb(stp); in strioctl()
3885 mutex_exit(&stp->sd_lock); in strioctl()
3886 if (stp->sd_anchorzone != crgetzoneid(crp)) in strioctl()
3891 mutex_exit(&stp->sd_lock); in strioctl()
3896 "I_POP:%p from %p", q, stp); in strioctl()
3903 mutex_enter(&stp->sd_lock); in strioctl()
3927 stp->sd_qn_minpsz = rmin; in strioctl()
3928 stp->sd_qn_maxpsz = rmax; in strioctl()
3932 if (stp->sd_pushcnt < stp->sd_anchor) { in strioctl()
3933 stp->sd_anchor = 0; in strioctl()
3934 stp->sd_anchorzone = 0; in strioctl()
3936 strendplumb(stp); in strioctl()
3937 mutex_exit(&stp->sd_lock); in strioctl()
4029 if (stp->sd_flag & STRHUP) in strioctl()
4031 if (STRMATED(stp)) in strioctl()
4035 if (stp->sd_anchor != 0 && in strioctl()
4036 stp->sd_anchorzone != crgetzoneid(crp)) in strioctl()
4057 if (error = strstartplumb(stp, flag, cmd)) { in strioctl()
4075 mutex_enter(&stp->sd_lock); in strioctl()
4076 if (stp->sd_pushcnt >= nstrpush || pos < 0 || in strioctl()
4077 pos > stp->sd_pushcnt) { in strioctl()
4079 strendplumb(stp); in strioctl()
4080 mutex_exit(&stp->sd_lock); in strioctl()
4083 if (stp->sd_anchor != 0) { in strioctl()
4090 if (pos > (stp->sd_pushcnt - stp->sd_anchor) && in strioctl()
4091 stp->sd_anchorzone != crgetzoneid(crp)) { in strioctl()
4093 strendplumb(stp); in strioctl()
4094 mutex_exit(&stp->sd_lock); in strioctl()
4099 mutex_exit(&stp->sd_lock); in strioctl()
4110 for (tmp_wrq = stp->sd_wrq; pos > 0; in strioctl()
4117 mutex_enter(&stp->sd_lock); in strioctl()
4118 strendplumb(stp); in strioctl()
4119 mutex_exit(&stp->sd_lock); in strioctl()
4123 mutex_enter(&stp->sd_lock); in strioctl()
4131 mutex_enter(QLOCK(stp->sd_wrq->q_next)); in strioctl()
4132 rmin = stp->sd_wrq->q_next->q_minpsz; in strioctl()
4133 rmax = stp->sd_wrq->q_next->q_maxpsz; in strioctl()
4134 mutex_exit(QLOCK(stp->sd_wrq->q_next)); in strioctl()
4146 stp->sd_qn_minpsz = rmin; in strioctl()
4147 stp->sd_qn_maxpsz = rmax; in strioctl()
4155 if (stp->sd_anchor != 0) { in strioctl()
4157 if (pos >= (stp->sd_pushcnt - stp->sd_anchor)) in strioctl()
4158 stp->sd_anchor++; in strioctl()
4161 strendplumb(stp); in strioctl()
4162 mutex_exit(&stp->sd_lock); in strioctl()
4195 if (stp->sd_flag & STRHUP) in strioctl()
4197 if (STRMATED(stp)) in strioctl()
4201 if (stp->sd_anchor != 0 && in strioctl()
4202 stp->sd_anchorzone != crgetzoneid(crp)) in strioctl()
4216 if ((error = strstartplumb(stp, flag, cmd)) != 0) in strioctl()
4226 for (q = stp->sd_wrq->q_next; SAMESTR(q) && pos > 0; in strioctl()
4231 mutex_enter(&stp->sd_lock); in strioctl()
4232 strendplumb(stp); in strioctl()
4233 mutex_exit(&stp->sd_lock); in strioctl()
4241 if (stp->sd_anchor != 0) { in strioctl()
4243 if (pos >= (stp->sd_pushcnt - stp->sd_anchor) && in strioctl()
4244 stp->sd_anchorzone != crgetzoneid(crp)) { in strioctl()
4245 mutex_enter(&stp->sd_lock); in strioctl()
4246 strendplumb(stp); in strioctl()
4247 mutex_exit(&stp->sd_lock); in strioctl()
4256 mutex_enter(&stp->sd_lock); in strioctl()
4281 stp->sd_qn_minpsz = rmin; in strioctl()
4282 stp->sd_qn_maxpsz = rmax; in strioctl()
4294 if (stp->sd_anchor != 0) { in strioctl()
4296 if (pos == stp->sd_pushcnt - stp->sd_anchor + 1) in strioctl()
4297 stp->sd_anchor = 0; in strioctl()
4298 else if (pos > (stp->sd_pushcnt - stp->sd_anchor + 1)) in strioctl()
4299 stp->sd_anchor--; in strioctl()
4302 strendplumb(stp); in strioctl()
4303 mutex_exit(&stp->sd_lock); in strioctl()
4314 mutex_enter(&stp->sd_lock); in strioctl()
4316 if (stp->sd_vnode->v_type == VFIFO) { in strioctl()
4317 mutex_exit(&stp->sd_lock); in strioctl()
4321 if (stp->sd_anchor != 0 && in strioctl()
4322 stp->sd_anchorzone != crgetzoneid(crp)) { in strioctl()
4323 mutex_exit(&stp->sd_lock); in strioctl()
4326 stp->sd_anchor = stp->sd_pushcnt; in strioctl()
4327 stp->sd_anchorzone = crgetzoneid(crp); in strioctl()
4328 mutex_exit(&stp->sd_lock); in strioctl()
4379 TR_I_UNLINK, "I_UNLINK/I_PUNLINK:%p", stp); in strioctl()
4396 error = munlinkall(stp, type, crp, rvalp, ss); in strioctl()
4399 if (!(linkp = findlinks(stp, (int)arg, type, ss))) { in strioctl()
4406 error = munlink(stp, linkp, type, crp, rvalp, ss); in strioctl()
4420 if (stp->sd_flag & STRHUP) in strioctl()
4426 if (putnextctl1(stp->sd_wrq, M_FLUSH, (int)arg)) { in strioctl()
4444 (void) strdoioctl(stp, &strioc, flag, K_TO_K, crp, rvalp); in strioctl()
4456 if (stp->sd_flag & STRHUP) in strioctl()
4467 putnext(stp->sd_wrq, mp); in strioctl()
4478 (void) strdoioctl(stp, &strioc, flag, K_TO_K, crp, rvalp); in strioctl()
4500 mutex_enter(&stp->sd_lock); in strioctl()
4503 stp->sd_read_opt &= ~(RD_MSGDIS | RD_MSGNODIS); in strioctl()
4506 stp->sd_read_opt = (stp->sd_read_opt & ~RD_MSGNODIS) | in strioctl()
4510 stp->sd_read_opt = (stp->sd_read_opt & ~RD_MSGDIS) | in strioctl()
4517 stp->sd_read_opt &= ~(RD_PROTDAT | RD_PROTDIS); in strioctl()
4521 stp->sd_read_opt = ((stp->sd_read_opt & ~RD_PROTDIS) | in strioctl()
4526 stp->sd_read_opt = ((stp->sd_read_opt & ~RD_PROTDAT) | in strioctl()
4530 mutex_exit(&stp->sd_lock); in strioctl()
4541 rdopt = ((stp->sd_read_opt & RD_MSGDIS) ? RMSGD : in strioctl()
4542 ((stp->sd_read_opt & RD_MSGNODIS) ? RMSGN : RNORM)); in strioctl()
4543 rdopt |= ((stp->sd_read_opt & RD_PROTDAT) ? RPROTDAT : in strioctl()
4544 ((stp->sd_read_opt & RD_PROTDIS) ? RPROTDIS : RPROTNORM)); in strioctl()
4562 mutex_enter(&stp->sd_lock); in strioctl()
4565 stp->sd_flag &= ~STRDERRNONPERSIST; in strioctl()
4568 stp->sd_flag |= STRDERRNONPERSIST; in strioctl()
4573 stp->sd_flag &= ~STWRERRNONPERSIST; in strioctl()
4576 stp->sd_flag |= STWRERRNONPERSIST; in strioctl()
4579 mutex_exit(&stp->sd_lock); in strioctl()
4590 erropt |= (stp->sd_flag & STRDERRNONPERSIST) ? RERRNONPERSIST : in strioctl()
4592 erropt |= (stp->sd_flag & STWRERRNONPERSIST) ? WERRNONPERSIST : in strioctl()
4614 mutex_enter(&stp->sd_lock); in strioctl()
4615 for (ssp = stp->sd_siglist; ssp && (ssp->ss_pidp != pidp); in strioctl()
4622 mutex_exit(&stp->sd_lock); in strioctl()
4626 mutex_exit(&stp->sd_lock); in strioctl()
4642 stp->sd_siglist = ssp; in strioctl()
4663 stp->sd_siglist = ssp->ss_next; in strioctl()
4666 mutex_exit(&stp->sd_lock); in strioctl()
4674 stp->sd_sigflags = 0; in strioctl()
4675 for (ssp = stp->sd_siglist; ssp; ssp = ssp->ss_next) in strioctl()
4676 stp->sd_sigflags |= ssp->ss_events; in strioctl()
4677 mutex_exit(&stp->sd_lock); in strioctl()
4691 mutex_enter(&stp->sd_lock); in strioctl()
4692 for (ssp = stp->sd_siglist; ssp; ssp = ssp->ss_next) in strioctl()
4696 mutex_exit(&stp->sd_lock); in strioctl()
4699 mutex_exit(&stp->sd_lock); in strioctl()
4762 mutex_enter(&stp->sd_lock); in strioctl()
4763 for (ssp = stp->sd_siglist; ssp && (ssp->ss_pid != pid); in strioctl()
4771 mutex_exit(&stp->sd_lock); in strioctl()
4779 mutex_exit(&stp->sd_lock); in strioctl()
4798 stp->sd_siglist = ssp; in strioctl()
4819 stp->sd_siglist = ssp->ss_next; in strioctl()
4822 mutex_exit(&stp->sd_lock); in strioctl()
4833 stp->sd_sigflags = 0; in strioctl()
4834 for (ssp = stp->sd_siglist; ssp; ssp = ssp->ss_next) in strioctl()
4835 stp->sd_sigflags |= ssp->ss_events; in strioctl()
4836 mutex_exit(&stp->sd_lock); in strioctl()
4880 mutex_enter(&stp->sd_lock); in strioctl()
4881 for (ssp = stp->sd_siglist; ssp; ssp = ssp->ss_next) in strioctl()
4887 mutex_exit(&stp->sd_lock); in strioctl()
4893 mutex_exit(&stp->sd_lock); in strioctl()
4932 } else if (stp->sd_struiordq == NULL || in strioctl()
5120 if (stp->sd_flag & STRHUP) in strioctl()
5195 mutex_enter(QLOCK(stp->sd_wrq)); in strioctl()
5196 rmin = stp->sd_qn_minpsz; in strioctl()
5197 rmax = stp->sd_qn_maxpsz; in strioctl()
5198 mutex_exit(QLOCK(stp->sd_wrq)); in strioctl()
5220 mutex_enter(&stp->sd_lock); in strioctl()
5222 !canputnext(stp->sd_wrq)) { in strioctl()
5223 if ((error = strwaitq(stp, WRITEWAIT, (ssize_t)0, in strioctl()
5225 mutex_exit(&stp->sd_lock); in strioctl()
5229 if ((error = i_straccess(stp, access)) != 0) { in strioctl()
5230 mutex_exit(&stp->sd_lock); in strioctl()
5236 mutex_exit(&stp->sd_lock); in strioctl()
5257 &msgsize, &uio, stp, in strioctl()
5276 stream_willservice(stp); in strioctl()
5277 putnext(stp->sd_wrq, mp); in strioctl()
5278 stream_runservice(stp); in strioctl()
5289 error = do_sendfp(stp, fp, crp); in strioctl()
5303 mutex_enter(&stp->sd_lock); in strioctl()
5305 if (stp->sd_flag & (STRHUP|STREOF)) { in strioctl()
5306 mutex_exit(&stp->sd_lock); in strioctl()
5309 if ((error = strwaitq(stp, GETWAIT, (ssize_t)0, in strioctl()
5311 mutex_exit(&stp->sd_lock); in strioctl()
5314 if ((error = i_straccess(stp, access)) != 0) { in strioctl()
5315 mutex_exit(&stp->sd_lock); in strioctl()
5320 putback(stp, rdq, mp, mp->b_band); in strioctl()
5321 mutex_exit(&stp->sd_lock); in strioctl()
5324 mutex_exit(&stp->sd_lock); in strioctl()
5328 mutex_enter(&stp->sd_lock); in strioctl()
5329 putback(stp, rdq, mp, mp->b_band); in strioctl()
5330 mutex_exit(&stp->sd_lock); in strioctl()
5340 mutex_enter(&stp->sd_lock); in strioctl()
5341 putback(stp, rdq, mp, mp->b_band); in strioctl()
5342 mutex_exit(&stp->sd_lock); in strioctl()
5374 mutex_enter(&stp->sd_lock); in strioctl()
5375 putback(stp, rdq, mp, mp->b_band); in strioctl()
5376 mutex_exit(&stp->sd_lock); in strioctl()
5409 mutex_enter(&stp->sd_lock); in strioctl()
5410 stp->sd_wput_opt &= ~(SW_SIGPIPE|SW_SNDZERO); in strioctl()
5412 stp->sd_wput_opt |= SW_SNDZERO; in strioctl()
5414 stp->sd_wput_opt |= SW_SIGPIPE; in strioctl()
5415 mutex_exit(&stp->sd_lock); in strioctl()
5422 if (stp->sd_wput_opt & SW_SNDZERO) in strioctl()
5424 if (stp->sd_wput_opt & SW_SIGPIPE) in strioctl()
5447 if (stp->sd_vnode->v_type == VFIFO) in strioctl()
5448 *rvalp = stp->sd_pushcnt; in strioctl()
5450 *rvalp = stp->sd_pushcnt + 1; in strioctl()
5466 claimstr(stp->sd_wrq); in strioctl()
5467 q = stp->sd_wrq; in strioctl()
5473 releasestr(stp->sd_wrq); in strioctl()
5477 releasestr(stp->sd_wrq); in strioctl()
5488 q = _RD(stp->sd_wrq); in strioctl()
5517 q = _RD(stp->sd_wrq); in strioctl()
5537 q = _RD(stp->sd_wrq); in strioctl()
5538 mutex_enter(&stp->sd_lock); in strioctl()
5539 if ((stp->sd_flag & STRATMARK) && (arg == ANYMARK)) { in strioctl()
5549 else if ((arg == LASTMARK) && (mp == stp->sd_mark)) in strioctl()
5555 mutex_exit(&stp->sd_lock); in strioctl()
5566 *rvalp = bcanputnext(stp->sd_wrq, band); in strioctl()
5581 stp->sd_closetime = closetime; in strioctl()
5589 closetime = stp->sd_closetime; in strioctl()
5598 mutex_enter(&stp->sd_lock); in strioctl()
5599 if (stp->sd_sidp == NULL) { in strioctl()
5600 mutex_exit(&stp->sd_lock); in strioctl()
5603 sid = stp->sd_sidp->pid_id; in strioctl()
5604 mutex_exit(&stp->sd_lock); in strioctl()
5618 mutex_enter(&stp->sd_lock); in strioctl()
5620 if (stp->sd_sidp != ttoproc(curthread)->p_sessp->s_sidp) { in strioctl()
5622 mutex_exit(&stp->sd_lock); in strioctl()
5625 if (pgrp == stp->sd_pgidp->pid_id) { in strioctl()
5627 mutex_exit(&stp->sd_lock); in strioctl()
5632 mutex_exit(&stp->sd_lock); in strioctl()
5638 mutex_exit(&stp->sd_lock); in strioctl()
5641 sid = stp->sd_sidp->pid_id; in strioctl()
5643 bg_pgid = stp->sd_pgidp->pid_id; in strioctl()
5645 PID_RELE(stp->sd_pgidp); in strioctl()
5647 stp->sd_pgidp = q->p_pgidp; in strioctl()
5648 PID_HOLD(stp->sd_pgidp); in strioctl()
5650 mutex_exit(&stp->sd_lock); in strioctl()
5658 mutex_enter(&stp->sd_lock); in strioctl()
5659 if (stp->sd_sidp == NULL) { in strioctl()
5660 mutex_exit(&stp->sd_lock); in strioctl()
5663 pgrp = stp->sd_pgidp->pid_id; in strioctl()
5664 mutex_exit(&stp->sd_lock); in strioctl()
5671 return (strctty(stp)); in strioctl()
5700 do_sendfp(struct stdata *stp, struct file *fp, struct cred *cr) in do_sendfp() argument
5711 if (stp->sd_flag & STRHUP) in do_sendfp()
5714 claimstr(stp->sd_wrq); in do_sendfp()
5717 if (STRMATED(stp)) { in do_sendfp()
5718 qp = _RD(stp->sd_mate->sd_wrq); in do_sendfp()
5729 qp = stp->sd_wrq; in do_sendfp()
5748 releasestr(stp->sd_wrq); in do_sendfp()
5774 if ((nextqp != NULL) && (STREAM(nextqp) != stp)) { in do_sendfp()
5782 releasestr(stp->sd_wrq); in do_sendfp()
5841 releasestr(stp->sd_wrq); in do_sendfp()
5864 struct stdata *stp, in strdoioctl() argument
5891 "strdoioctl:stp %p strioc %p", stp, strioc); in strdoioctl()
5944 if (stp->sd_flag & errs) { in strdoioctl()
5945 mutex_enter(&stp->sd_lock); in strdoioctl()
5946 error = strgeterr(stp, errs, 0); in strdoioctl()
5947 mutex_exit(&stp->sd_lock); in strdoioctl()
5969 mutex_enter(&stp->sd_lock); in strdoioctl()
5970 while ((stp->sd_flag & IOCWAIT) || in strdoioctl()
5971 (!set_iocwaitne && (stp->sd_flag & IOCWAITNE))) { in strdoioctl()
5977 cv_rval = str_cv_wait(&stp->sd_iocmonitor, &stp->sd_lock, in strdoioctl()
5990 if (!(stp->sd_flag & IOCWAITNE)) { in strdoioctl()
5992 stp->sd_flag |= IOCWAITNE; in strdoioctl()
5993 cv_broadcast(&stp->sd_monitor); in strdoioctl()
6009 } else if ((stp->sd_flag & errs)) { in strdoioctl()
6010 error = strgeterr(stp, errs, 0); in strdoioctl()
6013 mutex_exit(&stp->sd_lock); in strdoioctl()
6024 if (stp->sd_iocblk != (mblk_t *)-1) { in strdoioctl()
6025 freemsg(stp->sd_iocblk); in strdoioctl()
6027 stp->sd_iocblk = NULL; in strdoioctl()
6038 stp->sd_flag |= waitflags; in strdoioctl()
6043 iocbp->ioc_id = stp->sd_iocid = getiocseqno(); in strdoioctl()
6045 mutex_exit(&stp->sd_lock); in strdoioctl()
6048 TR_STRDOIOCTL_PUT, "strdoioctl put: stp %p", stp); in strdoioctl()
6049 stream_willservice(stp); in strdoioctl()
6050 putnext(stp->sd_wrq, bp); in strdoioctl()
6051 stream_runservice(stp); in strdoioctl()
6063 mutex_enter(&stp->sd_lock); in strdoioctl()
6071 while (!stp->sd_iocblk) { in strdoioctl()
6074 if (stp->sd_flag & errs) { in strdoioctl()
6075 error = strgeterr(stp, errs, 0); in strdoioctl()
6077 stp->sd_flag &= ~waitflags; in strdoioctl()
6078 cv_broadcast(&stp->sd_iocmonitor); in strdoioctl()
6079 mutex_exit(&stp->sd_lock); in strdoioctl()
6090 cv_rval = str_cv_wait(&stp->sd_monitor, &stp->sd_lock, in strdoioctl()
6108 stp->sd_iocblk == NULL && (stp->sd_flag & IOCWAITNE)) { in strdoioctl()
6126 bp = stp->sd_iocblk; in strdoioctl()
6127 stp->sd_iocblk = NULL; in strdoioctl()
6131 mutex_exit(&stp->sd_lock); in strdoioctl()
6142 stream_willservice(stp); in strdoioctl()
6143 putnext(stp->sd_wrq, bp); in strdoioctl()
6144 stream_runservice(stp); in strdoioctl()
6145 mutex_enter(&stp->sd_lock); in strdoioctl()
6150 stp->sd_flag &= ~waitflags; in strdoioctl()
6151 cv_broadcast(&stp->sd_iocmonitor); in strdoioctl()
6152 mutex_exit(&stp->sd_lock); in strdoioctl()
6157 bp = stp->sd_iocblk; in strdoioctl()
6169 stp->sd_iocblk = (mblk_t *)-1; in strdoioctl()
6170 stp->sd_flag &= ~waitflags; in strdoioctl()
6171 cv_broadcast(&stp->sd_iocmonitor); in strdoioctl()
6172 mutex_exit(&stp->sd_lock); in strdoioctl()
6178 stp->sd_iocblk = NULL; in strdoioctl()
6179 mutex_exit(&stp->sd_lock); in strdoioctl()
6266 stream_willservice(stp); in strdoioctl()
6267 putnext(stp->sd_wrq, bp); in strdoioctl()
6268 stream_runservice(stp); in strdoioctl()
6271 mutex_enter(&stp->sd_lock); in strdoioctl()
6272 stp->sd_flag &= ~waitflags; in strdoioctl()
6273 cv_broadcast(&stp->sd_iocmonitor); in strdoioctl()
6274 mutex_exit(&stp->sd_lock); in strdoioctl()
6310 stream_willservice(stp); in strdoioctl()
6311 putnext(stp->sd_wrq, bp); in strdoioctl()
6312 stream_runservice(stp); in strdoioctl()
6315 mutex_enter(&stp->sd_lock); in strdoioctl()
6316 stp->sd_flag &= ~waitflags; in strdoioctl()
6317 cv_broadcast(&stp->sd_iocmonitor); in strdoioctl()
6318 mutex_exit(&stp->sd_lock); in strdoioctl()
6326 mutex_enter(&stp->sd_lock); in strdoioctl()
6327 stp->sd_flag &= ~waitflags; in strdoioctl()
6328 cv_broadcast(&stp->sd_iocmonitor); in strdoioctl()
6329 mutex_exit(&stp->sd_lock); in strdoioctl()
6345 strdocmd(struct stdata *stp, struct strcmd *scp, cred_t *crp) in strdocmd() argument
6399 mutex_enter(&stp->sd_lock); in strdocmd()
6400 if (stp->sd_flag & STRCMDWAIT) { in strdocmd()
6401 mutex_exit(&stp->sd_lock); in strdocmd()
6405 stp->sd_flag |= STRCMDWAIT; in strdocmd()
6406 ASSERT(stp->sd_cmdblk == NULL); in strdocmd()
6407 mutex_exit(&stp->sd_lock); in strdocmd()
6409 putnext(stp->sd_wrq, mp); in strdocmd()
6417 mutex_enter(&stp->sd_lock); in strdocmd()
6418 while (stp->sd_cmdblk == NULL) { in strdocmd()
6419 if (stp->sd_flag & errs) { in strdocmd()
6420 if ((error = strgeterr(stp, errs, 0)) != 0) in strdocmd()
6424 rval = str_cv_wait(&stp->sd_monitor, &stp->sd_lock, timeout, 0); in strdocmd()
6425 if (stp->sd_cmdblk != NULL) in strdocmd()
6437 mp = stp->sd_cmdblk; in strdocmd()
6438 stp->sd_cmdblk = NULL; in strdocmd()
6440 ASSERT(stp->sd_flag & STRCMDWAIT); in strdocmd()
6441 stp->sd_flag &= ~STRCMDWAIT; in strdocmd()
6442 mutex_exit(&stp->sd_lock); in strdocmd()
6467 ASSERT(stp->sd_cmdblk == NULL); in strdocmd()
6468 stp->sd_flag &= ~STRCMDWAIT; in strdocmd()
6469 mutex_exit(&stp->sd_lock); in strdocmd()
6509 struct stdata *stp; in strgetmsg() local
6532 stp = vp->v_stream; in strgetmsg()
6535 mutex_enter(&stp->sd_lock); in strgetmsg()
6537 if ((error = i_straccess(stp, JCREAD)) != 0) { in strgetmsg()
6538 mutex_exit(&stp->sd_lock); in strgetmsg()
6542 if (stp->sd_flag & (STRDERR|STPLEX)) { in strgetmsg()
6543 error = strgeterr(stp, STRDERR|STPLEX, 0); in strgetmsg()
6545 mutex_exit(&stp->sd_lock); in strgetmsg()
6549 mutex_exit(&stp->sd_lock); in strgetmsg()
6578 q = _RD(stp->sd_wrq); in strgetmsg()
6579 mutex_enter(&stp->sd_lock); in strgetmsg()
6580 old_sd_flag = stp->sd_flag; in strgetmsg()
6611 bp = strget(stp, q, uiop, first, &error); in strgetmsg()
6612 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strgetmsg()
6615 strsignal_nolock(stp, *bp->b_rptr, in strgetmsg()
6647 strsignal_nolock(stp, *bp->b_rptr, bp->b_band); in strgetmsg()
6664 if ((stp->sd_flag & (STRHUP|STREOF)) || (mctl->maxlen == 0 && in strgetmsg()
6668 mutex_exit(&stp->sd_lock); in strgetmsg()
6674 if (((error = strwaitq(stp, GETWAIT, (ssize_t)0, fmode, -1, in strgetmsg()
6679 mutex_exit(&stp->sd_lock); in strgetmsg()
6684 if ((error = i_straccess(stp, JCREAD)) != 0) { in strgetmsg()
6685 mutex_exit(&stp->sd_lock); in strgetmsg()
6703 if (mark != 0 && bp == stp->sd_mark) { in strgetmsg()
6705 stp->sd_mark = NULL; in strgetmsg()
6713 if ((mark & _LASTMARK) && (stp->sd_mark == NULL)) in strgetmsg()
6714 stp->sd_mark = bp; in strgetmsg()
6716 putback(stp, q, bp, pri); in strgetmsg()
6718 mutex_exit(&stp->sd_lock); in strgetmsg()
6728 stp->sd_flag |= STRGETINPROG; in strgetmsg()
6729 mutex_exit(&stp->sd_lock); in strgetmsg()
6731 if (STREAM_NEEDSERVICE(stp)) in strgetmsg()
6732 stream_runservice(stp); in strgetmsg()
6755 mutex_enter(&stp->sd_lock); in strgetmsg()
6762 stp->sd_flag &= ~STRPRI; in strgetmsg()
6809 mutex_enter(&stp->sd_lock); in strgetmsg()
6816 stp->sd_flag &= ~STRPRI; in strgetmsg()
6839 mutex_enter(&stp->sd_lock); in strgetmsg()
6856 stp->sd_flag &= ~STRPRI; in strgetmsg()
6870 stp->sd_flag &= ~STRPRI; in strgetmsg()
6872 stp->sd_flag |= STRPRI; in strgetmsg()
6889 (stp->sd_mark == NULL)) { in strgetmsg()
6895 stp->sd_mark = savemp; in strgetmsg()
6898 putback(stp, q, savemp, pri); in strgetmsg()
6924 stp->sd_flag &= ~STRPRI; in strgetmsg()
6928 stp->sd_flag &= ~STRNOTATMARK; in strgetmsg()
6929 stp->sd_flag |= STRATMARK; in strgetmsg()
6931 stp->sd_flag &= ~STRATMARK; in strgetmsg()
6932 stp->sd_flag |= STRNOTATMARK; in strgetmsg()
6934 stp->sd_flag &= ~(STRATMARK|STRNOTATMARK); in strgetmsg()
6937 stp->sd_flag &= ~STRATMARK; in strgetmsg()
6955 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strgetmsg()
6965 strsignal_nolock(stp, *bp->b_rptr, bp->b_band); in strgetmsg()
6966 mutex_exit(&stp->sd_lock); in strgetmsg()
6968 if (STREAM_NEEDSERVICE(stp)) in strgetmsg()
6969 stream_runservice(stp); in strgetmsg()
6970 mutex_enter(&stp->sd_lock); in strgetmsg()
6978 stp->sd_flag &= ~STRGETINPROG; in strgetmsg()
6992 if ((bp = q->q_first) != NULL && !(stp->sd_flag & STRPRI)) { in strgetmsg()
7023 if (!(stp->sd_rput_opt & SR_POLLIN)) in strgetmsg()
7025 stp->sd_rput_opt &= ~SR_POLLIN; in strgetmsg()
7027 mutex_exit(&stp->sd_lock); in strgetmsg()
7028 pollwakeup(&stp->sd_pollist, pollwakeups); in strgetmsg()
7029 mutex_enter(&stp->sd_lock); in strgetmsg()
7033 if (stp->sd_sigflags & signals) in strgetmsg()
7034 strsendsig(stp->sd_siglist, signals, bp->b_band, 0); in strgetmsg()
7036 mutex_exit(&stp->sd_lock); in strgetmsg()
7074 struct stdata *stp; in kstrgetmsg() local
7095 stp = vp->v_stream; in kstrgetmsg()
7098 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7100 if ((error = i_straccess(stp, JCREAD)) != 0) { in kstrgetmsg()
7101 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7106 if (stp->sd_flag & (STRDERR|STPLEX)) { in kstrgetmsg()
7107 if ((stp->sd_flag & STPLEX) || in kstrgetmsg()
7109 error = strgeterr(stp, STRDERR|STPLEX, in kstrgetmsg()
7112 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7117 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7134 q = _RD(stp->sd_wrq); in kstrgetmsg()
7135 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7136 old_sd_flag = stp->sd_flag; in kstrgetmsg()
7151 bp = strget(stp, q, uiop, first, &error); in kstrgetmsg()
7152 ASSERT(MUTEX_HELD(&stp->sd_lock)); in kstrgetmsg()
7155 strsignal_nolock(stp, *bp->b_rptr, in kstrgetmsg()
7186 strsignal_nolock(stp, *bp->b_rptr, bp->b_band); in kstrgetmsg()
7200 if ((stp->sd_flag & (STRDERR|STPLEX)) && in kstrgetmsg()
7202 error = strgeterr(stp, STRDERR|STPLEX, in kstrgetmsg()
7205 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7219 if ((stp->sd_flag & (STRHUP|STREOF)) || in kstrgetmsg()
7224 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7248 if (((error = strwaitq(stp, waitflag, (ssize_t)0, in kstrgetmsg()
7253 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7258 if ((error = i_straccess(stp, JCREAD)) != 0) { in kstrgetmsg()
7259 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7284 putback(stp, q, bp, pri); in kstrgetmsg()
7286 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7289 if (bp == stp->sd_mark) { in kstrgetmsg()
7291 stp->sd_mark = NULL; in kstrgetmsg()
7301 if ((mark & _LASTMARK) && (stp->sd_mark == NULL)) in kstrgetmsg()
7302 stp->sd_mark = bp; in kstrgetmsg()
7304 putback(stp, q, bp, pri); in kstrgetmsg()
7306 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7329 if ((mark & _LASTMARK) && (stp->sd_mark == NULL)) in kstrgetmsg()
7330 stp->sd_mark = bp; in kstrgetmsg()
7332 putback(stp, q, bp, pri); in kstrgetmsg()
7333 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7345 if ((mark & _LASTMARK) && (stp->sd_mark == NULL)) in kstrgetmsg()
7346 stp->sd_mark = bp; in kstrgetmsg()
7348 putback(stp, q, bp, pri); in kstrgetmsg()
7357 stp->sd_flag |= STRGETINPROG; in kstrgetmsg()
7358 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7360 if ((stp->sd_rputdatafunc != NULL) && (DB_TYPE(bp) == M_DATA)) { in kstrgetmsg()
7373 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7374 putback(stp, q, tmp, tmp->b_band); in kstrgetmsg()
7375 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7380 bp = (stp->sd_rputdatafunc)(stp->sd_vnode, bp, in kstrgetmsg()
7387 if (STREAM_NEEDSERVICE(stp)) in kstrgetmsg()
7388 stream_runservice(stp); in kstrgetmsg()
7471 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7478 stp->sd_flag &= ~STRPRI; in kstrgetmsg()
7498 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7513 stp->sd_flag &= ~STRPRI; in kstrgetmsg()
7526 stp->sd_flag &= ~STRPRI; in kstrgetmsg()
7541 stp->sd_flag &= ~STRPRI; in kstrgetmsg()
7543 stp->sd_flag |= STRPRI; in kstrgetmsg()
7559 (stp->sd_mark == NULL)) { in kstrgetmsg()
7565 stp->sd_mark = savemp; in kstrgetmsg()
7569 putback(stp, q, savemp, pri); in kstrgetmsg()
7597 stp->sd_flag &= ~STRPRI; in kstrgetmsg()
7601 stp->sd_flag &= ~STRNOTATMARK; in kstrgetmsg()
7602 stp->sd_flag |= STRATMARK; in kstrgetmsg()
7604 stp->sd_flag &= ~STRATMARK; in kstrgetmsg()
7605 stp->sd_flag |= STRNOTATMARK; in kstrgetmsg()
7607 stp->sd_flag &= ~(STRATMARK|STRNOTATMARK); in kstrgetmsg()
7610 stp->sd_flag &= ~STRATMARK; in kstrgetmsg()
7628 ASSERT(MUTEX_HELD(&stp->sd_lock)); in kstrgetmsg()
7638 strsignal_nolock(stp, *bp->b_rptr, bp->b_band); in kstrgetmsg()
7639 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7641 if (STREAM_NEEDSERVICE(stp)) in kstrgetmsg()
7642 stream_runservice(stp); in kstrgetmsg()
7643 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7651 stp->sd_flag &= ~STRGETINPROG; in kstrgetmsg()
7665 if ((bp = q->q_first) != NULL && !(stp->sd_flag & STRPRI)) { in kstrgetmsg()
7696 if (!(stp->sd_rput_opt & SR_POLLIN)) in kstrgetmsg()
7698 stp->sd_rput_opt &= ~SR_POLLIN; in kstrgetmsg()
7700 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7701 pollwakeup(&stp->sd_pollist, pollwakeups); in kstrgetmsg()
7702 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7706 if (stp->sd_sigflags & signals) in kstrgetmsg()
7707 strsendsig(stp->sd_siglist, signals, bp->b_band, 0); in kstrgetmsg()
7709 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7730 struct stdata *stp; in strputmsg() local
7742 stp = vp->v_stream; in strputmsg()
7743 wqp = stp->sd_wrq; in strputmsg()
7756 mutex_enter(&stp->sd_lock); in strputmsg()
7758 if ((error = i_straccess(stp, JCWRITE)) != 0) { in strputmsg()
7759 mutex_exit(&stp->sd_lock); in strputmsg()
7763 if (stp->sd_flag & (STWRERR|STRHUP|STPLEX)) { in strputmsg()
7764 error = strwriteable(stp, B_FALSE, xpg4); in strputmsg()
7766 mutex_exit(&stp->sd_lock); in strputmsg()
7771 mutex_exit(&stp->sd_lock); in strputmsg()
7789 "strputmsg in:stp %p", stp); in strputmsg()
7792 rmin = stp->sd_qn_minpsz; in strputmsg()
7793 rmax = stp->sd_qn_maxpsz; in strputmsg()
7808 if (stp->sd_maxblk != INFPSZ && rmax != INFPSZ && rmax < stp->sd_maxblk) in strputmsg()
7809 rmax = stp->sd_maxblk; in strputmsg()
7849 stp, 1, error); in strputmsg()
7856 ASSERT(stp->sd_maxblk == INFPSZ || in strputmsg()
7857 stp->sd_maxblk >= mdata->len); in strputmsg()
7860 error = strput(stp, mp, uiop, &msgsize, 0, pri, flag); in strputmsg()
7869 mutex_enter(&stp->sd_lock); in strputmsg()
7877 mutex_exit(&stp->sd_lock); in strputmsg()
7881 "strputmsg wait:stp %p waits pri %d", stp, pri); in strputmsg()
7882 if (((error = strwaitq(stp, WRITEWAIT, (ssize_t)0, fmode, -1, in strputmsg()
7884 mutex_exit(&stp->sd_lock); in strputmsg()
7887 stp, 0, error); in strputmsg()
7891 "strputmsg wake:stp %p wakes", stp); in strputmsg()
7892 if ((error = i_straccess(stp, JCWRITE)) != 0) { in strputmsg()
7893 mutex_exit(&stp->sd_lock); in strputmsg()
7896 mutex_exit(&stp->sd_lock); in strputmsg()
7907 "strputmsg out:stp %p out %d error %d", stp, 2, error); in strputmsg()
7934 struct stdata *stp; in kstrputmsg() local
7940 stp = vp->v_stream; in kstrputmsg()
7941 wqp = stp->sd_wrq; in kstrputmsg()
7947 mutex_enter(&stp->sd_lock); in kstrputmsg()
7949 if ((error = i_straccess(stp, JCWRITE)) != 0) { in kstrputmsg()
7950 mutex_exit(&stp->sd_lock); in kstrputmsg()
7955 if ((stp->sd_flag & STPLEX) || !(flag & MSG_IGNERROR)) { in kstrputmsg()
7956 if (stp->sd_flag & (STWRERR|STRHUP|STPLEX)) { in kstrputmsg()
7957 error = strwriteable(stp, B_FALSE, B_TRUE); in kstrputmsg()
7959 mutex_exit(&stp->sd_lock); in kstrputmsg()
7966 mutex_exit(&stp->sd_lock); in kstrputmsg()
7986 "kstrputmsg in:stp %p", stp); in kstrputmsg()
7989 rmin = stp->sd_qn_minpsz; in kstrputmsg()
7990 rmax = stp->sd_qn_maxpsz; in kstrputmsg()
8006 if (stp->sd_maxblk != INFPSZ && rmax != INFPSZ && rmax < stp->sd_maxblk) in kstrputmsg()
8007 rmax = stp->sd_maxblk; in kstrputmsg()
8091 ASSERT(stp->sd_maxblk == INFPSZ || stp->sd_maxblk >= msgsize); in kstrputmsg()
8092 error = strput(stp, mp, uiop, &msgsize, 0, pri, flag); in kstrputmsg()
8104 mutex_enter(&stp->sd_lock); in kstrputmsg()
8112 mutex_exit(&stp->sd_lock); in kstrputmsg()
8116 "kstrputmsg wait:stp %p waits pri %d", stp, pri); in kstrputmsg()
8125 if (((error = strwaitq(stp, waitflag, in kstrputmsg()
8127 mutex_exit(&stp->sd_lock); in kstrputmsg()
8130 stp, 0, error); in kstrputmsg()
8135 "kstrputmsg wake:stp %p wakes", stp); in kstrputmsg()
8136 if ((error = i_straccess(stp, JCWRITE)) != 0) { in kstrputmsg()
8137 mutex_exit(&stp->sd_lock); in kstrputmsg()
8141 mutex_exit(&stp->sd_lock); in kstrputmsg()
8153 "kstrputmsg out:stp %p out %d error %d", stp, 2, error); in kstrputmsg()
8177 struct stdata *stp, in strpoll() argument
8187 long sd_flags = stp->sd_flag; in strpoll()
8213 queue_t *qp = stp->sd_wrq; in strpoll()
8220 polllock(&stp->sd_pollist, QLOCK(tq)); in strpoll()
8227 else if ((sqp = stp->sd_struiowrq) != NULL) { in strpoll()
8230 polllock(&stp->sd_pollist, QLOCK(sqp)); in strpoll()
8243 polllock(&stp->sd_pollist, QLOCK(tq)); in strpoll()
8268 queue_t *qp = _RD(stp->sd_wrq); in strpoll()
8275 polllock(&stp->sd_pollist, &stp->sd_lock); in strpoll()
8302 (stp->sd_wakeq & RSLEEP)) { in strpoll()
8316 mutex_exit(&stp->sd_lock); in strpoll()
8326 *phpp = &stp->sd_pollist; in strpoll()
8328 polllock(&stp->sd_pollist, &stp->sd_lock); in strpoll()
8331 stp->sd_rput_opt |= SR_POLLIN; in strpoll()
8334 mutex_exit(&stp->sd_lock); in strpoll()
8349 putback(struct stdata *stp, queue_t *q, mblk_t *bp, int band) in putback() argument
8352 ASSERT(MUTEX_HELD(&stp->sd_lock)); in putback()
8363 if ((stp->sd_rput_opt & SR_CONSOL_DATA) && in putback()
8422 if (stp->sd_flag & (STRATMARK | STRNOTATMARK)) { in putback()
8426 if (stp->sd_flag & STRATMARK) { in putback()
8429 stp->sd_flag &= ~STRATMARK; in putback()
8433 stp->sd_flag &= ~STRNOTATMARK; in putback()
8455 if (stp->sd_flag & RSLEEP) { in putback()
8456 stp->sd_flag &= ~RSLEEP; in putback()
8459 if (stp->sd_flag & STRPRI) { in putback()
8463 if (!(stp->sd_rput_opt & SR_POLLIN)) in putback()
8465 stp->sd_rput_opt &= ~SR_POLLIN; in putback()
8471 mutex_exit(&stp->sd_lock); in putback()
8472 pollwakeup(&stp->sd_pollist, pollevents); in putback()
8473 mutex_enter(&stp->sd_lock); in putback()
8562 struct stdata *stp; in str_cn_clean() local
8567 stp = vp->v_stream; in str_cn_clean()
8569 mutex_enter(&stp->sd_lock); in str_cn_clean()
8570 ssp = stp->sd_siglist; in str_cn_clean()
8582 stp->sd_siglist = tssp; in str_cn_clean()
8596 stp->sd_sigflags = 0; in str_cn_clean()
8597 for (ssp = stp->sd_siglist; ssp; ssp = ssp->ss_next) in str_cn_clean()
8598 stp->sd_sigflags |= ssp->ss_events; in str_cn_clean()
8600 mutex_exit(&stp->sd_lock); in str_cn_clean()