X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fshm.c;h=23bd9db2085221f341454bee136c76b1a6b91c68;hp=7bb52d4ee2feeb513d59079bf11813f319d8c48a;hb=e6852848914f842a703ea4d35172297ccd066589;hpb=7972d61991f4c7e25772502a3a7ebfe57a57645d diff --git a/src/bin/lttng-sessiond/shm.c b/src/bin/lttng-sessiond/shm.c index 7bb52d4ee..23bd9db20 100644 --- a/src/bin/lttng-sessiond/shm.c +++ b/src/bin/lttng-sessiond/shm.c @@ -16,7 +16,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -73,7 +73,7 @@ static int get_wait_shm(char *shm_path, size_t mmap_size, int global) */ wait_shm_fd = shm_open(shm_path, O_RDWR | O_CREAT, mode); if (wait_shm_fd < 0) { - PERROR("shm_open wait shm"); + PERROR("Failed to open wait shm at %s", shm_path); goto error; } @@ -132,12 +132,20 @@ error: */ char *shm_ust_get_mmap(char *shm_path, int global) { - size_t mmap_size = sysconf(_SC_PAGE_SIZE); + size_t mmap_size; int wait_shm_fd, ret; char *wait_shm_mmap; + long sys_page_size; assert(shm_path); + sys_page_size = sysconf(_SC_PAGE_SIZE); + if (sys_page_size < 0) { + PERROR("sysconf PAGE_SIZE"); + goto error; + } + mmap_size = sys_page_size; + wait_shm_fd = get_wait_shm(shm_path, mmap_size, global); if (wait_shm_fd < 0) { goto error;