Skip to content

Commit 19106b0

Browse files
committed
Add support for mapping with MAP_SYNC to file provider
Add support for mapping with MAP_SYNC to file provider: use utils_mmap_file() instead of utils_mmap(). Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 61e001e commit 19106b0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

include/umf/providers/provider_file_memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ umfFileMemoryProviderParamsDefault(const char *path) {
4444
umf_file_memory_provider_params_t params = {
4545
path, /* a path to the file */
4646
UMF_PROTECTION_READ | UMF_PROTECTION_WRITE, /* protection */
47-
UMF_MEM_MAP_PRIVATE, /* visibility mode */
47+
UMF_MEM_MAP_SHARED, /* visibility mode */
4848
};
4949

5050
return params;

src/provider/provider_file_memory.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static umf_result_t file_mmap_aligned(file_memory_provider_t *file_provider,
261261
ASSERT_IS_ALIGNED(extended_size, page_size);
262262
ASSERT_IS_ALIGNED(offset_fd, page_size);
263263

264-
void *ptr = utils_mmap(NULL, extended_size, prot, flag, fd, offset_fd);
264+
void *ptr = utils_mmap_file(NULL, extended_size, prot, flag, fd, offset_fd);
265265
if (ptr == NULL) {
266266
LOG_PERR("memory mapping failed");
267267
return UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC;
@@ -612,8 +612,9 @@ static umf_result_t file_open_ipc_handle(void *provider, void *providerIpcData,
612612
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
613613
}
614614

615-
*ptr = utils_mmap(NULL, file_ipc_data->size, file_provider->protection,
616-
file_provider->visibility, fd, file_ipc_data->offset_fd);
615+
*ptr = utils_mmap_file(NULL, file_ipc_data->size, file_provider->protection,
616+
file_provider->visibility, fd,
617+
file_ipc_data->offset_fd);
617618
(void)utils_close_fd(fd);
618619
if (*ptr == NULL) {
619620
file_store_last_native_error(UMF_FILE_RESULT_ERROR_ALLOC_FAILED, errno);

0 commit comments

Comments
 (0)