Lines Matching refs:stp

631 #define	STR_SERVICE(stp, q) {						\  argument
632 ASSERT(MUTEX_HELD(&stp->sd_qlock)); \
633 while (stp->sd_qhead != NULL) { \
634 DQ(q, stp->sd_qhead, stp->sd_qtail, q_link); \
635 ASSERT(stp->sd_nqueues > 0); \
636 stp->sd_nqueues--; \
638 mutex_exit(&stp->sd_qlock); \
640 mutex_enter(&stp->sd_qlock); \
642 ASSERT(stp->sd_nqueues == 0); \
643 ASSERT((stp->sd_qhead == NULL) && (stp->sd_qtail == NULL)); \
653 stdata_t *stp = buf; in stream_head_constructor() local
655 mutex_init(&stp->sd_lock, NULL, MUTEX_DEFAULT, NULL); in stream_head_constructor()
656 mutex_init(&stp->sd_reflock, NULL, MUTEX_DEFAULT, NULL); in stream_head_constructor()
657 mutex_init(&stp->sd_qlock, NULL, MUTEX_DEFAULT, NULL); in stream_head_constructor()
658 cv_init(&stp->sd_monitor, NULL, CV_DEFAULT, NULL); in stream_head_constructor()
659 cv_init(&stp->sd_iocmonitor, NULL, CV_DEFAULT, NULL); in stream_head_constructor()
660 cv_init(&stp->sd_refmonitor, NULL, CV_DEFAULT, NULL); in stream_head_constructor()
661 cv_init(&stp->sd_qcv, NULL, CV_DEFAULT, NULL); in stream_head_constructor()
662 cv_init(&stp->sd_zcopy_wait, NULL, CV_DEFAULT, NULL); in stream_head_constructor()
663 stp->sd_wrq = NULL; in stream_head_constructor()
672 stdata_t *stp = buf; in stream_head_destructor() local
674 mutex_destroy(&stp->sd_lock); in stream_head_destructor()
675 mutex_destroy(&stp->sd_reflock); in stream_head_destructor()
676 mutex_destroy(&stp->sd_qlock); in stream_head_destructor()
677 cv_destroy(&stp->sd_monitor); in stream_head_destructor()
678 cv_destroy(&stp->sd_iocmonitor); in stream_head_destructor()
679 cv_destroy(&stp->sd_refmonitor); in stream_head_destructor()
680 cv_destroy(&stp->sd_qcv); in stream_head_destructor()
681 cv_destroy(&stp->sd_zcopy_wait); in stream_head_destructor()
937 struct stdata *stp; in str_sendsig() local
940 stp = vp->v_stream; in str_sendsig()
942 mutex_enter(&stp->sd_lock); in str_sendsig()
943 if (stp->sd_sigflags & event) in str_sendsig()
944 strsendsig(stp->sd_siglist, event, band, error); in str_sendsig()
945 mutex_exit(&stp->sd_lock); in str_sendsig()
1629 findlinks(stdata_t *stp, int index, int type, str_stack_t *ss) in findlinks() argument
1638 qup = getendq(stp->sd_wrq); in findlinks()
1648 mnp = &ss->ss_mux_nodes[getmajor(stp->sd_vnode->v_rdev)]; in findlinks()
1733 struct stdata *stp; in mlink_file() local
1749 stp = vp->v_stream; in mlink_file()
1751 TR_I_LINK, "I_LINK/I_PLINK:stp %p", stp); in mlink_file()
1755 if (stp->sd_flag & STRHUP) { in mlink_file()
1761 if (stp->sd_strtab == NULL) { in mlink_file()
1764 if (!stp->sd_strtab->st_muxwinit) { in mlink_file()
1775 if (getmajor(stp->sd_vnode->v_rdev) >= ss->ss_devcnt) { in mlink_file()
1780 if (stp->sd_flag & STPLEX) { in mlink_file()
1795 (stpdown == stp) || (stpdown->sd_flag & in mlink_file()
1799 linkcycle(stp, stpdown, ss)) { in mlink_file()
1806 rq = getendq(stp->sd_wrq); in mlink_file()
1882 str = stp->sd_strtab; in mlink_file()
1902 error = strdoioctl(stp, &strioc, FNATIVE, in mlink_file()
1918 error = ldi_mlink_fp(stp, fpdown, lhlink, LINKNORMAL); in mlink_file()
1920 error = ldi_mlink_fp(stp, fpdown, lhlink, LINKPERSIST); in mlink_file()
1932 mux_addedge(stp, stpdown, linkp->li_lblk.l_index, ss); in mlink_file()
1939 mutex_enter(&stp->sd_lock); in mlink_file()
1940 stp->sd_flag |= STRHASLINKS; in mlink_file()
1941 mutex_exit(&stp->sd_lock); in mlink_file()
2023 munlink(stdata_t *stp, linkinfo_t *linkp, int flag, cred_t *crp, int *rvalp, in munlink() argument
2059 error = strdoioctl(stp, &strioc, FNATIVE, in munlink()
2082 mux_rmvedge(stp, linkp->li_lblk.l_index, ss); in munlink()
2245 VERIFY0(ldi_munlink_fp(stp, fpdown, LINKNORMAL)); in munlink()
2247 VERIFY0(ldi_munlink_fp(stp, fpdown, LINKPERSIST)); in munlink()
2270 munlinkall(stdata_t *stp, int flag, cred_t *crp, int *rvalp, str_stack_t *ss) in munlinkall() argument
2276 while (linkp = findlinks(stp, 0, flag, ss)) { in munlinkall()
2280 if (error = munlink(stp, linkp, flag, crp, rvalp, ss)) in munlinkall()
2365 devflg_to_qflag(struct streamtab *stp, uint32_t devflag, uint32_t *qflagp, in devflg_to_qflag() argument
2499 stp->st_rdinit->qi_minfo->mi_idname); in devflg_to_qflag()
2763 stdata_t *stp, in strmakemsg() argument
2782 error = strmakedata(iosize, uiop, stp, flag, &mpdata); in strmakemsg()
2876 stdata_t *stp, in strmakedata() argument
2882 int wroff = (int)stp->sd_wroff; in strmakedata()
2883 int tail_len = (int)stp->sd_tail; in strmakedata()
2898 maxblk = stp->sd_maxblk; in strmakedata()
2945 if (stp->sd_copyflag & STRCOPYCACHED) in strmakedata()
2959 if (stp->sd_wputdatafunc != NULL) { in strmakedata()
2962 newbp = (stp->sd_wputdatafunc)(stp->sd_vnode, in strmakedata()
3024 strwaitq(stdata_t *stp, int flag, ssize_t count, int fmode, clock_t timout, in strwaitq() argument
3034 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strwaitq()
3037 sleepon = &_RD(stp->sd_wrq)->q_wait; in strwaitq()
3041 sleepon = &stp->sd_wrq->q_wait; in strwaitq()
3047 if (stp->sd_wakeq & slpflg) { in strwaitq()
3051 stp->sd_wakeq &= ~slpflg; in strwaitq()
3056 if (stp->sd_flag & errs) { in strwaitq()
3062 error = strgeterr(stp, errs, (flag & STR_PEEK)); in strwaitq()
3074 if ((flag & READWAIT) && (stp->sd_flag & SNDMREAD)) { in strwaitq()
3075 mutex_exit(&stp->sd_lock); in strwaitq()
3078 mutex_enter(&stp->sd_lock); in strwaitq()
3090 stream_willservice(stp); in strwaitq()
3091 putnext(stp->sd_wrq, mp); in strwaitq()
3092 stream_runservice(stp); in strwaitq()
3093 mutex_enter(&stp->sd_lock); in strwaitq()
3099 if (_RD(stp->sd_wrq)->q_first != NULL) { in strwaitq()
3114 stp->sd_flag |= slpflg; in strwaitq()
3117 stp, flag, count, fmode, done); in strwaitq()
3119 rval = str_cv_wait(sleepon, &stp->sd_lock, timout, flag & STR_NOSIG); in strwaitq()
3124 stp, flag, count, fmode, done); in strwaitq()
3128 stp, flag, count, fmode, done); in strwaitq()
3129 stp->sd_flag &= ~slpflg; in strwaitq()
3141 stp, flag, count, fmode, done); in strwaitq()
3154 if ((stp->sd_flag & errs) && !(flag & STR_DELAYERR)) { in strwaitq()
3155 error = strgeterr(stp, errs, (flag & STR_PEEK)); in strwaitq()
3174 straccess(struct stdata *stp, enum jcaccess mode) in straccess() argument
3181 ASSERT(mutex_owned(&stp->sd_lock)); in straccess()
3183 if (stp->sd_sidp == NULL || stp->sd_vnode->v_type == VFIFO) in straccess()
3198 if (sp->s_dev != stp->sd_vnode->v_rdev || in straccess()
3199 p->p_pgidp == stp->sd_pgidp) { in straccess()
3232 mutex_exit(&stp->sd_lock); in straccess()
3234 mutex_enter(&stp->sd_lock); in straccess()
3237 if ((mode == JCWRITE && !(stp->sd_flag & STRTOSTOP)) || in straccess()
3247 mutex_exit(&stp->sd_lock); in straccess()
3249 mutex_enter(&stp->sd_lock); in straccess()
3264 mutex_exit(&stp->sd_lock); in straccess()
3267 mutex_enter(&stp->sd_lock); in straccess()
3271 mutex_enter(&stp->sd_lock); in straccess()
3302 stdata_t *stp; in shalloc() local
3304 stp = kmem_cache_alloc(stream_head_cache, KM_SLEEP); in shalloc()
3306 stp->sd_wrq = _WR(qp); in shalloc()
3307 stp->sd_strtab = NULL; in shalloc()
3308 stp->sd_iocid = 0; in shalloc()
3309 stp->sd_mate = NULL; in shalloc()
3310 stp->sd_freezer = NULL; in shalloc()
3311 stp->sd_refcnt = 0; in shalloc()
3312 stp->sd_wakeq = 0; in shalloc()
3313 stp->sd_anchor = 0; in shalloc()
3314 stp->sd_struiowrq = NULL; in shalloc()
3315 stp->sd_struiordq = NULL; in shalloc()
3316 stp->sd_struiodnak = 0; in shalloc()
3317 stp->sd_struionak = NULL; in shalloc()
3318 stp->sd_t_audit_data = NULL; in shalloc()
3319 stp->sd_rput_opt = 0; in shalloc()
3320 stp->sd_wput_opt = 0; in shalloc()
3321 stp->sd_read_opt = 0; in shalloc()
3322 stp->sd_rprotofunc = strrput_proto; in shalloc()
3323 stp->sd_rmiscfunc = strrput_misc; in shalloc()
3324 stp->sd_rderrfunc = stp->sd_wrerrfunc = NULL; in shalloc()
3325 stp->sd_rputdatafunc = stp->sd_wputdatafunc = NULL; in shalloc()
3326 stp->sd_ciputctrl = NULL; in shalloc()
3327 stp->sd_nciputctrl = 0; in shalloc()
3328 stp->sd_qhead = NULL; in shalloc()
3329 stp->sd_qtail = NULL; in shalloc()
3330 stp->sd_servid = NULL; in shalloc()
3331 stp->sd_nqueues = 0; in shalloc()
3332 stp->sd_svcflags = 0; in shalloc()
3333 stp->sd_copyflag = 0; in shalloc()
3335 return (stp); in shalloc()
3342 shfree(stdata_t *stp) in shfree() argument
3344 ASSERT(MUTEX_NOT_HELD(&stp->sd_lock)); in shfree()
3346 stp->sd_wrq = NULL; in shfree()
3348 mutex_enter(&stp->sd_qlock); in shfree()
3349 while (stp->sd_svcflags & STRS_SCHEDULED) { in shfree()
3351 cv_wait(&stp->sd_qcv, &stp->sd_qlock); in shfree()
3353 mutex_exit(&stp->sd_qlock); in shfree()
3355 if (stp->sd_ciputctrl != NULL) { in shfree()
3356 ASSERT(stp->sd_nciputctrl == n_ciputctrl - 1); in shfree()
3357 SUMCHECK_CIPUTCTRL_COUNTS(stp->sd_ciputctrl, in shfree()
3358 stp->sd_nciputctrl, 0); in shfree()
3360 kmem_cache_free(ciputctrl_cache, stp->sd_ciputctrl); in shfree()
3361 stp->sd_ciputctrl = NULL; in shfree()
3362 stp->sd_nciputctrl = 0; in shfree()
3364 ASSERT(stp->sd_qhead == NULL); in shfree()
3365 ASSERT(stp->sd_qtail == NULL); in shfree()
3366 ASSERT(stp->sd_nqueues == 0); in shfree()
3367 kmem_cache_free(stream_head_cache, stp); in shfree()
4184 strsignal_nolock(stdata_t *stp, int sig, uchar_t band) in strsignal_nolock() argument
4186 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strsignal_nolock()
4189 if (stp->sd_sigflags & S_MSG) in strsignal_nolock()
4190 strsendsig(stp->sd_siglist, S_MSG, band, 0); in strsignal_nolock()
4193 if (stp->sd_pgidp) in strsignal_nolock()
4194 pgsignal(stp->sd_pgidp, sig); in strsignal_nolock()
4200 strsignal(stdata_t *stp, int sig, int32_t band) in strsignal() argument
4203 "strsignal:%p, %X, %X", stp, sig, band); in strsignal()
4205 mutex_enter(&stp->sd_lock); in strsignal()
4208 if (stp->sd_sigflags & S_MSG) in strsignal()
4209 strsendsig(stp->sd_siglist, S_MSG, (uchar_t)band, 0); in strsignal()
4213 if (stp->sd_pgidp) { in strsignal()
4214 pgsignal(stp->sd_pgidp, sig); in strsignal()
4218 mutex_exit(&stp->sd_lock); in strsignal()
4222 strhup(stdata_t *stp) in strhup() argument
4224 ASSERT(mutex_owned(&stp->sd_lock)); in strhup()
4225 pollwakeup(&stp->sd_pollist, POLLHUP); in strhup()
4226 if (stp->sd_sigflags & S_HANGUP) in strhup()
4227 strsendsig(stp->sd_siglist, S_HANGUP, 0, 0); in strhup()
4299 strgeterr(stdata_t *stp, int32_t flags_to_check, int ispeek) in strgeterr() argument
4301 int32_t sd_flag = stp->sd_flag & flags_to_check; in strgeterr()
4304 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strgeterr()
4309 error = stp->sd_rerror; in strgeterr()
4310 if ((stp->sd_flag & STRDERRNONPERSIST) && !ispeek) { in strgeterr()
4315 stp->sd_rerror = 0; in strgeterr()
4316 stp->sd_flag &= ~STRDERR; in strgeterr()
4318 if (error == 0 && stp->sd_rderrfunc != NULL) { in strgeterr()
4321 error = (*stp->sd_rderrfunc)(stp->sd_vnode, ispeek, in strgeterr()
4324 stp->sd_flag &= ~STRDERR; in strgeterr()
4325 stp->sd_rderrfunc = NULL; in strgeterr()
4329 error = stp->sd_werror; in strgeterr()
4330 if ((stp->sd_flag & STWRERRNONPERSIST) && !ispeek) { in strgeterr()
4335 stp->sd_werror = 0; in strgeterr()
4336 stp->sd_flag &= ~STWRERR; in strgeterr()
4338 if (error == 0 && stp->sd_wrerrfunc != NULL) { in strgeterr()
4341 error = (*stp->sd_wrerrfunc)(stp->sd_vnode, ispeek, in strgeterr()
4344 stp->sd_flag &= ~STWRERR; in strgeterr()
4345 stp->sd_wrerrfunc = NULL; in strgeterr()
4350 error = stp->sd_werror; in strgeterr()
4361 strstartplumb(stdata_t *stp, int flag, int cmd) in strstartplumb() argument
4366 if (STRMATED(stp)) { in strstartplumb()
4367 struct stdata *stmatep = stp->sd_mate; in strstartplumb()
4369 STRLOCKMATES(stp); in strstartplumb()
4375 STRUNLOCKMATES(stp); in strstartplumb()
4379 mutex_exit(&stp->sd_lock); in strstartplumb()
4386 STRLOCKMATES(stp); in strstartplumb()
4388 while (stp->sd_flag & (STWOPEN|STRCLOSE|STRPLUMB)) { in strstartplumb()
4391 STRUNLOCKMATES(stp); in strstartplumb()
4396 if (!cv_wait_sig(&stp->sd_monitor, in strstartplumb()
4397 &stp->sd_lock)) { in strstartplumb()
4398 mutex_exit(&stp->sd_lock); in strstartplumb()
4401 mutex_exit(&stp->sd_lock); in strstartplumb()
4402 STRLOCKMATES(stp); in strstartplumb()
4404 if (stp->sd_flag & (STRDERR|STWRERR|STRHUP|STPLEX)) { in strstartplumb()
4405 error = strgeterr(stp, in strstartplumb()
4408 STRUNLOCKMATES(stp); in strstartplumb()
4413 stp->sd_flag |= STRPLUMB; in strstartplumb()
4414 STRUNLOCKMATES(stp); in strstartplumb()
4416 mutex_enter(&stp->sd_lock); in strstartplumb()
4417 while (stp->sd_flag & (STWOPEN|STRCLOSE|STRPLUMB)) { in strstartplumb()
4420 mutex_exit(&stp->sd_lock); in strstartplumb()
4423 if (!cv_wait_sig(&stp->sd_monitor, &stp->sd_lock)) { in strstartplumb()
4424 mutex_exit(&stp->sd_lock); in strstartplumb()
4427 if (stp->sd_flag & (STRDERR|STWRERR|STRHUP|STPLEX)) { in strstartplumb()
4428 error = strgeterr(stp, in strstartplumb()
4431 mutex_exit(&stp->sd_lock); in strstartplumb()
4436 stp->sd_flag |= STRPLUMB; in strstartplumb()
4437 mutex_exit(&stp->sd_lock); in strstartplumb()
4446 strendplumb(stdata_t *stp) in strendplumb() argument
4448 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strendplumb()
4449 ASSERT(stp->sd_flag & STRPLUMB); in strendplumb()
4450 stp->sd_flag &= ~STRPLUMB; in strendplumb()
4451 cv_broadcast(&stp->sd_monitor); in strendplumb()
4584 strlock(struct stdata *stp, sqlist_t *sqlist) in strlock() argument
4591 if (STRMATED(stp)) { in strlock()
4594 STRLOCKMATES(stp); in strlock()
4604 if (&(stp->sd_lock) > &((stp->sd_mate)->sd_lock)) { in strlock()
4605 stp1 = stp; in strlock()
4606 stp2 = stp->sd_mate; in strlock()
4608 stp2 = stp; in strlock()
4609 stp1 = stp->sd_mate; in strlock()
4613 STRUNLOCKMATES(stp); in strlock()
4620 STRUNLOCKMATES(stp); in strlock()
4629 mutex_enter(&stp->sd_lock); in strlock()
4630 mutex_enter(&stp->sd_reflock); in strlock()
4631 while (stp->sd_refcnt > 0) { in strlock()
4632 mutex_exit(&stp->sd_lock); in strlock()
4633 cv_wait(&stp->sd_refmonitor, &stp->sd_reflock); in strlock()
4634 if (mutex_tryenter(&stp->sd_lock) == 0) { in strlock()
4635 mutex_exit(&stp->sd_reflock); in strlock()
4636 mutex_enter(&stp->sd_lock); in strlock()
4637 mutex_enter(&stp->sd_reflock); in strlock()
4640 STREAM_PUTLOCKS_ENTER(stp); in strlock()
4659 if (STRMATED(stp)) { in strlock()
4660 STREAM_PUTLOCKS_EXIT(stp); in strlock()
4661 STREAM_PUTLOCKS_EXIT(stp->sd_mate); in strlock()
4662 STRUNLOCKMATES(stp); in strlock()
4663 mutex_exit(&stp->sd_reflock); in strlock()
4664 mutex_exit(&stp->sd_mate->sd_reflock); in strlock()
4666 STREAM_PUTLOCKS_EXIT(stp); in strlock()
4667 mutex_exit(&stp->sd_lock); in strlock()
4668 mutex_exit(&stp->sd_reflock); in strlock()
4707 strunlock(struct stdata *stp, sqlist_t *sqlist) in strunlock() argument
4711 if (STRMATED(stp)) { in strunlock()
4712 STREAM_PUTLOCKS_EXIT(stp); in strunlock()
4713 STREAM_PUTLOCKS_EXIT(stp->sd_mate); in strunlock()
4714 STRUNLOCKMATES(stp); in strunlock()
4715 mutex_exit(&stp->sd_reflock); in strunlock()
4716 mutex_exit(&stp->sd_mate->sd_reflock); in strunlock()
4718 STREAM_PUTLOCKS_EXIT(stp); in strunlock()
4719 mutex_exit(&stp->sd_lock); in strunlock()
4720 mutex_exit(&stp->sd_reflock); in strunlock()
4771 insertq(struct stdata *stp, queue_t *new) in insertq() argument
4779 ASSERT(stp->sd_vnode->v_type != VFIFO); in insertq()
4783 after = _RD(stp->sd_wrq); in insertq()
4784 wafter = stp->sd_wrq; in insertq()
4792 strlock(stp, NULL); in insertq()
4826 strsetuio(stp); in insertq()
4832 stp->sd_pushcnt++; in insertq()
4834 strunlock(stp, NULL); in insertq()
4880 struct stdata *stp = STREAM(qp); in removeq() local
4887 ASSERT(stp); in removeq()
4940 sqlist = sqlist_build(qp, stp, STRMATED(stp)); in removeq()
4941 strlock(stp, sqlist); in removeq()
4949 stp->sd_wrq->q_next = _RD(stp->sd_wrq); in removeq()
4961 ASSERT(_SAMESTR(stp->sd_wrq) == O_SAMESTR(stp->sd_wrq)); in removeq()
4962 ASSERT(_SAMESTR(_RD(stp->sd_wrq)) == O_SAMESTR(_RD(stp->sd_wrq))); in removeq()
4978 strsetuio(stp); in removeq()
4984 stp->sd_pushcnt--; in removeq()
4986 strunlock(stp, sqlist); in removeq()
5229 sqlist_build(queue_t *q, struct stdata *stp, boolean_t do_twist) in sqlist_build() argument
5231 sqlist_t *sqlist = sqlist_alloc(stp, KM_SLEEP); in sqlist_build()
5241 sqlist_insertall(sqlist, stp->sd_wrq); in sqlist_build()
5243 sqlist_insertall(sqlist, stp->sd_mate->sd_wrq); in sqlist_build()
5249 sqlist_alloc(struct stdata *stp, int kmflag) in sqlist_alloc() argument
5259 sqlist_size = 2 * sizeof (syncql_t) * stp->sd_pushcnt + in sqlist_alloc()
5261 if (STRMATED(stp)) in sqlist_alloc()
5262 sqlist_size += 2 * sizeof (syncql_t) * stp->sd_mate->sd_pushcnt; in sqlist_alloc()
5288 struct stdata *stp; in strblock() local
5294 stp = STREAM(q); in strblock()
5295 ASSERT(stp != NULL); in strblock()
5301 sqlist = sqlist_build(q, stp, B_FALSE); in strblock()
5313 struct stdata *stp; in strunblock() local
5328 stp = STREAM(q); in strunblock()
5329 ASSERT(stp != NULL); in strunblock()
5330 sqlist = sqlist_build(q, stp, B_FALSE); in strunblock()
5644 struct stdata *stp = STREAM(qp); in claimstr() local
5646 mutex_enter(&stp->sd_reflock); in claimstr()
5647 stp->sd_refcnt++; in claimstr()
5648 ASSERT(stp->sd_refcnt != 0); /* Wraparound */ in claimstr()
5649 mutex_exit(&stp->sd_reflock); in claimstr()
5658 struct stdata *stp = STREAM(qp); in releasestr() local
5660 mutex_enter(&stp->sd_reflock); in releasestr()
5661 ASSERT(stp->sd_refcnt != 0); in releasestr()
5662 if (--stp->sd_refcnt == 0) in releasestr()
5663 cv_broadcast(&stp->sd_refmonitor); in releasestr()
5664 mutex_exit(&stp->sd_reflock); in releasestr()
7777 strsetuio(stdata_t *stp) in strsetuio() argument
7781 if (stp->sd_flag & STPLEX) { in strsetuio()
7785 stp->sd_struiowrq = NULL; in strsetuio()
7786 stp->sd_struiordq = NULL; in strsetuio()
7793 wrq = stp->sd_wrq->q_next; in strsetuio()
7807 stp->sd_struiowrq = wrq; in strsetuio()
7812 wrq = stp->sd_wrq->q_next; in strsetuio()
7826 stp->sd_struiordq = wrq ? _RD(wrq) : 0; in strsetuio()
7981 struct stdata *stp = vp->v_stream; in strwaitmark() local
7982 queue_t *rq = _RD(stp->sd_wrq); in strwaitmark()
7985 mutex_enter(&stp->sd_lock); in strwaitmark()
7987 !(stp->sd_flag & (STRATMARK|STRNOTATMARK|STREOF))) { in strwaitmark()
7988 stp->sd_flag |= RSLEEP; in strwaitmark()
7991 if (str_cv_wait(&rq->q_wait, &stp->sd_lock, 100, 1) == -1) { in strwaitmark()
7992 mutex_exit(&stp->sd_lock); in strwaitmark()
7996 if (stp->sd_flag & STRATMARK) in strwaitmark()
8003 mutex_exit(&stp->sd_lock); in strwaitmark()
8015 struct stdata *stp = vp->v_stream; in strsetrerror() local
8017 mutex_enter(&stp->sd_lock); in strsetrerror()
8018 stp->sd_rerror = error; in strsetrerror()
8020 stp->sd_flag &= ~STRDERR; in strsetrerror()
8022 stp->sd_flag |= STRDERR; in strsetrerror()
8024 stp->sd_flag &= ~STRDERRNONPERSIST; in strsetrerror()
8026 stp->sd_flag |= STRDERRNONPERSIST; in strsetrerror()
8028 stp->sd_rderrfunc = errfunc; in strsetrerror()
8030 cv_broadcast(&_RD(stp->sd_wrq)->q_wait); /* readers */ in strsetrerror()
8031 cv_broadcast(&stp->sd_wrq->q_wait); /* writers */ in strsetrerror()
8032 cv_broadcast(&stp->sd_monitor); /* ioctllers */ in strsetrerror()
8034 mutex_exit(&stp->sd_lock); in strsetrerror()
8035 pollwakeup(&stp->sd_pollist, POLLERR); in strsetrerror()
8036 mutex_enter(&stp->sd_lock); in strsetrerror()
8038 if (stp->sd_sigflags & S_ERROR) in strsetrerror()
8039 strsendsig(stp->sd_siglist, S_ERROR, 0, error); in strsetrerror()
8041 mutex_exit(&stp->sd_lock); in strsetrerror()
8051 struct stdata *stp = vp->v_stream; in strsetwerror() local
8053 mutex_enter(&stp->sd_lock); in strsetwerror()
8054 stp->sd_werror = error; in strsetwerror()
8056 stp->sd_flag &= ~STWRERR; in strsetwerror()
8058 stp->sd_flag |= STWRERR; in strsetwerror()
8060 stp->sd_flag &= ~STWRERRNONPERSIST; in strsetwerror()
8062 stp->sd_flag |= STWRERRNONPERSIST; in strsetwerror()
8064 stp->sd_wrerrfunc = errfunc; in strsetwerror()
8066 cv_broadcast(&_RD(stp->sd_wrq)->q_wait); /* readers */ in strsetwerror()
8067 cv_broadcast(&stp->sd_wrq->q_wait); /* writers */ in strsetwerror()
8068 cv_broadcast(&stp->sd_monitor); /* ioctllers */ in strsetwerror()
8070 mutex_exit(&stp->sd_lock); in strsetwerror()
8071 pollwakeup(&stp->sd_pollist, POLLERR); in strsetwerror()
8072 mutex_enter(&stp->sd_lock); in strsetwerror()
8074 if (stp->sd_sigflags & S_ERROR) in strsetwerror()
8075 strsendsig(stp->sd_siglist, S_ERROR, 0, error); in strsetwerror()
8077 mutex_exit(&stp->sd_lock); in strsetwerror()
8087 struct stdata *stp = vp->v_stream; in strseteof() local
8089 mutex_enter(&stp->sd_lock); in strseteof()
8091 stp->sd_flag &= ~STREOF; in strseteof()
8092 mutex_exit(&stp->sd_lock); in strseteof()
8095 stp->sd_flag |= STREOF; in strseteof()
8096 if (stp->sd_flag & RSLEEP) { in strseteof()
8097 stp->sd_flag &= ~RSLEEP; in strseteof()
8098 cv_broadcast(&_RD(stp->sd_wrq)->q_wait); in strseteof()
8101 mutex_exit(&stp->sd_lock); in strseteof()
8102 pollwakeup(&stp->sd_pollist, POLLIN|POLLRDNORM); in strseteof()
8103 mutex_enter(&stp->sd_lock); in strseteof()
8105 if (stp->sd_sigflags & (S_INPUT|S_RDNORM)) in strseteof()
8106 strsendsig(stp->sd_siglist, S_INPUT|S_RDNORM, 0, 0); in strseteof()
8107 mutex_exit(&stp->sd_lock); in strseteof()
8113 struct stdata *stp = vp->v_stream; in strflushrq() local
8115 mutex_enter(&stp->sd_lock); in strflushrq()
8116 flushq(_RD(stp->sd_wrq), flag); in strflushrq()
8117 mutex_exit(&stp->sd_lock); in strflushrq()
8124 struct stdata *stp = vp->v_stream; in strsetrputhooks() local
8126 mutex_enter(&stp->sd_lock); in strsetrputhooks()
8129 stp->sd_rprotofunc = strrput_proto; in strsetrputhooks()
8131 stp->sd_rprotofunc = protofunc; in strsetrputhooks()
8134 stp->sd_rmiscfunc = strrput_misc; in strsetrputhooks()
8136 stp->sd_rmiscfunc = miscfunc; in strsetrputhooks()
8139 stp->sd_rput_opt |= SR_CONSOL_DATA; in strsetrputhooks()
8141 stp->sd_rput_opt &= ~SR_CONSOL_DATA; in strsetrputhooks()
8144 stp->sd_rput_opt |= SR_SIGALLDATA; in strsetrputhooks()
8146 stp->sd_rput_opt &= ~SR_SIGALLDATA; in strsetrputhooks()
8149 stp->sd_rput_opt |= SR_IGN_ZEROLEN; in strsetrputhooks()
8151 stp->sd_rput_opt &= ~SR_IGN_ZEROLEN; in strsetrputhooks()
8153 mutex_exit(&stp->sd_lock); in strsetrputhooks()
8159 struct stdata *stp = vp->v_stream; in strsetwputhooks() local
8161 mutex_enter(&stp->sd_lock); in strsetwputhooks()
8162 stp->sd_closetime = closetime; in strsetwputhooks()
8165 stp->sd_wput_opt |= SW_SIGPIPE; in strsetwputhooks()
8167 stp->sd_wput_opt &= ~SW_SIGPIPE; in strsetwputhooks()
8169 stp->sd_wput_opt |= SW_RECHECK_ERR; in strsetwputhooks()
8171 stp->sd_wput_opt &= ~SW_RECHECK_ERR; in strsetwputhooks()
8173 mutex_exit(&stp->sd_lock); in strsetwputhooks()
8179 struct stdata *stp = vp->v_stream; in strsetrwputdatahooks() local
8181 mutex_enter(&stp->sd_lock); in strsetrwputdatahooks()
8183 stp->sd_rputdatafunc = rdatafunc; in strsetrwputdatahooks()
8184 stp->sd_wputdatafunc = wdatafunc; in strsetrwputdatahooks()
8186 mutex_exit(&stp->sd_lock); in strsetrwputdatahooks()
8193 stdata_t *stp = STREAM(q); in qenable_locked() local
8225 mutex_enter(&stp->sd_qlock); in qenable_locked()
8230 IMPLY(STREAM_NEEDSERVICE(stp), in qenable_locked()
8231 (stp->sd_svcflags & (STRS_WILLSERVICE | STRS_SCHEDULED))); in qenable_locked()
8233 ENQUEUE(q, stp->sd_qhead, stp->sd_qtail, q_link); in qenable_locked()
8234 stp->sd_nqueues++; in qenable_locked()
8240 if (!(stp->sd_svcflags & (STRS_WILLSERVICE | STRS_SCHEDULED))) { in qenable_locked()
8246 stp->sd_svcflags |= STRS_SCHEDULED; in qenable_locked()
8247 stp->sd_servid = (void *)taskq_dispatch(streams_taskq, in qenable_locked()
8248 (task_func_t *)stream_service, stp, TQ_NOSLEEP|TQ_NOQUEUE); in qenable_locked()
8250 if (stp->sd_servid == NULL) { in qenable_locked()
8260 stp->sd_svcflags &= ~STRS_SCHEDULED; in qenable_locked()
8267 ASSERT((stp->sd_qhead == q) && (stp->sd_qtail == q)); in qenable_locked()
8280 stp->sd_qhead = stp->sd_qtail = NULL; in qenable_locked()
8281 stp->sd_nqueues = 0; in qenable_locked()
8289 mutex_exit(&stp->sd_qlock); in qenable_locked()
8380 stream_service(stdata_t *stp) in stream_service() argument
8384 mutex_enter(&stp->sd_qlock); in stream_service()
8386 STR_SERVICE(stp, q); in stream_service()
8388 stp->sd_svcflags &= ~STRS_SCHEDULED; in stream_service()
8389 stp->sd_servid = NULL; in stream_service()
8390 cv_signal(&stp->sd_qcv); in stream_service()
8391 mutex_exit(&stp->sd_qlock); in stream_service()
8398 stream_runservice(stdata_t *stp) in stream_runservice() argument
8402 mutex_enter(&stp->sd_qlock); in stream_runservice()
8408 stp->sd_svcflags |= STRS_WILLSERVICE; in stream_runservice()
8410 STR_SERVICE(stp, q); in stream_runservice()
8412 stp->sd_svcflags &= ~STRS_WILLSERVICE; in stream_runservice()
8413 mutex_exit(&stp->sd_qlock); in stream_runservice()
8428 stream_willservice(stdata_t *stp) in stream_willservice() argument
8430 mutex_enter(&stp->sd_qlock); in stream_willservice()
8431 stp->sd_svcflags |= STRS_WILLSERVICE; in stream_willservice()
8432 mutex_exit(&stp->sd_qlock); in stream_willservice()