Implement shm object table
[lttng-ust.git] / libringbuffer / shm_types.h
diff --git a/libringbuffer/shm_types.h b/libringbuffer/shm_types.h
new file mode 100644 (file)
index 0000000..e92c0af
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef _LIBRINGBUFFER_SHM_TYPES_H
+#define _LIBRINGBUFFER_SHM_TYPES_H
+
+/*
+ * libringbuffer/shm_types.h
+ *
+ * Copyright 2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Dual LGPL v2.1/GPL v2 license.
+ */
+
+#include <stdint.h>
+#include "shm_internal.h"
+
+struct channel;
+
+struct shm_object {
+       size_t index;   /* within the object table */
+       int shm_fd;     /* shm fd */
+       int wait_fd[2]; /* fd for wait/wakeup */
+       char *memory_map;
+       size_t memory_map_size;
+       size_t allocated_len;
+};
+
+struct shm_object_table {
+       size_t size;
+       size_t allocated_len;
+       struct shm_object objects[];
+};
+
+struct shm_handle {
+       struct shm_object_table *table;
+       DECLARE_SHMP(struct channel, chan);
+       /*
+        * In the consumer, chan points to a shadow copy, validated upon
+        * reception. The chan object is overridden in the consumer to
+        * point to this shadow copy.
+        */
+       struct channel *shadow_chan;
+};
+
+#endif /* _LIBRINGBUFFER_SHM_TYPES_H */
This page took 0.024682 seconds and 4 git commands to generate.