Update tests/hello test-case layout (cleanup)
[lttng-ust.git] / libringbuffer / shm.h
index 390a5b26bc2890f996577ebbda3d0dc0303cb726..71624e3999a3974ec4b11ea4c2c5045bc29dbaf1 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <stdint.h>
+#include <ust/usterr-signal-safe.h>
 #include "ust/core.h"
 
 #define SHM_MAGIC      0x54335433
@@ -39,6 +40,11 @@ struct shm_header {
        DECLARE_SHMP(struct channel, chan);
 };
 
+struct shm_handle {
+       struct shm_header *header;      /* beginning of mapping */
+       int shmfd;                      /* process-local file descriptor */
+};
+
 #define shmp(shm_offset)               \
        ((__typeof__(****(shm_offset))) (((char *) &(shm_offset)) + (ptrdiff_t) (shm_offset)))
 
@@ -68,4 +74,11 @@ void *zalloc_shm(struct shm_header *shm_header, size_t len)
        return ret;
 }
 
+static inline
+void align_shm(struct shm_header *shm_header, size_t align)
+{
+       size_t offset_len = offset_align(shm_header->shm_allocated, align);
+       shm_header->shm_allocated += offset_len;
+}
+
 #endif /* _LIBRINGBUFFER_SHM_H */
This page took 0.023859 seconds and 4 git commands to generate.