summaryrefslogtreecommitdiffstats
path: root/sys/sys/pipe.h
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1996-02-04 19:56:35 +0000
committerdyson <dyson@FreeBSD.org>1996-02-04 19:56:35 +0000
commit276899d730ed09c8d2362c150aa0908e69928c36 (patch)
treec4581fd40d3e230191bb0fb5da9e47cd2b097e1f /sys/sys/pipe.h
parentda644672140f1509396e47cf079f636657af7168 (diff)
downloadFreeBSD-src-276899d730ed09c8d2362c150aa0908e69928c36.zip
FreeBSD-src-276899d730ed09c8d2362c150aa0908e69928c36.tar.gz
Improve the performance for pipe(2) again. Also include some
fixes for previous version of new pipes from Bruce Evans. This new version: Supports more properly the semantics of select (BDE). Supports "OLD_PIPE" correctly (kern_descrip.c, BDE). Eliminates incorrect EPIPE returns (bash 'pipe broken' messages.) Much faster yet, currently tuned relatively conservatively -- but now gives approx 50% more perf than the new pipes code did originally. (That was about 50% more perf than the original BSD pipe code.) Known bugs outstanding: No support for async io (SIGIO). Will be included soon. Next to do: Merge support for FIFOs. Submitted by: bde
Diffstat (limited to 'sys/sys/pipe.h')
-rw-r--r--sys/sys/pipe.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/sys/sys/pipe.h b/sys/sys/pipe.h
index 68e688a..e402c69 100644
--- a/sys/sys/pipe.h
+++ b/sys/sys/pipe.h
@@ -26,8 +26,24 @@
struct vm_object;
/*
+ * Pipe buffer size, keep moderate in value, pipes take kva space.
+ */
+#ifndef PIPE_SIZE
+#define PIPE_SIZE (16384)
+#endif
+
+/*
+ * PIPE_MINDIRECT MUST be smaller than PIPE_SIZE and MUST be bigger
+ * than PIPE_BUF
+ */
+#ifndef PIPE_MINDIRECT
+#define PIPE_MINDIRECT (8192)
+#endif
+
+#define PIPENPAGES (PIPE_SIZE/PAGE_SIZE + 1)
+/*
* pipe buffer information
- * Separate in, out, cnt is used to simplify calculations.
+ * Seperate in, out, cnt is used to simplify calculations.
*/
struct pipebuf {
u_int cnt; /* number of chars currently in buffer */
@@ -39,6 +55,17 @@ struct pipebuf {
};
/*
+ * information to support direct transfers between processes for pipes
+ */
+struct pipemapping {
+ vm_offset_t kva; /* kernel virtual address */
+ vm_size_t cnt; /* number of chars in buffer */
+ vm_size_t pos; /* current position of transfer */
+ int npages; /* number of pages */
+ vm_page_t ms[PIPENPAGES]; /* pages in source process */
+};
+
+/*
* pipe_state bits
*/
#define PIPE_NBIO 0x1 /* non-blocking I/O */
@@ -50,6 +77,13 @@ struct pipebuf {
#define PIPE_EOF 0x80 /* Pipe is in EOF condition */
#define PIPE_LOCK 0x100 /* Process has exclusive access to pointers/data */
#define PIPE_LWANT 0x200 /* Process wants exclusive access to pointers/data */
+#define PIPE_DIRECTW 0x400 /* Pipe direct write active */
+#define PIPE_DIRECTOK 0x800 /* Direct mode ok */
+
+/*
+ * Buffered write is active when buffer.cnt
+ * field is set.
+ */
/*
* Per-pipe data structure
@@ -58,6 +92,7 @@ struct pipebuf {
*/
struct pipe {
struct pipebuf pipe_buffer; /* data storage */
+ struct pipemapping pipe_map; /* pipe mapping for dir I/O */
struct selinfo pipe_sel; /* for compat with select */
struct timeval pipe_atime; /* time of last access */
struct timeval pipe_mtime; /* time of last modify */
OpenPOWER on IntegriCloud