Skip to content

Commit 3019efa

Browse files
authored
Merge pull request #873 from ldorau/Fix_os_get_ipc_handle_-_add_protection_and_visibility
Fix os_get_ipc_handle() - add protection and visibility
2 parents a352cf7 + 1621193 commit 3019efa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/provider/provider_os_memory.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,8 @@ typedef struct os_ipc_data_t {
11531153
int fd;
11541154
size_t fd_offset;
11551155
size_t size;
1156+
unsigned protection; // combination of OS-specific protection flags
1157+
unsigned visibility; // memory visibility mode
11561158
// shm_name is a Flexible Array Member because it is optional and its size
11571159
// varies on the Shared Memory object name
11581160
size_t shm_name_len;
@@ -1200,6 +1202,8 @@ static umf_result_t os_get_ipc_handle(void *provider, const void *ptr,
12001202
os_ipc_data->pid = utils_getpid();
12011203
os_ipc_data->fd_offset = (size_t)value - 1;
12021204
os_ipc_data->size = size;
1205+
os_ipc_data->protection = os_provider->protection;
1206+
os_ipc_data->visibility = os_provider->visibility;
12031207
os_ipc_data->shm_name_len = strlen(os_provider->shm_name);
12041208
if (os_ipc_data->shm_name_len > 0) {
12051209
strncpy(os_ipc_data->shm_name, os_provider->shm_name,
@@ -1278,8 +1282,8 @@ static umf_result_t os_open_ipc_handle(void *provider, void *providerIpcData,
12781282
}
12791283
}
12801284

1281-
*ptr = utils_mmap(NULL, os_ipc_data->size, os_provider->protection,
1282-
os_provider->visibility, fd, os_ipc_data->fd_offset);
1285+
*ptr = utils_mmap(NULL, os_ipc_data->size, os_ipc_data->protection,
1286+
os_ipc_data->visibility, fd, os_ipc_data->fd_offset);
12831287
if (*ptr == NULL) {
12841288
os_store_last_native_error(UMF_OS_RESULT_ERROR_ALLOC_FAILED, errno);
12851289
LOG_PERR("memory mapping failed");

0 commit comments

Comments
 (0)