align.h: Implement ALIGN_FLOOR macro
[lttng-tools.git] / src / common / pipe.h
index 11f41cf1543b7dfe03aed2cb866c49ee2d76dbd0..01fe8824244184a0843b1f1df914ad02136b9167 100644 (file)
@@ -19,6 +19,8 @@
 #define LTTNG_PIPE_H
 
 #include <pthread.h>
+#include <common/macros.h>
+#include <sys/types.h>
 
 enum lttng_pipe_state {
        LTTNG_PIPE_STATE_OPENED = 1,
@@ -49,7 +51,7 @@ struct lttng_pipe {
 /*
  * Return 1 if read side is open else 0.
  */
-static inline int lttng_pipe_is_read_open(struct lttng_pipe *pipe)
+static inline int lttng_pipe_is_read_open(const struct lttng_pipe *pipe)
 {
        return pipe->r_state == LTTNG_PIPE_STATE_OPENED ? 1 : 0;
 }
@@ -57,30 +59,46 @@ static inline int lttng_pipe_is_read_open(struct lttng_pipe *pipe)
 /*
  * Return 1 if write side is open else 0.
  */
-static inline int lttng_pipe_is_write_open(struct lttng_pipe *pipe)
+static inline int lttng_pipe_is_write_open(const struct lttng_pipe *pipe)
 {
        return pipe->w_state == LTTNG_PIPE_STATE_OPENED ? 1 : 0;
 }
 
-static inline int lttng_pipe_get_readfd(struct lttng_pipe *pipe)
+static inline int lttng_pipe_get_readfd(const struct lttng_pipe *pipe)
 {
        return pipe->fd[0];
 }
 
-static inline int lttng_pipe_get_writefd(struct lttng_pipe *pipe)
+static inline int lttng_pipe_get_writefd(const struct lttng_pipe *pipe)
 {
        return pipe->fd[1];
 }
 
+LTTNG_HIDDEN
 struct lttng_pipe *lttng_pipe_open(int flags);
+LTTNG_HIDDEN
+struct lttng_pipe *lttng_pipe_named_open(const char *path, mode_t mode,
+               int flags);
+LTTNG_HIDDEN
 int lttng_pipe_write_close(struct lttng_pipe *pipe);
+LTTNG_HIDDEN
 int lttng_pipe_read_close(struct lttng_pipe *pipe);
 /* Close both side of pipe. */
+LTTNG_HIDDEN
 int lttng_pipe_close(struct lttng_pipe *pipe);
+LTTNG_HIDDEN
 void lttng_pipe_destroy(struct lttng_pipe *pipe);
 
+LTTNG_HIDDEN
 ssize_t lttng_pipe_read(struct lttng_pipe *pipe, void *buf, size_t count);
+LTTNG_HIDDEN
 ssize_t lttng_pipe_write(struct lttng_pipe *pipe, const void *buf,
                size_t count);
+/* Returns and releases the read end of the pipe. */
+LTTNG_HIDDEN
+int lttng_pipe_release_readfd(struct lttng_pipe *pipe);
+/* Returns and releases the write end of the pipe. */
+LTTNG_HIDDEN
+int lttng_pipe_release_writefd(struct lttng_pipe *pipe);
 
 #endif /* LTTNG_PIPE_H */
This page took 0.027453 seconds and 5 git commands to generate.