Lines Matching refs:stp
630 #define STR_SERVICE(stp, q) { \ argument
631 ASSERT(MUTEX_HELD(&stp->sd_qlock)); \
632 while (stp->sd_qhead != NULL) { \
633 DQ(q, stp->sd_qhead, stp->sd_qtail, q_link); \
634 ASSERT(stp->sd_nqueues > 0); \
635 stp->sd_nqueues--; \
637 mutex_exit(&stp->sd_qlock); \
639 mutex_enter(&stp->sd_qlock); \
641 ASSERT(stp->sd_nqueues == 0); \
642 ASSERT((stp->sd_qhead == NULL) && (stp->sd_qtail == NULL)); \
652 stdata_t *stp = buf; in stream_head_constructor() local
654 mutex_init(&stp->sd_lock, NULL, MUTEX_DEFAULT, NULL); in stream_head_constructor()
655 mutex_init(&stp->sd_reflock, NULL, MUTEX_DEFAULT, NULL); in stream_head_constructor()
656 mutex_init(&stp->sd_qlock, NULL, MUTEX_DEFAULT, NULL); in stream_head_constructor()
657 cv_init(&stp->sd_monitor, NULL, CV_DEFAULT, NULL); in stream_head_constructor()
658 cv_init(&stp->sd_iocmonitor, NULL, CV_DEFAULT, NULL); in stream_head_constructor()
659 cv_init(&stp->sd_refmonitor, NULL, CV_DEFAULT, NULL); in stream_head_constructor()
660 cv_init(&stp->sd_qcv, NULL, CV_DEFAULT, NULL); in stream_head_constructor()
661 cv_init(&stp->sd_zcopy_wait, NULL, CV_DEFAULT, NULL); in stream_head_constructor()
662 stp->sd_wrq = NULL; in stream_head_constructor()
671 stdata_t *stp = buf; in stream_head_destructor() local
673 mutex_destroy(&stp->sd_lock); in stream_head_destructor()
674 mutex_destroy(&stp->sd_reflock); in stream_head_destructor()
675 mutex_destroy(&stp->sd_qlock); in stream_head_destructor()
676 cv_destroy(&stp->sd_monitor); in stream_head_destructor()
677 cv_destroy(&stp->sd_iocmonitor); in stream_head_destructor()
678 cv_destroy(&stp->sd_refmonitor); in stream_head_destructor()
679 cv_destroy(&stp->sd_qcv); in stream_head_destructor()
680 cv_destroy(&stp->sd_zcopy_wait); in stream_head_destructor()
936 struct stdata *stp; in str_sendsig() local
939 stp = vp->v_stream; in str_sendsig()
941 mutex_enter(&stp->sd_lock); in str_sendsig()
942 if (stp->sd_sigflags & event) in str_sendsig()
943 strsendsig(stp->sd_siglist, event, band, error); in str_sendsig()
944 mutex_exit(&stp->sd_lock); in str_sendsig()
1628 findlinks(stdata_t *stp, int index, int type, str_stack_t *ss) in findlinks() argument
1637 qup = getendq(stp->sd_wrq); in findlinks()
1647 mnp = &ss->ss_mux_nodes[getmajor(stp->sd_vnode->v_rdev)]; in findlinks()
1732 struct stdata *stp; in mlink_file() local
1748 stp = vp->v_stream; in mlink_file()
1750 TR_I_LINK, "I_LINK/I_PLINK:stp %p", stp); in mlink_file()
1754 if (stp->sd_flag & STRHUP) { in mlink_file()
1760 if (stp->sd_strtab == NULL) { in mlink_file()
1763 if (!stp->sd_strtab->st_muxwinit) { in mlink_file()
1774 if (getmajor(stp->sd_vnode->v_rdev) >= ss->ss_devcnt) { in mlink_file()
1779 if (stp->sd_flag & STPLEX) { in mlink_file()
1794 (stpdown == stp) || (stpdown->sd_flag & in mlink_file()
1798 linkcycle(stp, stpdown, ss)) { in mlink_file()
1805 rq = getendq(stp->sd_wrq); in mlink_file()
1881 str = stp->sd_strtab; in mlink_file()
1901 error = strdoioctl(stp, &strioc, FNATIVE, in mlink_file()
1917 error = ldi_mlink_fp(stp, fpdown, lhlink, LINKNORMAL); in mlink_file()
1919 error = ldi_mlink_fp(stp, fpdown, lhlink, LINKPERSIST); in mlink_file()
1931 mux_addedge(stp, stpdown, linkp->li_lblk.l_index, ss); in mlink_file()
1938 mutex_enter(&stp->sd_lock); in mlink_file()
1939 stp->sd_flag |= STRHASLINKS; in mlink_file()
1940 mutex_exit(&stp->sd_lock); in mlink_file()
2022 munlink(stdata_t *stp, linkinfo_t *linkp, int flag, cred_t *crp, int *rvalp, in munlink() argument
2058 error = strdoioctl(stp, &strioc, FNATIVE, in munlink()
2081 mux_rmvedge(stp, linkp->li_lblk.l_index, ss); in munlink()
2244 VERIFY0(ldi_munlink_fp(stp, fpdown, LINKNORMAL)); in munlink()
2246 VERIFY0(ldi_munlink_fp(stp, fpdown, LINKPERSIST)); in munlink()
2269 munlinkall(stdata_t *stp, int flag, cred_t *crp, int *rvalp, str_stack_t *ss) in munlinkall() argument
2275 while (linkp = findlinks(stp, 0, flag, ss)) { in munlinkall()
2279 if (error = munlink(stp, linkp, flag, crp, rvalp, ss)) in munlinkall()
2364 devflg_to_qflag(struct streamtab *stp, uint32_t devflag, uint32_t *qflagp, in devflg_to_qflag() argument
2498 stp->st_rdinit->qi_minfo->mi_idname); in devflg_to_qflag()
2762 stdata_t *stp, in strmakemsg() argument
2781 error = strmakedata(iosize, uiop, stp, flag, &mpdata); in strmakemsg()
2875 stdata_t *stp, in strmakedata() argument
2881 int wroff = (int)stp->sd_wroff; in strmakedata()
2882 int tail_len = (int)stp->sd_tail; in strmakedata()
2897 maxblk = stp->sd_maxblk; in strmakedata()
2944 if (stp->sd_copyflag & STRCOPYCACHED) in strmakedata()
2958 if (stp->sd_wputdatafunc != NULL) { in strmakedata()
2961 newbp = (stp->sd_wputdatafunc)(stp->sd_vnode, in strmakedata()
3023 strwaitq(stdata_t *stp, int flag, ssize_t count, int fmode, clock_t timout, in strwaitq() argument
3033 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strwaitq()
3036 sleepon = &_RD(stp->sd_wrq)->q_wait; in strwaitq()
3040 sleepon = &stp->sd_wrq->q_wait; in strwaitq()
3046 if (stp->sd_wakeq & slpflg) { in strwaitq()
3050 stp->sd_wakeq &= ~slpflg; in strwaitq()
3055 if (stp->sd_flag & errs) { in strwaitq()
3061 error = strgeterr(stp, errs, (flag & STR_PEEK)); in strwaitq()
3073 if ((flag & READWAIT) && (stp->sd_flag & SNDMREAD)) { in strwaitq()
3074 mutex_exit(&stp->sd_lock); in strwaitq()
3077 mutex_enter(&stp->sd_lock); in strwaitq()
3089 stream_willservice(stp); in strwaitq()
3090 putnext(stp->sd_wrq, mp); in strwaitq()
3091 stream_runservice(stp); in strwaitq()
3092 mutex_enter(&stp->sd_lock); in strwaitq()
3098 if (_RD(stp->sd_wrq)->q_first != NULL) { in strwaitq()
3113 stp->sd_flag |= slpflg; in strwaitq()
3116 stp, flag, count, fmode, done); in strwaitq()
3118 rval = str_cv_wait(sleepon, &stp->sd_lock, timout, flag & STR_NOSIG); in strwaitq()
3123 stp, flag, count, fmode, done); in strwaitq()
3127 stp, flag, count, fmode, done); in strwaitq()
3128 stp->sd_flag &= ~slpflg; in strwaitq()
3140 stp, flag, count, fmode, done); in strwaitq()
3153 if ((stp->sd_flag & errs) && !(flag & STR_DELAYERR)) { in strwaitq()
3154 error = strgeterr(stp, errs, (flag & STR_PEEK)); in strwaitq()
3173 straccess(struct stdata *stp, enum jcaccess mode) in straccess() argument
3180 ASSERT(mutex_owned(&stp->sd_lock)); in straccess()
3182 if (stp->sd_sidp == NULL || stp->sd_vnode->v_type == VFIFO) in straccess()
3197 if (sp->s_dev != stp->sd_vnode->v_rdev || in straccess()
3198 p->p_pgidp == stp->sd_pgidp) { in straccess()
3231 mutex_exit(&stp->sd_lock); in straccess()
3233 mutex_enter(&stp->sd_lock); in straccess()
3236 if ((mode == JCWRITE && !(stp->sd_flag & STRTOSTOP)) || in straccess()
3246 mutex_exit(&stp->sd_lock); in straccess()
3248 mutex_enter(&stp->sd_lock); in straccess()
3263 mutex_exit(&stp->sd_lock); in straccess()
3266 mutex_enter(&stp->sd_lock); in straccess()
3270 mutex_enter(&stp->sd_lock); in straccess()
3301 stdata_t *stp; in shalloc() local
3303 stp = kmem_cache_alloc(stream_head_cache, KM_SLEEP); in shalloc()
3305 stp->sd_wrq = _WR(qp); in shalloc()
3306 stp->sd_strtab = NULL; in shalloc()
3307 stp->sd_iocid = 0; in shalloc()
3308 stp->sd_mate = NULL; in shalloc()
3309 stp->sd_freezer = NULL; in shalloc()
3310 stp->sd_refcnt = 0; in shalloc()
3311 stp->sd_wakeq = 0; in shalloc()
3312 stp->sd_anchor = 0; in shalloc()
3313 stp->sd_struiowrq = NULL; in shalloc()
3314 stp->sd_struiordq = NULL; in shalloc()
3315 stp->sd_struiodnak = 0; in shalloc()
3316 stp->sd_struionak = NULL; in shalloc()
3317 stp->sd_t_audit_data = NULL; in shalloc()
3318 stp->sd_rput_opt = 0; in shalloc()
3319 stp->sd_wput_opt = 0; in shalloc()
3320 stp->sd_read_opt = 0; in shalloc()
3321 stp->sd_rprotofunc = strrput_proto; in shalloc()
3322 stp->sd_rmiscfunc = strrput_misc; in shalloc()
3323 stp->sd_rderrfunc = stp->sd_wrerrfunc = NULL; in shalloc()
3324 stp->sd_rputdatafunc = stp->sd_wputdatafunc = NULL; in shalloc()
3325 stp->sd_ciputctrl = NULL; in shalloc()
3326 stp->sd_nciputctrl = 0; in shalloc()
3327 stp->sd_qhead = NULL; in shalloc()
3328 stp->sd_qtail = NULL; in shalloc()
3329 stp->sd_servid = NULL; in shalloc()
3330 stp->sd_nqueues = 0; in shalloc()
3331 stp->sd_svcflags = 0; in shalloc()
3332 stp->sd_copyflag = 0; in shalloc()
3334 return (stp); in shalloc()
3341 shfree(stdata_t *stp) in shfree() argument
3343 ASSERT(MUTEX_NOT_HELD(&stp->sd_lock)); in shfree()
3345 stp->sd_wrq = NULL; in shfree()
3347 mutex_enter(&stp->sd_qlock); in shfree()
3348 while (stp->sd_svcflags & STRS_SCHEDULED) { in shfree()
3350 cv_wait(&stp->sd_qcv, &stp->sd_qlock); in shfree()
3352 mutex_exit(&stp->sd_qlock); in shfree()
3354 if (stp->sd_ciputctrl != NULL) { in shfree()
3355 ASSERT(stp->sd_nciputctrl == n_ciputctrl - 1); in shfree()
3356 SUMCHECK_CIPUTCTRL_COUNTS(stp->sd_ciputctrl, in shfree()
3357 stp->sd_nciputctrl, 0); in shfree()
3359 kmem_cache_free(ciputctrl_cache, stp->sd_ciputctrl); in shfree()
3360 stp->sd_ciputctrl = NULL; in shfree()
3361 stp->sd_nciputctrl = 0; in shfree()
3363 ASSERT(stp->sd_qhead == NULL); in shfree()
3364 ASSERT(stp->sd_qtail == NULL); in shfree()
3365 ASSERT(stp->sd_nqueues == 0); in shfree()
3366 kmem_cache_free(stream_head_cache, stp); in shfree()
4183 strsignal_nolock(stdata_t *stp, int sig, uchar_t band) in strsignal_nolock() argument
4185 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strsignal_nolock()
4188 if (stp->sd_sigflags & S_MSG) in strsignal_nolock()
4189 strsendsig(stp->sd_siglist, S_MSG, band, 0); in strsignal_nolock()
4192 if (stp->sd_pgidp) in strsignal_nolock()
4193 pgsignal(stp->sd_pgidp, sig); in strsignal_nolock()
4199 strsignal(stdata_t *stp, int sig, int32_t band) in strsignal() argument
4202 "strsignal:%p, %X, %X", stp, sig, band); in strsignal()
4204 mutex_enter(&stp->sd_lock); in strsignal()
4207 if (stp->sd_sigflags & S_MSG) in strsignal()
4208 strsendsig(stp->sd_siglist, S_MSG, (uchar_t)band, 0); in strsignal()
4212 if (stp->sd_pgidp) { in strsignal()
4213 pgsignal(stp->sd_pgidp, sig); in strsignal()
4217 mutex_exit(&stp->sd_lock); in strsignal()
4221 strhup(stdata_t *stp) in strhup() argument
4223 ASSERT(mutex_owned(&stp->sd_lock)); in strhup()
4224 pollwakeup(&stp->sd_pollist, POLLHUP); in strhup()
4225 if (stp->sd_sigflags & S_HANGUP) in strhup()
4226 strsendsig(stp->sd_siglist, S_HANGUP, 0, 0); in strhup()
4298 strgeterr(stdata_t *stp, int32_t flags_to_check, int ispeek) in strgeterr() argument
4300 int32_t sd_flag = stp->sd_flag & flags_to_check; in strgeterr()
4303 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strgeterr()
4308 error = stp->sd_rerror; in strgeterr()
4309 if ((stp->sd_flag & STRDERRNONPERSIST) && !ispeek) { in strgeterr()
4314 stp->sd_rerror = 0; in strgeterr()
4315 stp->sd_flag &= ~STRDERR; in strgeterr()
4317 if (error == 0 && stp->sd_rderrfunc != NULL) { in strgeterr()
4320 error = (*stp->sd_rderrfunc)(stp->sd_vnode, ispeek, in strgeterr()
4323 stp->sd_flag &= ~STRDERR; in strgeterr()
4324 stp->sd_rderrfunc = NULL; in strgeterr()
4328 error = stp->sd_werror; in strgeterr()
4329 if ((stp->sd_flag & STWRERRNONPERSIST) && !ispeek) { in strgeterr()
4334 stp->sd_werror = 0; in strgeterr()
4335 stp->sd_flag &= ~STWRERR; in strgeterr()
4337 if (error == 0 && stp->sd_wrerrfunc != NULL) { in strgeterr()
4340 error = (*stp->sd_wrerrfunc)(stp->sd_vnode, ispeek, in strgeterr()
4343 stp->sd_flag &= ~STWRERR; in strgeterr()
4344 stp->sd_wrerrfunc = NULL; in strgeterr()
4349 error = stp->sd_werror; in strgeterr()
4360 strstartplumb(stdata_t *stp, int flag, int cmd) in strstartplumb() argument
4365 if (STRMATED(stp)) { in strstartplumb()
4366 struct stdata *stmatep = stp->sd_mate; in strstartplumb()
4368 STRLOCKMATES(stp); in strstartplumb()
4374 STRUNLOCKMATES(stp); in strstartplumb()
4378 mutex_exit(&stp->sd_lock); in strstartplumb()
4385 STRLOCKMATES(stp); in strstartplumb()
4387 while (stp->sd_flag & (STWOPEN|STRCLOSE|STRPLUMB)) { in strstartplumb()
4390 STRUNLOCKMATES(stp); in strstartplumb()
4395 if (!cv_wait_sig(&stp->sd_monitor, in strstartplumb()
4396 &stp->sd_lock)) { in strstartplumb()
4397 mutex_exit(&stp->sd_lock); in strstartplumb()
4400 mutex_exit(&stp->sd_lock); in strstartplumb()
4401 STRLOCKMATES(stp); in strstartplumb()
4403 if (stp->sd_flag & (STRDERR|STWRERR|STRHUP|STPLEX)) { in strstartplumb()
4404 error = strgeterr(stp, in strstartplumb()
4407 STRUNLOCKMATES(stp); in strstartplumb()
4412 stp->sd_flag |= STRPLUMB; in strstartplumb()
4413 STRUNLOCKMATES(stp); in strstartplumb()
4415 mutex_enter(&stp->sd_lock); in strstartplumb()
4416 while (stp->sd_flag & (STWOPEN|STRCLOSE|STRPLUMB)) { in strstartplumb()
4419 mutex_exit(&stp->sd_lock); in strstartplumb()
4422 if (!cv_wait_sig(&stp->sd_monitor, &stp->sd_lock)) { in strstartplumb()
4423 mutex_exit(&stp->sd_lock); in strstartplumb()
4426 if (stp->sd_flag & (STRDERR|STWRERR|STRHUP|STPLEX)) { in strstartplumb()
4427 error = strgeterr(stp, in strstartplumb()
4430 mutex_exit(&stp->sd_lock); in strstartplumb()
4435 stp->sd_flag |= STRPLUMB; in strstartplumb()
4436 mutex_exit(&stp->sd_lock); in strstartplumb()
4445 strendplumb(stdata_t *stp) in strendplumb() argument
4447 ASSERT(MUTEX_HELD(&stp->sd_lock)); in strendplumb()
4448 ASSERT(stp->sd_flag & STRPLUMB); in strendplumb()
4449 stp->sd_flag &= ~STRPLUMB; in strendplumb()
4450 cv_broadcast(&stp->sd_monitor); in strendplumb()
4583 strlock(struct stdata *stp, sqlist_t *sqlist) in strlock() argument
4590 if (STRMATED(stp)) { in strlock()
4593 STRLOCKMATES(stp); in strlock()
4603 if (&(stp->sd_lock) > &((stp->sd_mate)->sd_lock)) { in strlock()
4604 stp1 = stp; in strlock()
4605 stp2 = stp->sd_mate; in strlock()
4607 stp2 = stp; in strlock()
4608 stp1 = stp->sd_mate; in strlock()
4612 STRUNLOCKMATES(stp); in strlock()
4619 STRUNLOCKMATES(stp); in strlock()
4628 mutex_enter(&stp->sd_lock); in strlock()
4629 mutex_enter(&stp->sd_reflock); in strlock()
4630 while (stp->sd_refcnt > 0) { in strlock()
4631 mutex_exit(&stp->sd_lock); in strlock()
4632 cv_wait(&stp->sd_refmonitor, &stp->sd_reflock); in strlock()
4633 if (mutex_tryenter(&stp->sd_lock) == 0) { in strlock()
4634 mutex_exit(&stp->sd_reflock); in strlock()
4635 mutex_enter(&stp->sd_lock); in strlock()
4636 mutex_enter(&stp->sd_reflock); in strlock()
4639 STREAM_PUTLOCKS_ENTER(stp); in strlock()
4658 if (STRMATED(stp)) { in strlock()
4659 STREAM_PUTLOCKS_EXIT(stp); in strlock()
4660 STREAM_PUTLOCKS_EXIT(stp->sd_mate); in strlock()
4661 STRUNLOCKMATES(stp); in strlock()
4662 mutex_exit(&stp->sd_reflock); in strlock()
4663 mutex_exit(&stp->sd_mate->sd_reflock); in strlock()
4665 STREAM_PUTLOCKS_EXIT(stp); in strlock()
4666 mutex_exit(&stp->sd_lock); in strlock()
4667 mutex_exit(&stp->sd_reflock); in strlock()
4706 strunlock(struct stdata *stp, sqlist_t *sqlist) in strunlock() argument
4710 if (STRMATED(stp)) { in strunlock()
4711 STREAM_PUTLOCKS_EXIT(stp); in strunlock()
4712 STREAM_PUTLOCKS_EXIT(stp->sd_mate); in strunlock()
4713 STRUNLOCKMATES(stp); in strunlock()
4714 mutex_exit(&stp->sd_reflock); in strunlock()
4715 mutex_exit(&stp->sd_mate->sd_reflock); in strunlock()
4717 STREAM_PUTLOCKS_EXIT(stp); in strunlock()
4718 mutex_exit(&stp->sd_lock); in strunlock()
4719 mutex_exit(&stp->sd_reflock); in strunlock()
4770 insertq(struct stdata *stp, queue_t *new) in insertq() argument
4778 ASSERT(stp->sd_vnode->v_type != VFIFO); in insertq()
4782 after = _RD(stp->sd_wrq); in insertq()
4783 wafter = stp->sd_wrq; in insertq()
4791 strlock(stp, NULL); in insertq()
4825 strsetuio(stp); in insertq()
4831 stp->sd_pushcnt++; in insertq()
4833 strunlock(stp, NULL); in insertq()
4879 struct stdata *stp = STREAM(qp); in removeq() local
4886 ASSERT(stp); in removeq()
4939 sqlist = sqlist_build(qp, stp, STRMATED(stp)); in removeq()
4940 strlock(stp, sqlist); in removeq()
4948 stp->sd_wrq->q_next = _RD(stp->sd_wrq); in removeq()
4960 ASSERT(_SAMESTR(stp->sd_wrq) == O_SAMESTR(stp->sd_wrq)); in removeq()
4961 ASSERT(_SAMESTR(_RD(stp->sd_wrq)) == O_SAMESTR(_RD(stp->sd_wrq))); in removeq()
4977 strsetuio(stp); in removeq()
4983 stp->sd_pushcnt--; in removeq()
4985 strunlock(stp, sqlist); in removeq()
5228 sqlist_build(queue_t *q, struct stdata *stp, boolean_t do_twist) in sqlist_build() argument
5230 sqlist_t *sqlist = sqlist_alloc(stp, KM_SLEEP); in sqlist_build()
5240 sqlist_insertall(sqlist, stp->sd_wrq); in sqlist_build()
5242 sqlist_insertall(sqlist, stp->sd_mate->sd_wrq); in sqlist_build()
5248 sqlist_alloc(struct stdata *stp, int kmflag) in sqlist_alloc() argument
5258 sqlist_size = 2 * sizeof (syncql_t) * stp->sd_pushcnt + in sqlist_alloc()
5260 if (STRMATED(stp)) in sqlist_alloc()
5261 sqlist_size += 2 * sizeof (syncql_t) * stp->sd_mate->sd_pushcnt; in sqlist_alloc()
5287 struct stdata *stp; in strblock() local
5293 stp = STREAM(q); in strblock()
5294 ASSERT(stp != NULL); in strblock()
5300 sqlist = sqlist_build(q, stp, B_FALSE); in strblock()
5312 struct stdata *stp; in strunblock() local
5327 stp = STREAM(q); in strunblock()
5328 ASSERT(stp != NULL); in strunblock()
5329 sqlist = sqlist_build(q, stp, B_FALSE); in strunblock()
5643 struct stdata *stp = STREAM(qp); in claimstr() local
5645 mutex_enter(&stp->sd_reflock); in claimstr()
5646 stp->sd_refcnt++; in claimstr()
5647 ASSERT(stp->sd_refcnt != 0); /* Wraparound */ in claimstr()
5648 mutex_exit(&stp->sd_reflock); in claimstr()
5657 struct stdata *stp = STREAM(qp); in releasestr() local
5659 mutex_enter(&stp->sd_reflock); in releasestr()
5660 ASSERT(stp->sd_refcnt != 0); in releasestr()
5661 if (--stp->sd_refcnt == 0) in releasestr()
5662 cv_broadcast(&stp->sd_refmonitor); in releasestr()
5663 mutex_exit(&stp->sd_reflock); in releasestr()
7776 strsetuio(stdata_t *stp) in strsetuio() argument
7780 if (stp->sd_flag & STPLEX) { in strsetuio()
7784 stp->sd_struiowrq = NULL; in strsetuio()
7785 stp->sd_struiordq = NULL; in strsetuio()
7792 wrq = stp->sd_wrq->q_next; in strsetuio()
7806 stp->sd_struiowrq = wrq; in strsetuio()
7811 wrq = stp->sd_wrq->q_next; in strsetuio()
7825 stp->sd_struiordq = wrq ? _RD(wrq) : 0; in strsetuio()
7980 struct stdata *stp = vp->v_stream; in strwaitmark() local
7981 queue_t *rq = _RD(stp->sd_wrq); in strwaitmark()
7984 mutex_enter(&stp->sd_lock); in strwaitmark()
7986 !(stp->sd_flag & (STRATMARK|STRNOTATMARK|STREOF))) { in strwaitmark()
7987 stp->sd_flag |= RSLEEP; in strwaitmark()
7990 if (str_cv_wait(&rq->q_wait, &stp->sd_lock, 100, 1) == -1) { in strwaitmark()
7991 mutex_exit(&stp->sd_lock); in strwaitmark()
7995 if (stp->sd_flag & STRATMARK) in strwaitmark()
8002 mutex_exit(&stp->sd_lock); in strwaitmark()
8014 struct stdata *stp = vp->v_stream; in strsetrerror() local
8016 mutex_enter(&stp->sd_lock); in strsetrerror()
8017 stp->sd_rerror = error; in strsetrerror()
8019 stp->sd_flag &= ~STRDERR; in strsetrerror()
8021 stp->sd_flag |= STRDERR; in strsetrerror()
8023 stp->sd_flag &= ~STRDERRNONPERSIST; in strsetrerror()
8025 stp->sd_flag |= STRDERRNONPERSIST; in strsetrerror()
8027 stp->sd_rderrfunc = errfunc; in strsetrerror()
8029 cv_broadcast(&_RD(stp->sd_wrq)->q_wait); /* readers */ in strsetrerror()
8030 cv_broadcast(&stp->sd_wrq->q_wait); /* writers */ in strsetrerror()
8031 cv_broadcast(&stp->sd_monitor); /* ioctllers */ in strsetrerror()
8033 mutex_exit(&stp->sd_lock); in strsetrerror()
8034 pollwakeup(&stp->sd_pollist, POLLERR); in strsetrerror()
8035 mutex_enter(&stp->sd_lock); in strsetrerror()
8037 if (stp->sd_sigflags & S_ERROR) in strsetrerror()
8038 strsendsig(stp->sd_siglist, S_ERROR, 0, error); in strsetrerror()
8040 mutex_exit(&stp->sd_lock); in strsetrerror()
8050 struct stdata *stp = vp->v_stream; in strsetwerror() local
8052 mutex_enter(&stp->sd_lock); in strsetwerror()
8053 stp->sd_werror = error; in strsetwerror()
8055 stp->sd_flag &= ~STWRERR; in strsetwerror()
8057 stp->sd_flag |= STWRERR; in strsetwerror()
8059 stp->sd_flag &= ~STWRERRNONPERSIST; in strsetwerror()
8061 stp->sd_flag |= STWRERRNONPERSIST; in strsetwerror()
8063 stp->sd_wrerrfunc = errfunc; in strsetwerror()
8065 cv_broadcast(&_RD(stp->sd_wrq)->q_wait); /* readers */ in strsetwerror()
8066 cv_broadcast(&stp->sd_wrq->q_wait); /* writers */ in strsetwerror()
8067 cv_broadcast(&stp->sd_monitor); /* ioctllers */ in strsetwerror()
8069 mutex_exit(&stp->sd_lock); in strsetwerror()
8070 pollwakeup(&stp->sd_pollist, POLLERR); in strsetwerror()
8071 mutex_enter(&stp->sd_lock); in strsetwerror()
8073 if (stp->sd_sigflags & S_ERROR) in strsetwerror()
8074 strsendsig(stp->sd_siglist, S_ERROR, 0, error); in strsetwerror()
8076 mutex_exit(&stp->sd_lock); in strsetwerror()
8086 struct stdata *stp = vp->v_stream; in strseteof() local
8088 mutex_enter(&stp->sd_lock); in strseteof()
8090 stp->sd_flag &= ~STREOF; in strseteof()
8091 mutex_exit(&stp->sd_lock); in strseteof()
8094 stp->sd_flag |= STREOF; in strseteof()
8095 if (stp->sd_flag & RSLEEP) { in strseteof()
8096 stp->sd_flag &= ~RSLEEP; in strseteof()
8097 cv_broadcast(&_RD(stp->sd_wrq)->q_wait); in strseteof()
8100 mutex_exit(&stp->sd_lock); in strseteof()
8101 pollwakeup(&stp->sd_pollist, POLLIN|POLLRDNORM); in strseteof()
8102 mutex_enter(&stp->sd_lock); in strseteof()
8104 if (stp->sd_sigflags & (S_INPUT|S_RDNORM)) in strseteof()
8105 strsendsig(stp->sd_siglist, S_INPUT|S_RDNORM, 0, 0); in strseteof()
8106 mutex_exit(&stp->sd_lock); in strseteof()
8112 struct stdata *stp = vp->v_stream; in strflushrq() local
8114 mutex_enter(&stp->sd_lock); in strflushrq()
8115 flushq(_RD(stp->sd_wrq), flag); in strflushrq()
8116 mutex_exit(&stp->sd_lock); in strflushrq()
8123 struct stdata *stp = vp->v_stream; in strsetrputhooks() local
8125 mutex_enter(&stp->sd_lock); in strsetrputhooks()
8128 stp->sd_rprotofunc = strrput_proto; in strsetrputhooks()
8130 stp->sd_rprotofunc = protofunc; in strsetrputhooks()
8133 stp->sd_rmiscfunc = strrput_misc; in strsetrputhooks()
8135 stp->sd_rmiscfunc = miscfunc; in strsetrputhooks()
8138 stp->sd_rput_opt |= SR_CONSOL_DATA; in strsetrputhooks()
8140 stp->sd_rput_opt &= ~SR_CONSOL_DATA; in strsetrputhooks()
8143 stp->sd_rput_opt |= SR_SIGALLDATA; in strsetrputhooks()
8145 stp->sd_rput_opt &= ~SR_SIGALLDATA; in strsetrputhooks()
8148 stp->sd_rput_opt |= SR_IGN_ZEROLEN; in strsetrputhooks()
8150 stp->sd_rput_opt &= ~SR_IGN_ZEROLEN; in strsetrputhooks()
8152 mutex_exit(&stp->sd_lock); in strsetrputhooks()
8158 struct stdata *stp = vp->v_stream; in strsetwputhooks() local
8160 mutex_enter(&stp->sd_lock); in strsetwputhooks()
8161 stp->sd_closetime = closetime; in strsetwputhooks()
8164 stp->sd_wput_opt |= SW_SIGPIPE; in strsetwputhooks()
8166 stp->sd_wput_opt &= ~SW_SIGPIPE; in strsetwputhooks()
8168 stp->sd_wput_opt |= SW_RECHECK_ERR; in strsetwputhooks()
8170 stp->sd_wput_opt &= ~SW_RECHECK_ERR; in strsetwputhooks()
8172 mutex_exit(&stp->sd_lock); in strsetwputhooks()
8178 struct stdata *stp = vp->v_stream; in strsetrwputdatahooks() local
8180 mutex_enter(&stp->sd_lock); in strsetrwputdatahooks()
8182 stp->sd_rputdatafunc = rdatafunc; in strsetrwputdatahooks()
8183 stp->sd_wputdatafunc = wdatafunc; in strsetrwputdatahooks()
8185 mutex_exit(&stp->sd_lock); in strsetrwputdatahooks()
8192 stdata_t *stp = STREAM(q); in qenable_locked() local
8224 mutex_enter(&stp->sd_qlock); in qenable_locked()
8229 IMPLY(STREAM_NEEDSERVICE(stp), in qenable_locked()
8230 (stp->sd_svcflags & (STRS_WILLSERVICE | STRS_SCHEDULED))); in qenable_locked()
8232 ENQUEUE(q, stp->sd_qhead, stp->sd_qtail, q_link); in qenable_locked()
8233 stp->sd_nqueues++; in qenable_locked()
8239 if (!(stp->sd_svcflags & (STRS_WILLSERVICE | STRS_SCHEDULED))) { in qenable_locked()
8245 stp->sd_svcflags |= STRS_SCHEDULED; in qenable_locked()
8246 stp->sd_servid = (void *)taskq_dispatch(streams_taskq, in qenable_locked()
8247 (task_func_t *)stream_service, stp, TQ_NOSLEEP|TQ_NOQUEUE); in qenable_locked()
8249 if (stp->sd_servid == NULL) { in qenable_locked()
8259 stp->sd_svcflags &= ~STRS_SCHEDULED; in qenable_locked()
8266 ASSERT((stp->sd_qhead == q) && (stp->sd_qtail == q)); in qenable_locked()
8279 stp->sd_qhead = stp->sd_qtail = NULL; in qenable_locked()
8280 stp->sd_nqueues = 0; in qenable_locked()
8288 mutex_exit(&stp->sd_qlock); in qenable_locked()
8379 stream_service(stdata_t *stp) in stream_service() argument
8383 mutex_enter(&stp->sd_qlock); in stream_service()
8385 STR_SERVICE(stp, q); in stream_service()
8387 stp->sd_svcflags &= ~STRS_SCHEDULED; in stream_service()
8388 stp->sd_servid = NULL; in stream_service()
8389 cv_signal(&stp->sd_qcv); in stream_service()
8390 mutex_exit(&stp->sd_qlock); in stream_service()
8397 stream_runservice(stdata_t *stp) in stream_runservice() argument
8401 mutex_enter(&stp->sd_qlock); in stream_runservice()
8407 stp->sd_svcflags |= STRS_WILLSERVICE; in stream_runservice()
8409 STR_SERVICE(stp, q); in stream_runservice()
8411 stp->sd_svcflags &= ~STRS_WILLSERVICE; in stream_runservice()
8412 mutex_exit(&stp->sd_qlock); in stream_runservice()
8416 stream_willservice(stdata_t *stp) in stream_willservice() argument
8418 mutex_enter(&stp->sd_qlock); in stream_willservice()
8419 stp->sd_svcflags |= STRS_WILLSERVICE; in stream_willservice()
8420 mutex_exit(&stp->sd_qlock); in stream_willservice()