/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
if (res.second) {
// The new element was inserted.
// Generate a shared memory name from the address of the shared_data:
if (res.second) {
// The new element was inserted.
// Generate a shared memory name from the address of the shared_data:
snprintf(shmname, 31, "/shmalloc%p", &*data);
int fd = shm_open(shmname, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (fd < 0) {
snprintf(shmname, 31, "/shmalloc%p", &*data);
int fd = shm_open(shmname, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (fd < 0) {
bool use_huge_page = not huge_page_mount_point.empty();
#ifndef MAP_HUGETLB /* If the system header don't define that mmap flag */
xbt_assert(not use_huge_page,
"Huge pages are not available on your system, you cannot use the smpi/shared-malloc-hugepage option.");
#endif
bool use_huge_page = not huge_page_mount_point.empty();
#ifndef MAP_HUGETLB /* If the system header don't define that mmap flag */
xbt_assert(not use_huge_page,
"Huge pages are not available on your system, you cannot use the smpi/shared-malloc-hugepage option.");
#endif
int nb_shared_blocks = 1;
size_t shared_block_offsets[2] = {0, size};
return smpi_shared_malloc_partial(size, shared_block_offsets, nb_shared_blocks);
int nb_shared_blocks = 1;
size_t shared_block_offsets[2] = {0, size};
return smpi_shared_malloc_partial(size, shared_block_offsets, nb_shared_blocks);
auto low = allocs_metadata.lower_bound(ptr);
if (low != allocs_metadata.end() && low->first == ptr) {
private_blocks = low->second.private_blocks;
auto low = allocs_metadata.lower_bound(ptr);
if (low != allocs_metadata.end() && low->first == ptr) {
private_blocks = low->second.private_blocks;
char loc[PTR_STRLEN];
snprintf(loc, PTR_STRLEN, "%p", ptr);
auto meta = allocs_metadata.find(ptr);
char loc[PTR_STRLEN];
snprintf(loc, PTR_STRLEN, "%p", ptr);
auto meta = allocs_metadata.find(ptr);
XBT_DEBUG("Shared free - no removal - of %p, count = %d", ptr, data->count);
}
XBT_DEBUG("Shared free - no removal - of %p, count = %d", ptr, data->count);
}
auto meta = allocs_metadata.find(ptr);
if (meta != allocs_metadata.end()){
meta->second.data->second.count--;
auto meta = allocs_metadata.find(ptr);
if (meta != allocs_metadata.end()){
meta->second.data->second.count--;