aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm/ssvm.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-07-04 04:17:41 -0700
committerMarco Varlese <marco.varlese@suse.de>2018-07-06 08:40:18 +0000
commit65784c1602c7c8171effd00384f65f546d93a13b (patch)
treee649a73d3420d1df96e40d0087be6e5d1fbf1f57 /src/svm/ssvm.c
parent01a771b12198b3f07d67a4bc73650c1f65257708 (diff)
svm: add unidirectional message queue
Meant for single reader/writer message exchanges. Supports multiple message rings. Change-Id: I925de9a6ae19226c5c39a63caff76424ed123a13 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/svm/ssvm.c')
-rw-r--r--src/svm/ssvm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/svm/ssvm.c b/src/svm/ssvm.c
index 04e0efa3d62..dfb68c039ad 100644
--- a/src/svm/ssvm.c
+++ b/src/svm/ssvm.c
@@ -29,7 +29,6 @@ int
ssvm_master_init_shm (ssvm_private_t * ssvm)
{
int ssvm_fd, mh_flags = MHEAP_FLAG_DISABLE_VM | MHEAP_FLAG_THREAD_SAFE;
- svm_main_region_t *smr = svm_get_root_rp ()->data_base;
clib_mem_vm_map_t mapa = { 0 };
u8 junk = 0, *ssvm_filename;
ssvm_shared_header_t *sh;
@@ -56,8 +55,13 @@ ssvm_master_init_shm (ssvm_private_t * ssvm)
if (fchmod (ssvm_fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) < 0)
clib_unix_warning ("ssvm segment chmod");
- if (fchown (ssvm_fd, smr->uid, smr->gid) < 0)
- clib_unix_warning ("ssvm segment chown");
+ if (svm_get_root_rp ())
+ {
+ /* TODO: is this really needed? */
+ svm_main_region_t *smr = svm_get_root_rp ()->data_base;
+ if (fchown (ssvm_fd, smr->uid, smr->gid) < 0)
+ clib_unix_warning ("ssvm segment chown");
+ }
if (lseek (ssvm_fd, ssvm->ssvm_size, SEEK_SET) < 0)
{