STATIC void spm_free_priv(queue_t *q) { uint t; spm_t *s = PRIV(q); ensure(s, return); if (s->rbid) unbufcall(xchg(&s->rbid, 0)); if (s->wbid) unbufcall(xchg(&s->wbid, 0)); if ((*(s->prev) = s->next)) s->next->prev = s->prev; s->next = NULL; s->prev = NULL; if ((t = xchg(&s->wtim, 0))) untimeout(t); if ((t = xchg(&s->rtim, 0))) untimeout(t); noenable(s->wq); noenable(s->rq); assure(s->refcnt == 0); printd(("spm: unlinked module private structure\n")); kmem_cache_free(spm_priv_cachep, s); printd(("spm: freed module private structure\n")); return; }
static streamscall int pckt_qclose(queue_t *q, int oflag, cred_t *crp) { struct pckt *p; qprocsoff(q); if ((p = (struct pckt *) q->q_ptr)) { bcid_t bc; /* atomic exchange for LiS's stupid sake */ if ((bc = xchg(&p->bufcall, 0))) unbufcall(bc); kmem_free(p, sizeof(*p)); } q->q_ptr = WR(q)->q_ptr = NULL; return (0); }
/* * cvc_ioctl() * handle normal console ioctls. */ static void cvc_ioctl(register queue_t *q, register mblk_t *mp) { register cvc_t *cp = q->q_ptr; int datasize; int error = 0; /* * Let ttycommon_ioctl take the first shot at processing the ioctl. If * it fails because it can't allocate memory, schedule processing of the * ioctl later when a proper buffer is available. The mblk that * couldn't be processed will have been stored in the tty structure by * ttycommon_ioctl. */ datasize = ttycommon_ioctl(&cp->cvc_tty, q, mp, &error); if (datasize != 0) { if (cp->cvc_wbufcid) { unbufcall(cp->cvc_wbufcid); } cp->cvc_wbufcid = bufcall(datasize, BPRI_HI, cvc_reioctl, cp); return; } /* * ttycommon_ioctl didn't do anything, but there's nothing we really * support either with the exception of TCSBRK, which is supported * only to appear a bit more like a serial device for software that * expects TCSBRK to work. */ if (error != 0) { struct iocblk *iocp = (struct iocblk *)mp->b_rptr; if (iocp->ioc_cmd == TCSBRK) { miocack(q, mp, 0, 0); } else { miocnak(q, mp, 0, EINVAL); } } else { qreply(q, mp); } }
/* ARGSUSED */ static int cvc_close(queue_t *q, int flag, cred_t *crp) { register int err = DDI_SUCCESS; register cvc_t *cp; mutex_enter(&cvcmutex); input_ok = 0; mutex_exit(&cvcmutex); cp = q->q_ptr; if (cp->cvc_wbufcid != 0) { unbufcall(cp->cvc_wbufcid); } ttycommon_close(&cp->cvc_tty); WR(q)->q_ptr = q->q_ptr = NULL; cvcinput_q = NULL; bzero((caddr_t)cp, sizeof (cvc_t)); qprocsoff(q); CVC_DBG0(CVC_DBG_CLOSE, "Un-plumbed successfully"); return (err); }