1 // SPDX-License-Identifier: BSD-3-Clause
2 /* Copyright 2019-2020, Intel Corporation */
5 * persist_posix.c -- POSIX-specific part of persist implementation
14 #include "pmem2_utils.h"
15 #include "valgrind_internal.h"
18 * pmem2_flush_file_buffers_os -- flush CPU and OS file caches for the given
22 pmem2_flush_file_buffers_os(struct pmem2_map
*map
, const void *addr
, size_t len
,
26 * msync accepts addresses aligned to the page boundary, so we may sync
27 * more and part of it may have been marked as undefined/inaccessible.
28 * Msyncing such memory is not a bug, so as a workaround temporarily
29 * disable error reporting.
31 VALGRIND_DO_DISABLE_ERROR_REPORTING
;
34 ret
= msync((void *)addr
, len
, MS_SYNC
);
40 VALGRIND_DO_PERSIST((uintptr_t)addr
, len
);
42 } while (autorestart
&& ret
< 0 && errno
== EINTR
);
44 VALGRIND_DO_ENABLE_ERROR_REPORTING
;