Lines Matching refs:stp
93 #define i_straccess(x, y) ((stp->sd_sidp == NULL) ? 0 : \
94 (stp->sd_vnode->v_type == VFIFO) ? 0 : \
197 push_mod(queue_t *qp, dev_t *devp, struct stdata *stp, const char *name, in push_mod() argument
203 if (stp->sd_flag & (STRHUP|STRDERR|STWRERR)) { in push_mod()
204 error = (stp->sd_flag & STRHUP) ? ENXIO : EIO; in push_mod()
207 if (stp->sd_pushcnt >= nstrpush) { in push_mod()
212 stp->sd_flag |= STREOPENFAIL; in push_mod()
226 mutex_enter(&stp->sd_lock); in push_mod()
227 if (anchor == stp->sd_pushcnt) { in push_mod()
228 stp->sd_anchor = stp->sd_pushcnt; in push_mod()
229 stp->sd_anchorzone = anchor_zoneid; in push_mod()
231 mutex_exit(&stp->sd_lock); in push_mod()
237 xpg4_fixup(queue_t *qp, dev_t *devp, struct stdata *stp, cred_t *crp) in xpg4_fixup() argument
260 error = push_mod(qp, &dummydev, stp, ptsmods[i], 0, in xpg4_fixup()
275 (void) strdoioctl(stp, &strioc, FNATIVE, K_TO_K, crp, &rval); in xpg4_fixup()
286 struct stdata *stp; in stropen() local
309 if ((stp = vp->v_stream) != NULL) { in stropen()
317 if (STRMATED(stp)) { in stropen()
318 struct stdata *strmatep = stp->sd_mate; in stropen()
320 STRLOCKMATES(stp); in stropen()
327 mutex_exit(&stp->sd_lock); in stropen()
332 mutex_enter(&stp->sd_lock); in stropen()
338 if (stp->sd_flag & (STWOPEN|STRCLOSE|STRPLUMB)) { in stropen()
345 if (!cv_wait_sig(&stp->sd_monitor, in stropen()
346 &stp->sd_lock)) { in stropen()
350 mutex_exit(&stp->sd_lock); in stropen()
354 if (stp->sd_flag & (STRDERR|STWRERR)) { in stropen()
360 stp->sd_flag |= STWOPEN; in stropen()
361 STRUNLOCKMATES(stp); in stropen()
363 mutex_enter(&stp->sd_lock); in stropen()
364 if (stp->sd_flag & (STWOPEN|STRCLOSE|STRPLUMB)) { in stropen()
369 if (!cv_wait_sig(&stp->sd_monitor, in stropen()
370 &stp->sd_lock)) { in stropen()
374 mutex_exit(&stp->sd_lock); in stropen()
378 if (stp->sd_flag & (STRDERR|STWRERR)) { in stropen()
383 stp->sd_flag |= STWOPEN; in stropen()
384 mutex_exit(&stp->sd_lock); in stropen()
393 claimstr(stp->sd_wrq); in stropen()
394 qp = stp->sd_wrq; in stropen()
400 releasestr(stp->sd_wrq); in stropen()
401 mutex_enter(&stp->sd_lock); in stropen()
402 stp->sd_flag &= ~(STRHUP|STWOPEN|STRDERR|STWRERR); in stropen()
403 stp->sd_rerror = 0; in stropen()
404 stp->sd_werror = 0; in stropen()
406 cv_broadcast(&stp->sd_monitor); in stropen()
407 mutex_exit(&stp->sd_lock); in stropen()
417 stp = shalloc(qp); in stropen()
424 stp->sd_flag = STWOPEN; in stropen()
425 stp->sd_siglist = NULL; in stropen()
426 stp->sd_pollist.ph_list = NULL; in stropen()
427 stp->sd_sigflags = 0; in stropen()
428 stp->sd_mark = NULL; in stropen()
429 stp->sd_closetime = STRTIMOUT; in stropen()
430 stp->sd_sidp = NULL; in stropen()
431 stp->sd_pgidp = NULL; in stropen()
432 stp->sd_vnode = vp; in stropen()
433 stp->sd_pvnode = NULL; in stropen()
434 stp->sd_rerror = 0; in stropen()
435 stp->sd_werror = 0; in stropen()
436 stp->sd_wroff = 0; in stropen()
437 stp->sd_tail = 0; in stropen()
438 stp->sd_iocblk = NULL; in stropen()
439 stp->sd_cmdblk = NULL; in stropen()
440 stp->sd_pushcnt = 0; in stropen()
441 stp->sd_qn_minpsz = 0; in stropen()
442 stp->sd_qn_maxpsz = INFPSZ - 1; /* used to check for initialization */ in stropen()
443 stp->sd_maxblk = INFPSZ; in stropen()
444 qp->q_ptr = _WR(qp)->q_ptr = stp; in stropen()
445 STREAM(qp) = STREAM(_WR(qp)) = stp; in stropen()
446 vp->v_stream = stp; in stropen()
449 stp->sd_flag |= OLDNDELAY; in stropen()
457 stp->sd_wput_opt = SW_SIGPIPE; in stropen()
464 stp->sd_strtab = fifo_getinfo(); in stropen()
470 mutex_enter(&stp->sd_lock); in stropen()
476 stp->sd_qn_minpsz = qp->q_minpsz; in stropen()
477 stp->sd_qn_maxpsz = qp->q_maxpsz; in stropen()
478 stp->sd_flag &= ~STWOPEN; in stropen()
495 mutex_enter(&stp->sd_lock); in stropen()
496 cv_broadcast(&stp->sd_monitor); in stropen()
497 mutex_exit(&stp->sd_lock); in stropen()
499 shfree(stp); in stropen()
505 stp->sd_strtab = STREAMSTAB(getmajor(*devp)); in stropen()
522 if (push_mod(qp, &dummydev, stp, DRMODNAME, 0, crp, 0) != 0) in stropen()
551 error = push_mod(qp, &dummydev, stp, in stropen()
588 error = push_mod(qp, &dummydev, stp, ap->ap_list[s], in stropen()
599 (stp->sd_flag & (STRISTTY|STRXPG4TTY)) == (STRISTTY|STRXPG4TTY)) { in stropen()
600 error = xpg4_fixup(qp, devp, stp, crp); in stropen()
607 mutex_enter(&stp->sd_lock); in stropen()
608 stp->sd_flag |= STREOPENFAIL; in stropen()
609 mutex_exit(&stp->sd_lock); in stropen()
615 mutex_enter(&stp->sd_lock); in stropen()
616 stp->sd_flag &= ~STWOPEN; in stropen()
623 mutex_enter(QLOCK(stp->sd_wrq->q_next)); in stropen()
624 rmin = stp->sd_wrq->q_next->q_minpsz; in stropen()
625 rmax = stp->sd_wrq->q_next->q_maxpsz; in stropen()
626 mutex_exit(QLOCK(stp->sd_wrq->q_next)); in stropen()
636 mutex_enter(QLOCK(stp->sd_wrq)); in stropen()
637 stp->sd_qn_minpsz = rmin; in stropen()
638 stp->sd_qn_maxpsz = rmax; in stropen()
639 mutex_exit(QLOCK(stp->sd_wrq)); in stropen()
642 cv_broadcast(&stp->sd_monitor); in stropen()
643 mutex_exit(&stp->sd_lock); in stropen()
667 struct stdata *stp; in strclose() local
677 stp = vp->v_stream; in strclose()
678 ASSERT(!(stp->sd_flag & STPLEX)); in strclose()
679 qp = stp->sd_wrq; in strclose()
685 mutex_enter(&stp->sd_lock); in strclose()
686 stp->sd_flag |= STRHUP; in strclose()
687 mutex_exit(&stp->sd_lock); in strclose()
695 if (stp->sd_siglist != NULL) in strclose()
698 ASSERT(stp->sd_siglist == NULL); in strclose()
699 ASSERT(stp->sd_sigflags == 0); in strclose()
701 if (STRMATED(stp)) { in strclose()
702 struct stdata *strmatep = stp->sd_mate; in strclose()
705 STRLOCKMATES(stp); in strclose()
708 while (stp->sd_flag & (STWOPEN|STRCLOSE|STRPLUMB)) { in strclose()
710 cv_wait(&stp->sd_monitor, &stp->sd_lock); in strclose()
711 mutex_exit(&stp->sd_lock); in strclose()
712 STRLOCKMATES(stp); in strclose()
717 mutex_exit(&stp->sd_lock); in strclose()
721 STRLOCKMATES(stp); in strclose()
725 stp->sd_flag |= STRCLOSE; in strclose()
726 STRUNLOCKMATES(stp); in strclose()
728 mutex_enter(&stp->sd_lock); in strclose()
729 stp->sd_flag |= STRCLOSE; in strclose()
730 mutex_exit(&stp->sd_lock); in strclose()
736 if (stp->sd_flag & STRHASLINKS) { in strclose()
745 (void) munlinkall(stp, LINKCLOSE|LINKNORMAL, crp, &rval, ss); in strclose()
754 mutex_enter(&stp->sd_lock); in strclose()
755 if (!(flag & (FNDELAY|FNONBLOCK)) && (stp->sd_closetime > 0)) { in strclose()
766 stp->sd_flag |= WSLEEP; in strclose()
772 if (str_cv_wait(&qp->q_wait, &stp->sd_lock, in strclose()
773 stp->sd_closetime, 0) <= 0) { in strclose()
777 stp->sd_flag &= ~WSLEEP; in strclose()
779 mutex_exit(&stp->sd_lock); in strclose()
798 if (stp->sd_pollist.ph_list != NULL) { in strclose()
799 pollwakeup(&stp->sd_pollist, POLLERR); in strclose()
800 pollhead_clean(&stp->sd_pollist); in strclose()
802 ASSERT(stp->sd_pollist.ph_list == NULL); in strclose()
803 ASSERT(stp->sd_sidp == NULL); in strclose()
804 ASSERT(stp->sd_pgidp == NULL); in strclose()
852 if (stp->sd_iocblk) { in strclose()
853 if (stp->sd_iocblk != (mblk_t *)-1) { in strclose()
854 freemsg(stp->sd_iocblk); in strclose()
856 stp->sd_iocblk = NULL; in strclose()
858 stp->sd_vnode = stp->sd_pvnode = NULL; in strclose()
861 mutex_enter(&stp->sd_lock); in strclose()
862 freemsg(stp->sd_cmdblk); in strclose()
863 stp->sd_cmdblk = NULL; in strclose()
864 stp->sd_flag &= ~STRCLOSE; in strclose()
865 cv_broadcast(&stp->sd_monitor); in strclose()
866 mutex_exit(&stp->sd_lock); in strclose()
869 shfree(stp); in strclose()
950 stdata_t *stp; in strclean() local
955 stp = vp->v_stream; in strclean()
957 mutex_enter(&stp->sd_lock); in strclean()
958 ssp = stp->sd_siglist; in strclean()
965 stp->sd_siglist = tssp; in strclean()
978 stp->sd_sigflags = 0; in strclean()
979 for (ssp = stp->sd_siglist; ssp; ssp = ssp->ss_next) in strclean()
980 stp->sd_sigflags |= ssp->ss_events; in strclean()
982 mutex_exit(&stp->sd_lock); in strclean()
995 stdata_t *stp; in strcleanall() local
997 stp = vp->v_stream; in strcleanall()
998 mutex_enter(&stp->sd_lock); in strcleanall()
999 ssp = stp->sd_siglist; in strcleanall()
1000 stp->sd_siglist = NULL; in strcleanall()
1009 stp->sd_sigflags = 0; in strcleanall()
1010 mutex_exit(&stp->sd_lock); in strcleanall()
1021 strget(struct stdata *stp, queue_t *q, struct uio *uiop, int first, in strget() argument
1029 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strget()
1031 if (uiop != NULL && stp->sd_struiordq != NULL && in strget()
1033 (!first || (stp->sd_wakeq & RSLEEP))) { in strget()
1045 stp->sd_wakeq &= ~RSLEEP; in strget()
1062 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strget()
1063 stp->sd_struiodnak++; in strget()
1068 ASSERT(MUTEX_NOT_HELD(&stp->sd_lock)); in strget()
1069 mutex_enter(&stp->sd_lock); in strget()
1070 stp->sd_struiodnak--; in strget()
1071 while (stp->sd_struiodnak == 0 && in strget()
1072 ((bp = stp->sd_struionak) != NULL)) { in strget()
1073 stp->sd_struionak = bp->b_next; in strget()
1083 mutex_exit(&stp->sd_lock); in strget()
1085 mutex_enter(&stp->sd_lock); in strget()
1088 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strget()
1092 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strget()
1113 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strget()
1128 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strget()
1141 if ((uiop != NULL) && (stp->sd_vnode->v_type == VSOCK) && in strget()
1142 (stp->sd_rputdatafunc == NULL)) in strget()
1219 struct stdata *stp; in strread() local
1236 stp = vp->v_stream; in strread()
1238 mutex_enter(&stp->sd_lock); in strread()
1240 if ((error = i_straccess(stp, JCREAD)) != 0) { in strread()
1241 mutex_exit(&stp->sd_lock); in strread()
1245 if (stp->sd_flag & (STRDERR|STPLEX)) { in strread()
1246 error = strgeterr(stp, STRDERR|STPLEX, 0); in strread()
1248 mutex_exit(&stp->sd_lock); in strread()
1258 q = _RD(stp->sd_wrq); in strread()
1260 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strread()
1261 old_sd_flag = stp->sd_flag; in strread()
1265 while ((bp = strget(stp, q, uiop, first, &error)) == NULL) { in strread()
1268 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strread()
1273 if (stp->sd_flag & (STRHUP|STREOF)) { in strread()
1276 if (rflg && !(stp->sd_flag & STRDELIM)) { in strread()
1293 if ((error = strwaitq(stp, waitflag, uiop->uio_resid, in strread()
1299 (stp->sd_flag & OLDNDELAY) && in strread()
1306 if ((error = i_straccess(stp, JCREAD)) != 0) { in strread()
1312 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strread()
1330 if (mark != 0 && bp == stp->sd_mark) { in strread()
1332 putback(stp, q, bp, pri); in strread()
1336 stp->sd_mark = NULL; in strread()
1338 if ((stp->sd_flag & STRDELIM) && (bp->b_flag & MSGDELIM)) in strread()
1340 mutex_exit(&stp->sd_lock); in strread()
1342 if (STREAM_NEEDSERVICE(stp)) in strread()
1343 stream_runservice(stp); in strread()
1362 mutex_enter(&stp->sd_lock); in strread()
1363 putback(stp, q, bp, pri); in strread()
1364 mutex_exit(&stp->sd_lock); in strread()
1378 mutex_enter(&stp->sd_lock); in strread()
1384 if (stp->sd_read_opt & RD_MSGDIS) { in strread()
1389 (stp->sd_mark == NULL)) in strread()
1390 stp->sd_mark = bp; in strread()
1397 putback(stp, q, bp, pri); in strread()
1418 stp->sd_flag &= ~STRNOTATMARK; in strread()
1419 stp->sd_flag |= STRATMARK; in strread()
1421 stp->sd_flag &= ~STRATMARK; in strread()
1422 stp->sd_flag |= STRNOTATMARK; in strread()
1424 stp->sd_flag &= in strread()
1428 stp->sd_flag &= ~STRATMARK; in strread()
1446 strsignal_nolock(stp, *bp->b_rptr, bp->b_band); in strread()
1447 mutex_exit(&stp->sd_lock); in strread()
1449 if (STREAM_NEEDSERVICE(stp)) in strread()
1450 stream_runservice(stp); in strread()
1451 mutex_enter(&stp->sd_lock); in strread()
1456 (stp->sd_read_opt & (RD_MSGDIS|RD_MSGNODIS))) { in strread()
1462 strsignal(stp, *bp->b_rptr, (int32_t)bp->b_band); in strread()
1464 mutex_enter(&stp->sd_lock); in strread()
1474 if (stp->sd_read_opt & RD_PROTDAT) { in strread()
1490 mutex_enter(&stp->sd_lock); in strread()
1491 stp->sd_flag &= ~STRPRI; in strread()
1492 mutex_exit(&stp->sd_lock); in strread()
1495 } else if (stp->sd_read_opt & RD_PROTDIS) { in strread()
1511 mutex_enter(&stp->sd_lock); in strread()
1512 stp->sd_flag &= ~STRPRI; in strread()
1513 mutex_exit(&stp->sd_lock); in strread()
1525 (stp->sd_read_opt & RD_PROTDIS)) { in strread()
1529 mutex_enter(&stp->sd_lock); in strread()
1530 putback(stp, q, bp, pri); in strread()
1531 mutex_exit(&stp->sd_lock); in strread()
1545 mutex_enter(&stp->sd_lock); in strread()
1548 mutex_exit(&stp->sd_lock); in strread()
1616 struct stdata *stp; in strrput() local
1627 stp = (struct stdata *)q->q_ptr; in strrput()
1633 rput_opt = stp->sd_rput_opt; in strrput()
1652 if (stp->sd_flag == STREOF) { in strrput()
1665 mutex_enter(&stp->sd_lock); in strrput()
1675 stp->sd_flag &= ~STRNOTATMARK; in strrput()
1676 stp->sd_flag |= STRATMARK; in strrput()
1688 stp->sd_flag &= ~STRATMARK; in strrput()
1689 stp->sd_flag |= STRNOTATMARK; in strrput()
1692 if (stp->sd_flag & RSLEEP) { in strrput()
1693 stp->sd_flag &= ~RSLEEP; in strrput()
1696 mutex_exit(&stp->sd_lock); in strrput()
1713 mutex_enter(&stp->sd_lock); in strrput()
1784 mutex_enter(&stp->sd_lock); in strrput()
1789 ASSERT(stp->sd_rprotofunc != NULL); in strrput()
1790 bp = (stp->sd_rprotofunc)(stp->sd_vnode, bp, in strrput()
1802 mutex_enter(&stp->sd_lock); in strrput()
1806 ASSERT(stp->sd_rmiscfunc != NULL); in strrput()
1807 bp = (stp->sd_rmiscfunc)(stp->sd_vnode, bp, in strrput()
1815 mutex_enter(&stp->sd_lock); in strrput()
1818 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strrput()
1841 if (stp->sd_flag & STRPRI) { in strrput()
1845 mutex_exit(&stp->sd_lock); in strrput()
1848 stp->sd_flag |= STRPRI; in strrput()
1863 stp->sd_mark = bp; in strrput()
1876 (((stp->sd_flag & STRGETINPROG) == 0) && in strrput()
1884 mutex_exit(&stp->sd_lock); in strrput()
1886 mutex_enter(&stp->sd_lock); in strrput()
1890 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strrput()
1895 stp->sd_wakeq &= ~RSLEEP; in strrput()
1897 wakeups &= stp->sd_flag; in strrput()
1899 stp->sd_flag &= ~RSLEEP; in strrput()
1903 stp->sd_flag &= ~WSLEEP; in strrput()
1914 if (!(stp->sd_rput_opt & SR_POLLIN)) in strrput()
1916 stp->sd_rput_opt &= ~SR_POLLIN; in strrput()
1918 mutex_exit(&stp->sd_lock); in strrput()
1919 pollwakeup(&stp->sd_pollist, pollwakeups); in strrput()
1920 mutex_enter(&stp->sd_lock); in strrput()
1928 if (stp->sd_sigflags & signals) in strrput()
1929 strsendsig(stp->sd_siglist, signals, band, 0); in strrput()
1930 mutex_exit(&stp->sd_lock); in strrput()
1945 mutex_enter(&stp->sd_lock); in strrput()
2006 struct stdata *stp; in strrput_nondata() local
2014 stp = (struct stdata *)q->q_ptr; in strrput_nondata()
2016 ASSERT(!(stp->sd_flag & STPLEX)); in strrput_nondata()
2028 mutex_enter(&stp->sd_lock); in strrput_nondata()
2031 if (stp->sd_flag & STRDERR) in strrput_nondata()
2033 stp->sd_flag |= STRDERR; in strrput_nondata()
2036 stp->sd_flag &= ~STRDERR; in strrput_nondata()
2038 stp->sd_rerror = *bp->b_rptr; in strrput_nondata()
2043 if (stp->sd_flag & STWRERR) in strrput_nondata()
2045 stp->sd_flag |= STWRERR; in strrput_nondata()
2048 stp->sd_flag &= ~STWRERR; in strrput_nondata()
2050 stp->sd_werror = *bp->b_rptr; in strrput_nondata()
2058 cv_broadcast(&stp->sd_monitor); /* ioctllers */ in strrput_nondata()
2060 mutex_exit(&stp->sd_lock); in strrput_nondata()
2061 pollwakeup(&stp->sd_pollist, POLLERR); in strrput_nondata()
2062 mutex_enter(&stp->sd_lock); in strrput_nondata()
2064 if (stp->sd_sigflags & S_ERROR) in strrput_nondata()
2065 strsendsig(stp->sd_siglist, S_ERROR, 0, in strrput_nondata()
2066 ((rw & FLUSHR) ? stp->sd_rerror : in strrput_nondata()
2067 stp->sd_werror)); in strrput_nondata()
2068 mutex_exit(&stp->sd_lock); in strrput_nondata()
2093 mutex_exit(&stp->sd_lock); in strrput_nondata()
2095 if (stp->sd_flag & (STRDERR|STWRERR)) in strrput_nondata()
2097 mutex_enter(&stp->sd_lock); in strrput_nondata()
2098 stp->sd_flag |= (STRDERR|STWRERR); in strrput_nondata()
2099 stp->sd_rerror = *bp->b_rptr; in strrput_nondata()
2100 stp->sd_werror = *bp->b_rptr; in strrput_nondata()
2106 cv_broadcast(&stp->sd_monitor); /* ioctllers */ in strrput_nondata()
2108 mutex_exit(&stp->sd_lock); in strrput_nondata()
2109 pollwakeup(&stp->sd_pollist, POLLERR); in strrput_nondata()
2110 mutex_enter(&stp->sd_lock); in strrput_nondata()
2112 if (stp->sd_sigflags & S_ERROR) in strrput_nondata()
2113 strsendsig(stp->sd_siglist, S_ERROR, 0, in strrput_nondata()
2114 (stp->sd_werror ? stp->sd_werror : in strrput_nondata()
2115 stp->sd_rerror)); in strrput_nondata()
2116 mutex_exit(&stp->sd_lock); in strrput_nondata()
2144 mutex_enter(&stp->sd_lock); in strrput_nondata()
2145 stp->sd_werror = ENXIO; in strrput_nondata()
2146 stp->sd_flag |= STRHUP; in strrput_nondata()
2147 stp->sd_flag &= ~(WSLEEP|RSLEEP); in strrput_nondata()
2153 if (stp->sd_sidp) { in strrput_nondata()
2154 prsignal(stp->sd_sidp, SIGHUP); in strrput_nondata()
2155 if (stp->sd_sidp != stp->sd_pgidp) in strrput_nondata()
2156 pgsignal(stp->sd_pgidp, SIGTSTP); in strrput_nondata()
2165 cv_broadcast(&stp->sd_monitor); /* the ioctllers */ in strrput_nondata()
2166 strhup(stp); in strrput_nondata()
2167 mutex_exit(&stp->sd_lock); in strrput_nondata()
2172 mutex_enter(&stp->sd_lock); in strrput_nondata()
2173 stp->sd_werror = 0; in strrput_nondata()
2174 stp->sd_flag &= ~STRHUP; in strrput_nondata()
2175 mutex_exit(&stp->sd_lock); in strrput_nondata()
2190 mutex_enter(&stp->sd_lock); in strrput_nondata()
2192 !(stp->sd_flag & RSLEEP))) { in strrput_nondata()
2194 mutex_exit(&stp->sd_lock); in strrput_nondata()
2197 mutex_exit(&stp->sd_lock); in strrput_nondata()
2204 strsignal(stp, *bp->b_rptr, 0L); in strrput_nondata()
2214 mutex_enter(&stp->sd_lock); in strrput_nondata()
2215 if (stp->sd_flag & STRCMDWAIT) { in strrput_nondata()
2216 ASSERT(stp->sd_cmdblk == NULL); in strrput_nondata()
2217 stp->sd_cmdblk = bp; in strrput_nondata()
2218 cv_broadcast(&stp->sd_monitor); in strrput_nondata()
2219 mutex_exit(&stp->sd_lock); in strrput_nondata()
2221 mutex_exit(&stp->sd_lock); in strrput_nondata()
2239 mutex_enter(&stp->sd_lock); in strrput_nondata()
2245 stp->sd_read_opt & RFLUSHPCPROT); in strrput_nondata()
2248 stp->sd_flag &= ~STRPRI; in strrput_nondata()
2250 ASSERT(stp->sd_flag & STRPRI); in strrput_nondata()
2252 mutex_exit(&stp->sd_lock); in strrput_nondata()
2279 mutex_enter(&stp->sd_lock); in strrput_nondata()
2280 if ((stp->sd_flag & IOCWAIT) == 0 || stp->sd_iocblk || in strrput_nondata()
2281 (stp->sd_iocid != iocbp->ioc_id)) { in strrput_nondata()
2290 if ((stp->sd_iocid == iocbp->ioc_id) && in strrput_nondata()
2291 (stp->sd_iocblk != NULL)) { in strrput_nondata()
2295 mutex_exit(&stp->sd_lock); in strrput_nondata()
2302 stp->sd_iocblk = bp; in strrput_nondata()
2303 cv_broadcast(&stp->sd_monitor); in strrput_nondata()
2304 mutex_exit(&stp->sd_lock); in strrput_nondata()
2317 mutex_enter(&stp->sd_lock); in strrput_nondata()
2318 if ((stp->sd_flag & IOCWAIT) == 0 || stp->sd_iocblk || in strrput_nondata()
2319 (stp->sd_iocid != reqp->cq_id)) { in strrput_nondata()
2328 mutex_exit(&stp->sd_lock); in strrput_nondata()
2329 putnext(stp->sd_wrq, bp); in strrput_nondata()
2336 stp->sd_iocblk = bp; in strrput_nondata()
2337 cv_broadcast(&stp->sd_monitor); in strrput_nondata()
2338 mutex_exit(&stp->sd_lock); in strrput_nondata()
2350 mutex_enter(&stp->sd_lock); in strrput_nondata()
2354 stp->sd_read_opt &= ~(RD_MSGDIS | RD_MSGNODIS); in strrput_nondata()
2358 stp->sd_read_opt = in strrput_nondata()
2359 ((stp->sd_read_opt & ~RD_MSGNODIS) | in strrput_nondata()
2364 stp->sd_read_opt = in strrput_nondata()
2365 ((stp->sd_read_opt & ~RD_MSGDIS) | in strrput_nondata()
2371 stp->sd_read_opt &= ~(RD_PROTDAT | RD_PROTDIS); in strrput_nondata()
2375 stp->sd_read_opt = in strrput_nondata()
2376 ((stp->sd_read_opt & ~RD_PROTDIS) | in strrput_nondata()
2381 stp->sd_read_opt = in strrput_nondata()
2382 ((stp->sd_read_opt & ~RD_PROTDAT) | in strrput_nondata()
2392 stp->sd_read_opt |= RFLUSHPCPROT; in strrput_nondata()
2399 stp->sd_flag &= ~STRDERRNONPERSIST; in strrput_nondata()
2402 stp->sd_flag |= STRDERRNONPERSIST; in strrput_nondata()
2407 stp->sd_flag &= ~STWRERRNONPERSIST; in strrput_nondata()
2410 stp->sd_flag |= STWRERRNONPERSIST; in strrput_nondata()
2416 stp->sd_copyflag |= STZCVMSAFE; in strrput_nondata()
2417 stp->sd_copyflag &= ~STZCVMUNSAFE; in strrput_nondata()
2419 stp->sd_copyflag |= STZCVMUNSAFE; in strrput_nondata()
2420 stp->sd_copyflag &= ~STZCVMSAFE; in strrput_nondata()
2424 stp->sd_copyflag |= STRCOPYCACHED; in strrput_nondata()
2428 stp->sd_wroff = sop->so_wroff; in strrput_nondata()
2430 stp->sd_tail = sop->so_tail; in strrput_nondata()
2436 stp->sd_maxblk = sop->so_maxblk; in strrput_nondata()
2464 stp->sd_flag |= SNDMREAD; in strrput_nondata()
2466 stp->sd_flag &= ~SNDMREAD; in strrput_nondata()
2468 stp->sd_flag |= OLDNDELAY; in strrput_nondata()
2470 stp->sd_flag &= ~OLDNDELAY; in strrput_nondata()
2472 stp->sd_flag |= STRISTTY; in strrput_nondata()
2474 stp->sd_flag &= ~STRISTTY; in strrput_nondata()
2476 stp->sd_flag |= STRTOSTOP; in strrput_nondata()
2478 stp->sd_flag &= ~STRTOSTOP; in strrput_nondata()
2480 stp->sd_flag |= STRDELIM; in strrput_nondata()
2482 stp->sd_flag &= ~STRDELIM; in strrput_nondata()
2484 mutex_exit(&stp->sd_lock); in strrput_nondata()
2515 mutex_enter(&stp->sd_lock); in strrput_nondata()
2516 if (stp->sd_struiodnak != 0) { in strrput_nondata()
2521 mblk_t *mp = stp->sd_struionak; in strrput_nondata()
2528 stp->sd_struionak = bp; in strrput_nondata()
2530 mutex_exit(&stp->sd_lock); in strrput_nondata()
2533 mutex_exit(&stp->sd_lock); in strrput_nondata()
2566 strwriteable(struct stdata *stp, boolean_t eiohup, boolean_t sigpipeok) in strwriteable() argument
2570 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strwriteable()
2576 if (eiohup && (stp->sd_flag & (STPLEX|STRHUP)) == STRHUP) in strwriteable()
2579 error = strgeterr(stp, STRHUP|STPLEX|STWRERR, 0); in strwriteable()
2582 if (!(stp->sd_flag & STPLEX) && in strwriteable()
2583 (stp->sd_wput_opt & SW_SIGPIPE) && sigpipeok) { in strwriteable()
2612 strput(struct stdata *stp, mblk_t *mctl, struct uio *uiop, ssize_t *iosize, in strput() argument
2619 queue_t *wqp = stp->sd_wrq; in strput()
2623 ASSERT(MUTEX_NOT_HELD(&stp->sd_lock)); in strput()
2626 flags |= stp->sd_struiowrq ? STRUIO_POSTPONE : 0; in strput()
2644 if ((error = strmakedata(iosize, uiop, stp, flags, in strput()
2680 stream_willservice(stp); in strput()
2682 stream_runservice(stp); in strput()
2689 if ((error = strmakedata(iosize, uiop, stp, flags, &mp)) != 0) { in strput()
2779 stream_willservice(stp); in strput()
2781 stream_runservice(stp); in strput()
2818 struct stdata *stp; in strwrite_common() local
2828 stp = vp->v_stream; in strwrite_common()
2830 mutex_enter(&stp->sd_lock); in strwrite_common()
2832 if ((error = i_straccess(stp, JCWRITE)) != 0) { in strwrite_common()
2833 mutex_exit(&stp->sd_lock); in strwrite_common()
2837 if (stp->sd_flag & (STWRERR|STRHUP|STPLEX)) { in strwrite_common()
2838 error = strwriteable(stp, B_TRUE, B_TRUE); in strwrite_common()
2840 mutex_exit(&stp->sd_lock); in strwrite_common()
2845 mutex_exit(&stp->sd_lock); in strwrite_common()
2847 wqp = stp->sd_wrq; in strwrite_common()
2850 rmin = stp->sd_qn_minpsz; in strwrite_common()
2851 rmax = stp->sd_qn_maxpsz; in strwrite_common()
2883 if (stp->sd_flag & OLDNDELAY) in strwrite_common()
2909 if ((stp->sd_flag & STRDELIM) && (uiop->uio_resid == iosize)) in strwrite_common()
2917 error = strput(stp, NULL, uiop, &iosize, b_flag, 0, 0); in strwrite_common()
2923 mutex_enter(&stp->sd_lock); in strwrite_common()
2931 mutex_exit(&stp->sd_lock); in strwrite_common()
2936 if ((error = strwaitq(stp, waitflag, (ssize_t)0, in strwrite_common()
2938 mutex_exit(&stp->sd_lock); in strwrite_common()
2947 if ((error = i_straccess(stp, JCWRITE)) != 0) { in strwrite_common()
2948 mutex_exit(&stp->sd_lock); in strwrite_common()
2951 mutex_exit(&stp->sd_lock); in strwrite_common()
2958 if ((stp->sd_wput_opt & SW_RECHECK_ERR) && in strwrite_common()
2959 (stp->sd_flag & (STWRERR|STRHUP|STPLEX))) { in strwrite_common()
2960 mutex_enter(&stp->sd_lock); in strwrite_common()
2961 error = strwriteable(stp, B_FALSE, B_TRUE); in strwrite_common()
2962 mutex_exit(&stp->sd_lock); in strwrite_common()
2993 struct stdata *stp; in strwsrv() local
3003 stp = (struct stdata *)q->q_ptr; in strwsrv()
3005 mutex_enter(&stp->sd_lock); in strwsrv()
3006 ASSERT(!(stp->sd_flag & STPLEX)); in strwsrv()
3008 if (stp->sd_flag & WSLEEP) { in strwsrv()
3009 stp->sd_flag &= ~WSLEEP; in strwsrv()
3012 mutex_exit(&stp->sd_lock); in strwsrv()
3040 pollwakeup(&stp->sd_pollist, POLLWRNORM); in strwsrv()
3041 mutex_enter(&stp->sd_lock); in strwsrv()
3042 if (stp->sd_sigflags & S_WRNORM) in strwsrv()
3043 strsendsig(stp->sd_siglist, S_WRNORM, 0, 0); in strwsrv()
3044 mutex_exit(&stp->sd_lock); in strwsrv()
3077 pollwakeup(&stp->sd_pollist, POLLWRBAND); in strwsrv()
3078 mutex_enter(&stp->sd_lock); in strwsrv()
3079 if (stp->sd_sigflags & S_WRBAND) in strwsrv()
3080 strsendsig(stp->sd_siglist, S_WRBAND, in strwsrv()
3082 mutex_exit(&stp->sd_lock); in strwsrv()
3283 struct stdata *stp; in strioctl() local
3304 stp = vp->v_stream; in strioctl()
3307 "strioctl:stp %p cmd %X arg %lX", stp, cmd, arg); in strioctl()
3319 wrq = stp->sd_wrq; in strioctl()
3328 mutex_enter(&stp->sd_lock); in strioctl()
3329 if ((access != -1) && ((error = i_straccess(stp, access)) != 0)) { in strioctl()
3330 mutex_exit(&stp->sd_lock); in strioctl()
3333 mutex_exit(&stp->sd_lock); in strioctl()
3355 mutex_enter(&stp->sd_lock); in strioctl()
3367 if (stp->sd_flag & (STRDERR|STPLEX)) { in strioctl()
3368 error = strgeterr(stp, STRDERR|STPLEX, 0); in strioctl()
3370 mutex_exit(&stp->sd_lock); in strioctl()
3377 if (stp->sd_flag & (STRDERR|STWRERR|STPLEX)) { in strioctl()
3378 error = strgeterr(stp, STRDERR|STWRERR|STPLEX, 0); in strioctl()
3380 mutex_exit(&stp->sd_lock); in strioctl()
3386 mutex_exit(&stp->sd_lock); in strioctl()
3423 if (stp->sd_flag & STRHUP) in strioctl()
3438 return (strdoioctl(stp, &strioc, flag, in strioctl()
3447 return (strdoioctl(stp, &strioc, flag, in strioctl()
3455 return (strdoioctl(stp, &strioc, flag, in strioctl()
3461 return (strdoioctl(stp, &strioc, flag, in strioctl()
3467 return (strdoioctl(stp, &strioc, flag, in strioctl()
3475 mutex_enter(&stp->sd_lock); in strioctl()
3477 if (stp->sd_sidp != curproc->p_sessp->s_sidp && in strioctl()
3480 mutex_exit(&stp->sd_lock); in strioctl()
3484 mutex_exit(&stp->sd_lock); in strioctl()
3488 return (strdoioctl(stp, &strioc, flag, in strioctl()
3494 return (strdoioctl(stp, &strioc, flag, in strioctl()
3500 return (strdoioctl(stp, &strioc, flag, in strioctl()
3517 return (strdoioctl(stp, &strioc, flag, in strioctl()
3524 return (strdoioctl(stp, &strioc, flag, in strioctl()
3531 return (strdoioctl(stp, &strioc, flag, in strioctl()
3538 return (strdoioctl(stp, &strioc, flag, in strioctl()
3544 return (strdoioctl(stp, &strioc, flag, in strioctl()
3551 return (strdoioctl(stp, &strioc, flag, in strioctl()
3585 return (strdoioctl(stp, &strioc, flag, in strioctl()
3598 return (strdoioctl(stp, &strioc, flag, copyflag, crp, rvalp)); in strioctl()
3608 if (stp->sd_flag & STRHUP) in strioctl()
3620 mutex_enter(&stp->sd_lock); in strioctl()
3622 ((error = i_straccess(stp, access)) != 0)) { in strioctl()
3623 mutex_exit(&stp->sd_lock); in strioctl()
3626 mutex_exit(&stp->sd_lock); in strioctl()
3650 error = strdoioctl(stp, &strioc, flag, copyflag, crp, rvalp); in strioctl()
3662 if (stp->sd_flag & STRHUP) in strioctl()
3680 mutex_enter(&stp->sd_lock); in strioctl()
3681 if (access != -1 && (error = i_straccess(stp, access)) != 0) { in strioctl()
3682 mutex_exit(&stp->sd_lock); in strioctl()
3687 mutex_exit(&stp->sd_lock); in strioctl()
3690 if ((error = strdocmd(stp, scp, crp)) == 0) { in strioctl()
3718 if (stp->sd_struiordq) { in strioctl()
3760 if (stp->sd_struiordq) { in strioctl()
3797 if (stp->sd_struiordq) { in strioctl()
3841 claimstr(stp->sd_wrq); in strioctl()
3842 for (q = stp->sd_wrq->q_next; q; q = q->q_next) { in strioctl()
3850 releasestr(stp->sd_wrq); in strioctl()
3869 if (stp->sd_flag & STRHUP) in strioctl()
3885 "I_PUSH:fp %p stp %p", fp, stp); in strioctl()
3895 claimstr(stp->sd_wrq); in strioctl()
3896 for (q = stp->sd_wrq->q_next; q; q = q->q_next) { in strioctl()
3904 releasestr(stp->sd_wrq); in strioctl()
3911 if (error = strstartplumb(stp, flag, cmd)) { in strioctl()
3922 mutex_enter(&stp->sd_lock); in strioctl()
3923 if (stp->sd_pushcnt >= nstrpush) { in strioctl()
3925 strendplumb(stp); in strioctl()
3926 mutex_exit(&stp->sd_lock); in strioctl()
3929 mutex_exit(&stp->sd_lock); in strioctl()
3940 (cmd == I_PUSH) && (stp->sd_flag & STRISTTY)) { in strioctl()
3944 (void) strctty(stp); in strioctl()
3948 mutex_enter(&stp->sd_lock); in strioctl()
3955 mutex_enter(QLOCK(stp->sd_wrq->q_next)); in strioctl()
3956 rmin = stp->sd_wrq->q_next->q_minpsz; in strioctl()
3957 rmax = stp->sd_wrq->q_next->q_maxpsz; in strioctl()
3958 mutex_exit(QLOCK(stp->sd_wrq->q_next)); in strioctl()
3972 stp->sd_qn_minpsz = rmin; in strioctl()
3973 stp->sd_qn_maxpsz = rmax; in strioctl()
3976 strendplumb(stp); in strioctl()
3977 mutex_exit(&stp->sd_lock); in strioctl()
3985 if (stp->sd_flag & STRHUP) in strioctl()
3990 if (error = strstartplumb(stp, flag, cmd)) in strioctl()
4001 (stp->sd_anchorzone != crgetzoneid(crp))) { in strioctl()
4002 mutex_enter(&stp->sd_lock); in strioctl()
4007 if (stp->sd_pushcnt > 0 && in strioctl()
4008 stp->sd_pushcnt == stp->sd_anchor && in strioctl()
4009 stp->sd_vnode->v_type != VFIFO) { in strioctl()
4010 strendplumb(stp); in strioctl()
4011 mutex_exit(&stp->sd_lock); in strioctl()
4012 if (stp->sd_anchorzone != crgetzoneid(crp)) in strioctl()
4017 mutex_exit(&stp->sd_lock); in strioctl()
4022 "I_POP:%p from %p", q, stp); in strioctl()
4029 mutex_enter(&stp->sd_lock); in strioctl()
4053 stp->sd_qn_minpsz = rmin; in strioctl()
4054 stp->sd_qn_maxpsz = rmax; in strioctl()
4058 if (stp->sd_pushcnt < stp->sd_anchor) { in strioctl()
4059 stp->sd_anchor = 0; in strioctl()
4060 stp->sd_anchorzone = 0; in strioctl()
4062 strendplumb(stp); in strioctl()
4063 mutex_exit(&stp->sd_lock); in strioctl()
4155 if (stp->sd_flag & STRHUP) in strioctl()
4157 if (STRMATED(stp)) in strioctl()
4161 if (stp->sd_anchor != 0 && in strioctl()
4162 stp->sd_anchorzone != crgetzoneid(crp)) in strioctl()
4183 if (error = strstartplumb(stp, flag, cmd)) { in strioctl()
4201 mutex_enter(&stp->sd_lock); in strioctl()
4202 if (stp->sd_pushcnt >= nstrpush || pos < 0 || in strioctl()
4203 pos > stp->sd_pushcnt) { in strioctl()
4205 strendplumb(stp); in strioctl()
4206 mutex_exit(&stp->sd_lock); in strioctl()
4209 if (stp->sd_anchor != 0) { in strioctl()
4216 if (pos > (stp->sd_pushcnt - stp->sd_anchor) && in strioctl()
4217 stp->sd_anchorzone != crgetzoneid(crp)) { in strioctl()
4219 strendplumb(stp); in strioctl()
4220 mutex_exit(&stp->sd_lock); in strioctl()
4225 mutex_exit(&stp->sd_lock); in strioctl()
4236 for (tmp_wrq = stp->sd_wrq; pos > 0; in strioctl()
4243 mutex_enter(&stp->sd_lock); in strioctl()
4244 strendplumb(stp); in strioctl()
4245 mutex_exit(&stp->sd_lock); in strioctl()
4249 mutex_enter(&stp->sd_lock); in strioctl()
4257 mutex_enter(QLOCK(stp->sd_wrq->q_next)); in strioctl()
4258 rmin = stp->sd_wrq->q_next->q_minpsz; in strioctl()
4259 rmax = stp->sd_wrq->q_next->q_maxpsz; in strioctl()
4260 mutex_exit(QLOCK(stp->sd_wrq->q_next)); in strioctl()
4272 stp->sd_qn_minpsz = rmin; in strioctl()
4273 stp->sd_qn_maxpsz = rmax; in strioctl()
4281 if (stp->sd_anchor != 0) { in strioctl()
4283 if (pos >= (stp->sd_pushcnt - stp->sd_anchor)) in strioctl()
4284 stp->sd_anchor++; in strioctl()
4287 strendplumb(stp); in strioctl()
4288 mutex_exit(&stp->sd_lock); in strioctl()
4321 if (stp->sd_flag & STRHUP) in strioctl()
4323 if (STRMATED(stp)) in strioctl()
4327 if (stp->sd_anchor != 0 && in strioctl()
4328 stp->sd_anchorzone != crgetzoneid(crp)) in strioctl()
4342 if ((error = strstartplumb(stp, flag, cmd)) != 0) in strioctl()
4352 for (q = stp->sd_wrq->q_next; SAMESTR(q) && pos > 0; in strioctl()
4357 mutex_enter(&stp->sd_lock); in strioctl()
4358 strendplumb(stp); in strioctl()
4359 mutex_exit(&stp->sd_lock); in strioctl()
4367 if (stp->sd_anchor != 0) { in strioctl()
4369 if (pos >= (stp->sd_pushcnt - stp->sd_anchor) && in strioctl()
4370 stp->sd_anchorzone != crgetzoneid(crp)) { in strioctl()
4371 mutex_enter(&stp->sd_lock); in strioctl()
4372 strendplumb(stp); in strioctl()
4373 mutex_exit(&stp->sd_lock); in strioctl()
4382 mutex_enter(&stp->sd_lock); in strioctl()
4407 stp->sd_qn_minpsz = rmin; in strioctl()
4408 stp->sd_qn_maxpsz = rmax; in strioctl()
4420 if (stp->sd_anchor != 0) { in strioctl()
4422 if (pos == stp->sd_pushcnt - stp->sd_anchor + 1) in strioctl()
4423 stp->sd_anchor = 0; in strioctl()
4424 else if (pos > (stp->sd_pushcnt - stp->sd_anchor + 1)) in strioctl()
4425 stp->sd_anchor--; in strioctl()
4428 strendplumb(stp); in strioctl()
4429 mutex_exit(&stp->sd_lock); in strioctl()
4440 mutex_enter(&stp->sd_lock); in strioctl()
4442 if (stp->sd_vnode->v_type == VFIFO) { in strioctl()
4443 mutex_exit(&stp->sd_lock); in strioctl()
4447 if (stp->sd_anchor != 0 && in strioctl()
4448 stp->sd_anchorzone != crgetzoneid(crp)) { in strioctl()
4449 mutex_exit(&stp->sd_lock); in strioctl()
4452 stp->sd_anchor = stp->sd_pushcnt; in strioctl()
4453 stp->sd_anchorzone = crgetzoneid(crp); in strioctl()
4454 mutex_exit(&stp->sd_lock); in strioctl()
4505 TR_I_UNLINK, "I_UNLINK/I_PUNLINK:%p", stp); in strioctl()
4522 error = munlinkall(stp, type, crp, rvalp, ss); in strioctl()
4525 if (!(linkp = findlinks(stp, (int)arg, type, ss))) { in strioctl()
4532 error = munlink(stp, linkp, type, crp, rvalp, ss); in strioctl()
4546 if (stp->sd_flag & STRHUP) in strioctl()
4552 if (putnextctl1(stp->sd_wrq, M_FLUSH, (int)arg)) { in strioctl()
4570 (void) strdoioctl(stp, &strioc, flag, K_TO_K, crp, rvalp); in strioctl()
4582 if (stp->sd_flag & STRHUP) in strioctl()
4593 putnext(stp->sd_wrq, mp); in strioctl()
4604 (void) strdoioctl(stp, &strioc, flag, K_TO_K, crp, rvalp); in strioctl()
4626 mutex_enter(&stp->sd_lock); in strioctl()
4629 stp->sd_read_opt &= ~(RD_MSGDIS | RD_MSGNODIS); in strioctl()
4632 stp->sd_read_opt = (stp->sd_read_opt & ~RD_MSGNODIS) | in strioctl()
4636 stp->sd_read_opt = (stp->sd_read_opt & ~RD_MSGDIS) | in strioctl()
4643 stp->sd_read_opt &= ~(RD_PROTDAT | RD_PROTDIS); in strioctl()
4647 stp->sd_read_opt = ((stp->sd_read_opt & ~RD_PROTDIS) | in strioctl()
4652 stp->sd_read_opt = ((stp->sd_read_opt & ~RD_PROTDAT) | in strioctl()
4656 mutex_exit(&stp->sd_lock); in strioctl()
4667 rdopt = ((stp->sd_read_opt & RD_MSGDIS) ? RMSGD : in strioctl()
4668 ((stp->sd_read_opt & RD_MSGNODIS) ? RMSGN : RNORM)); in strioctl()
4669 rdopt |= ((stp->sd_read_opt & RD_PROTDAT) ? RPROTDAT : in strioctl()
4670 ((stp->sd_read_opt & RD_PROTDIS) ? RPROTDIS : RPROTNORM)); in strioctl()
4688 mutex_enter(&stp->sd_lock); in strioctl()
4691 stp->sd_flag &= ~STRDERRNONPERSIST; in strioctl()
4694 stp->sd_flag |= STRDERRNONPERSIST; in strioctl()
4699 stp->sd_flag &= ~STWRERRNONPERSIST; in strioctl()
4702 stp->sd_flag |= STWRERRNONPERSIST; in strioctl()
4705 mutex_exit(&stp->sd_lock); in strioctl()
4716 erropt |= (stp->sd_flag & STRDERRNONPERSIST) ? RERRNONPERSIST : in strioctl()
4718 erropt |= (stp->sd_flag & STWRERRNONPERSIST) ? WERRNONPERSIST : in strioctl()
4740 mutex_enter(&stp->sd_lock); in strioctl()
4741 for (ssp = stp->sd_siglist; ssp && (ssp->ss_pidp != pidp); in strioctl()
4748 mutex_exit(&stp->sd_lock); in strioctl()
4752 mutex_exit(&stp->sd_lock); in strioctl()
4768 stp->sd_siglist = ssp; in strioctl()
4789 stp->sd_siglist = ssp->ss_next; in strioctl()
4792 mutex_exit(&stp->sd_lock); in strioctl()
4800 stp->sd_sigflags = 0; in strioctl()
4801 for (ssp = stp->sd_siglist; ssp; ssp = ssp->ss_next) in strioctl()
4802 stp->sd_sigflags |= ssp->ss_events; in strioctl()
4803 mutex_exit(&stp->sd_lock); in strioctl()
4817 mutex_enter(&stp->sd_lock); in strioctl()
4818 for (ssp = stp->sd_siglist; ssp; ssp = ssp->ss_next) in strioctl()
4822 mutex_exit(&stp->sd_lock); in strioctl()
4825 mutex_exit(&stp->sd_lock); in strioctl()
4888 mutex_enter(&stp->sd_lock); in strioctl()
4889 for (ssp = stp->sd_siglist; ssp && (ssp->ss_pid != pid); in strioctl()
4897 mutex_exit(&stp->sd_lock); in strioctl()
4905 mutex_exit(&stp->sd_lock); in strioctl()
4924 stp->sd_siglist = ssp; in strioctl()
4945 stp->sd_siglist = ssp->ss_next; in strioctl()
4948 mutex_exit(&stp->sd_lock); in strioctl()
4959 stp->sd_sigflags = 0; in strioctl()
4960 for (ssp = stp->sd_siglist; ssp; ssp = ssp->ss_next) in strioctl()
4961 stp->sd_sigflags |= ssp->ss_events; in strioctl()
4962 mutex_exit(&stp->sd_lock); in strioctl()
5006 mutex_enter(&stp->sd_lock); in strioctl()
5007 for (ssp = stp->sd_siglist; ssp; ssp = ssp->ss_next) in strioctl()
5013 mutex_exit(&stp->sd_lock); in strioctl()
5019 mutex_exit(&stp->sd_lock); in strioctl()
5058 } else if (stp->sd_struiordq == NULL || in strioctl()
5246 if (stp->sd_flag & STRHUP) in strioctl()
5321 mutex_enter(QLOCK(stp->sd_wrq)); in strioctl()
5322 rmin = stp->sd_qn_minpsz; in strioctl()
5323 rmax = stp->sd_qn_maxpsz; in strioctl()
5324 mutex_exit(QLOCK(stp->sd_wrq)); in strioctl()
5346 mutex_enter(&stp->sd_lock); in strioctl()
5348 !canputnext(stp->sd_wrq)) { in strioctl()
5349 if ((error = strwaitq(stp, WRITEWAIT, (ssize_t)0, in strioctl()
5351 mutex_exit(&stp->sd_lock); in strioctl()
5355 if ((error = i_straccess(stp, access)) != 0) { in strioctl()
5356 mutex_exit(&stp->sd_lock); in strioctl()
5362 mutex_exit(&stp->sd_lock); in strioctl()
5383 &msgsize, &uio, stp, in strioctl()
5402 stream_willservice(stp); in strioctl()
5403 putnext(stp->sd_wrq, mp); in strioctl()
5404 stream_runservice(stp); in strioctl()
5415 error = do_sendfp(stp, fp, crp); in strioctl()
5429 mutex_enter(&stp->sd_lock); in strioctl()
5431 if (stp->sd_flag & (STRHUP|STREOF)) { in strioctl()
5432 mutex_exit(&stp->sd_lock); in strioctl()
5435 if ((error = strwaitq(stp, GETWAIT, (ssize_t)0, in strioctl()
5437 mutex_exit(&stp->sd_lock); in strioctl()
5440 if ((error = i_straccess(stp, access)) != 0) { in strioctl()
5441 mutex_exit(&stp->sd_lock); in strioctl()
5446 putback(stp, rdq, mp, mp->b_band); in strioctl()
5447 mutex_exit(&stp->sd_lock); in strioctl()
5450 mutex_exit(&stp->sd_lock); in strioctl()
5454 mutex_enter(&stp->sd_lock); in strioctl()
5455 putback(stp, rdq, mp, mp->b_band); in strioctl()
5456 mutex_exit(&stp->sd_lock); in strioctl()
5466 mutex_enter(&stp->sd_lock); in strioctl()
5467 putback(stp, rdq, mp, mp->b_band); in strioctl()
5468 mutex_exit(&stp->sd_lock); in strioctl()
5500 mutex_enter(&stp->sd_lock); in strioctl()
5501 putback(stp, rdq, mp, mp->b_band); in strioctl()
5502 mutex_exit(&stp->sd_lock); in strioctl()
5535 mutex_enter(&stp->sd_lock); in strioctl()
5536 stp->sd_wput_opt &= ~(SW_SIGPIPE|SW_SNDZERO); in strioctl()
5538 stp->sd_wput_opt |= SW_SNDZERO; in strioctl()
5540 stp->sd_wput_opt |= SW_SIGPIPE; in strioctl()
5541 mutex_exit(&stp->sd_lock); in strioctl()
5548 if (stp->sd_wput_opt & SW_SNDZERO) in strioctl()
5550 if (stp->sd_wput_opt & SW_SIGPIPE) in strioctl()
5573 if (stp->sd_vnode->v_type == VFIFO) in strioctl()
5574 *rvalp = stp->sd_pushcnt; in strioctl()
5576 *rvalp = stp->sd_pushcnt + 1; in strioctl()
5592 claimstr(stp->sd_wrq); in strioctl()
5593 q = stp->sd_wrq; in strioctl()
5599 releasestr(stp->sd_wrq); in strioctl()
5603 releasestr(stp->sd_wrq); in strioctl()
5614 q = _RD(stp->sd_wrq); in strioctl()
5643 q = _RD(stp->sd_wrq); in strioctl()
5663 q = _RD(stp->sd_wrq); in strioctl()
5664 mutex_enter(&stp->sd_lock); in strioctl()
5665 if ((stp->sd_flag & STRATMARK) && (arg == ANYMARK)) { in strioctl()
5675 else if ((arg == LASTMARK) && (mp == stp->sd_mark)) in strioctl()
5681 mutex_exit(&stp->sd_lock); in strioctl()
5692 *rvalp = bcanputnext(stp->sd_wrq, band); in strioctl()
5707 stp->sd_closetime = closetime; in strioctl()
5715 closetime = stp->sd_closetime; in strioctl()
5724 mutex_enter(&stp->sd_lock); in strioctl()
5725 if (stp->sd_sidp == NULL) { in strioctl()
5726 mutex_exit(&stp->sd_lock); in strioctl()
5729 sid = stp->sd_sidp->pid_id; in strioctl()
5730 mutex_exit(&stp->sd_lock); in strioctl()
5744 mutex_enter(&stp->sd_lock); in strioctl()
5746 if (stp->sd_sidp != ttoproc(curthread)->p_sessp->s_sidp) { in strioctl()
5748 mutex_exit(&stp->sd_lock); in strioctl()
5751 if (pgrp == stp->sd_pgidp->pid_id) { in strioctl()
5753 mutex_exit(&stp->sd_lock); in strioctl()
5758 mutex_exit(&stp->sd_lock); in strioctl()
5764 mutex_exit(&stp->sd_lock); in strioctl()
5767 sid = stp->sd_sidp->pid_id; in strioctl()
5769 bg_pgid = stp->sd_pgidp->pid_id; in strioctl()
5771 PID_RELE(stp->sd_pgidp); in strioctl()
5773 stp->sd_pgidp = q->p_pgidp; in strioctl()
5774 PID_HOLD(stp->sd_pgidp); in strioctl()
5776 mutex_exit(&stp->sd_lock); in strioctl()
5784 mutex_enter(&stp->sd_lock); in strioctl()
5785 if (stp->sd_sidp == NULL) { in strioctl()
5786 mutex_exit(&stp->sd_lock); in strioctl()
5789 pgrp = stp->sd_pgidp->pid_id; in strioctl()
5790 mutex_exit(&stp->sd_lock); in strioctl()
5797 return (strctty(stp)); in strioctl()
5826 do_sendfp(struct stdata *stp, struct file *fp, struct cred *cr) in do_sendfp() argument
5837 if (stp->sd_flag & STRHUP) in do_sendfp()
5840 claimstr(stp->sd_wrq); in do_sendfp()
5843 if (STRMATED(stp)) { in do_sendfp()
5844 qp = _RD(stp->sd_mate->sd_wrq); in do_sendfp()
5855 qp = stp->sd_wrq; in do_sendfp()
5874 releasestr(stp->sd_wrq); in do_sendfp()
5900 if ((nextqp != NULL) && (STREAM(nextqp) != stp)) { in do_sendfp()
5908 releasestr(stp->sd_wrq); in do_sendfp()
5967 releasestr(stp->sd_wrq); in do_sendfp()
5990 struct stdata *stp, in strdoioctl() argument
6017 "strdoioctl:stp %p strioc %p", stp, strioc); in strdoioctl()
6070 if (stp->sd_flag & errs) { in strdoioctl()
6071 mutex_enter(&stp->sd_lock); in strdoioctl()
6072 error = strgeterr(stp, errs, 0); in strdoioctl()
6073 mutex_exit(&stp->sd_lock); in strdoioctl()
6095 mutex_enter(&stp->sd_lock); in strdoioctl()
6096 while ((stp->sd_flag & IOCWAIT) || in strdoioctl()
6097 (!set_iocwaitne && (stp->sd_flag & IOCWAITNE))) { in strdoioctl()
6103 cv_rval = str_cv_wait(&stp->sd_iocmonitor, &stp->sd_lock, in strdoioctl()
6116 if (!(stp->sd_flag & IOCWAITNE)) { in strdoioctl()
6118 stp->sd_flag |= IOCWAITNE; in strdoioctl()
6119 cv_broadcast(&stp->sd_monitor); in strdoioctl()
6135 } else if ((stp->sd_flag & errs)) { in strdoioctl()
6136 error = strgeterr(stp, errs, 0); in strdoioctl()
6139 mutex_exit(&stp->sd_lock); in strdoioctl()
6150 if (stp->sd_iocblk != (mblk_t *)-1) { in strdoioctl()
6151 freemsg(stp->sd_iocblk); in strdoioctl()
6153 stp->sd_iocblk = NULL; in strdoioctl()
6164 stp->sd_flag |= waitflags; in strdoioctl()
6169 iocbp->ioc_id = stp->sd_iocid = getiocseqno(); in strdoioctl()
6171 mutex_exit(&stp->sd_lock); in strdoioctl()
6174 TR_STRDOIOCTL_PUT, "strdoioctl put: stp %p", stp); in strdoioctl()
6175 stream_willservice(stp); in strdoioctl()
6176 putnext(stp->sd_wrq, bp); in strdoioctl()
6177 stream_runservice(stp); in strdoioctl()
6189 mutex_enter(&stp->sd_lock); in strdoioctl()
6197 while (!stp->sd_iocblk) { in strdoioctl()
6200 if (stp->sd_flag & errs) { in strdoioctl()
6201 error = strgeterr(stp, errs, 0); in strdoioctl()
6203 stp->sd_flag &= ~waitflags; in strdoioctl()
6204 cv_broadcast(&stp->sd_iocmonitor); in strdoioctl()
6205 mutex_exit(&stp->sd_lock); in strdoioctl()
6216 cv_rval = str_cv_wait(&stp->sd_monitor, &stp->sd_lock, in strdoioctl()
6234 stp->sd_iocblk == NULL && (stp->sd_flag & IOCWAITNE)) { in strdoioctl()
6252 bp = stp->sd_iocblk; in strdoioctl()
6253 stp->sd_iocblk = NULL; in strdoioctl()
6257 mutex_exit(&stp->sd_lock); in strdoioctl()
6268 stream_willservice(stp); in strdoioctl()
6269 putnext(stp->sd_wrq, bp); in strdoioctl()
6270 stream_runservice(stp); in strdoioctl()
6271 mutex_enter(&stp->sd_lock); in strdoioctl()
6276 stp->sd_flag &= ~waitflags; in strdoioctl()
6277 cv_broadcast(&stp->sd_iocmonitor); in strdoioctl()
6278 mutex_exit(&stp->sd_lock); in strdoioctl()
6283 bp = stp->sd_iocblk; in strdoioctl()
6295 stp->sd_iocblk = (mblk_t *)-1; in strdoioctl()
6296 stp->sd_flag &= ~waitflags; in strdoioctl()
6297 cv_broadcast(&stp->sd_iocmonitor); in strdoioctl()
6298 mutex_exit(&stp->sd_lock); in strdoioctl()
6304 stp->sd_iocblk = NULL; in strdoioctl()
6305 mutex_exit(&stp->sd_lock); in strdoioctl()
6392 stream_willservice(stp); in strdoioctl()
6393 putnext(stp->sd_wrq, bp); in strdoioctl()
6394 stream_runservice(stp); in strdoioctl()
6397 mutex_enter(&stp->sd_lock); in strdoioctl()
6398 stp->sd_flag &= ~waitflags; in strdoioctl()
6399 cv_broadcast(&stp->sd_iocmonitor); in strdoioctl()
6400 mutex_exit(&stp->sd_lock); in strdoioctl()
6436 stream_willservice(stp); in strdoioctl()
6437 putnext(stp->sd_wrq, bp); in strdoioctl()
6438 stream_runservice(stp); in strdoioctl()
6441 mutex_enter(&stp->sd_lock); in strdoioctl()
6442 stp->sd_flag &= ~waitflags; in strdoioctl()
6443 cv_broadcast(&stp->sd_iocmonitor); in strdoioctl()
6444 mutex_exit(&stp->sd_lock); in strdoioctl()
6452 mutex_enter(&stp->sd_lock); in strdoioctl()
6453 stp->sd_flag &= ~waitflags; in strdoioctl()
6454 cv_broadcast(&stp->sd_iocmonitor); in strdoioctl()
6455 mutex_exit(&stp->sd_lock); in strdoioctl()
6471 strdocmd(struct stdata *stp, struct strcmd *scp, cred_t *crp) in strdocmd() argument
6525 mutex_enter(&stp->sd_lock); in strdocmd()
6526 if (stp->sd_flag & STRCMDWAIT) { in strdocmd()
6527 mutex_exit(&stp->sd_lock); in strdocmd()
6531 stp->sd_flag |= STRCMDWAIT; in strdocmd()
6532 ASSERT(stp->sd_cmdblk == NULL); in strdocmd()
6533 mutex_exit(&stp->sd_lock); in strdocmd()
6535 putnext(stp->sd_wrq, mp); in strdocmd()
6543 mutex_enter(&stp->sd_lock); in strdocmd()
6544 while (stp->sd_cmdblk == NULL) { in strdocmd()
6545 if (stp->sd_flag & errs) { in strdocmd()
6546 if ((error = strgeterr(stp, errs, 0)) != 0) in strdocmd()
6550 rval = str_cv_wait(&stp->sd_monitor, &stp->sd_lock, timeout, 0); in strdocmd()
6551 if (stp->sd_cmdblk != NULL) in strdocmd()
6563 mp = stp->sd_cmdblk; in strdocmd()
6564 stp->sd_cmdblk = NULL; in strdocmd()
6566 ASSERT(stp->sd_flag & STRCMDWAIT); in strdocmd()
6567 stp->sd_flag &= ~STRCMDWAIT; in strdocmd()
6568 mutex_exit(&stp->sd_lock); in strdocmd()
6593 ASSERT(stp->sd_cmdblk == NULL); in strdocmd()
6594 stp->sd_flag &= ~STRCMDWAIT; in strdocmd()
6595 mutex_exit(&stp->sd_lock); in strdocmd()
6635 struct stdata *stp; in strgetmsg() local
6658 stp = vp->v_stream; in strgetmsg()
6661 mutex_enter(&stp->sd_lock); in strgetmsg()
6663 if ((error = i_straccess(stp, JCREAD)) != 0) { in strgetmsg()
6664 mutex_exit(&stp->sd_lock); in strgetmsg()
6668 if (stp->sd_flag & (STRDERR|STPLEX)) { in strgetmsg()
6669 error = strgeterr(stp, STRDERR|STPLEX, 0); in strgetmsg()
6671 mutex_exit(&stp->sd_lock); in strgetmsg()
6675 mutex_exit(&stp->sd_lock); in strgetmsg()
6704 q = _RD(stp->sd_wrq); in strgetmsg()
6705 mutex_enter(&stp->sd_lock); in strgetmsg()
6706 old_sd_flag = stp->sd_flag; in strgetmsg()
6737 bp = strget(stp, q, uiop, first, &error); in strgetmsg()
6738 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strgetmsg()
6741 strsignal_nolock(stp, *bp->b_rptr, in strgetmsg()
6773 strsignal_nolock(stp, *bp->b_rptr, bp->b_band); in strgetmsg()
6790 if ((stp->sd_flag & (STRHUP|STREOF)) || (mctl->maxlen == 0 && in strgetmsg()
6794 mutex_exit(&stp->sd_lock); in strgetmsg()
6800 if (((error = strwaitq(stp, GETWAIT, (ssize_t)0, fmode, -1, in strgetmsg()
6805 mutex_exit(&stp->sd_lock); in strgetmsg()
6810 if ((error = i_straccess(stp, JCREAD)) != 0) { in strgetmsg()
6811 mutex_exit(&stp->sd_lock); in strgetmsg()
6829 if (mark != 0 && bp == stp->sd_mark) { in strgetmsg()
6831 stp->sd_mark = NULL; in strgetmsg()
6839 if ((mark & _LASTMARK) && (stp->sd_mark == NULL)) in strgetmsg()
6840 stp->sd_mark = bp; in strgetmsg()
6842 putback(stp, q, bp, pri); in strgetmsg()
6844 mutex_exit(&stp->sd_lock); in strgetmsg()
6854 stp->sd_flag |= STRGETINPROG; in strgetmsg()
6855 mutex_exit(&stp->sd_lock); in strgetmsg()
6857 if (STREAM_NEEDSERVICE(stp)) in strgetmsg()
6858 stream_runservice(stp); in strgetmsg()
6881 mutex_enter(&stp->sd_lock); in strgetmsg()
6888 stp->sd_flag &= ~STRPRI; in strgetmsg()
6935 mutex_enter(&stp->sd_lock); in strgetmsg()
6942 stp->sd_flag &= ~STRPRI; in strgetmsg()
6965 mutex_enter(&stp->sd_lock); in strgetmsg()
6982 stp->sd_flag &= ~STRPRI; in strgetmsg()
6996 stp->sd_flag &= ~STRPRI; in strgetmsg()
6998 stp->sd_flag |= STRPRI; in strgetmsg()
7015 (stp->sd_mark == NULL)) { in strgetmsg()
7021 stp->sd_mark = savemp; in strgetmsg()
7024 putback(stp, q, savemp, pri); in strgetmsg()
7050 stp->sd_flag &= ~STRPRI; in strgetmsg()
7054 stp->sd_flag &= ~STRNOTATMARK; in strgetmsg()
7055 stp->sd_flag |= STRATMARK; in strgetmsg()
7057 stp->sd_flag &= ~STRATMARK; in strgetmsg()
7058 stp->sd_flag |= STRNOTATMARK; in strgetmsg()
7060 stp->sd_flag &= ~(STRATMARK|STRNOTATMARK); in strgetmsg()
7063 stp->sd_flag &= ~STRATMARK; in strgetmsg()
7081 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strgetmsg()
7091 strsignal_nolock(stp, *bp->b_rptr, bp->b_band); in strgetmsg()
7092 mutex_exit(&stp->sd_lock); in strgetmsg()
7094 if (STREAM_NEEDSERVICE(stp)) in strgetmsg()
7095 stream_runservice(stp); in strgetmsg()
7096 mutex_enter(&stp->sd_lock); in strgetmsg()
7104 stp->sd_flag &= ~STRGETINPROG; in strgetmsg()
7118 if ((bp = q->q_first) != NULL && !(stp->sd_flag & STRPRI)) { in strgetmsg()
7149 if (!(stp->sd_rput_opt & SR_POLLIN)) in strgetmsg()
7151 stp->sd_rput_opt &= ~SR_POLLIN; in strgetmsg()
7153 mutex_exit(&stp->sd_lock); in strgetmsg()
7154 pollwakeup(&stp->sd_pollist, pollwakeups); in strgetmsg()
7155 mutex_enter(&stp->sd_lock); in strgetmsg()
7159 if (stp->sd_sigflags & signals) in strgetmsg()
7160 strsendsig(stp->sd_siglist, signals, bp->b_band, 0); in strgetmsg()
7162 mutex_exit(&stp->sd_lock); in strgetmsg()
7200 struct stdata *stp; in kstrgetmsg() local
7221 stp = vp->v_stream; in kstrgetmsg()
7224 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7226 if ((error = i_straccess(stp, JCREAD)) != 0) { in kstrgetmsg()
7227 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7232 if (stp->sd_flag & (STRDERR|STPLEX)) { in kstrgetmsg()
7233 if ((stp->sd_flag & STPLEX) || in kstrgetmsg()
7235 error = strgeterr(stp, STRDERR|STPLEX, in kstrgetmsg()
7238 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7243 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7260 q = _RD(stp->sd_wrq); in kstrgetmsg()
7261 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7262 old_sd_flag = stp->sd_flag; in kstrgetmsg()
7277 bp = strget(stp, q, uiop, first, &error); in kstrgetmsg()
7278 ASSERT(MUTEX_HELD(&stp->sd_lock)); in kstrgetmsg()
7281 strsignal_nolock(stp, *bp->b_rptr, in kstrgetmsg()
7312 strsignal_nolock(stp, *bp->b_rptr, bp->b_band); in kstrgetmsg()
7326 if ((stp->sd_flag & (STRDERR|STPLEX)) && in kstrgetmsg()
7328 error = strgeterr(stp, STRDERR|STPLEX, in kstrgetmsg()
7331 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7345 if ((stp->sd_flag & (STRHUP|STREOF)) || in kstrgetmsg()
7350 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7374 if (((error = strwaitq(stp, waitflag, (ssize_t)0, in kstrgetmsg()
7379 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7384 if ((error = i_straccess(stp, JCREAD)) != 0) { in kstrgetmsg()
7385 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7410 putback(stp, q, bp, pri); in kstrgetmsg()
7412 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7415 if (bp == stp->sd_mark) { in kstrgetmsg()
7417 stp->sd_mark = NULL; in kstrgetmsg()
7427 if ((mark & _LASTMARK) && (stp->sd_mark == NULL)) in kstrgetmsg()
7428 stp->sd_mark = bp; in kstrgetmsg()
7430 putback(stp, q, bp, pri); in kstrgetmsg()
7432 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7455 if ((mark & _LASTMARK) && (stp->sd_mark == NULL)) in kstrgetmsg()
7456 stp->sd_mark = bp; in kstrgetmsg()
7458 putback(stp, q, bp, pri); in kstrgetmsg()
7459 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7471 if ((mark & _LASTMARK) && (stp->sd_mark == NULL)) in kstrgetmsg()
7472 stp->sd_mark = bp; in kstrgetmsg()
7474 putback(stp, q, bp, pri); in kstrgetmsg()
7483 stp->sd_flag |= STRGETINPROG; in kstrgetmsg()
7484 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7486 if ((stp->sd_rputdatafunc != NULL) && (DB_TYPE(bp) == M_DATA)) { in kstrgetmsg()
7499 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7500 putback(stp, q, tmp, tmp->b_band); in kstrgetmsg()
7501 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7506 bp = (stp->sd_rputdatafunc)(stp->sd_vnode, bp, in kstrgetmsg()
7513 if (STREAM_NEEDSERVICE(stp)) in kstrgetmsg()
7514 stream_runservice(stp); in kstrgetmsg()
7597 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7604 stp->sd_flag &= ~STRPRI; in kstrgetmsg()
7624 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7639 stp->sd_flag &= ~STRPRI; in kstrgetmsg()
7652 stp->sd_flag &= ~STRPRI; in kstrgetmsg()
7667 stp->sd_flag &= ~STRPRI; in kstrgetmsg()
7669 stp->sd_flag |= STRPRI; in kstrgetmsg()
7685 (stp->sd_mark == NULL)) { in kstrgetmsg()
7691 stp->sd_mark = savemp; in kstrgetmsg()
7695 putback(stp, q, savemp, pri); in kstrgetmsg()
7723 stp->sd_flag &= ~STRPRI; in kstrgetmsg()
7727 stp->sd_flag &= ~STRNOTATMARK; in kstrgetmsg()
7728 stp->sd_flag |= STRATMARK; in kstrgetmsg()
7730 stp->sd_flag &= ~STRATMARK; in kstrgetmsg()
7731 stp->sd_flag |= STRNOTATMARK; in kstrgetmsg()
7733 stp->sd_flag &= ~(STRATMARK|STRNOTATMARK); in kstrgetmsg()
7736 stp->sd_flag &= ~STRATMARK; in kstrgetmsg()
7754 ASSERT(MUTEX_HELD(&stp->sd_lock)); in kstrgetmsg()
7764 strsignal_nolock(stp, *bp->b_rptr, bp->b_band); in kstrgetmsg()
7765 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7767 if (STREAM_NEEDSERVICE(stp)) in kstrgetmsg()
7768 stream_runservice(stp); in kstrgetmsg()
7769 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7777 stp->sd_flag &= ~STRGETINPROG; in kstrgetmsg()
7791 if ((bp = q->q_first) != NULL && !(stp->sd_flag & STRPRI)) { in kstrgetmsg()
7822 if (!(stp->sd_rput_opt & SR_POLLIN)) in kstrgetmsg()
7824 stp->sd_rput_opt &= ~SR_POLLIN; in kstrgetmsg()
7826 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7827 pollwakeup(&stp->sd_pollist, pollwakeups); in kstrgetmsg()
7828 mutex_enter(&stp->sd_lock); in kstrgetmsg()
7832 if (stp->sd_sigflags & signals) in kstrgetmsg()
7833 strsendsig(stp->sd_siglist, signals, bp->b_band, 0); in kstrgetmsg()
7835 mutex_exit(&stp->sd_lock); in kstrgetmsg()
7856 struct stdata *stp; in strputmsg() local
7868 stp = vp->v_stream; in strputmsg()
7869 wqp = stp->sd_wrq; in strputmsg()
7882 mutex_enter(&stp->sd_lock); in strputmsg()
7884 if ((error = i_straccess(stp, JCWRITE)) != 0) { in strputmsg()
7885 mutex_exit(&stp->sd_lock); in strputmsg()
7889 if (stp->sd_flag & (STWRERR|STRHUP|STPLEX)) { in strputmsg()
7890 error = strwriteable(stp, B_FALSE, xpg4); in strputmsg()
7892 mutex_exit(&stp->sd_lock); in strputmsg()
7897 mutex_exit(&stp->sd_lock); in strputmsg()
7915 "strputmsg in:stp %p", stp); in strputmsg()
7918 rmin = stp->sd_qn_minpsz; in strputmsg()
7919 rmax = stp->sd_qn_maxpsz; in strputmsg()
7934 if (stp->sd_maxblk != INFPSZ && rmax != INFPSZ && rmax < stp->sd_maxblk) in strputmsg()
7935 rmax = stp->sd_maxblk; in strputmsg()
7975 stp, 1, error); in strputmsg()
7982 ASSERT(stp->sd_maxblk == INFPSZ || in strputmsg()
7983 stp->sd_maxblk >= mdata->len); in strputmsg()
7986 error = strput(stp, mp, uiop, &msgsize, 0, pri, flag); in strputmsg()
7995 mutex_enter(&stp->sd_lock); in strputmsg()
8003 mutex_exit(&stp->sd_lock); in strputmsg()
8007 "strputmsg wait:stp %p waits pri %d", stp, pri); in strputmsg()
8008 if (((error = strwaitq(stp, WRITEWAIT, (ssize_t)0, fmode, -1, in strputmsg()
8010 mutex_exit(&stp->sd_lock); in strputmsg()
8013 stp, 0, error); in strputmsg()
8017 "strputmsg wake:stp %p wakes", stp); in strputmsg()
8018 if ((error = i_straccess(stp, JCWRITE)) != 0) { in strputmsg()
8019 mutex_exit(&stp->sd_lock); in strputmsg()
8022 mutex_exit(&stp->sd_lock); in strputmsg()
8033 "strputmsg out:stp %p out %d error %d", stp, 2, error); in strputmsg()
8060 struct stdata *stp; in kstrputmsg() local
8066 stp = vp->v_stream; in kstrputmsg()
8067 wqp = stp->sd_wrq; in kstrputmsg()
8073 mutex_enter(&stp->sd_lock); in kstrputmsg()
8075 if ((error = i_straccess(stp, JCWRITE)) != 0) { in kstrputmsg()
8076 mutex_exit(&stp->sd_lock); in kstrputmsg()
8081 if ((stp->sd_flag & STPLEX) || !(flag & MSG_IGNERROR)) { in kstrputmsg()
8082 if (stp->sd_flag & (STWRERR|STRHUP|STPLEX)) { in kstrputmsg()
8083 error = strwriteable(stp, B_FALSE, B_TRUE); in kstrputmsg()
8085 mutex_exit(&stp->sd_lock); in kstrputmsg()
8092 mutex_exit(&stp->sd_lock); in kstrputmsg()
8112 "kstrputmsg in:stp %p", stp); in kstrputmsg()
8115 rmin = stp->sd_qn_minpsz; in kstrputmsg()
8116 rmax = stp->sd_qn_maxpsz; in kstrputmsg()
8132 if (stp->sd_maxblk != INFPSZ && rmax != INFPSZ && rmax < stp->sd_maxblk) in kstrputmsg()
8133 rmax = stp->sd_maxblk; in kstrputmsg()
8217 ASSERT(stp->sd_maxblk == INFPSZ || stp->sd_maxblk >= msgsize); in kstrputmsg()
8218 error = strput(stp, mp, uiop, &msgsize, 0, pri, flag); in kstrputmsg()
8230 mutex_enter(&stp->sd_lock); in kstrputmsg()
8238 mutex_exit(&stp->sd_lock); in kstrputmsg()
8242 "kstrputmsg wait:stp %p waits pri %d", stp, pri); in kstrputmsg()
8251 if (((error = strwaitq(stp, waitflag, in kstrputmsg()
8253 mutex_exit(&stp->sd_lock); in kstrputmsg()
8256 stp, 0, error); in kstrputmsg()
8261 "kstrputmsg wake:stp %p wakes", stp); in kstrputmsg()
8262 if ((error = i_straccess(stp, JCWRITE)) != 0) { in kstrputmsg()
8263 mutex_exit(&stp->sd_lock); in kstrputmsg()
8267 mutex_exit(&stp->sd_lock); in kstrputmsg()
8279 "kstrputmsg out:stp %p out %d error %d", stp, 2, error); in kstrputmsg()
8302 strpoll(struct stdata *stp, short events_arg, int anyyet, short *reventsp, in strpoll() argument
8309 long sd_flags = stp->sd_flag; in strpoll()
8335 queue_t *qp = stp->sd_wrq; in strpoll()
8342 if (polllock(&stp->sd_pollist, QLOCK(tq)) != 0) { in strpoll()
8353 else if ((sqp = stp->sd_struiowrq) != NULL) { in strpoll()
8356 if (polllock(&stp->sd_pollist, in strpoll()
8374 if (polllock(&stp->sd_pollist, in strpoll()
8404 queue_t *qp = _RD(stp->sd_wrq); in strpoll()
8411 if (polllock(&stp->sd_pollist, &stp->sd_lock) != 0) { in strpoll()
8440 if (!(retevents & normevents) && (stp->sd_wakeq & RSLEEP)) { in strpoll()
8456 *phpp = &stp->sd_pollist; in strpoll()
8458 if (polllock(&stp->sd_pollist, &stp->sd_lock) != 0) { in strpoll()
8464 stp->sd_rput_opt |= SR_POLLIN; in strpoll()
8469 mutex_exit(&stp->sd_lock); in strpoll()
8484 putback(struct stdata *stp, queue_t *q, mblk_t *bp, int band) in putback() argument
8487 ASSERT(MUTEX_HELD(&stp->sd_lock)); in putback()
8498 if ((stp->sd_rput_opt & SR_CONSOL_DATA) && in putback()
8557 if (stp->sd_flag & (STRATMARK | STRNOTATMARK)) { in putback()
8561 if (stp->sd_flag & STRATMARK) { in putback()
8564 stp->sd_flag &= ~STRATMARK; in putback()
8568 stp->sd_flag &= ~STRNOTATMARK; in putback()
8590 if (stp->sd_flag & RSLEEP) { in putback()
8591 stp->sd_flag &= ~RSLEEP; in putback()
8594 if (stp->sd_flag & STRPRI) { in putback()
8598 if (!(stp->sd_rput_opt & SR_POLLIN)) in putback()
8600 stp->sd_rput_opt &= ~SR_POLLIN; in putback()
8606 mutex_exit(&stp->sd_lock); in putback()
8607 pollwakeup(&stp->sd_pollist, pollevents); in putback()
8608 mutex_enter(&stp->sd_lock); in putback()
8697 struct stdata *stp; in str_cn_clean() local
8702 stp = vp->v_stream; in str_cn_clean()
8704 mutex_enter(&stp->sd_lock); in str_cn_clean()
8705 ssp = stp->sd_siglist; in str_cn_clean()
8717 stp->sd_siglist = tssp; in str_cn_clean()
8731 stp->sd_sigflags = 0; in str_cn_clean()
8732 for (ssp = stp->sd_siglist; ssp; ssp = ssp->ss_next) in str_cn_clean()
8733 stp->sd_sigflags |= ssp->ss_events; in str_cn_clean()
8735 mutex_exit(&stp->sd_lock); in str_cn_clean()