X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=libringbuffer%2Fshm.h;h=4e9ced198755809cdf63f8140180eeecfb4ff5bd;hb=431d5cf0d589654dfa74e07194dd186f5311cc29;hp=390a5b26bc2890f996577ebbda3d0dc0303cb726;hpb=f4681817263e0d8daa2839da41ea3ef666d6bc1b;p=lttng-ust.git diff --git a/libringbuffer/shm.h b/libringbuffer/shm.h index 390a5b26..4e9ced19 100644 --- a/libringbuffer/shm.h +++ b/libringbuffer/shm.h @@ -11,6 +11,7 @@ #include #include "ust/core.h" +#include "usterr_signal_safe.h" #define SHM_MAGIC 0x54335433 #define SHM_MAJOR 0 @@ -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 */