Lines Matching defs: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.
112 #include <sys/pipe.h>
138 #define PIPE_PEER(pipe) \
139 (((pipe)->pipe_type & PIPE_TYPE_NAMED) ? (pipe) : ((pipe)->pipe_peer))
196 * Default pipe buffer size(s), this can be kind-of large now because pipe
197 * space is pageable. The pipe code will try to maintain locality of
226 "Superuser-reserved percentage of the pipe buffers space");
229 static void pipeclose(struct pipe *cpipe);
230 static void pipe_free_kmem(struct pipe *cpipe);
231 static int pipe_create(struct pipe *pipe, bool backing);
233 static __inline int pipelock(struct pipe *cpipe, bool catch);
234 static __inline void pipeunlock(struct pipe *cpipe);
237 static int pipe_build_write_buffer(struct pipe *wpipe, struct uio *uio);
238 static void pipe_destroy_write_buffer(struct pipe *wpipe);
239 static int pipe_direct_write(struct pipe *wpipe, struct uio *uio);
240 static void pipe_clone_write_buffer(struct pipe *wpipe);
242 static int pipespace(struct pipe *cpipe, int size);
243 static int pipespace_new(struct pipe *cpipe, int size);
259 pipe_zone = uma_zcreate("pipe", sizeof(struct pipepair),
265 KASSERT(pipedev_ino > 0, ("pipe dev inode not initialized"));
295 struct pipe *rpipe, *wpipe;
302 * We zero both pipe endpoints to make sure all the kmem pointers
348 mtx_init(&pp->pp_mtx, "pipe mutex", NULL, MTX_DEF | MTX_NEW);
368 struct pipe *rpipe, *wpipe;
389 * Only the forward direction pipe is backed by big buffer by
398 * This cleanup leaves the pipe inode number for rpipe
426 pipe_named_ctor(struct pipe **ppipe, struct thread *td)
440 pipe_dtor(struct pipe *dpipe)
442 struct pipe *peer;
468 * The pipe system call for the DTYPE_PIPE type of pipes. If we fail, let
476 struct pipe *rpipe, *wpipe;
560 * Allocate kva for pipe circular buffer, the space is pageable
561 * This routine will 'realloc' the size of a pipe safely, if it fails
566 pipespace_new(struct pipe *cpipe, int size)
573 KASSERT(!mtx_owned(PIPE_MTX(cpipe)), ("pipespace: pipe mutex locked"));
656 pipespace(struct pipe *cpipe, int size)
660 ("Unlocked pipe passed to pipespace"));
665 * lock a pipe for I/O, blocking other access
668 pipelock(struct pipe *cpipe, bool catch)
693 * unlock a pipe I/O lock
696 pipeunlock(struct pipe *cpipe)
701 ("Unlocked pipe passed to pipeunlock"));
711 pipeselwakeup(struct pipe *cpipe)
726 * Initialize and allocate VM and memory for pipe. The structure
730 pipe_create(struct pipe *pipe, bool large_backing)
734 error = pipespace_new(pipe, !large_backing || amountpipekva >
737 pipe->pipe_ino = alloc_unr64(&pipeino_unr);
746 struct pipe *rpipe;
754 * Try to avoid locking the pipe if we have nothing to do.
756 * There are programs which share one pipe amongst multiple processes
757 * and perform non-blocking reads in parallel, even if the pipe is
795 * normal pipe buffer receive
819 * If there is no more to read in the pipe, reset
872 * Unlock the pipe buffer for our remaining processing.
942 pipe_build_write_buffer(struct pipe *wpipe, struct uio *uio)
951 ("%s: pipe map for %p contains residual data", __func__, wpipe));
989 pipe_destroy_write_buffer(struct pipe *wpipe)
996 ("%s: pipe map for %p contains residual data", __func__, wpipe));
1009 pipe_clone_write_buffer(struct pipe *wpipe)
1044 * This implements the pipe buffer write mechanism. Note that only
1045 * a direct write OR a normal pipe write can be pending at any given time.
1046 * If there are any characters in the pipe buffer, the direct write will
1048 * the pipe buffer. Then the direct mapping write is set-up.
1051 pipe_direct_write(struct pipe *wpipe, struct uio *uio)
1124 ("pipe %p leaked PIPE_DIRECTW", wpipe));
1137 struct pipe *wpipe, *rpipe;
1150 * detect loss of pipe read side, issue SIGPIPE if lost.
1230 * pipe buffer. We break out if a signal occurs or the
1261 * and free space in pipe buffer.
1270 * pipe buffer. If first segment to transfer
1402 struct pipe *cpipe;
1420 struct pipe *mpipe = fp->f_data;
1491 struct pipe *rpipe;
1492 struct pipe *wpipe;
1568 struct pipe *pipe;
1573 pipe = fp->f_data;
1576 PIPE_LOCK(pipe);
1577 error = mac_pipe_check_stat(active_cred, pipe->pipe_pair);
1578 PIPE_UNLOCK(pipe);
1586 if (pipe->pipe_type & PIPE_TYPE_NAMED) {
1593 if (pipe->pipe_pages.cnt != 0)
1594 ub->st_size = pipe->pipe_pages.cnt;
1596 ub->st_size = pipe->pipe_buffer.cnt;
1598 ub->st_atim = pipe->pipe_atime;
1599 ub->st_mtim = pipe->pipe_mtime;
1600 ub->st_ctim = pipe->pipe_ctime;
1604 ub->st_ino = pipe->pipe_ino;
1627 struct pipe *cpipe;
1642 struct pipe *cpipe;
1656 struct pipe *pi;
1672 pipe_free_kmem(struct pipe *cpipe)
1676 ("pipe_free_kmem: pipe mutex locked"));
1697 * shutdown the pipe
1700 pipeclose(struct pipe *cpipe)
1705 struct pipe *ppipe;
1743 * doing that, or the pipe might disappear out from under
1764 * pipe pair. If not, unlock.
1781 struct pipe *cpipe;
1805 /* other end of pipe has been closed */
1829 struct pipe *cpipe = kn->kn_hook;
1841 struct pipe *rpipe = kn->kn_hook;
1862 struct pipe *wpipe = kn->kn_hook;
1865 * If this end of the pipe is closed, the knote was removed from the
1866 * knlist and the list lock (i.e., the pipe lock) is therefore not held.