Lines Matching refs:pipe

32  * "normal" pipe buffering is done.  If the buffer is between PIPE_MINDIRECT
39 * is returned back to the user-mode side. In that case, the pipe code
85 * both directions of a pipe.
111 #include <sys/pipe.h>
137 #define PIPE_PEER(pipe) \
138 (((pipe)->pipe_type & PIPE_TYPE_NAMED) ? (pipe) : ((pipe)->pipe_peer))
195 * Default pipe buffer size(s), this can be kind-of large now because pipe
196 * space is pageable. The pipe code will try to maintain locality of
224 static void pipeclose(struct pipe *cpipe);
225 static void pipe_free_kmem(struct pipe *cpipe);
226 static int pipe_create(struct pipe *pipe, bool backing);
228 static __inline int pipelock(struct pipe *cpipe, int catch);
229 static __inline void pipeunlock(struct pipe *cpipe);
232 static int pipe_build_write_buffer(struct pipe *wpipe, struct uio *uio);
233 static void pipe_destroy_write_buffer(struct pipe *wpipe);
234 static int pipe_direct_write(struct pipe *wpipe, struct uio *uio);
235 static void pipe_clone_write_buffer(struct pipe *wpipe);
237 static int pipespace(struct pipe *cpipe, int size);
238 static int pipespace_new(struct pipe *cpipe, int size);
254 pipe_zone = uma_zcreate("pipe", sizeof(struct pipepair),
260 KASSERT(pipedev_ino > 0, ("pipe dev inode not initialized"));
290 struct pipe *rpipe, *wpipe;
297 * We zero both pipe endpoints to make sure all the kmem pointers
343 mtx_init(&pp->pp_mtx, "pipe mutex", NULL, MTX_DEF | MTX_NEW);
363 struct pipe *rpipe, *wpipe;
383 * Only the forward direction pipe is backed by big buffer by
392 * This cleanup leaves the pipe inode number for rpipe
419 pipe_named_ctor(struct pipe **ppipe, struct thread *td)
433 pipe_dtor(struct pipe *dpipe)
435 struct pipe *peer;
461 * The pipe system call for the DTYPE_PIPE type of pipes. If we fail, let
469 struct pipe *rpipe, *wpipe;
553 * Allocate kva for pipe circular buffer, the space is pageable
554 * This routine will 'realloc' the size of a pipe safely, if it fails
559 pipespace_new(struct pipe *cpipe, int size)
566 KASSERT(!mtx_owned(PIPE_MTX(cpipe)), ("pipespace: pipe mutex locked"));
624 pipespace(struct pipe *cpipe, int size)
628 ("Unlocked pipe passed to pipespace"));
633 * lock a pipe for I/O, blocking other access
636 pipelock(struct pipe *cpipe, int catch)
661 * unlock a pipe I/O lock
664 pipeunlock(struct pipe *cpipe)
669 ("Unlocked pipe passed to pipeunlock"));
679 pipeselwakeup(struct pipe *cpipe)
694 * Initialize and allocate VM and memory for pipe. The structure
698 pipe_create(struct pipe *pipe, bool large_backing)
702 error = pipespace_new(pipe, !large_backing || amountpipekva >
705 pipe->pipe_ino = alloc_unr64(&pipeino_unr);
714 struct pipe *rpipe;
722 * Try to avoid locking the pipe if we have nothing to do.
724 * There are programs which share one pipe amongst multiple processes
725 * and perform non-blocking reads in parallel, even if the pipe is
763 * normal pipe buffer receive
787 * If there is no more to read in the pipe, reset
840 * Unlock the pipe buffer for our remaining processing.
910 pipe_build_write_buffer(struct pipe *wpipe, struct uio *uio)
919 ("%s: pipe map for %p contains residual data", __func__, wpipe));
955 pipe_destroy_write_buffer(struct pipe *wpipe)
962 ("%s: pipe map for %p contains residual data", __func__, wpipe));
975 pipe_clone_write_buffer(struct pipe *wpipe)
1010 * This implements the pipe buffer write mechanism. Note that only
1011 * a direct write OR a normal pipe write can be pending at any given time.
1012 * If there are any characters in the pipe buffer, the direct write will
1014 * the pipe buffer. Then the direct mapping write is set-up.
1017 pipe_direct_write(struct pipe *wpipe, struct uio *uio)
1090 ("pipe %p leaked PIPE_DIRECTW", wpipe));
1103 struct pipe *wpipe, *rpipe;
1116 * detect loss of pipe read side, issue SIGPIPE if lost.
1196 * pipe buffer. We break out if a signal occurs or the
1227 * and free space in pipe buffer.
1236 * pipe buffer. If first segment to transfer
1368 struct pipe *cpipe;
1386 struct pipe *mpipe = fp->f_data;
1457 struct pipe *rpipe;
1458 struct pipe *wpipe;
1534 struct pipe *pipe;
1539 pipe = fp->f_data;
1542 PIPE_LOCK(pipe);
1543 error = mac_pipe_check_stat(active_cred, pipe->pipe_pair);
1544 PIPE_UNLOCK(pipe);
1552 if (pipe->pipe_type & PIPE_TYPE_NAMED) {
1559 if (pipe->pipe_pages.cnt != 0)
1560 ub->st_size = pipe->pipe_pages.cnt;
1562 ub->st_size = pipe->pipe_buffer.cnt;
1564 ub->st_atim = pipe->pipe_atime;
1565 ub->st_mtim = pipe->pipe_mtime;
1566 ub->st_ctim = pipe->pipe_ctime;
1570 ub->st_ino = pipe->pipe_ino;
1593 struct pipe *cpipe;
1608 struct pipe *cpipe;
1622 struct pipe *pi;
1638 pipe_free_kmem(struct pipe *cpipe)
1642 ("pipe_free_kmem: pipe mutex locked"));
1661 * shutdown the pipe
1664 pipeclose(struct pipe *cpipe)
1669 struct pipe *ppipe;
1707 * doing that, or the pipe might disappear out from under
1728 * pipe pair. If not, unlock.
1744 struct pipe *cpipe;
1768 /* other end of pipe has been closed */
1792 struct pipe *cpipe = kn->kn_hook;
1804 struct pipe *rpipe = kn->kn_hook;
1825 struct pipe *wpipe = kn->kn_hook;
1828 * If this end of the pipe is closed, the knote was removed from the
1829 * knlist and the list lock (i.e., the pipe lock) is therefore not held.