Skip to content
Snippets Groups Projects
Commit 33abdd3a authored by Adam Wujek's avatar Adam Wujek
Browse files

[issue:#216] libwr/shmem: fix mechanism of following pointers in shmem


Fix the calculation of an offset in shmem when reopening shmem.

Signed-off-by: default avatarAdam Wujek <dev_public@wujek.eu>
parent 6d8d7cc8
Branches
Tags
No related merge requests found
......@@ -112,7 +112,14 @@ struct wrs_shm_head *wrs_shm_get(enum wrs_shm_name name_id, char *name,
}
head->fd = fd;
head->sequence = 1; /* a sort of lock */
head->mapbase = head;
/* Set mapbase only for the first call of wrs_shm_get.
* At further calls (probably due to a restart of a writter/writer),
* this is used by wrs_shm_follow to calculate the offset of a given
* pointer from the beginning of shmem. */
if (!head->mapbase)
head->mapbase = head;
strncpy(head->name, name, sizeof(head->name));
head->name[sizeof(head->name) - 1] = '\0';
head->stamp = 0;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment