summaryrefslogtreecommitdiff
path: root/libpipe/pipe.h
diff options
context:
space:
mode:
Diffstat (limited to 'libpipe/pipe.h')
-rw-r--r--libpipe/pipe.h50
1 files changed, 46 insertions, 4 deletions
diff --git a/libpipe/pipe.h b/libpipe/pipe.h
index 701cc918..96432990 100644
--- a/libpipe/pipe.h
+++ b/libpipe/pipe.h
@@ -24,13 +24,16 @@
#define EWOULDBLOCK EAGAIN /* XXX */
#include <cthreads.h> /* For conditions & mutexes */
+#include <features.h>
-#include "pq.h"
-
-#ifndef PIPE_EI
-#define PIPE_EI extern inline
+#ifdef PIPE_DEFINE_EI
+#define PIPE_EI
+#else
+#define PIPE_EI __extern_inline
#endif
+#include "pq.h"
+
/* A description of a class of pipes and how to operate on them. */
struct pipe_class
@@ -107,6 +110,21 @@ struct pipe
/* Pipe flags. */
#define PIPE_BROKEN 0x1 /* This pipe isn't connected. */
+
+extern size_t pipe_readable (struct pipe *pipe, int data_only);
+
+extern int pipe_is_readable (struct pipe *pipe, int data_only);
+
+extern error_t pipe_wait_readable (struct pipe *pipe, int noblock, int data_only);
+
+extern error_t pipe_select_readable (struct pipe *pipe, int data_only);
+
+extern error_t pipe_wait_writable (struct pipe *pipe, int noblock);
+
+extern error_t pipe_select_writable (struct pipe *pipe);
+
+#if defined(__USE_EXTERN_INLINES) || defined(PIPE_DEFINE_EI)
+
/* Returns the number of characters quickly readable from PIPE. If DATA_ONLY
is true, then `control' packets are ignored. */
PIPE_EI size_t
@@ -203,6 +221,8 @@ pipe_select_writable (struct pipe *pipe)
return 0;
}
+#endif /* Use extern inlines. */
+
/* Creates a new pipe of class CLASS and returns it in RESULT. */
error_t pipe_create (struct pipe_class *class, struct pipe **pipe);
@@ -223,6 +243,26 @@ void _pipe_no_readers (struct pipe *pipe);
should be locked. */
void _pipe_no_writers (struct pipe *pipe);
+extern void pipe_acquire_reader (struct pipe *pipe);
+
+extern void pipe_acquire_writer (struct pipe *pipe);
+
+extern void pipe_release_reader (struct pipe *pipe);
+
+extern void pipe_release_writer (struct pipe *pipe);
+
+extern void pipe_add_reader (struct pipe *pipe);
+
+extern void pipe_add_writer (struct pipe *pipe);
+
+extern void pipe_remove_reader (struct pipe *pipe);
+
+extern void pipe_remove_writer (struct pipe *pipe);
+
+extern void pipe_drain (struct pipe *pipe);
+
+#if defined(__USE_EXTERN_INLINES) || defined(PIPE_DEFINE_EI)
+
/* Lock PIPE and increment its readers count. */
PIPE_EI void
pipe_acquire_reader (struct pipe *pipe)
@@ -304,6 +344,8 @@ pipe_drain (struct pipe *pipe)
pq_drain (pipe->queue);
}
+#endif /* Use extern inlines. */
+
/* Writes up to LEN bytes of DATA, to PIPE, which should be locked, and
returns the amount written in AMOUNT. If present, the information in
CONTROL & PORTS is written in a preceding control packet. If an error is