diff --git a/messaging/msgq.cc b/messaging/msgq.cc index af93bbf..abbefe7 100644 --- a/messaging/msgq.cc +++ b/messaging/msgq.cc @@ -105,6 +105,13 @@ int msgq_new_queue(msgq_queue_t * q, const char * path, size_t size){ close(fd); return -1; } + + rc = fallocate(fd, 0, 0, size + sizeof(msgq_header_t)); + if (rc < 0){ + close(fd); + return -1; + } + char * mem = (char*)mmap(NULL, size + sizeof(msgq_header_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); close(fd);