Skip to content

Commit e45efa6

Browse files
committed
open_ipc_handle should use shm from handle
1 parent e6ff45e commit e45efa6

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

src/provider/provider_os_memory.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,14 +1251,14 @@ static umf_result_t os_open_ipc_handle(void *provider, void *providerIpcData,
12511251
umf_result_t ret = UMF_RESULT_SUCCESS;
12521252
int fd;
12531253

1254-
if (os_provider->shm_name[0]) {
1255-
fd = utils_shm_open(os_provider->shm_name);
1254+
if (os_ipc_data->shm_name[0]) {
1255+
fd = utils_shm_open(os_ipc_data->shm_name);
12561256
if (fd <= 0) {
12571257
LOG_PERR("opening a shared memory file (%s) failed",
1258-
os_provider->shm_name);
1258+
os_ipc_data->shm_name);
12591259
return UMF_RESULT_ERROR_UNKNOWN;
12601260
}
1261-
(void)utils_shm_unlink(os_provider->shm_name);
1261+
(void)utils_shm_unlink(os_ipc_data->shm_name);
12621262
} else {
12631263
umf_result_t umf_result =
12641264
utils_duplicate_fd(os_ipc_data->pid, os_ipc_data->fd, &fd);

test/ipc_os_prov_consumer.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "ipc_os_prov_common.h"
1515

1616
int main(int argc, char *argv[]) {
17-
if (argc < 2) {
18-
fprintf(stderr, "usage: %s <port> [shm_name]\n", argv[0]);
17+
if (argc < 1) {
18+
fprintf(stderr, "usage: %s <port>\n", argv[0]);
1919
return -1;
2020
}
2121

@@ -25,9 +25,6 @@ int main(int argc, char *argv[]) {
2525

2626
os_params = umfOsMemoryProviderParamsDefault();
2727
os_params.visibility = UMF_MEM_MAP_SHARED;
28-
if (argc >= 3) {
29-
os_params.shm_name = argv[2];
30-
}
3128

3229
return run_consumer(port, umfOsMemoryProviderOps(), &os_params, memcopy,
3330
NULL);

test/ipc_os_prov_shm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ echo "Waiting 1 sec ..."
2626
sleep 1
2727

2828
echo "Starting ipc_os_prov_shm PRODUCER on port $PORT ..."
29-
UMF_LOG=$UMF_LOG_VAL ./umf_test-ipc_os_prov_producer $PORT $SHM_NAME
29+
UMF_LOG=$UMF_LOG_VAL ./umf_test-ipc_os_prov_producer $PORT
3030

3131
# remove the SHM file
3232
rm -f /dev/shm/${SHM_NAME}

0 commit comments

Comments
 (0)