#include <vppinfra/bitmap.h>
#include <vppinfra/fifo.h>
#include <vppinfra/time.h>
-#include <vppinfra/mheap.h>
#include <vppinfra/heap.h>
#include <vppinfra/pool.h>
#include <vppinfra/format.h>
rp->mutex_owner_pid = getpid ();
rp->mutex_owner_tag = tag;
#endif
- ASSERT (nheld < MAXLOCK);
+ ASSERT (nheld < MAXLOCK); //NOSONAR
/*
* Keep score of held mutexes so we can try to exit
* cleanly if the world comes to an end at the worst possible
}
}
}
-#if USE_DLMALLOC == 0
- s = format (s, " rgn heap stats: %U", format_mheap,
- rp->region_heap, 0);
- if ((rp->flags & SVM_FLAGS_MHEAP) && rp->data_heap)
- {
- s = format (s, "\n data heap stats: %U", format_mheap,
- rp->data_heap, 1);
- }
- s = format (s, "\n");
-#endif
}
return (s);
return -3;
}
close (fd);
- rp->backing_file = (char *) format (0, "%s\0", a->backing_file);
+ CLIB_MEM_UNPOISON (rp->data_base, map_size);
+ rp->backing_file = (char *) format (0, "%s%c", a->backing_file, 0);
rp->flags |= SVM_FLAGS_FILE;
}
if (a->flags & SVM_FLAGS_MHEAP)
{
-#if USE_DLMALLOC == 0
- mheap_t *heap_header;
- rp->data_heap =
- mheap_alloc_with_flags ((void *) (rp->data_base), map_size,
- MHEAP_FLAG_DISABLE_VM);
- heap_header = mheap_header (rp->data_heap);
- heap_header->flags |= MHEAP_FLAG_THREAD_SAFE;
-#else
- rp->data_heap = create_mspace_with_base (rp->data_base,
- map_size, 1 /* locked */ );
- mspace_disable_expand (rp->data_heap);
-#endif
+ rp->data_heap = clib_mem_create_heap (rp->data_base, map_size,
+ 1 /* locked */ , "svm data");
rp->flags |= SVM_FLAGS_MHEAP;
}
return -3;
}
close (fd);
+ CLIB_MEM_UNPOISON (rp->data_base, map_size);
}
return 0;
}
rp->virtual_base = a->baseva;
rp->virtual_size = a->size;
-#if USE_DLMALLOC == 0
- rp->region_heap =
- mheap_alloc_with_flags (uword_to_pointer
- (a->baseva + MMAP_PAGESIZE, void *),
- (a->pvt_heap_size !=
- 0) ? a->pvt_heap_size : SVM_PVT_MHEAP_SIZE,
- MHEAP_FLAG_DISABLE_VM);
-#else
- rp->region_heap = create_mspace_with_base
+ rp->region_heap = clib_mem_create_heap
(uword_to_pointer (a->baseva + MMAP_PAGESIZE, void *),
(a->pvt_heap_size !=
- 0) ? a->pvt_heap_size : SVM_PVT_MHEAP_SIZE, 1 /* locked */ );
-
- mspace_disable_expand (rp->region_heap);
-#endif
+ 0) ? a->pvt_heap_size : SVM_PVT_MHEAP_SIZE, 1 /* locked */ ,
+ "svm region");
oldheap = svm_push_pvt_heap (rp);
return (0);
}
close (svm_fd);
+ CLIB_MEM_UNPOISON (rp, a->size);
svm_region_init_mapped_region (a, rp);
clib_warning ("mmap");
return (0);
}
+
+ CLIB_MEM_UNPOISON (rp, MMAP_PAGESIZE);
+
/*
* We lost the footrace to create this region; make sure
* the winner has crossed the finish line.
close (svm_fd);
+ CLIB_MEM_UNPOISON (rp, a->size);
+
if ((uword) rp != rp->virtual_base)
{
clib_warning ("mmap botch");
return ((void *) rp);
}
- return 0; /* NOTREACHED */
+ return 0; /* NOTREACHED *///NOSONAR
}
static void
int i;
for (i = 0; i < nheld; i++)
{
- pthread_mutex_unlock (mutexes_held[i]);
+ pthread_mutex_unlock (mutexes_held[i]); //NOSONAR
}
}
oldheap = svm_push_pvt_heap (rp); /* nb vec_delete() in the loop */
/* Remove the caller from the list of mappers */
+ CLIB_MEM_UNPOISON (rp->client_pids, vec_bytes (rp->client_pids));
for (i = 0; i < vec_len (rp->client_pids); i++)
{
if (rp->client_pids[i] == mypid)
virtual_base = root_rp->virtual_base;
virtual_size = root_rp->virtual_size;
+ CLIB_MEM_UNPOISON (root_rp->client_pids, vec_bytes (root_rp->client_pids));
for (i = 0; i < vec_len (root_rp->client_pids); i++)
{
if (root_rp->client_pids[i] == mypid)
* find_or_create.
*/
/* *INDENT-OFF* */
- pool_foreach (subp, mp->subregions, ({
+ pool_foreach (subp, mp->subregions) {
name = vec_dup (subp->subregion_name);
vec_add1(svm_names, name);
- }));
+ }
/* *INDENT-ON* */
pthread_mutex_unlock (&root_rp->mutex);