Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

examples: print a message in case no pmem provided or able to be used #1185

Merged
merged 1 commit into from
Aug 9, 2021
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
1 change: 1 addition & 0 deletions examples/03-read-to-persistent/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ main(int argc, char *argv[])

/* if no pmem support or it is not provided */
if (mr_ptr == NULL) {
(void) fprintf(stderr, NO_PMEM_MSG);
mr_ptr = malloc_aligned(sizeof(struct hello_t));
if (mr_ptr == NULL)
return -1;
Expand Down
6 changes: 5 additions & 1 deletion examples/common/common-conn.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause */
/* Copyright 2020, Intel Corporation */
/* Copyright 2020-2021, Intel Corporation */

/*
* common-conn.h -- a common connection functions declarations for examples
Expand All @@ -17,6 +17,10 @@
#define SIGNATURE_STR "RPMA_EXAMPLE_SIG"
#define SIGNATURE_LEN (strlen(SIGNATURE_STR) + 1)

#define NO_PMEM_MSG "No <pmem-path> provided. Using DRAM instead.\n"
#else
#define NO_PMEM_MSG \
"The example is unable to use libpmem. If unintended please check the build log. Using DRAM instead.\n"
#endif

/*
Expand Down