wakeup((caddr_t)&fip->fi_writers);
wakeup(&fip->fi_writers);
fifo_open(v)	void *v;{	struct vop_open_args /* {		struct vnode *a_vp;		int  a_mode;		struct ucred *a_cred;		struct proc *a_p;	} */ *ap = v;	register struct vnode *vp = ap->a_vp;	register struct fifoinfo *fip;	struct proc *p = ap->a_p;	struct socket *rso, *wso;	int error;	static char openstr[] = "fifo";	if ((fip = vp->v_fifoinfo) == NULL) {		MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK);		vp->v_fifoinfo = fip;		if ((error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0)) != 0) {			free(fip, M_VNODE);			vp->v_fifoinfo = NULL;			return (error);		}		fip->fi_readsock = rso;		if ((error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0)) != 0) {			(void)soclose(rso);			free(fip, M_VNODE);			vp->v_fifoinfo = NULL;			return (error);		}		fip->fi_writesock = wso;		if ((error = unp_connect2(wso, rso)) != 0) {			(void)soclose(wso);			(void)soclose(rso);			free(fip, M_VNODE);			vp->v_fifoinfo = NULL;			return (error);		}		fip->fi_readers = fip->fi_writers = 0;		wso->so_state |= SS_CANTRCVMORE;		rso->so_state |= SS_CANTSENDMORE;	}	if (ap->a_mode & FREAD) {		if (fip->fi_readers++ == 0) {			fip->fi_writesock->so_state &= ~SS_CANTSENDMORE;			if (fip->fi_writers > 0)				wakeup((caddr_t)&fip->fi_writers);		}	} else if (ap->a_mode & FWRITE) {		if (fip->fi_writers++ == 0) {			fip->fi_readsock->so_state &= ~SS_CANTRCVMORE;			if (fip->fi_readers > 0)				wakeup((caddr_t)&fip->fi_readers);		}	}	if (ap->a_mode & FREAD) {		if (ap->a_mode & O_NONBLOCK) {		} else {			while (fip->fi_writers == 0) {				VOP_UNLOCK(vp, 0, p);				error = tsleep((caddr_t)&fip->fi_readers,				    PCATCH | PSOCK, openstr, 0);				vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);				if (error)					goto bad;			}		}	} else if (ap->a_mode & FWRITE) {		if (ap->a_mode & O_NONBLOCK) {			if (fip->fi_readers == 0) {				error = ENXIO;				goto bad;			}		} else {			while (fip->fi_readers == 0) {				VOP_UNLOCK(vp, 0, p);				error = tsleep((caddr_t)&fip->fi_writers,				    PCATCH | PSOCK, openstr, 0);				vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);				if (error)					goto bad;			}		}	}	return (0);bad:	VOP_CLOSE(vp, ap->a_mode, ap->a_cred, ap->a_p);	return (error);}