Lines Matching defs:rpipe

295 	struct pipe *rpipe, *wpipe;
306 rpipe = &pp->pp_rpipe;
307 bzero(rpipe, sizeof(*rpipe));
308 pipe_timestamp(&rpipe->pipe_ctime);
309 rpipe->pipe_atime = rpipe->pipe_mtime = rpipe->pipe_ctime;
313 wpipe->pipe_ctime = rpipe->pipe_ctime;
314 wpipe->pipe_atime = wpipe->pipe_mtime = rpipe->pipe_ctime;
316 rpipe->pipe_peer = wpipe;
317 rpipe->pipe_pair = pp;
318 wpipe->pipe_peer = rpipe;
326 rpipe->pipe_present = PIPE_ACTIVE;
368 struct pipe *rpipe, *wpipe;
381 rpipe = &pp->pp_rpipe;
385 knlist_init_mtx(&rpipe->pipe_sel.si_note, PIPE_MTX(rpipe));
392 error = pipe_create(rpipe, true);
398 * This cleanup leaves the pipe inode number for rpipe
406 pipe_free_kmem(rpipe);
410 rpipe->pipe_state |= PIPE_DIRECTOK;
415 knlist_destroy(&rpipe->pipe_sel.si_note);
476 struct pipe *rpipe, *wpipe;
483 rpipe = &pp->pp_rpipe;
487 pipeclose(rpipe);
504 finit(rf, fflags, DTYPE_PIPE, rpipe, &pipeops);
509 /* rpipe has been closed by fdrop(). */
746 struct pipe *rpipe;
751 rpipe = fp->f_data;
765 if ((atomic_load_short(&rpipe->pipe_state) & PIPE_EOF) == 0 &&
766 atomic_load_int(&rpipe->pipe_buffer.cnt) == 0 &&
767 atomic_load_int(&rpipe->pipe_pages.cnt) == 0)
771 PIPE_LOCK(rpipe);
772 ++rpipe->pipe_busy;
773 error = pipelock(rpipe, true);
778 error = mac_pipe_check_read(active_cred, rpipe->pipe_pair);
783 if ((rpipe->pipe_state & PIPE_DIRECTW) == 0 &&
784 rpipe->pipe_buffer.size > SMALL_PIPE_SIZE &&
785 rpipe->pipe_buffer.cnt <= SMALL_PIPE_SIZE &&
787 PIPE_UNLOCK(rpipe);
788 pipespace(rpipe, SMALL_PIPE_SIZE);
789 PIPE_LOCK(rpipe);
797 if (rpipe->pipe_buffer.cnt > 0) {
798 size = rpipe->pipe_buffer.size - rpipe->pipe_buffer.out;
799 if (size > rpipe->pipe_buffer.cnt)
800 size = rpipe->pipe_buffer.cnt;
804 PIPE_UNLOCK(rpipe);
806 &rpipe->pipe_buffer.buffer[rpipe->pipe_buffer.out],
808 PIPE_LOCK(rpipe);
812 rpipe->pipe_buffer.out += size;
813 if (rpipe->pipe_buffer.out >= rpipe->pipe_buffer.size)
814 rpipe->pipe_buffer.out = 0;
816 rpipe->pipe_buffer.cnt -= size;
823 if (rpipe->pipe_buffer.cnt == 0) {
824 rpipe->pipe_buffer.in = 0;
825 rpipe->pipe_buffer.out = 0;
832 } else if ((size = rpipe->pipe_pages.cnt) != 0) {
835 PIPE_UNLOCK(rpipe);
836 error = uiomove_fromphys(rpipe->pipe_pages.ms,
837 rpipe->pipe_pages.pos, size, uio);
838 PIPE_LOCK(rpipe);
842 rpipe->pipe_pages.pos += size;
843 rpipe->pipe_pages.cnt -= size;
844 if (rpipe->pipe_pages.cnt == 0) {
845 rpipe->pipe_state &= ~PIPE_WANTW;
846 wakeup(rpipe);
854 if (rpipe->pipe_state & PIPE_EOF)
860 if (rpipe->pipe_state & PIPE_WANTW) {
861 rpipe->pipe_state &= ~PIPE_WANTW;
862 wakeup(rpipe);
876 pipeunlock(rpipe);
885 rpipe->pipe_state |= PIPE_WANTR;
886 if ((error = msleep(rpipe, PIPE_MTX(rpipe),
889 error = pipelock(rpipe, true);
898 pipeunlock(rpipe);
902 pipe_timestamp(&rpipe->pipe_atime);
904 --rpipe->pipe_busy;
909 if ((rpipe->pipe_busy == 0) && (rpipe->pipe_state & PIPE_WANT)) {
910 rpipe->pipe_state &= ~(PIPE_WANT|PIPE_WANTW);
911 wakeup(rpipe);
912 } else if (rpipe->pipe_buffer.cnt < MINPIPESIZE) {
916 if (rpipe->pipe_state & PIPE_WANTW) {
917 rpipe->pipe_state &= ~PIPE_WANTW;
918 wakeup(rpipe);
927 rpipe->pipe_buffer.size - rpipe->pipe_buffer.cnt >= PIPE_BUF)
928 pipeselwakeup(rpipe);
930 PIPE_UNLOCK(rpipe);
1137 struct pipe *wpipe, *rpipe;
1141 rpipe = fp->f_data;
1142 wpipe = PIPE_PEER(rpipe);
1143 PIPE_LOCK(rpipe);
1146 PIPE_UNLOCK(rpipe);
1155 PIPE_UNLOCK(rpipe);
1162 PIPE_UNLOCK(rpipe);
1241 error = msleep(wpipe, PIPE_MTX(rpipe), PRIBIO | PCATCH,
1281 PIPE_UNLOCK(rpipe);
1284 PIPE_LOCK(rpipe);
1296 PIPE_UNLOCK(rpipe);
1300 PIPE_LOCK(rpipe);
1346 error = msleep(wpipe, PIPE_MTX(rpipe),
1391 PIPE_UNLOCK(rpipe);
1491 struct pipe *rpipe;
1499 rpipe = fp->f_data;
1500 wpipe = PIPE_PEER(rpipe);
1501 PIPE_LOCK(rpipe);
1503 error = mac_pipe_check_poll(active_cred, rpipe->pipe_pair);
1508 if (rpipe->pipe_pages.cnt > 0 || rpipe->pipe_buffer.cnt > 0)
1521 if (rpipe->pipe_type & PIPE_TYPE_NAMED && fp->f_flag & FREAD && levents &&
1522 fp->f_pipegen == rpipe->pipe_wgen)
1526 if (rpipe->pipe_state & PIPE_EOF) {
1541 selrecord(td, &rpipe->pipe_sel);
1542 if (SEL_WAITING(&rpipe->pipe_sel))
1543 rpipe->pipe_state |= PIPE_SEL;
1556 PIPE_UNLOCK(rpipe);
1841 struct pipe *rpipe = kn->kn_hook;
1843 PIPE_LOCK_ASSERT(rpipe, MA_OWNED);
1844 kn->kn_data = rpipe->pipe_buffer.cnt;
1846 kn->kn_data = rpipe->pipe_pages.cnt;
1848 if ((rpipe->pipe_state & PIPE_EOF) != 0 &&
1849 ((rpipe->pipe_type & PIPE_TYPE_NAMED) == 0 ||
1850 fp->f_pipegen != rpipe->pipe_wgen)) {