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.
116 #include <sys/pipe.h>
142 #define PIPE_PEER(pipe) \
143 (((pipe)->pipe_state & PIPE_NAMED) ? (pipe) : ((pipe)->pipe_peer))
199 * Default pipe buffer size(s), this can be kind-of large now because pipe
200 * space is pageable. The pipe code will try to maintain locality of
227 static void pipeclose(struct pipe *cpipe);
228 static void pipe_free_kmem(struct pipe *cpipe);
229 static void pipe_create(struct pipe *pipe, int backing);
231 static __inline int pipelock(struct pipe *cpipe, int catch);
232 static __inline void pipeunlock(struct pipe *cpipe);
234 static int pipe_build_write_buffer(struct pipe *wpipe, struct uio *uio);
235 static void pipe_destroy_write_buffer(struct pipe *wpipe);
236 static int pipe_direct_write(struct pipe *wpipe, struct uio *uio);
237 static void pipe_clone_write_buffer(struct pipe *wpipe);
239 static int pipespace(struct pipe *cpipe, int size);
240 static int pipespace_new(struct pipe *cpipe, int size);
256 pipe_zone = uma_zcreate("pipe", sizeof(struct pipepair),
261 KASSERT(pipeino_unr != NULL, ("pipe fake inodes not initialized"));
263 KASSERT(pipedev_ino > 0, ("pipe dev inode not initialized"));
270 struct pipe *rpipe, *wpipe;
277 * We zero both pipe endpoints to make sure all the kmem pointers
323 mtx_init(&pp->pp_mtx, "pipe mutex", NULL, MTX_DEF | MTX_NEW);
343 struct pipe *rpipe, *wpipe;
361 /* Only the forward direction pipe is backed by default */
370 pipe_named_ctor(struct pipe **ppipe, struct thread *td)
380 pipe_dtor(struct pipe *dpipe)
382 struct pipe *peer;
398 * The pipe system call for the DTYPE_PIPE type of pipes. If we fail, let
406 struct pipe *rpipe, *wpipe;
488 * Allocate kva for pipe circular buffer, the space is pageable
489 * This routine will 'realloc' the size of a pipe safely, if it fails
495 struct pipe *cpipe;
503 KASSERT(!mtx_owned(PIPE_MTX(cpipe)), ("pipespace: pipe mutex locked"));
562 struct pipe *cpipe;
567 ("Unlocked pipe passed to pipespace"));
572 * lock a pipe for I/O, blocking other access
576 struct pipe *cpipe;
595 * unlock a pipe I/O lock
599 struct pipe *cpipe;
604 ("Unlocked pipe passed to pipeunlock"));
614 struct pipe *cpipe;
629 * Initialize and allocate VM and memory for pipe. The structure
633 pipe_create(pipe, backing)
634 struct pipe *pipe;
640 * Note that these functions can fail if pipe map is exhausted
644 * with given pipe.
647 (void)pipespace_new(pipe, SMALL_PIPE_SIZE);
649 (void)pipespace_new(pipe, PIPE_SIZE);
652 pipe->pipe_ino = -1;
664 struct pipe *rpipe;
694 * normal pipe buffer receive
718 * If there is no more to read in the pipe, reset
773 * Unlock the pipe buffer for our remaining processing.
837 struct pipe *wpipe;
845 ("Clone attempt on non-direct write pipe!"));
883 struct pipe *wpipe;
902 struct pipe *wpipe;
936 * This implements the pipe buffer write mechanism. Note that only
937 * a direct write OR a normal pipe write can be pending at any given time.
938 * If there are any characters in the pipe buffer, the direct write will
940 * the pipe buffer. Then the direct mapping write is set-up.
944 struct pipe *wpipe;
1032 ("pipe %p leaked PIPE_DIRECTW", wpipe));
1052 struct pipe *wpipe, *rpipe;
1063 * detect loss of pipe read side, issue SIGPIPE if lost.
1158 * pipe buffer. We break out if a signal occurs or the
1189 * and free space in pipe buffer.
1198 * pipe buffer. If first segment to transfer
1331 struct pipe *cpipe;
1353 struct pipe *mpipe = fp->f_data;
1428 struct pipe *rpipe;
1429 struct pipe *wpipe;
1504 struct pipe *pipe;
1510 pipe = fp->f_data;
1511 PIPE_LOCK(pipe);
1513 error = mac_pipe_check_stat(active_cred, pipe->pipe_pair);
1515 PIPE_UNLOCK(pipe);
1521 if (pipe->pipe_state & PIPE_NAMED) {
1522 PIPE_UNLOCK(pipe);
1527 * Lazily allocate an inode number for the pipe. Most pipe
1528 * users do not call fstat(2) on the pipe, which means that
1536 if (pipe->pipe_ino == (ino_t)-1) {
1539 pipe->pipe_ino = new_unr;
1541 pipe->pipe_ino = 0;
1543 PIPE_UNLOCK(pipe);
1548 if (pipe->pipe_state & PIPE_DIRECTW)
1549 ub->st_size = pipe->pipe_map.cnt;
1551 ub->st_size = pipe->pipe_buffer.cnt;
1553 ub->st_atim = pipe->pipe_atime;
1554 ub->st_mtim = pipe->pipe_mtime;
1555 ub->st_ctim = pipe->pipe_ctime;
1559 ub->st_ino = pipe->pipe_ino;
1584 struct pipe *cpipe;
1603 struct pipe *cpipe;
1617 struct pipe *pi;
1631 struct pipe *cpipe;
1635 ("pipe_free_kmem: pipe mutex locked"));
1654 * shutdown the pipe
1658 struct pipe *cpipe;
1661 struct pipe *ppipe;
1700 * doing that, or the pipe might disappear out from under
1721 * pipe pair. If not, unlock.
1737 struct pipe *cpipe;
1761 /* other end of pipe has been closed */
1781 struct pipe *cpipe = kn->kn_hook;
1792 struct pipe *rpipe = kn->kn_hook;
1793 struct pipe *wpipe = rpipe->pipe_peer;
1815 struct pipe *wpipe;
1818 * If this end of the pipe is closed, the knote was removed from the
1819 * knlist and the list lock (i.e., the pipe lock) is therefore not held.