Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions test/ipc_file_prov_consumer.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>

#include <umf/providers/provider_file_memory.h>

Expand All @@ -15,17 +18,30 @@

int main(int argc, char *argv[]) {
if (argc < 3) {
fprintf(stderr, "usage: %s <port> <file_name>\n", argv[0]);
fprintf(stderr, "usage: %s <port> <file_name> <fsdax>\n", argv[0]);
fprintf(stderr, " <fsdax> should be \"FSDAX\" or \"fsdax\" if "
"<file_name> is located on FSDAX \n");
return -1;
}

int port = atoi(argv[1]);
char *file_name = argv[2];
bool is_fsdax = false;

if (argc >= 4) {
if (strncasecmp(argv[3], "FSDAX", strlen("FSDAX")) == 0) {
is_fsdax = true;
}
}

umf_file_memory_provider_params_t file_params;

file_params = umfFileMemoryProviderParamsDefault(file_name);
file_params.visibility = UMF_MEM_MAP_SHARED;
if (is_fsdax) {
file_params.visibility = UMF_MEM_MAP_SYNC;
} else {
file_params.visibility = UMF_MEM_MAP_SHARED;
}

return run_consumer(port, umfFileMemoryProviderOps(), &file_params, memcopy,
NULL);
Expand Down
4 changes: 2 additions & 2 deletions test/ipc_file_prov_fsdax.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ UMF_LOG_VAL="level:debug;flush:debug;output:stderr;pid:yes"
rm -f ${FILE_NAME}

echo "Starting ipc_file_prov_fsdax CONSUMER on port $PORT ..."
UMF_LOG=$UMF_LOG_VAL ./umf_test-ipc_file_prov_consumer $PORT $FILE_NAME &
UMF_LOG=$UMF_LOG_VAL ./umf_test-ipc_file_prov_consumer $PORT $FILE_NAME "FSDAX" &

echo "Waiting 1 sec ..."
sleep 1

echo "Starting ipc_file_prov_fsdax PRODUCER on port $PORT ..."
UMF_LOG=$UMF_LOG_VAL ./umf_test-ipc_file_prov_producer $PORT $FILE_NAME
UMF_LOG=$UMF_LOG_VAL ./umf_test-ipc_file_prov_producer $PORT $FILE_NAME "FSDAX"

# remove the SHM file
rm -f ${FILE_NAME}
20 changes: 18 additions & 2 deletions test/ipc_file_prov_producer.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>

#include <umf/providers/provider_file_memory.h>

Expand All @@ -15,17 +18,30 @@

int main(int argc, char *argv[]) {
if (argc < 3) {
fprintf(stderr, "usage: %s <port> <file_name>\n", argv[0]);
fprintf(stderr, "usage: %s <port> <file_name> <fsdax>\n", argv[0]);
fprintf(stderr, " <fsdax> should be \"FSDAX\" or \"fsdax\" if "
"<file_name> is located on FSDAX \n");
return -1;
}

int port = atoi(argv[1]);
char *file_name = argv[2];
bool is_fsdax = false;

if (argc >= 4) {
if (strncasecmp(argv[3], "FSDAX", strlen("FSDAX")) == 0) {
is_fsdax = true;
}
}

umf_file_memory_provider_params_t file_params;

file_params = umfFileMemoryProviderParamsDefault(file_name);
file_params.visibility = UMF_MEM_MAP_SHARED;
if (is_fsdax) {
file_params.visibility = UMF_MEM_MAP_SYNC;
} else {
file_params.visibility = UMF_MEM_MAP_SHARED;
}

return run_producer(port, umfFileMemoryProviderOps(), &file_params, memcopy,
NULL);
Expand Down
Loading