PMEMSET_PERSIST(3)

NAME

pmemset_persist() - persist data from the range

SYNOPSIS

    #include <libpmemset.h>
    int pmemset_persist(struct pmemset *set, const void *ptr, size_t size);

DESCRIPTION

The pmemset_persist() function efficiently persists data from set in the range [ptr, ptr + size]. It works on either persistent memory or a memory mapped file on traditional storage. The pmemset_persist() function is combination of pmemset_flush(3) and pmemset_drain(3) functions and can be used interchangeably:

        struct pmemset *set;
        ...
        /* save stores durably on underlying medium */
        pmemset_persist(set, addr, len);

is an equivalent of:

        struct pmemset *set;
        ...
        /* flush the processor caches */
        pmemset_flush(set, addr, len);
        /* wait for any pmem stores to drain from HW buffers */
        pmemset_drain(set);

    NOTE: In the underlying implementation pmemset_persist() uses pmem2_persist_fn returned by pmemset_get_persist_fn(3), so all flush principles are identical for pmemset_persist() function, and you can find them in the pmem2_get_persist_fn(3) man page.

RETURN VALUE

The pmemset_persist() function always returns 0.

SEE ALSO

pmem2_get_persist_fn(3), libpmemset(7), libpmem2(7), and <https://pmem.io>