Search is not available for this dataset
repo
stringlengths 2
152
⌀ | file
stringlengths 15
239
| code
stringlengths 0
58.4M
| file_length
int64 0
58.4M
| avg_line_length
float64 0
1.81M
| max_line_length
int64 0
12.7M
| extension_type
stringclasses 364
values |
---|---|---|---|---|---|---|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/check-area.sh
|
#!/usr/bin/env bash
#
# Copyright 2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# Finds applicable area name for specified commit id.
#
if [ -z "$1" ]; then
echo "Missing commit id argument."
exit 1
fi
files=`git show $1 | grep -e "^--- a/" -e "^+++ b/" | grep -v /dev/null | sed "s/^--- a\///" | sed "s/^+++ b\///" | uniq`
git show -q $1
echo
echo "Modified files:"
echo "$files"
function categorize() {
category=$1
shift
cat_files=`echo "$files" | grep $*`
if [ -n "${cat_files}" ]; then
echo "$category"
files=`echo "$files" | grep -v $*`
fi
}
echo
echo "Areas computed basing on the list of modified files: (see utils/check-area.sh for full algorithm)"
categorize pmem -e "^src/libpmem/" -e "^src/include/libpmem.h"
categorize rpmem -e "^src/librpmem/" -e "^src/include/librpmem.h" -e "^src/tools/rpmemd/" -e "^src/rpmem_common/"
categorize log -e "^src/libpmemlog/" -e "^src/include/libpmemlog.h"
categorize blk -e "^src/libpmemblk/" -e "^src/include/libpmemblk.h"
categorize obj -e "^src/libpmemobj/" -e "^src/include/libpmemobj.h" -e "^src/include/libpmemobj/"
categorize pool -e "^src/libpmempool/" -e "^src/include/libpmempool.h" -e "^src/tools/pmempool/"
categorize vmem -e "^src/libvmem/" -e "^src/include/libvmem.h"
categorize vmmalloc -e "^src/libvmmalloc/" -e "^src/include/libvmmalloc.h"
categorize jemalloc -e "^src/jemalloc/" -e "^src/windows/jemalloc_gen/"
categorize cto -e "^src/libpmemcto/" -e "^src/include/libpmemcto.h"
categorize benchmark -e "^src/benchmarks/"
categorize examples -e "^src/examples/"
categorize daxio -e "^src/tools/daxio/"
categorize pmreorder -e "^src/tools/pmreorder/"
categorize test -e "^src/test/"
categorize doc -e "^doc/" -e ".md\$" -e "^ChangeLog" -e "README"
categorize common -e "^src/common/" \
-e "^utils/" \
-e ".inc\$" \
-e ".yml\$" \
-e ".gitattributes" \
-e ".gitignore" \
-e "^.mailmap\$" \
-e "^src/PMDK.sln\$" \
-e "Makefile\$" \
-e "^src/freebsd/" \
-e "^src/windows/" \
-e "^src/include/pmemcompat.h"
echo
echo "If the above list contains more than 1 entry, please consider splitting"
echo "your change into more commits, unless those changes don't make sense "
echo "individually (they do not build, tests do not pass, etc)."
echo "For example, it's perfectly fine to use 'obj' prefix for one commit that"
echo "changes libpmemobj source code, its tests and documentation."
if [ -n "$files" ]; then
echo
echo "Uncategorized files:"
echo "$files"
fi
| 4,060 | 37.311321 | 121 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/check-shebang.sh
|
#!/usr/bin/env bash
#
# Copyright 2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# utils/check-shebang.sh -- interpreter directive check script
#
set -e
err_count=0
for file in $@ ; do
[ ! -f $file ] && continue
SHEBANG=`head -n1 $file | cut -d" " -f1`
[ "${SHEBANG:0:2}" != "#!" ] && continue
if [ "$SHEBANG" != "#!/usr/bin/env" -a $SHEBANG != "#!/bin/sh" ]; then
INTERP=`echo $SHEBANG | rev | cut -d"/" -f1 | rev`
echo "$file:1: error: invalid interpreter directive:" >&2
echo " (is: \"$SHEBANG\", should be: \"#!/usr/bin/env $INTERP\")" >&2
((err_count+=1))
fi
done
if [ "$err_count" == "0" ]; then
echo "Interpreter directives are OK."
else
echo "Found $err_count errors in interpreter directives!" >&2
err_count=1
fi
exit $err_count
| 2,271 | 35.645161 | 73 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/get_aliases.sh
|
#!/usr/bin/env bash
#
# Copyright 2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# get_aliases.sh -- generate map of manuals functions and libraries
#
# usage: run from /pmdk/doc/generated location without parameters:
# ./../../utils/get_aliases.sh
#
# This script searches manpages from section 7 then
# takes all functions from each section using specified pattern
# and at the end to every function it assign real markdown file
# representation based on *.gz file content
#
# Generated libs_map.yml file is used on gh-pages
# to handle functions and their aliases
#
list=("$@")
man_child=("$@")
function search_aliases {
children=$1
for i in ${children[@]}
do
if [ -e $i ]
then
echo "Man: $i"
content=$(head -c 150 $i)
if [[ "$content" == ".so "* ]] ;
then
content=$(basename ${content#".so"})
i="${i%.*}"
echo " $i: $content" >> $map_file
else
r="${i%.*}"
echo " $r: $i" >> $map_file
fi
fi
done
}
function list_pages {
parent="${1%.*}"
list=("$@")
man_child=("$@")
if [ "$parent" == "libpmem" ]; then
man_child=($(ls pmem_*.3))
echo -n "- $parent: " >> $map_file
echo "${man_child[@]}" >> $map_file
fi
if [ "$parent" == "libpmemblk" ]; then
man_child=($(ls pmemblk_*.3))
echo -n "- $parent: " >> $map_file
echo "${man_child[@]}" >> $map_file
fi
if [ "$parent" == "libpmemcto" ]; then
man_child=($(ls pmemcto_*.3))
echo -n "- $parent: " >> $map_file
echo "${man_child[@]}" >> $map_file
fi
if [ "$parent" == "libpmemlog" ]; then
man_child=($(ls pmemlog_*.3))
echo -n "- $parent: " >> $map_file
echo "${man_child[@]}" >> $map_file
fi
if [ "$parent" == "libpmemobj" ]; then
man_child=($(ls pmemobj_*.3))
man_child+=($(ls pobj_*.3))
man_child+=($(ls oid_*.3))
man_child+=($(ls toid_*.3))
man_child+=($(ls direct_*.3))
man_child+=($(ls d_r*.3))
man_child+=($(ls tx_*.3))
echo -n "- $parent: " >> $map_file
echo "${man_child[@]}" >> $map_file
fi
if [ "$parent" == "libvmmalloc" ]; then
man_child=($(ls vmmalloc_*.3 2>/dev/null))
echo -n "- $parent: " >> $map_file
fi
if [ "$parent" == "libvmem" ]; then
man_child=($(ls vmem_*.3))
echo -n "- $parent: " >> $map_file
echo "${man_child[@]}" >> $map_file
fi
if [ "$parent" == "libpmempool" ]; then
man_child=($(ls pmempool_*.3))
echo -n "- $parent: " >> $map_file
echo "${man_child[@]}" >> $map_file
fi
if [ "$parent" == "librpmem" ]; then
man_child=($(ls rpmem_*.3))
echo -n "- $parent: " >> $map_file
echo "${man_child[@]}" >> $map_file
fi
if [ ${#man_child[@]} -ne 0 ]
then
list=${man_child[@]}
search_aliases "${list[@]}"
fi
}
man7=($(ls *.7))
map_file=libs_map.yml
[ -e $map_file ] && rm $map_file
touch $map_file
for i in "${man7[@]}"
do
echo "Library: $i"
list_pages $i
done
| 4,273 | 26.397436 | 73 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/copy-source.sh
|
#!/usr/bin/env bash
#
# Copyright 2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# utils/copy-source.sh -- copy source files (from HEAD) to 'path_to_dir/pmdk'
# directory whether in git repository or not.
#
# usage: ./copy-source.sh [path_to_dir] [srcversion]
set -e
DESTDIR="$1"
SRCVERSION=$2
if [ -d .git ]; then
if [ -n "$(git status --porcelain)" ]; then
echo "Error: Working directory is dirty: $(git status --porcelain)"
exit 1
fi
else
echo "Warning: You are not in git repository, working directory might be dirty."
fi
mkdir -p "$DESTDIR"/pmdk
echo -n $SRCVERSION > "$DESTDIR"/pmdk/.version
if [ -d .git ]; then
git archive HEAD | tar -x -C "$DESTDIR"/pmdk
else
find . \
-maxdepth 1 \
-not -name $(basename "$DESTDIR") \
-not -name . \
-exec cp -r "{}" "$DESTDIR"/pmdk \;
fi
| 2,304 | 34.461538 | 81 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/check-commit.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# Used to check whether all the commit messages in a pull request
# follow the GIT/PMDK guidelines.
#
# usage: ./check-commit.sh
#
if [[ $TRAVIS_REPO_SLUG != "pmem/pmdk" \
|| $TRAVIS_EVENT_TYPE != "pull_request" ]];
then
echo "SKIP: $0 can only be executed for pull requests to pmem/pmdk"
exit 0
fi
# Find all the commits for the current build
if [[ -n "$TRAVIS_COMMIT_RANGE" ]]; then
MERGE_BASE=$(echo $TRAVIS_COMMIT_RANGE | cut -d. -f1)
[ -z $MERGE_BASE ] && \
MERGE_BASE=$(git log --pretty="%cN:%H" | grep GitHub | head -n1 | cut -d: -f2)
commits=$(git log --pretty=%H $MERGE_BASE..$TRAVIS_COMMIT)
else
commits=$TRAVIS_COMMIT
fi
# valid area names
AREAS="pmem\|rpmem\|log\|blk\|obj\|pool\|test\|benchmark\|examples\|vmem\|vmmalloc\|jemalloc\|doc\|common\|cto\|daxio\|pmreorder"
# Check commit message
for commit in $commits; do
subject=$(git log --format="%s" -n 1 $commit)
commit_len=$(git log --format="%s%n%b" -n 1 $commit | wc -L)
prefix=$(echo $subject | sed -n "s/^\($AREAS\)\:.*/\1/p")
if [[ $subject =~ ^Merge.* ]]; then
# skip
continue
fi
if [ "$prefix" = "" ]; then
echo "FAIL: subject line in commit message does not contain valid area name"
echo
./utils/check-area.sh $commit
exit 1
fi
if [ $commit_len -gt 73 ]; then
echo "FAIL: commit message exceeds 72 chars per line (commit_len)"
echo
git log -n 1 $commit
exit 1
fi
done
| 2,977 | 34.035294 | 129 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/build-rpm.sh
|
#!/usr/bin/env bash
#
# Copyright 2014-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# build-rpm.sh - Script for building rpm packages
#
set -e
SCRIPT_DIR=$(dirname $0)
source $SCRIPT_DIR/pkg-common.sh
check_tool rpmbuild
check_file $SCRIPT_DIR/pkg-config.sh
source $SCRIPT_DIR/pkg-config.sh
#
# usage -- print usage message and exit
#
usage()
{
[ "$1" ] && echo Error: $1
cat >&2 <<EOF
Usage: $0 [ -h ] -t version-tag -s source-dir -w working-dir -o output-dir
[ -d distro ] [ -e build-experimental ] [ -c run-check ]
[ -r build-rpmem ] [ -n with-ndctl ] [ -f testconfig-file ]
-h print this help message
-t version-tag source version tag
-s source-dir source directory
-w working-dir working directory
-o output-dir outut directory
-d distro Linux distro name
-e build-experimental build experimental packages
-c run-check run package check
-r build-rpmem build librpmem and rpmemd packages
-n with-ndctl build with libndctl
-f testconfig-file custom testconfig.sh
EOF
exit 1
}
#
# command-line argument processing...
#
args=`getopt he:c:r:n:t:d:s:w:o:f: $*`
[ $? != 0 ] && usage
set -- $args
for arg
do
receivetype=auto
case "$arg"
in
-e)
EXPERIMENTAL="$2"
shift 2
;;
-c)
BUILD_PACKAGE_CHECK="$2"
shift 2
;;
-f)
TEST_CONFIG_FILE="$2"
shift 2
;;
-r)
BUILD_RPMEM="$2"
shift 2
;;
-n)
NDCTL_ENABLE="$2"
shift 2
;;
-t)
PACKAGE_VERSION_TAG="$2"
shift 2
;;
-s)
SOURCE="$2"
shift 2
;;
-w)
WORKING_DIR="$2"
shift 2
;;
-o)
OUT_DIR="$2"
shift 2
;;
-d)
DISTRO="$2"
shift 2
;;
--)
shift
break
;;
esac
done
# check for mandatory arguments
if [ -z "$PACKAGE_VERSION_TAG" -o -z "$SOURCE" -o -z "$WORKING_DIR" -o -z "$OUT_DIR" ]
then
error "Mandatory arguments missing"
usage
fi
# detected distro or defined in cmd
if [ -z "${DISTRO}" ]
then
OS=$(get_os)
if [ "$OS" != "1" ]
then
echo "Detected OS: $OS"
DISTRO=$OS
else
error "Unknown distribution"
exit 1
fi
fi
if [ "$EXTRA_CFLAGS_RELEASE" = "" ]; then
export EXTRA_CFLAGS_RELEASE="-ggdb -fno-omit-frame-pointer"
fi
LIBFABRIC_MIN_VERSION=1.4.2
NDCTL_MIN_VERSION=60.1
RPMBUILD_OPTS=( )
PACKAGE_VERSION=$(get_version $PACKAGE_VERSION_TAG)
if [ -z "$PACKAGE_VERSION" ]
then
error "Can not parse version from '${PACKAGE_VERSION_TAG}'"
exit 1
fi
PACKAGE_SOURCE=${PACKAGE_NAME}-${PACKAGE_VERSION}
SOURCE=$PACKAGE_NAME
PACKAGE_TARBALL=$PACKAGE_SOURCE.tar.gz
RPM_SPEC_FILE=$PACKAGE_SOURCE/$PACKAGE_NAME.spec
MAGIC_INSTALL=$PACKAGE_SOURCE/utils/magic-install.sh
MAGIC_UNINSTALL=$PACKAGE_SOURCE/utils/magic-uninstall.sh
OLDPWD=$PWD
[ -d $WORKING_DIR ] || mkdir -v $WORKING_DIR
[ -d $OUT_DIR ] || mkdir $OUT_DIR
cd $WORKING_DIR
check_dir $SOURCE
mv $SOURCE $PACKAGE_SOURCE
if [ "$DISTRO" = "SLES_like" ]
then
RPM_LICENSE="BSD-3-Clause"
RPM_GROUP_SYS_BASE="System\/Base"
RPM_GROUP_SYS_LIBS="System\/Libraries"
RPM_GROUP_DEV_LIBS="Development\/Libraries\/C and C++"
RPM_PKG_NAME_SUFFIX="1"
RPM_MAKE_FLAGS="BINDIR=""%_bindir"" NORPATH=1"
RPM_MAKE_INSTALL="%fdupes %{buildroot}\/%{_prefix}"
else
RPM_LICENSE="BSD"
RPM_GROUP_SYS_BASE="System Environment\/Base"
RPM_GROUP_SYS_LIBS="System Environment\/Libraries"
RPM_GROUP_DEV_LIBS="Development\/Libraries"
RPM_PKG_NAME_SUFFIX=""
RPM_MAKE_FLAGS="NORPATH=1"
RPM_MAKE_INSTALL=""
fi
#
# Create parametrized spec file required by rpmbuild.
# Most of variables are set in pkg-config.sh file in order to
# keep descriptive values separately from this script.
#
sed -e "s/__VERSION__/$PACKAGE_VERSION/g" \
-e "s/__LICENSE__/$RPM_LICENSE/g" \
-e "s/__PACKAGE_MAINTAINER__/$PACKAGE_MAINTAINER/g" \
-e "s/__PACKAGE_SUMMARY__/$PACKAGE_SUMMARY/g" \
-e "s/__GROUP_SYS_BASE__/$RPM_GROUP_SYS_BASE/g" \
-e "s/__GROUP_SYS_LIBS__/$RPM_GROUP_SYS_LIBS/g" \
-e "s/__GROUP_DEV_LIBS__/$RPM_GROUP_DEV_LIBS/g" \
-e "s/__PKG_NAME_SUFFIX__/$RPM_PKG_NAME_SUFFIX/g" \
-e "s/__MAKE_FLAGS__/$RPM_MAKE_FLAGS/g" \
-e "s/__MAKE_INSTALL_FDUPES__/$RPM_MAKE_INSTALL/g" \
-e "s/__LIBFABRIC_MIN_VER__/$LIBFABRIC_MIN_VERSION/g" \
-e "s/__NDCTL_MIN_VER__/$NDCTL_MIN_VERSION/g" \
$OLDPWD/$SCRIPT_DIR/pmdk.spec.in > $RPM_SPEC_FILE
if [ "$DISTRO" = "SLES_like" ]
then
sed -i '/^#.*bugzilla.redhat/d' $RPM_SPEC_FILE
fi
# do not split on space
IFS=$'\n'
# experimental features
if [ "${EXPERIMENTAL}" = "y" ]
then
# no experimental features for now
RPMBUILD_OPTS+=( )
fi
# librpmem & rpmemd
if [ "${BUILD_RPMEM}" = "y" ]
then
RPMBUILD_OPTS+=(--with fabric)
else
RPMBUILD_OPTS+=(--without fabric)
fi
# daxio & RAS
if [ "${NDCTL_ENABLE}" = "n" ]
then
RPMBUILD_OPTS+=(--without ndctl)
else
RPMBUILD_OPTS+=(--with ndctl)
fi
# use specified testconfig file or default
if [[( -n "${TEST_CONFIG_FILE}") && ( -f "$TEST_CONFIG_FILE" ) ]]
then
echo "Test config file: $TEST_CONFIG_FILE"
RPMBUILD_OPTS+=(--define "_testconfig $TEST_CONFIG_FILE")
else
echo -e "Test config file $TEST_CONFIG_FILE does not exist.\n"\
"Default test config will be used."
fi
# run make check or not
if [ "${BUILD_PACKAGE_CHECK}" == "n" ]
then
RPMBUILD_OPTS+=(--define "_skip_check 1")
fi
tar zcf $PACKAGE_TARBALL $PACKAGE_SOURCE
# Create directory structure for rpmbuild
mkdir -v BUILD SPECS
echo "opts: ${RPMBUILD_OPTS[@]}"
rpmbuild --define "_topdir `pwd`"\
--define "_rpmdir ${OUT_DIR}"\
--define "_srcrpmdir ${OUT_DIR}"\
-ta $PACKAGE_TARBALL \
${RPMBUILD_OPTS[@]}
echo "Building rpm packages done"
exit 0
| 6,899 | 23.041812 | 86 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/pkg-common.sh
|
#
# Copyright 2014-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# pkg-common.sh - common functions and variables for building packages
#
export LC_ALL="C"
function error() {
echo -e "error: $@"
}
function check_dir() {
if [ ! -d $1 ]
then
error "Directory '$1' does not exist."
exit 1
fi
}
function check_file() {
if [ ! -f $1 ]
then
error "File '$1' does not exist."
exit 1
fi
}
function check_tool() {
local tool=$1
if [ -z "$(which $tool 2>/dev/null)" ]
then
error "'${tool}' not installed or not in PATH"
exit 1
fi
}
function format_version () {
echo $1 | sed 's|0*\([0-9]\+\)|\1|g'
}
function get_version_item() {
local INPUT=$1
local TARGET=$2
local REGEX="([^0-9]*)(([0-9]+\.){,2}[0-9]+)([.+-]?.*)"
local VERSION="0.0"
local RELEASE="-$INPUT"
if [[ $INPUT =~ $REGEX ]]
then
VERSION="${BASH_REMATCH[2]}"
RELEASE="${BASH_REMATCH[4]}"
fi
case $TARGET in
version)
echo -n $VERSION
;;
release)
echo -n $RELEASE
;;
*)
error "Wrong target"
exit 1
;;
esac
}
function get_version() {
local VERSION=$(get_version_item $1 version)
local RELEASE=$(get_version_item $1 release)
VERSION=$(format_version $VERSION)
if [ -z "$RELEASE" ]
then
echo -n $VERSION
else
RELEASE=${RELEASE//[-:_.]/"~"}
echo -n ${VERSION}${RELEASE}
fi
}
function get_os() {
if [ -f /etc/os-release ]
then
local OS=$(cat /etc/os-release | grep -m1 -o -P '(?<=NAME=).*($)')
[[ "$OS" =~ SLES|openSUSE ]] && echo -n "SLES_like" ||
([[ "$OS" =~ "Fedora"|"Red Hat"|"CentOS" ]] && echo -n "RHEL_like" || echo 1)
else
echo 1
fi
}
REGEX_DATE_AUTHOR="([a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{4})\s*(.*)"
REGEX_MESSAGE_START="\s*\*\s*(.*)"
REGEX_MESSAGE="\s*(\S.*)"
| 3,230 | 24.440945 | 79 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/build-dpkg.sh
|
#!/usr/bin/env bash
#
# Copyright 2014-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# build-dpkg.sh - Script for building deb packages
#
set -e
SCRIPT_DIR=$(dirname $0)
source $SCRIPT_DIR/pkg-common.sh
#
# usage -- print usage message and exit
#
usage()
{
[ "$1" ] && echo Error: $1
cat >&2 <<EOF
Usage: $0 [ -h ] -t version-tag -s source-dir -w working-dir -o output-dir
[ -e build-experimental ] [ -c run-check ]
[ -n with-ndctl ] [ -f testconfig-file ]
-h print this help message
-t version-tag source version tag
-s source-dir source directory
-w working-dir working directory
-o output-dir outut directory
-e build-experimental build experimental packages
-c run-check run package check
-n with-ndctl build with libndctl
-f testconfig-file custom testconfig.sh
EOF
exit 1
}
#
# command-line argument processing...
#
args=`getopt he:c:r:n:t:d:s:w:o:f: $*`
[ $? != 0 ] && usage
set -- $args
for arg
do
receivetype=auto
case "$arg"
in
-e)
EXPERIMENTAL="$2"
shift 2
;;
-c)
BUILD_PACKAGE_CHECK="$2"
shift 2
;;
-f)
TEST_CONFIG_FILE="$2"
shift 2
;;
-r)
BUILD_RPMEM="$2"
shift 2
;;
-n)
NDCTL_ENABLE="$2"
shift 2
;;
-t)
PACKAGE_VERSION_TAG="$2"
shift 2
;;
-s)
SOURCE="$2"
shift 2
;;
-w)
WORKING_DIR="$2"
shift 2
;;
-o)
OUT_DIR="$2"
shift 2
;;
--)
shift
break
;;
esac
done
# check for mandatory arguments
if [ -z "$PACKAGE_VERSION_TAG" -o -z "$SOURCE" -o -z "$WORKING_DIR" -o -z "$OUT_DIR" ]
then
error "Mandatory arguments missing"
usage
fi
PREFIX=usr
LIB_DIR=$PREFIX/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)
INC_DIR=$PREFIX/include
MAN1_DIR=$PREFIX/share/man/man1
MAN3_DIR=$PREFIX/share/man/man3
MAN5_DIR=$PREFIX/share/man/man5
MAN7_DIR=$PREFIX/share/man/man7
DOC_DIR=$PREFIX/share/doc
if [ "$EXTRA_CFLAGS_RELEASE" = "" ]; then
export EXTRA_CFLAGS_RELEASE="-ggdb -fno-omit-frame-pointer"
fi
LIBFABRIC_MIN_VERSION=1.4.2
NDCTL_MIN_VERSION=60.1
function convert_changelog() {
while read line
do
if [[ $line =~ $REGEX_DATE_AUTHOR ]]
then
DATE="${BASH_REMATCH[1]}"
AUTHOR="${BASH_REMATCH[2]}"
echo " * ${DATE} ${AUTHOR}"
elif [[ $line =~ $REGEX_MESSAGE_START ]]
then
MESSAGE="${BASH_REMATCH[1]}"
echo " - ${MESSAGE}"
elif [[ $line =~ $REGEX_MESSAGE ]]
then
MESSAGE="${BASH_REMATCH[1]}"
echo " ${MESSAGE}"
fi
done < $1
}
function rpmem_install_triggers_overrides() {
cat << EOF > debian/librpmem.install
$LIB_DIR/librpmem.so.*
EOF
cat << EOF > debian/librpmem.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
librpmem: package-name-doesnt-match-sonames
EOF
cat << EOF > debian/librpmem-dev.install
$LIB_DIR/pmdk_debug/librpmem.a $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/librpmem.so $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/librpmem.so.* $LIB_DIR/pmdk_dbg/
$LIB_DIR/librpmem.so
$LIB_DIR/pkgconfig/librpmem.pc
$INC_DIR/librpmem.h
$MAN7_DIR/librpmem.7
$MAN3_DIR/rpmem_*.3
EOF
cat << EOF > debian/librpmem-dev.triggers
interest man-db
EOF
cat << EOF > debian/librpmem-dev.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
# The following warnings are triggered by a bug in debhelper:
# http://bugs.debian.org/204975
postinst-has-useless-call-to-ldconfig
postrm-has-useless-call-to-ldconfig
# We do not want to compile with -O2 for debug version
hardening-no-fortify-functions $LIB_DIR/pmdk_dbg/*
EOF
cat << EOF > debian/rpmemd.install
usr/bin/rpmemd
$MAN1_DIR/rpmemd.1
EOF
cat << EOF > debian/rpmemd.triggers
interest man-db
EOF
cat << EOF > debian/rpmemd.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
EOF
}
function append_rpmem_control() {
cat << EOF >> $CONTROL_FILE
Package: librpmem
Architecture: any
Depends: libfabric (>= $LIBFABRIC_MIN_VERSION), \${shlibs:Depends}, \${misc:Depends}
Description: Persistent Memory remote access support library
librpmem provides low-level support for remote access to persistent memory
(pmem) utilizing RDMA-capable RNICs. The library can be used to replicate
remotely a memory region over RDMA protocol. It utilizes appropriate
persistency mechanism based on remote node’s platform capabilities. The
librpmem utilizes the ssh client to authenticate a user on remote node and for
encryption of connection’s out-of-band configuration data.
.
This library is for applications that use remote persistent memory directly,
without the help of any library-supplied transactions or memory allocation.
Higher-level libraries that build on libpmem are available and are recommended
for most applications.
Package: librpmem-dev
Section: libdevel
Architecture: any
Depends: librpmem (=\${binary:Version}), libpmem-dev, \${shlibs:Depends}, \${misc:Depends}
Description: Development files for librpmem
librpmem provides low-level support for remote access to persistent memory
(pmem) utilizing RDMA-capable RNICs.
.
This package contains libraries and header files used for linking programs
against librpmem.
Package: rpmemd
Section: misc
Architecture: any
Priority: optional
Depends: libfabric (>= $LIBFABRIC_MIN_VERSION), \${shlibs:Depends}, \${misc:Depends}
Description: rpmem daemon
Daemon for Remote Persistent Memory support
EOF
}
function daxio_install_triggers_overrides() {
cat << EOF > debian/daxio.install
usr/bin/daxio
$MAN1_DIR/daxio.1
EOF
cat << EOF > debian/daxio.triggers
interest man-db
EOF
cat << EOF > debian/daxio.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
EOF
}
function append_daxio_control() {
cat << EOF >> $CONTROL_FILE
Package: daxio
Section: misc
Architecture: any
Priority: optional
Depends: libpmem (=\${binary:Version}), libndctl (>= $NDCTL_MIN_VERSION), libdaxctl (>= $NDCTL_MIN_VERSION), \${shlibs:Depends}, \${misc:Depends}
Description: daxio utility
The daxio utility performs I/O on Device DAX devices or zero
a Device DAX device. Since the standard I/O APIs (read/write) cannot be used
with Device DAX, data transfer is performed on a memory-mapped device.
The daxio may be used to dump Device DAX data to a file, restore data from
a backup copy, move/copy data to another device or to erase data from
a device.
EOF
}
if [ "${BUILD_PACKAGE_CHECK}" == "y" ]
then
CHECK_CMD="
override_dh_auto_test:
dh_auto_test
if [ -f $TEST_CONFIG_FILE ]; then\
cp $TEST_CONFIG_FILE src/test/testconfig.sh;\
else\
cp src/test/testconfig.sh.example src/test/testconfig.sh;\
fi
make pcheck ${PCHECK_OPTS}
"
else
CHECK_CMD="
override_dh_auto_test:
"
fi
check_tool debuild
check_tool dch
check_file $SCRIPT_DIR/pkg-config.sh
source $SCRIPT_DIR/pkg-config.sh
PACKAGE_VERSION=$(get_version $PACKAGE_VERSION_TAG)
PACKAGE_RELEASE=1
PACKAGE_SOURCE=${PACKAGE_NAME}-${PACKAGE_VERSION}
PACKAGE_TARBALL_ORIG=${PACKAGE_NAME}_${PACKAGE_VERSION}.orig.tar.gz
MAGIC_INSTALL=utils/magic-install.sh
MAGIC_UNINSTALL=utils/magic-uninstall.sh
CONTROL_FILE=debian/control
[ -d $WORKING_DIR ] || mkdir $WORKING_DIR
[ -d $OUT_DIR ] || mkdir $OUT_DIR
OLD_DIR=$PWD
cd $WORKING_DIR
check_dir $SOURCE
mv $SOURCE $PACKAGE_SOURCE
tar zcf $PACKAGE_TARBALL_ORIG $PACKAGE_SOURCE
cd $PACKAGE_SOURCE
mkdir debian
# Generate compat file
cat << EOF > debian/compat
9
EOF
# Generate control file
cat << EOF > $CONTROL_FILE
Source: $PACKAGE_NAME
Maintainer: $PACKAGE_MAINTAINER
Section: libs
Priority: optional
Standards-version: 4.1.4
Build-Depends: debhelper (>= 9)
Homepage: http://pmem.io/pmdk/
Package: libpmem
Architecture: any
Depends: \${shlibs:Depends}, \${misc:Depends}
Description: Persistent Memory low level support library
libpmem provides low level persistent memory support. In particular, support
for the persistent memory instructions for flushing changes to pmem is
provided.
Package: libpmem-dev
Section: libdevel
Architecture: any
Depends: libpmem (=\${binary:Version}), \${shlibs:Depends}, \${misc:Depends}
Description: Development files for libpmem
libpmem provides low level persistent memory support. In particular, support
for the persistent memory instructions for flushing changes to pmem is
provided.
Package: libpmemblk
Architecture: any
Depends: libpmem (=\${binary:Version}), \${shlibs:Depends}, \${misc:Depends}
Description: Persistent Memory block array support library
libpmemblk implements a pmem-resident array of blocks, all the same size, where
a block is updated atomically with respect to power failure or program
interruption (no torn blocks).
Package: libpmemblk-dev
Section: libdevel
Architecture: any
Depends: libpmemblk (=\${binary:Version}), libpmem-dev, \${shlibs:Depends}, \${misc:Depends}
Description: Development files for libpmemblk
libpmemblk implements a pmem-resident array of blocks, all the same size, where
a block is updated atomically with respect to power failure or program
interruption (no torn blocks).
Package: libpmemlog
Architecture: any
Depends: libpmem (=\${binary:Version}), \${shlibs:Depends}, \${misc:Depends}
Description: Persistent Memory log file support library
libpmemlog implements a pmem-resident log file.
Package: libpmemlog-dev
Section: libdevel
Architecture: any
Depends: libpmemlog (=\${binary:Version}), libpmem-dev, \${shlibs:Depends}, \${misc:Depends}
Description: Development files for libpmemlog
libpmemlog implements a pmem-resident log file.
Package: libpmemcto
Architecture: any
Depends: libpmem (=\${binary:Version}), \${shlibs:Depends}, \${misc:Depends}
Description: Persistent Memory allocator cto library
The libpmemcto library is a persistent memory allocator providing malloc-like
interfaces, with no overhead imposed by run-time flushing or transactional
updates. An overhead is imposed only when program exits normally and have to
flush the pool contents.
.
NOTE: This is an experimental API and should not be used in production
environments.
Package: libpmemcto-dev
Section: libdevel
Architecture: any
Depends: libpmemcto (=\${binary:Version}), libpmem-dev, \${shlibs:Depends}, \${misc:Depends}
Description: Development files for libpmemcto
The libpmemcto library is a persistent memory allocator providing malloc-like
interfaces, with no overhead imposed by run-time flushing or transactional
updates. An overhead is imposed only when program exits normally and have to
flush the pool contents.
.
NOTE: This is an experimental API and should not be used in production
environments.
.
This package contains libraries and header files used for linking programs
against libpmemcto.
Package: libpmemobj
Architecture: any
Depends: libpmem (=\${binary:Version}), \${shlibs:Depends}, \${misc:Depends}
Description: Persistent Memory object store support library
libpmemobj turns a persistent memory file into a flexible object store,
supporting transactions, memory management, locking, lists, and a number of
other features.
Package: libpmemobj-dev
Section: libdevel
Architecture: any
Depends: libpmemobj (=\${binary:Version}), libpmem-dev, \${shlibs:Depends}, \${misc:Depends}
Description: Development files for libpmemobj
libpmemobj turns a persistent memory file into a flexible object store,
supporting transactions, memory management, locking, lists, and a number of
other features.
.
This package contains libraries and header files used for linking programs
against libpmemobj.
Package: libpmempool
Architecture: any
Depends: libpmem (=\${binary:Version}), \${shlibs:Depends}, \${misc:Depends}
Description: Persistent Memory pool management support library
libpmempool provides a set of utilities for management, diagnostics and repair
of persistent memory pools. A pool in this context means a pmemobj pool,
pmemblk pool, pmemlog pool or BTT layout, independent of the underlying
storage. The libpmempool is for applications that need high reliability or
built-in troubleshooting. It may be useful for testing and debugging purposes
also.
Package: libpmempool-dev
Section: libdevel
Architecture: any
Depends: libpmempool (=\${binary:Version}), libpmem-dev, \${shlibs:Depends}, \${misc:Depends}
Description: Development files for libpmempool
libpmempool provides a set of utilities for management, diagnostics and repair
of persistent memory pools.
.
This package contains libraries and header files used for linking programs
against libpmempool.
Package: libvmem
Architecture: any
Depends: \${shlibs:Depends}, \${misc:Depends}
Description: Persistent Memory volatile memory support library
The libvmem library turns a pool of persistent memory into a volatile memory
pool, similar to the system heap but kept separate and with its own
malloc-style API.
.
libvmem supports the traditional malloc/free interfaces on a memory mapped
file. This allows the use of persistent memory as volatile memory, for cases
where the pool of persistent memory is useful to an application, but when the
application doesn’t need it to be persistent.
Package: libvmem-dev
Section: libdevel
Architecture: any
Depends: libvmem (=\${binary:Version}), \${shlibs:Depends}, \${misc:Depends}
Description: Development files for libvmem
The libvmem library turns a pool of persistent memory into a volatile memory
pool, similar to the system heap but kept separate and with its own
malloc-style API.
.
This package contains libraries and header files used for linking programs
against libvmem.
Package: libvmmalloc
Architecture: any
Depends: \${shlibs:Depends}, \${misc:Depends}
Description: Persistent Memory dynamic allocation support library
The libvmmalloc library transparently converts all the dynamic memory
allocations into persistent memory allocations. This allows the use of
persistent memory as volatile memory without modifying the target
application.
Package: libvmmalloc-dev
Section: libdevel
Architecture: any
Depends: libvmmalloc (=\${binary:Version}), \${shlibs:Depends}, \${misc:Depends}
Description: Development files for libvmmalloc
The libvmmalloc library transparently converts all the dynamic memory
allocations into persistent memory allocations.
.
This package contains libraries and header files used for linking programs
against libvmalloc.
Package: $PACKAGE_NAME-dbg
Section: debug
Priority: optional
Architecture: any
Depends: libvmem (=\${binary:Version}), libvmmalloc (=\${binary:Version}), libpmem (=\${binary:Version}), libpmemblk (=\${binary:Version}), libpmemlog (=\${binary:Version}), libpmemobj (=\${binary:Version}), libpmemcto (=\${binary:Version}), libpmempool (=\${binary:Version}), \${misc:Depends}
Description: Debug symbols for PMDK libraries
Debug symbols for all PMDK libraries.
Package: pmempool
Section: misc
Architecture: any
Priority: optional
Depends: \${shlibs:Depends}, \${misc:Depends}
Description: Standalone utility for management and off-line analysis
of Persistent Memory pools created by PMDK libraries. It provides a set
of utilities for administration and diagnostics of Persistent Memory pools.
Pmempool may be useful for troubleshooting by system administrators
and users of the applications based on PMDK libraries.
EOF
cp LICENSE debian/copyright
if [ -n "$NDCTL_ENABLE" ]; then
pass_ndctl_enable="NDCTL_ENABLE=$NDCTL_ENABLE"
else
pass_ndctl_enable=""
fi
cat << EOF > debian/rules
#!/usr/bin/make -f
#export DH_VERBOSE=1
%:
dh \$@
override_dh_strip:
dh_strip --dbg-package=$PACKAGE_NAME-dbg
override_dh_auto_build:
dh_auto_build -- EXPERIMENTAL=${EXPERIMENTAL} prefix=/$PREFIX libdir=/$LIB_DIR includedir=/$INC_DIR docdir=/$DOC_DIR man1dir=/$MAN1_DIR man3dir=/$MAN3_DIR man5dir=/$MAN5_DIR man7dir=/$MAN7_DIR sysconfdir=/etc bashcompdir=/usr/share/bash-completion/completions NORPATH=1 ${pass_ndctl_enable} SRCVERSION=$SRCVERSION
override_dh_auto_install:
dh_auto_install -- EXPERIMENTAL=${EXPERIMENTAL} prefix=/$PREFIX libdir=/$LIB_DIR includedir=/$INC_DIR docdir=/$DOC_DIR man1dir=/$MAN1_DIR man3dir=/$MAN3_DIR man5dir=/$MAN5_DIR man7dir=/$MAN7_DIR sysconfdir=/etc bashcompdir=/usr/share/bash-completion/completions NORPATH=1 ${pass_ndctl_enable} SRCVERSION=$SRCVERSION
find -path './debian/*usr/share/man/man*/*.gz' -exec gunzip {} \;
override_dh_install:
mkdir -p debian/tmp/usr/share/pmdk/
cp utils/pmdk.magic debian/tmp/usr/share/pmdk/
dh_install
${CHECK_CMD}
EOF
chmod +x debian/rules
mkdir debian/source
ITP_BUG_EXCUSE="# This is our first package but we do not want to upload it yet.
# Please refer to Debian Developer's Reference section 5.1 (New packages) for details:
# https://www.debian.org/doc/manuals/developers-reference/pkgs.html#newpackage"
cat << EOF > debian/source/format
3.0 (quilt)
EOF
cat << EOF > debian/libpmem.install
$LIB_DIR/libpmem.so.*
usr/share/pmdk/pmdk.magic
$MAN5_DIR/poolset.5
EOF
cat $MAGIC_INSTALL > debian/libpmem.postinst
sed -i '1s/.*/\#\!\/bin\/bash/' debian/libpmem.postinst
echo $'\n#DEBHELPER#\n' >> debian/libpmem.postinst
cat $MAGIC_UNINSTALL > debian/libpmem.prerm
sed -i '1s/.*/\#\!\/bin\/bash/' debian/libpmem.prerm
echo $'\n#DEBHELPER#\n' >> debian/libpmem.prerm
cat << EOF > debian/libpmem.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
libpmem: package-name-doesnt-match-sonames
EOF
cat << EOF > debian/libpmem-dev.install
$LIB_DIR/pmdk_debug/libpmem.a $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libpmem.so $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libpmem.so.* $LIB_DIR/pmdk_dbg/
$LIB_DIR/libpmem.so
$LIB_DIR/pkgconfig/libpmem.pc
$INC_DIR/libpmem.h
$MAN7_DIR/libpmem.7
$MAN3_DIR/pmem_*.3
EOF
cat << EOF > debian/libpmem-dev.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
# The following warnings are triggered by a bug in debhelper:
# http://bugs.debian.org/204975
postinst-has-useless-call-to-ldconfig
postrm-has-useless-call-to-ldconfig
# We do not want to compile with -O2 for debug version
hardening-no-fortify-functions $LIB_DIR/pmdk_dbg/*
# pmdk provides second set of libraries for debugging.
# These are in /usr/lib/$arch/pmdk_dbg/, but still trigger ldconfig.
# Related issue: https://github.com/pmem/issues/issues/841
libpmem-dev: package-has-unnecessary-activation-of-ldconfig-trigger
EOF
cat << EOF > debian/libpmemblk.install
$LIB_DIR/libpmemblk.so.*
EOF
cat << EOF > debian/libpmemblk.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
libpmemblk: package-name-doesnt-match-sonames
EOF
cat << EOF > debian/libpmemblk-dev.install
$LIB_DIR/pmdk_debug/libpmemblk.a $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libpmemblk.so $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libpmemblk.so.* $LIB_DIR/pmdk_dbg/
$LIB_DIR/libpmemblk.so
$LIB_DIR/pkgconfig/libpmemblk.pc
$INC_DIR/libpmemblk.h
$MAN7_DIR/libpmemblk.7
$MAN3_DIR/pmemblk_*.3
EOF
cat << EOF > debian/libpmemblk-dev.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
# The following warnings are triggered by a bug in debhelper:
# http://bugs.debian.org/204975
postinst-has-useless-call-to-ldconfig
postrm-has-useless-call-to-ldconfig
# We do not want to compile with -O2 for debug version
hardening-no-fortify-functions $LIB_DIR/pmdk_dbg/*
# pmdk provides second set of libraries for debugging.
# These are in /usr/lib/$arch/pmdk_dbg/, but still trigger ldconfig.
# Related issue: https://github.com/pmem/issues/issues/841
libpmemblk-dev: package-has-unnecessary-activation-of-ldconfig-trigger
EOF
cat << EOF > debian/libpmemlog.install
$LIB_DIR/libpmemlog.so.*
EOF
cat << EOF > debian/libpmemlog.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
libpmemlog: package-name-doesnt-match-sonames
EOF
cat << EOF > debian/libpmemlog-dev.install
$LIB_DIR/pmdk_debug/libpmemlog.a $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libpmemlog.so $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libpmemlog.so.* $LIB_DIR/pmdk_dbg/
$LIB_DIR/libpmemlog.so
$LIB_DIR/pkgconfig/libpmemlog.pc
$INC_DIR/libpmemlog.h
$MAN7_DIR/libpmemlog.7
$MAN3_DIR/pmemlog_*.3
EOF
cat << EOF > debian/libpmemlog-dev.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
# The following warnings are triggered by a bug in debhelper:
# http://bugs.debian.org/204975
postinst-has-useless-call-to-ldconfig
postrm-has-useless-call-to-ldconfig
# We do not want to compile with -O2 for debug version
hardening-no-fortify-functions $LIB_DIR/pmdk_dbg/*
# pmdk provides second set of libraries for debugging.
# These are in /usr/lib/$arch/pmdk_dbg/, but still trigger ldconfig.
# Related issue: https://github.com/pmem/issues/issues/841
libpmemlog-dev: package-has-unnecessary-activation-of-ldconfig-trigger
EOF
cat << EOF > debian/libpmemcto.install
$LIB_DIR/libpmemcto.so.*
EOF
cat << EOF > debian/libpmemcto.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
libpmemcto: package-name-doesnt-match-sonames
EOF
cat << EOF > debian/libpmemcto-dev.install
$LIB_DIR/pmdk_debug/libpmemcto.a $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libpmemcto.so $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libpmemcto.so.* $LIB_DIR/pmdk_dbg/
$LIB_DIR/libpmemcto.so
$LIB_DIR/pkgconfig/libpmemcto.pc
$INC_DIR/libpmemcto.h
$MAN7_DIR/libpmemcto.7
$MAN3_DIR/pmemcto*.3
EOF
cat << EOF > debian/libpmemcto-dev.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
# The following warnings are triggered by a bug in debhelper:
# http://bugs.debian.org/204975
postinst-has-useless-call-to-ldconfig
postrm-has-useless-call-to-ldconfig
# We do not want to compile with -O2 for debug version
hardening-no-fortify-functions $LIB_DIR/pmdk_dbg/*
# pmdk provides second set of libraries for debugging.
# These are in /usr/lib/$arch/pmdk_dbg/, but still trigger ldconfig.
# Related issue: https://github.com/pmem/issues/issues/841
libpmemcto-dev: package-has-unnecessary-activation-of-ldconfig-trigger
EOF
cat << EOF > debian/libpmemobj.install
$LIB_DIR/libpmemobj.so.*
EOF
cat << EOF > debian/libpmemobj.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
libpmemobj: package-name-doesnt-match-sonames
EOF
cat << EOF > debian/libpmemobj-dev.install
$LIB_DIR/pmdk_debug/libpmemobj.a $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libpmemobj.so $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libpmemobj.so.* $LIB_DIR/pmdk_dbg/
$LIB_DIR/libpmemobj.so
$LIB_DIR/pkgconfig/libpmemobj.pc
$INC_DIR/libpmemobj.h
$INC_DIR/libpmemobj/*.h
$MAN7_DIR/libpmemobj.7
$MAN3_DIR/pmemobj_*.3
$MAN3_DIR/pobj_*.3
$MAN3_DIR/oid_*.3
$MAN3_DIR/toid*.3
$MAN3_DIR/direct_*.3
$MAN3_DIR/d_r*.3
$MAN3_DIR/tx_*.3
EOF
cat << EOF > debian/libpmemobj-dev.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
# The following warnings are triggered by a bug in debhelper:
# http://bugs.debian.org/204975
postinst-has-useless-call-to-ldconfig
postrm-has-useless-call-to-ldconfig
# We do not want to compile with -O2 for debug version
hardening-no-fortify-functions $LIB_DIR/pmdk_dbg/*
# pmdk provides second set of libraries for debugging.
# These are in /usr/lib/$arch/pmdk_dbg/, but still trigger ldconfig.
# Related issue: https://github.com/pmem/issues/issues/841
libpmemobj-dev: package-has-unnecessary-activation-of-ldconfig-trigger
EOF
cat << EOF > debian/libpmempool.install
$LIB_DIR/libpmempool.so.*
EOF
cat << EOF > debian/libpmempool.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
libpmempool: package-name-doesnt-match-sonames
EOF
cat << EOF > debian/libpmempool-dev.install
$LIB_DIR/pmdk_debug/libpmempool.a $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libpmempool.so $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libpmempool.so.* $LIB_DIR/pmdk_dbg/
$LIB_DIR/libpmempool.so
$LIB_DIR/pkgconfig/libpmempool.pc
$INC_DIR/libpmempool.h
$MAN7_DIR/libpmempool.7
$MAN3_DIR/pmempool_*.3
EOF
cat << EOF > debian/libpmempool-dev.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
# The following warnings are triggered by a bug in debhelper:
# http://bugs.debian.org/204975
postinst-has-useless-call-to-ldconfig
postrm-has-useless-call-to-ldconfig
# We do not want to compile with -O2 for debug version
hardening-no-fortify-functions $LIB_DIR/pmdk_dbg/*
# pmdk provides second set of libraries for debugging.
# These are in /usr/lib/$arch/pmdk_dbg/, but still trigger ldconfig.
# Related issue: https://github.com/pmem/issues/issues/841
libpmempool-dev: package-has-unnecessary-activation-of-ldconfig-trigger
EOF
cat << EOF > debian/libvmem.install
$LIB_DIR/libvmem.so.*
EOF
cat << EOF > debian/libvmem.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
libvmem: package-name-doesnt-match-sonames
EOF
cat << EOF > debian/libvmem-dev.install
$LIB_DIR/pmdk_debug/libvmem.a $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libvmem.so $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libvmem.so.* $LIB_DIR/pmdk_dbg/
$LIB_DIR/libvmem.so
$LIB_DIR/pkgconfig/libvmem.pc
$INC_DIR/libvmem.h
$MAN7_DIR/libvmem.7
$MAN3_DIR/vmem_*.3
EOF
cat << EOF > debian/libvmem-dev.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
# The following warnings are triggered by a bug in debhelper:
# http://bugs.debian.org/204975
postinst-has-useless-call-to-ldconfig
postrm-has-useless-call-to-ldconfig
# We do not want to compile with -O2 for debug version
hardening-no-fortify-functions $LIB_DIR/pmdk_dbg/*
# pmdk provides second set of libraries for debugging.
# These are in /usr/lib/$arch/pmdk_dbg/, but still trigger ldconfig.
# Related issue: https://github.com/pmem/issues/issues/841
libvmem-dev: package-has-unnecessary-activation-of-ldconfig-trigger
EOF
cat << EOF > debian/libvmmalloc.install
$LIB_DIR/libvmmalloc.so.*
EOF
cat << EOF > debian/libvmmalloc.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
libvmmalloc: package-name-doesnt-match-sonames
EOF
cat << EOF > debian/libvmmalloc-dev.install
$LIB_DIR/pmdk_debug/libvmmalloc.a $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libvmmalloc.so $LIB_DIR/pmdk_dbg/
$LIB_DIR/pmdk_debug/libvmmalloc.so.* $LIB_DIR/pmdk_dbg/
$LIB_DIR/libvmmalloc.so
$LIB_DIR/pkgconfig/libvmmalloc.pc
$INC_DIR/libvmmalloc.h
$MAN7_DIR/libvmmalloc.7
EOF
cat << EOF > debian/libvmmalloc-dev.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
# The following warnings are triggered by a bug in debhelper:
# http://bugs.debian.org/204975
postinst-has-useless-call-to-ldconfig
postrm-has-useless-call-to-ldconfig
# We do not want to compile with -O2 for debug version
hardening-no-fortify-functions $LIB_DIR/pmdk_dbg/*
# pmdk provides second set of libraries for debugging.
# These are in /usr/lib/$arch/pmdk_dbg/, but still trigger ldconfig.
# Related issue: https://github.com/pmem/issues/issues/841
libvmmalloc-dev: package-has-unnecessary-activation-of-ldconfig-trigger
EOF
cat << EOF > debian/$PACKAGE_NAME-dbg.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
EOF
cat << EOF > debian/pmempool.install
usr/bin/pmempool
$MAN1_DIR/pmempool.1
$MAN1_DIR/pmempool-*.1
usr/share/bash-completion/completions/pmempool
EOF
cat << EOF > debian/pmempool.lintian-overrides
$ITP_BUG_EXCUSE
new-package-should-close-itp-bug
EOF
# librpmem & rpmemd
if [ "${BUILD_RPMEM}" = "y" -a "${RPMEM_DPKG}" = "y" ]
then
append_rpmem_control;
rpmem_install_triggers_overrides;
fi
# daxio
if [ "${NDCTL_ENABLE}" != "n" ]
then
append_daxio_control;
daxio_install_triggers_overrides;
fi
# Convert ChangeLog to debian format
CHANGELOG_TMP=changelog.tmp
dch --create --empty --package $PACKAGE_NAME -v $PACKAGE_VERSION-$PACKAGE_RELEASE -M -c $CHANGELOG_TMP
touch debian/changelog
head -n1 $CHANGELOG_TMP >> debian/changelog
echo "" >> debian/changelog
convert_changelog ChangeLog >> debian/changelog
echo "" >> debian/changelog
tail -n1 $CHANGELOG_TMP >> debian/changelog
rm $CHANGELOG_TMP
# This is our first release but we do
debuild --preserve-envvar=EXTRA_CFLAGS_RELEASE \
--preserve-envvar=EXTRA_CFLAGS_DEBUG \
--preserve-envvar=EXTRA_CFLAGS \
--preserve-envvar=EXTRA_CXXFLAGS \
--preserve-envvar=EXTRA_LDFLAGS \
--preserve-envvar=NDCTL_ENABLE \
-us -uc
cd $OLD_DIR
find $WORKING_DIR -name "*.deb"\
-or -name "*.dsc"\
-or -name "*.changes"\
-or -name "*.orig.tar.gz"\
-or -name "*.debian.tar.gz" | while read FILE
do
mv -v $FILE $OUT_DIR/
done
exit 0
| 29,336 | 29.84858 | 316 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/check-doc.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# Used to check whether changes to the generated documentation directory
# are made by the authorised user. Used only by travis builds.
#
# usage: ./check-doc.sh
#
directory=doc/generated
allowed_user="Generic builder <nvml-bot@intel.com>"
if [[ -z "$TRAVIS" ]]; then
echo "ERROR: $0 can only be executed on Travis CI."
exit 1
fi
if [[ $TRAVIS_REPO_SLUG != "pmem/pmdk" \
|| $TRAVIS_EVENT_TYPE != "pull_request" ]];
then
echo "SKIP: $0 can only be executed for pull requests to pmem/pmdk"
exit 0
fi
# Find all the commits for the current build
if [[ -n "$TRAVIS_COMMIT_RANGE" ]]; then
commits=$(git rev-list $TRAVIS_COMMIT_RANGE)
else
commits=$TRAVIS_COMMIT
fi
# Check for changes in the generated docs directory
# Only new files are allowed (first version)
for commit in $commits; do
last_author=$(git --no-pager show -s --format='%aN <%aE>' $commit)
if [ "$last_author" == "$allowed_user" ]; then
continue
fi
fail=$(git diff-tree --no-commit-id --name-status -r $commit | grep -c ^M.*$directory)
if [ $fail -ne 0 ]; then
echo "FAIL: changes to ${directory} allowed only by \"${allowed_user}\""
exit 1
fi
done
| 2,727 | 34.428571 | 87 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/check-os.sh
|
#!/usr/bin/env bash
#
# Copyright 2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# Used to check if there are no banned functions in .o file
#
# usage: ./check-os.sh [os.h path] [.o file] [.c file]
EXCLUDE="os_linux|os_thread_linux"
if [[ $2 =~ $EXCLUDE ]]; then
echo "skip $2"
exit 0
fi
symbols=$(nm --demangle --undefined-only --format=posix $2 | sed 's/ U *//g')
functions=$(cat $1 | tr '\n' '|')
out=$(
for sym in $symbols
do
grep -w $functions <<<"$sym"
done | sed 's/$/\(\)/g')
[[ ! -z $out ]] &&
echo -e "`pwd`/$3:1: non wrapped function(s):\n$out\nplease use os wrappers" &&
rm -f $2 && # remove .o file as it don't match requirments
exit 1
exit 0
| 2,176 | 35.898305 | 80 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/magic-uninstall.sh
|
#!/usr/bin/env bash
#
# Copyright 2014-2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# magic-uninstall.sh -- Script for uninstalling magic script
#
set -e
HDR_LOCAL=$(grep "File: pmdk" /etc/magic)
HDR_PKG=$(grep "File: pmdk" /usr/share/pmdk/pmdk.magic)
if [[ $HDR_LOCAL == $HDR_PKG ]]
then
echo "Removing PMDK magic from /etc/magic"
HDR_LINE=$(grep -n "File: pmdk" /etc/magic | cut -f1 -d:)
HDR_PKG_LINE=$(grep -n "File: pmdk" /usr/share/pmdk/pmdk.magic | cut -f1 -d:)
HDR_LINES=$(cat /usr/share/pmdk/pmdk.magic | wc -l)
HDR_FIRST=$(($HDR_LINE - $HDR_PKG_LINE + 1))
HDR_LAST=$(($HDR_FIRST + $HDR_LINES))
sed -i "${HDR_FIRST},${HDR_LAST}d" /etc/magic
fi
| 2,166 | 42.34 | 78 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/pkg-config.sh
|
#
# Copyright 2014-2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Name of package
PACKAGE_NAME="pmdk"
# Name and email of package maintainer
PACKAGE_MAINTAINER="Krzysztof Czurylo <krzysztof.czurylo@intel.com>"
# Brief description of the package
PACKAGE_SUMMARY="Persistent Memory Development Kit"
# Full description of the package
PACKAGE_DESCRIPTION="The collection of libraries and utilities for Persistent Memory Programming"
# Website
PACKAGE_URL="http://pmem.io/pmdk"
| 1,981 | 42.086957 | 97 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/style_check.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# utils/style_check.sh -- common style checking script
#
set -e
ARGS=("$@")
CSTYLE_ARGS=()
CLANG_ARGS=()
CHECK_TYPE=$1
[ -z "$clang_format_bin" ] && clang_format_bin=clang-format
#
# print script usage
#
function usage() {
echo "$0 <check|format> [C/C++ files]"
}
#
# require clang-format version 3.8
#
function check_clang_version() {
set +e
which ${clang_format_bin} &> /dev/null && ${clang_format_bin} --version |\
grep "version 3\.8"\
&> /dev/null
if [ $? -ne 0 ]; then
echo "SKIP: requires clang-format version 3.8"
exit 0
fi
set -e
}
#
# run old cstyle check
#
function run_cstyle() {
if [ $# -eq 0 ]; then
return
fi
${cstyle_bin} -pP $@
}
#
# generate diff with clang-format rules
#
function run_clang_check() {
if [ $# -eq 0 ]; then
return
fi
check_clang_version
for file in $@
do
LINES=$(${clang_format_bin} -style=file $file |\
git diff --no-index $file - | wc -l)
if [ $LINES -ne 0 ]; then
${clang_format_bin} -style=file $file | git diff --no-index $file -
fi
done
}
#
# in-place format according to clang-format rules
#
function run_clang_format() {
if [ $# -eq 0 ]; then
return
fi
check_clang_version
${clang_format_bin} -style=file -i $@
}
for ((i=1; i<$#; i++)) {
IGNORE="$(dirname ${ARGS[$i]})/.cstyleignore"
if [ -e $IGNORE ]; then
if grep -q ${ARGS[$i]} $IGNORE ; then
echo "SKIP ${ARGS[$i]}"
continue
fi
fi
case ${ARGS[$i]} in
*.[ch]pp)
CLANG_ARGS+="${ARGS[$i]} "
;;
*.[ch])
CSTYLE_ARGS+="${ARGS[$i]} "
;;
*)
echo "Unknown argument"
exit 1
;;
esac
}
case $CHECK_TYPE in
check)
run_cstyle ${CSTYLE_ARGS}
run_clang_check ${CLANG_ARGS}
;;
format)
run_clang_format ${CLANG_ARGS}
;;
*)
echo "Invalid parameters"
usage
exit 1
;;
esac
| 3,361 | 21.563758 | 75 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/version.sh
|
#!/usr/bin/env bash
#
# Copyright 2017-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# utils/version.sh -- determine project's version
#
set -e
if [ -f "$1/VERSION" ]; then
cat "$1/VERSION"
exit 0
fi
if [ -f $1/GIT_VERSION ]; then
echo -n "\$Format:%h %d\$" | cmp -s $1/GIT_VERSION - && true
if [ $? -eq 0 ]; then
PARSE_GIT_VERSION=0
else
PARSE_GIT_VERSION=1
fi
else
PARSE_GIT_VERSION=0
fi
if [ $PARSE_GIT_VERSION -eq 1 ]; then
GIT_VERSION_TAG=$(cat $1/GIT_VERSION | grep tag: | sed 's/.*tag: \([0-9a-z.+-]*\).*/\1/')
GIT_VERSION_HASH=$(cat $1/GIT_VERSION | sed -e 's/ .*//')
if [ -n "$GIT_VERSION_TAG" ]; then
echo "$GIT_VERSION_TAG"
exit 0
fi
if [ -n "$GIT_VERSION_HASH" ]; then
echo "$GIT_VERSION_HASH"
exit 0
fi
fi
cd "$1"
GIT_DESCRIBE=$(git describe 2>/dev/null) && true
if [ -n "$GIT_DESCRIBE" ]; then
echo "$GIT_DESCRIBE"
exit 0
fi
# try commit it, git describe can fail when there are no tags (e.g. with shallow clone, like on Travis)
GIT_COMMIT=$(git log -1 --format=%h) && true
if [ -n "$GIT_COMMIT" ]; then
echo "$GIT_COMMIT"
exit 0
fi
cd - >/dev/null
# If nothing works, try to get version from directory name
VER=$(basename `realpath "$1"` | sed 's/pmdk[-]*\([0-9a-z.+-]*\).*/\1/')
if [ -n "$VER" ]; then
echo "$VER"
exit 0
fi
exit 1
| 2,793 | 29.043011 | 103 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/check_license/check-license.c
|
/*
* Copyright 2016-2017, Intel Corporation
* Copyright (c) 2016, Microsoft Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* check-license.c -- check the license in the file
*/
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#define LICENSE_MAX_LEN 2048
#define COPYRIGHT "Copyright "
#define COPYRIGHT_LEN 10
#define COPYRIGHT_SYMBOL "(c) "
#define COPYRIGHT_SYMBOL_LEN 4
#define YEAR_MIN 1900
#define YEAR_MAX 9999
#define YEAR_INIT_MIN 9999
#define YEAR_INIT_MAX 0
#define YEAR_LEN 4
#define LICENSE_BEG "Redistribution and use"
#define LICENSE_END "THE POSSIBILITY OF SUCH DAMAGE."
#define DIFF_LEN 50
#define COMMENT_STR_LEN 5
#define STR_MODE_CREATE "create"
#define STR_MODE_PATTERN "check-pattern"
#define STR_MODE_LICENSE "check-license"
#define ERROR(fmt, ...) fprintf(stderr, "error: " fmt "\n", __VA_ARGS__)
#define ERROR2(fmt, ...) fprintf(stderr, fmt "\n", __VA_ARGS__)
/*
* help_str -- string for the help message
*/
static const char * const help_str =
"Usage: %s <mode> <file_1> <file_2> [filename]\n"
"\n"
"Modes:\n"
" create <file_license> <file_pattern>\n"
" - create a license pattern file <file_pattern>\n"
" from the license text file <file_license>\n"
"\n"
" check-pattern <file_pattern> <file_to_check>\n"
" - check if a license in <file_to_check>\n"
" matches the license pattern in <file_pattern>,\n"
" if it does, copyright dates are printed out (see below)\n"
"\n"
" check-license <file_license> <file_to_check>\n"
" - check if a license in <file_to_check>\n"
" matches the license text in <file_license>,\n"
" if it does, copyright dates are printed out (see below)\n"
"\n"
"In case of 'check_pattern' and 'check_license' modes,\n"
"if the license is correct, it prints out copyright dates\n"
"in the following format: OLDEST_YEAR-NEWEST_YEAR\n"
"\n"
"Return value: returns 0 on success and -1 on error.\n"
"\n";
/*
* read_pattern -- read the pattern from the 'path_pattern' file to 'pattern'
*/
static int
read_pattern(const char *path_pattern, char *pattern)
{
int file_pattern;
ssize_t ret;
if ((file_pattern = open(path_pattern, O_RDONLY)) == -1) {
ERROR("open(): %s: %s", strerror(errno), path_pattern);
return -1;
}
ret = read(file_pattern, pattern, LICENSE_MAX_LEN);
close(file_pattern);
if (ret == -1) {
ERROR("read(): %s: %s", strerror(errno), path_pattern);
return -1;
} else if (ret != LICENSE_MAX_LEN) {
ERROR("read(): incorrect format of the license pattern"
" file (%s)", path_pattern);
return -1;
}
return 0;
}
/*
* write_pattern -- write 'pattern' to the 'path_pattern' file
*/
static int
write_pattern(const char *path_pattern, char *pattern)
{
int file_pattern;
ssize_t ret;
if ((file_pattern = open(path_pattern, O_WRONLY | O_CREAT | O_EXCL,
S_IRUSR | S_IRGRP | S_IROTH)) == -1) {
ERROR("open(): %s: %s", strerror(errno), path_pattern);
return -1;
}
ret = write(file_pattern, pattern, LICENSE_MAX_LEN);
close(file_pattern);
if (ret < LICENSE_MAX_LEN) {
ERROR("write(): %s: %s", strerror(errno), path_pattern);
return -1;
}
return 0;
}
/*
* strstr2 -- locate two substrings in the string
*/
static int
strstr2(const char *str, const char *sub1, const char *sub2,
char **pos1, char **pos2)
{
*pos1 = strstr(str, sub1);
*pos2 = strstr(str, sub2);
if (*pos1 == NULL || *pos2 == NULL)
return -1;
return 0;
}
/*
* format_license -- remove comments and redundant whitespaces from the license
*/
static void
format_license(char *license, size_t length)
{
char comment_str[COMMENT_STR_LEN];
char *comment = license;
size_t comment_len;
int was_space;
size_t w, r;
/* detect a comment string */
while (*comment != '\n')
comment--;
/* is there any comment? */
if (comment + 1 != license) {
/* separate out a comment */
strncpy(comment_str, comment, COMMENT_STR_LEN);
comment = comment_str + 1;
while (isspace(*comment))
comment++;
while (!isspace(*comment))
comment++;
*comment = '\0';
comment_len = strlen(comment_str);
/* replace comments with spaces */
if (comment_len > 2) {
while ((comment = strstr(license, comment_str)) != NULL)
for (w = 1; w < comment_len; w++)
comment[w] = ' ';
} else {
while ((comment = strstr(license, comment_str)) != NULL)
comment[1] = ' ';
}
}
/* replace multiple spaces with one space */
was_space = 0;
for (r = w = 0; r < length; r++) {
if (!isspace(license[r])) {
if (was_space) {
license[w++] = ' ';
was_space = 0;
}
if (w < r)
license[w] = license[r];
w++;
} else {
if (!was_space)
was_space = 1;
}
}
license[w] = '\0';
}
/*
* analyze_license -- check correctness of the license
*/
static int
analyze_license(const char *path_to_check,
char *buffer,
char **license)
{
char *_license;
size_t _length;
char *beg_str, *end_str;
if (strstr2(buffer, LICENSE_BEG, LICENSE_END,
&beg_str, &end_str)) {
if (!beg_str)
ERROR2("%s:1: error: incorrect license"
" (license should start with the string '%s')",
path_to_check, LICENSE_BEG);
else
ERROR2("%s:1: error: incorrect license"
" (license should end with the string '%s')",
path_to_check, LICENSE_END);
return -1;
}
_license = beg_str;
assert((uintptr_t)end_str > (uintptr_t)beg_str);
_length = (size_t)(end_str - beg_str) + strlen(LICENSE_END);
_license[_length] = '\0';
format_license(_license, _length);
*license = _license;
return 0;
}
/*
* create_pattern -- create 'pattern' from the 'path_license' file
*/
static int
create_pattern(const char *path_license, char *pattern)
{
char buffer[LICENSE_MAX_LEN];
char *license;
ssize_t ret;
int file_license;
if ((file_license = open(path_license, O_RDONLY)) == -1) {
ERROR("open(): %s: %s", strerror(errno), path_license);
return -1;
}
memset(buffer, 0, sizeof(buffer));
ret = read(file_license, buffer, LICENSE_MAX_LEN);
close(file_license);
if (ret == -1) {
ERROR("read(): %s: %s", strerror(errno), path_license);
return -1;
}
if (analyze_license(path_license, buffer, &license) == -1)
return -1;
memset(pattern, 0, LICENSE_MAX_LEN);
strncpy(pattern, license, strlen(license) + 1);
return 0;
}
/*
* print_diff -- print the first difference between 'license' and 'pattern'
*/
static void
print_diff(char *license, char *pattern, size_t len)
{
size_t i = 0;
while (i < len && license[i] == pattern[i])
i++;
license[i + 1] = '\0';
pattern[i + 1] = '\0';
i = (i - DIFF_LEN > 0) ? (i - DIFF_LEN) : 0;
while (i > 0 && license[i] != ' ')
i--;
fprintf(stderr, " The first difference is at the end of the line:\n");
fprintf(stderr, " * License: %s\n", license + i);
fprintf(stderr, " * Pattern: %s\n", pattern + i);
}
/*
* verify_license -- compare 'license' with 'pattern' and check correctness
* of the copyright line
*/
static int
verify_license(const char *path_to_check, char *pattern, const char *filename)
{
char buffer[LICENSE_MAX_LEN];
char *license, *copyright;
int file_to_check;
ssize_t ret;
int year_first, year_last;
int min_year_first = YEAR_INIT_MIN;
int max_year_last = YEAR_INIT_MAX;
char *err_str = NULL;
const char *name_to_print = filename ? filename : path_to_check;
if ((file_to_check = open(path_to_check, O_RDONLY)) == -1) {
ERROR("open(): %s: %s", strerror(errno), path_to_check);
return -1;
}
memset(buffer, 0, sizeof(buffer));
ret = read(file_to_check, buffer, LICENSE_MAX_LEN);
close(file_to_check);
if (ret == -1) {
ERROR("read(): %s: %s", strerror(errno), name_to_print);
return -1;
}
if (analyze_license(path_to_check, buffer, &license) == -1)
return -1;
/* check the copyright notice */
copyright = buffer;
while ((copyright = strstr(copyright, COPYRIGHT)) != NULL) {
copyright += COPYRIGHT_LEN;
/* skip the copyright symbol '(c)' if any */
if (strncmp(copyright, COPYRIGHT_SYMBOL,
COPYRIGHT_SYMBOL_LEN) == 0)
copyright += COPYRIGHT_SYMBOL_LEN;
/* look for the first year */
if (!isdigit(*copyright)) {
err_str = "no digit just after the 'Copyright ' string";
break;
}
year_first = atoi(copyright);
if (year_first < YEAR_MIN || year_first > YEAR_MAX) {
err_str = "the first year is wrong";
break;
}
copyright += YEAR_LEN;
if (year_first < min_year_first)
min_year_first = year_first;
if (year_first > max_year_last)
max_year_last = year_first;
/* check if there is the second year */
if (*copyright == ',')
continue;
else if (*copyright != '-') {
err_str = "'-' or ',' expected after the first year";
break;
}
copyright++;
/* look for the second year */
if (!isdigit(*copyright)) {
err_str = "no digit after '-'";
break;
}
year_last = atoi(copyright);
if (year_last < YEAR_MIN || year_last > YEAR_MAX) {
err_str = "the second year is wrong";
break;
}
copyright += YEAR_LEN;
if (year_last > max_year_last)
max_year_last = year_last;
if (*copyright != ',') {
err_str = "',' expected after the second year";
break;
}
}
if (!err_str && min_year_first == YEAR_INIT_MIN)
err_str = "no 'Copyright ' string found";
if (err_str)
/* found an error in the copyright notice */
ERROR2("%s:1: error: incorrect copyright notice: %s",
name_to_print, err_str);
/* now check the license */
if (memcmp(license, pattern, strlen(pattern)) != 0) {
ERROR2("%s:1: error: incorrect license", name_to_print);
print_diff(license, pattern, strlen(pattern));
return -1;
}
if (err_str)
return -1;
/* all checks passed */
if (min_year_first != max_year_last && max_year_last != YEAR_INIT_MAX) {
printf("%i-%i\n", min_year_first, max_year_last);
} else {
printf("%i\n", min_year_first);
}
return 0;
}
/*
* mode_create_pattern_file -- 'create' mode function
*/
static int
mode_create_pattern_file(const char *path_license, const char *path_pattern)
{
char pattern[LICENSE_MAX_LEN];
if (create_pattern(path_license, pattern) == -1)
return -1;
return write_pattern(path_pattern, pattern);
}
/*
* mode_check_pattern -- 'check_pattern' mode function
*/
static int
mode_check_pattern(const char *path_license, const char *path_to_check)
{
char pattern[LICENSE_MAX_LEN];
if (create_pattern(path_license, pattern) == -1)
return -1;
return verify_license(path_to_check, pattern, NULL);
}
/*
* mode_check_license -- 'check_license' mode function
*/
static int
mode_check_license(const char *path_pattern, const char *path_to_check,
const char *filename)
{
char pattern[LICENSE_MAX_LEN];
if (read_pattern(path_pattern, pattern) == -1)
return -1;
return verify_license(path_to_check, pattern, filename);
}
int
main(int argc, char *argv[])
{
if (strcmp(argv[1], STR_MODE_CREATE) == 0) {
if (argc != 4)
goto invalid_args;
return mode_create_pattern_file(argv[2], argv[3]);
} else if (strcmp(argv[1], STR_MODE_PATTERN) == 0) {
if (argc != 5)
goto invalid_args;
return mode_check_license(argv[2], argv[3], argv[4]);
} else if (strcmp(argv[1], STR_MODE_LICENSE) == 0) {
if (argc != 4)
goto invalid_args;
return mode_check_pattern(argv[2], argv[3]);
} else {
ERROR("wrong mode: %s\n", argv[1]);
}
invalid_args:
printf(help_str, argv[0]);
return -1;
}
| 12,980 | 24.353516 | 79 |
c
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/check_license/file-exceptions.sh
|
#!/bin/sh -e
#
# Copyright 2016-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# file-exceptions.sh - filter out files not checked for copyright and license
grep -v -E -e 'src/jemalloc/' -e 'src/windows/jemalloc_gen/' -e '/queue.h$' -e '/getopt.h$' -e '/getopt.c$' -e 'src/common/valgrind/'
| 1,796 | 47.567568 | 133 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/check_license/check-headers.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# check-headers.sh - check copyright and license in source files
SELF=$0
function usage() {
echo "Usage: $SELF <source_root_path> <check_license_bin_path> <license_path> [-h|-v|-a]"
echo " -h, --help this help message"
echo " -v, --verbose verbose mode"
echo " -a, --all check all files (only modified files are checked by default)"
}
if [ "$#" -lt 3 ]; then
usage >&2
exit 2
fi
SOURCE_ROOT=$1
shift
CHECK_LICENSE=$1
shift
LICENSE=$1
shift
PATTERN=`mktemp`
TMP=`mktemp`
TMP2=`mktemp`
TEMPFILE=`mktemp`
rm -f $PATTERN $TMP $TMP2
function exit_if_not_exist()
{
if [ ! -f $1 ]; then
echo "Error: file $1 does not exist. Exiting..." >&2
exit 1
fi
}
if [ "$1" == "-h" -o "$1" == "--help" ]; then
usage
exit 0
fi
exit_if_not_exist $LICENSE
exit_if_not_exist $CHECK_LICENSE
export GIT="git -C ${SOURCE_ROOT}"
$GIT rev-parse || exit 1
if [ -f $SOURCE_ROOT/.git/shallow ]; then
SHALLOW_CLONE=1
echo
echo "Warning: This is a shallow clone. Checking dates in copyright headers"
echo " will be skipped in case of files that have no history."
echo
else
SHALLOW_CLONE=0
fi
VERBOSE=0
CHECK_ALL=0
while [ "$1" != "" ]; do
case $1 in
-v|--verbose)
VERBOSE=1
;;
-a|--all)
CHECK_ALL=1
;;
esac
shift
done
if [ $CHECK_ALL -eq 0 ]; then
CURRENT_COMMIT=$($GIT log --pretty=%H -1)
MERGE_BASE=$($GIT merge-base HEAD origin/master 2>/dev/null)
[ -z $MERGE_BASE ] && \
MERGE_BASE=$($GIT log --pretty="%cN:%H" | grep GitHub | head -n1 | cut -d: -f2)
[ -z $MERGE_BASE -o "$CURRENT_COMMIT" = "$MERGE_BASE" ] && \
CHECK_ALL=1
fi
if [ $CHECK_ALL -eq 1 ]; then
echo "Checking copyright headers of all files..."
GIT_COMMAND="ls-tree -r --name-only HEAD"
else
echo
echo "Warning: will check copyright headers of modified files only,"
echo " in order to check all files issue the following command:"
echo " $ $SELF <source_root_path> <check_license_bin_path> <license_path> -a"
echo " (e.g.: $ $SELF $SOURCE_ROOT $CHECK_LICENSE $LICENSE -a)"
echo
echo "Checking copyright headers of modified files only..."
GIT_COMMAND="diff --name-only $MERGE_BASE $CURRENT_COMMIT"
fi
FILES=$($GIT $GIT_COMMAND | ${SOURCE_ROOT}/utils/check_license/file-exceptions.sh | \
grep -E -e '*\.[chs]$' -e '*\.[ch]pp$' -e '*\.sh$' \
-e '*\.py$' -e '*\.map$' -e 'Makefile*' -e 'TEST*' \
-e '/common.inc$' -e '/match$' -e '/check_whitespace$' \
-e 'LICENSE$' -e 'CMakeLists.txt$' -e '*\.cmake$' | \
xargs)
# jemalloc.mk has to be checked always, because of the grep rules above
FILES="$FILES src/jemalloc/jemalloc.mk"
# create a license pattern file
$CHECK_LICENSE create $LICENSE $PATTERN
[ $? -ne 0 ] && exit 1
RV=0
for file in $FILES ; do
# The src_path is a path which should be used in every command except git.
# git is called with -C flag so filepaths should be relative to SOURCE_ROOT
src_path="${SOURCE_ROOT}/$file"
[ ! -f $src_path ] && continue
# ensure that file is UTF-8 encoded
ENCODING=`file -b --mime-encoding $src_path`
iconv -f $ENCODING -t "UTF-8" $src_path > $TEMPFILE
YEARS=`$CHECK_LICENSE check-pattern $PATTERN $TEMPFILE $src_path`
if [ $? -ne 0 ]; then
echo -n $YEARS
RV=1
else
HEADER_FIRST=`echo $YEARS | cut -d"-" -f1`
HEADER_LAST=` echo $YEARS | cut -d"-" -f2`
if [ $SHALLOW_CLONE -eq 0 ]; then
$GIT log --no-merges --format="%ai %aE" -- $file | sort > $TMP
else
# mark the grafted commits (commits with no parents)
$GIT log --no-merges --format="%ai %aE grafted-%p-commit" -- $file | sort > $TMP
fi
# skip checking dates for non-Intel commits
[[ ! $(tail -n1 $TMP) =~ "@intel.com" ]] && continue
# skip checking dates for new files
[ $(cat $TMP | wc -l) -le 1 ] && continue
# grep out the grafted commits (commits with no parents)
# and skip checking dates for non-Intel commits
grep -v -e "grafted--commit" $TMP | grep -e "@intel.com" > $TMP2
[ $(cat $TMP2 | wc -l) -eq 0 ] && continue
FIRST=`head -n1 $TMP2`
LAST=` tail -n1 $TMP2`
COMMIT_FIRST=`echo $FIRST | cut -d"-" -f1`
COMMIT_LAST=` echo $LAST | cut -d"-" -f1`
if [ "$COMMIT_FIRST" != "" -a "$COMMIT_LAST" != "" ]; then
if [ $HEADER_LAST -lt $COMMIT_LAST ]; then
if [ $HEADER_FIRST -lt $COMMIT_FIRST ]; then
COMMIT_FIRST=$HEADER_FIRST
fi
COMMIT_LAST=`date +%G`
if [ $COMMIT_FIRST -eq $COMMIT_LAST ]; then
NEW=$COMMIT_LAST
else
NEW=$COMMIT_FIRST-$COMMIT_LAST
fi
echo "$file:1: error: wrong copyright date: (is: $YEARS, should be: $NEW)" >&2
RV=1
fi
else
echo "error: unknown commit dates in file: $file" >&2
RV=1
fi
fi
done
rm -f $TMP $TMP2 $TEMPFILE
# check if error found
if [ $RV -eq 0 ]; then
echo "Copyright headers are OK."
else
echo "Error(s) in copyright headers found!" >&2
fi
exit $RV
| 6,380 | 28.817757 | 90 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/build-local.sh
|
#!/usr/bin/env bash
#
# Copyright 2017-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# build-local.sh - runs a Docker container from a Docker image with environment
# prepared for building PMDK project and starts building PMDK
#
# this script is for building PMDK locally (not on Travis)
#
# Notes:
# - run this script from its location or set the variable 'HOST_WORKDIR' to
# where the root of the PMDK project is on the host machine,
# - set variables 'OS' and 'OS_VER' properly to a system you want to build PMDK
# on (for proper values take a look on the list of Dockerfiles at the
# utils/docker/images directory), eg. OS=ubuntu, OS_VER=16.04.
# - set 'KEEP_TEST_CONFIG' variable to 1 if you do not want the tests to be
# reconfigured (your current test configuration will be preserved and used)
# - tests with Device Dax are not supported by pcheck yet, so do not provide
# these devices in your configuration
#
set -e
# Environment variables that can be customized (default values are after dash):
export KEEP_CONTAINER=${KEEP_CONTAINER:-0}
export KEEP_TEST_CONFIG=${KEEP_TEST_CONFIG:-0}
export TEST_BUILD=${TEST_BUILD:-all}
export REMOTE_TESTS=${REMOTE_TESTS:-1}
export MAKE_PKG=${MAKE_PKG:-0}
export EXTRA_CFLAGS=${EXTRA_CFLAGS}
export EXTRA_CXXFLAGS=${EXTRA_CXXFLAGS:-}
export PMDK_CC=${PMDK_CC:-gcc}
export PMDK_CXX=${PMDK_CXX:-g++}
export EXPERIMENTAL=${EXPERIMENTAL:-n}
export VALGRIND=${VALGRIND:-1}
if [[ -z "$OS" || -z "$OS_VER" ]]; then
echo "ERROR: The variables OS and OS_VER have to be set " \
"(eg. OS=ubuntu, OS_VER=16.04)."
exit 1
fi
if [[ -z "$HOST_WORKDIR" ]]; then
HOST_WORKDIR=$(readlink -f ../..)
fi
if [[ "$KEEP_CONTAINER" != "1" ]]; then
RM_SETTING=" --rm"
fi
imageName=pmem/pmdk:${OS}-${OS_VER}
containerName=pmdk-${OS}-${OS_VER}
if [[ $MAKE_PKG -eq 1 ]] ; then
command="./run-build-package.sh"
else
command="./run-build.sh"
fi
if [ -n "$DNS_SERVER" ]; then DNS_SETTING=" --dns=$DNS_SERVER "; fi
if [ -z "$NDCTL_ENABLE" ]; then ndctl_enable=; else ndctl_enable="--env NDCTL_ENABLE=$NDCTL_ENABLE"; fi
WORKDIR=/pmdk
SCRIPTSDIR=$WORKDIR/utils/docker
echo Building ${OS}-${OS_VER}
# Run a container with
# - environment variables set (--env)
# - host directory containing PMDK source mounted (-v)
# - working directory set (-w)
docker run --privileged=true --name=$containerName -ti \
$RM_SETTING \
$DNS_SETTING \
--env http_proxy=$http_proxy \
--env https_proxy=$https_proxy \
--env CC=$PMDK_CC \
--env CXX=$PMDK_CXX \
--env VALGRIND=$VALGRIND \
--env EXTRA_CFLAGS=$EXTRA_CFLAGS \
--env EXTRA_CXXFLAGS=$EXTRA_CXXFLAGS \
--env REMOTE_TESTS=$REMOTE_TESTS \
--env CONFIGURE_TESTS=$CONFIGURE_TESTS \
--env TEST_BUILD=$TEST_BUILD \
--env WORKDIR=$WORKDIR \
--env EXPERIMENTAL=$EXPERIMENTAL \
--env SCRIPTSDIR=$SCRIPTSDIR \
--env CLANG_FORMAT=clang-format-3.8 \
--env KEEP_TEST_CONFIG=$KEEP_TEST_CONFIG \
$ndctl_enable \
-v $HOST_WORKDIR:$WORKDIR \
-v /etc/localtime:/etc/localtime \
$DAX_SETTING \
-w $SCRIPTSDIR \
$imageName $command
| 4,536 | 35.007937 | 103 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/run-build.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# run-build.sh - is called inside a Docker container; prepares the environment
# and starts a build of PMDK project.
#
set -e
# Prepare build environment
./prepare-for-build.sh
# Build librpmem even if libfabric is not compiled with ibverbs
export RPMEM_DISABLE_LIBIBVERBS=y
# Build all and run tests
cd $WORKDIR
make check-license
make cstyle
make -j2 USE_LIBUNWIND=1
make -j2 test USE_LIBUNWIND=1
make -j2 pcheck TEST_BUILD=$TEST_BUILD
make DESTDIR=/tmp source
| 2,073 | 36.709091 | 78 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/prepare-for-build.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# prepare-for-build.sh - is called inside a Docker container; prepares
# the environment inside a Docker container for
# running build of PMDK project.
#
set -e
# Mount filesystem for tests
echo $USERPASS | sudo -S mount -t tmpfs none /tmp -osize=6G
# Configure tests (e.g. ssh for remote tests) unless the current configuration
# should be preserved
KEEP_TEST_CONFIG=${KEEP_TEST_CONFIG:-0}
if [[ "$KEEP_TEST_CONFIG" == 0 ]]; then
./configure-tests.sh
fi
# Check for changes in automatically generated docs (only when on Travis)
if [[ -n "$TRAVIS" ]]; then
../check-doc.sh
fi
| 2,218 | 39.345455 | 78 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/run-build-package.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# run-build-package.sh - is called inside a Docker container; prepares
# the environment and starts a build of PMDK project.
#
set -e
# Prepare build enviromnent
./prepare-for-build.sh
# Build librpmem even if libfabric is not compiled with ibverbs
export RPMEM_DISABLE_LIBIBVERBS=y
# Create fake tag, so that package has proper 'version' field
git config user.email "test@package.com"
git config user.name "test package"
git tag -a 1.4.99 -m "1.4" HEAD~1
# Build all and run tests
cd $WORKDIR
export PCHECK_OPTS=-j2
make -j2 $PACKAGE_MANAGER
# Install packages
if [[ "$PACKAGE_MANAGER" == "dpkg" ]]; then
cd $PACKAGE_MANAGER
echo $USERPASS | sudo -S dpkg --install -R *.deb
else
cd $PACKAGE_MANAGER/x86_64
echo $USERPASS | sudo -S rpm --install *.rpm
fi
# Compile and run standalone test
cd $WORKDIR/utils/docker/test_package
make LIBPMEMOBJ_MIN_VERSION=1.4
./test_package testfile1
| 2,508 | 35.362319 | 76 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/pull-or-rebuild-image.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# pull-or-rebuild-image.sh - rebuilds the Docker image used in the
# current Travis build if necessary.
#
# The script rebuilds the Docker image if the Dockerfile for the current
# OS version (Dockerfile.${OS}-${OS_VER}) or any .sh script from the directory
# with Dockerfiles were modified and committed.
#
# If the Travis build is not of the "pull_request" type (i.e. in case of
# merge after pull_request) and it succeed, the Docker image should be pushed
# to the Docker Hub repository. An empty file is created to signal that to
# further scripts.
#
# If the Docker image does not have to be rebuilt, it will be pulled from
# Docker Hub.
#
set -e
if [[ "$TRAVIS_EVENT_TYPE" != "cron" && "$TRAVIS_BRANCH" != "coverity_scan" \
&& "$COVERITY" -eq 1 ]]; then
echo "INFO: Skip Coverity scan job if build is triggered neither by " \
"'cron' nor by a push to 'coverity_scan' branch"
exit 0
fi
if [[ ( "$TRAVIS_EVENT_TYPE" == "cron" || "$TRAVIS_BRANCH" == "coverity_scan" )\
&& "$COVERITY" -ne 1 ]]; then
echo "INFO: Skip regular jobs if build is triggered either by 'cron'" \
" or by a push to 'coverity_scan' branch"
exit 0
fi
if [[ -z "$OS" || -z "$OS_VER" ]]; then
echo "ERROR: The variables OS and OS_VER have to be set properly " \
"(eg. OS=ubuntu, OS_VER=16.04)."
exit 1
fi
if [[ -z "$HOST_WORKDIR" ]]; then
echo "ERROR: The variable HOST_WORKDIR has to contain a path to " \
"the root of the PMDK project on the host machine"
exit 1
fi
# TRAVIS_COMMIT_RANGE is usually invalid for force pushes - ignore such values
# when used with non-upstream repository
if [ -n "$TRAVIS_COMMIT_RANGE" -a $TRAVIS_REPO_SLUG != "pmem/pmdk" ]; then
if ! git rev-list $TRAVIS_COMMIT_RANGE; then
TRAVIS_COMMIT_RANGE=
fi
fi
# Find all the commits for the current build
if [[ -n "$TRAVIS_COMMIT_RANGE" ]]; then
commits=$(git rev-list $TRAVIS_COMMIT_RANGE)
else
commits=$TRAVIS_COMMIT
fi
echo "Commits in the commit range:"
for commit in $commits; do echo $commit; done
# Get the list of files modified by the commits
files=$(for commit in $commits; do git diff-tree --no-commit-id --name-only \
-r $commit; done | sort -u)
echo "Files modified within the commit range:"
for file in $files; do echo $file; done
# Path to directory with Dockerfiles and image building scripts
images_dir_name=images
base_dir=utils/docker/$images_dir_name
# Check if committed file modifications require the Docker image to be rebuilt
for file in $files; do
# Check if modified files are relevant to the current build
if [[ $file =~ ^($base_dir)\/Dockerfile\.($OS)-($OS_VER)$ ]] \
|| [[ $file =~ ^($base_dir)\/.*\.sh$ ]]
then
# Rebuild Docker image for the current OS version
echo "Rebuilding the Docker image for the Dockerfile.$OS-$OS_VER"
pushd $images_dir_name
./build-image.sh ${OS}-${OS_VER}
popd
# Check if the image has to be pushed to Docker Hub
# (i.e. the build is triggered by commits to the pmem/pmdk
# repository's master branch, and the Travis build is not
# of the "pull_request" type). In that case, create the empty
# file.
if [[ $TRAVIS_REPO_SLUG == "pmem/pmdk" \
&& $TRAVIS_BRANCH == "master" \
&& $TRAVIS_EVENT_TYPE != "pull_request"
&& $PUSH_IMAGE == "1" ]]
then
echo "The image will be pushed to Docker Hub"
touch push_image_to_repo_flag
else
echo "Skip pushing the image to Docker Hub"
fi
if [[ $PUSH_IMAGE == "1" ]]
then
echo "Skip build package check if image has to be pushed"
touch skip_build_package_check
fi
exit 0
fi
done
# Getting here means rebuilding the Docker image is not required.
# Pull the image from Docker Hub.
docker pull pmem/pmdk:${OS}-${OS_VER}
| 5,286 | 35.462069 | 80 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/configure-tests.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# configure-tests.sh - is called inside a Docker container; configures tests
# and ssh server for use during build of PMDK project.
#
set -e
# Configure tests
cat << EOF > $WORKDIR/src/test/testconfig.sh
LONGDIR=LoremipsumdolorsitametconsecteturadipiscingelitVivamuslacinianibhattortordictumsollicitudinNullamvariusvestibulumligulaetegestaselitsemperidMaurisultriciesligulaeuipsumtinciduntluctusMorbimaximusvariusdolorid
# this path is ~3000 characters long
DIRSUFFIX="$LONGDIR/$LONGDIR/$LONGDIR/$LONGDIR/$LONGDIR"
NON_PMEM_FS_DIR=/tmp
PMEM_FS_DIR=/tmp
PMEM_FS_DIR_FORCE_PMEM=1
TEST_BUILD="debug nondebug"
ENABLE_SUDO_TESTS=y
TM=1
EOF
# Configure remote tests
if [[ $REMOTE_TESTS -eq 1 ]]; then
echo "Configuring remote tests"
cat << EOF >> $WORKDIR/src/test/testconfig.sh
NODE[0]=127.0.0.1
NODE_WORKING_DIR[0]=/tmp/node0
NODE_ADDR[0]=127.0.0.1
NODE_ENV[0]="PMEM_IS_PMEM_FORCE=1"
NODE[1]=127.0.0.1
NODE_WORKING_DIR[1]=/tmp/node1
NODE_ADDR[1]=127.0.0.1
NODE_ENV[1]="PMEM_IS_PMEM_FORCE=1"
NODE[2]=127.0.0.1
NODE_WORKING_DIR[2]=/tmp/node2
NODE_ADDR[2]=127.0.0.1
NODE_ENV[2]="PMEM_IS_PMEM_FORCE=1"
NODE[3]=127.0.0.1
NODE_WORKING_DIR[3]=/tmp/node3
NODE_ADDR[3]=127.0.0.1
NODE_ENV[3]="PMEM_IS_PMEM_FORCE=1"
TEST_BUILD="debug nondebug"
TEST_PROVIDERS=sockets
EOF
mkdir -p ~/.ssh/cm
cat << EOF >> ~/.ssh/config
Host 127.0.0.1
StrictHostKeyChecking no
ControlPath ~/.ssh/cm/%r@%h:%p
ControlMaster auto
ControlPersist 10m
EOF
if [ ! -f /etc/ssh/ssh_host_rsa_key ]
then
(echo $USERPASS | sudo -S ssh-keygen -t rsa -C $USER@$HOSTNAME -P '' -f /etc/ssh/ssh_host_rsa_key)
fi
echo $USERPASS | sudo -S sh -c 'cat /etc/ssh/ssh_host_rsa_key.pub >> /etc/ssh/authorized_keys'
ssh-keygen -t rsa -C $USER@$HOSTNAME -P '' -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod -R 700 ~/.ssh
chmod 640 ~/.ssh/authorized_keys
chmod 600 ~/.ssh/config
# Start ssh service
echo $USERPASS | sudo -S $START_SSH_COMMAND
ssh 127.0.0.1 exit 0
else
echo "Skipping remote tests"
echo
echo "Removing all libfabric.pc files in order to simulate that libfabric is not installed:"
find /usr -name "libfabric.pc" 2>/dev/null
echo $USERPASS | sudo -S sh -c 'find /usr -name "libfabric.pc" -exec rm -f {} + 2>/dev/null'
fi
| 3,843 | 34.266055 | 216 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/build-travis.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# build-travis.sh - runs a Docker container from a Docker image with environment
# prepared for building PMDK project and starts building PMDK
#
# this script is for building PMDK on Travis only
#
set -e
if [[ "$TRAVIS_EVENT_TYPE" != "cron" && "$TRAVIS_BRANCH" != "coverity_scan" \
&& "$COVERITY" -eq 1 ]]; then
echo "INFO: Skip Coverity scan job if build is triggered neither by " \
"'cron' nor by a push to 'coverity_scan' branch"
exit 0
fi
if [[ ( "$TRAVIS_EVENT_TYPE" == "cron" || "$TRAVIS_BRANCH" == "coverity_scan" )\
&& "$COVERITY" -ne 1 ]]; then
echo "INFO: Skip regular jobs if build is triggered either by 'cron'" \
" or by a push to 'coverity_scan' branch"
exit 0
fi
if [[ -z "$OS" || -z "$OS_VER" ]]; then
echo "ERROR: The variables OS and OS_VER have to be set properly " \
"(eg. OS=ubuntu, OS_VER=16.04)."
exit 1
fi
if [[ -z "$HOST_WORKDIR" ]]; then
echo "ERROR: The variable HOST_WORKDIR has to contain a path to " \
"the root of the PMDK project on the host machine"
exit 1
fi
if [[ -z "$TEST_BUILD" ]]; then
TEST_BUILD=all
fi
imageName=pmem/pmdk:${OS}-${OS_VER}
containerName=pmdk-${OS}-${OS_VER}
if [[ $MAKE_PKG -eq 0 ]] ; then command="./run-build.sh"; fi
if [[ $MAKE_PKG -eq 1 ]] ; then command="./run-build-package.sh"; fi
if [[ $COVERAGE -eq 1 ]] ; then command="./run-coverage.sh"; ci_env=`bash <(curl -s https://codecov.io/env)`; fi
if [[ ( "$TRAVIS_EVENT_TYPE" == "cron" || "$TRAVIS_BRANCH" == "coverity_scan" )\
&& "$COVERITY" -eq 1 ]]; then
command="./run-coverity.sh"
fi
if [ -n "$DNS_SERVER" ]; then DNS_SETTING=" --dns=$DNS_SERVER "; fi
if [[ $SKIP_CHECK -eq 1 ]]; then BUILD_PACKAGE_CHECK=n; else BUILD_PACKAGE_CHECK=y; fi
if [ -z "$NDCTL_ENABLE" ]; then ndctl_enable=; else ndctl_enable="--env NDCTL_ENABLE=$NDCTL_ENABLE"; fi
WORKDIR=/pmdk
SCRIPTSDIR=$WORKDIR/utils/docker
# Run a container with
# - environment variables set (--env)
# - host directory containing PMDK source mounted (-v)
# - working directory set (-w)
docker run --rm --privileged=true --name=$containerName -ti \
$DNS_SETTING \
$ci_env \
--env http_proxy=$http_proxy \
--env https_proxy=$https_proxy \
--env CC=$PMDK_CC \
--env CXX=$PMDK_CXX \
--env VALGRIND=$VALGRIND \
--env EXTRA_CFLAGS=$EXTRA_CFLAGS \
--env EXTRA_CXXFLAGS=$EXTRA_CXXFLAGS \
--env REMOTE_TESTS=$REMOTE_TESTS \
--env TEST_BUILD=$TEST_BUILD \
--env WORKDIR=$WORKDIR \
--env EXPERIMENTAL=$EXPERIMENTAL \
--env BUILD_PACKAGE_CHECK=$BUILD_PACKAGE_CHECK \
--env SCRIPTSDIR=$SCRIPTSDIR \
--env CLANG_FORMAT=clang-format-3.8 \
--env TRAVIS=$TRAVIS \
--env TRAVIS_COMMIT_RANGE=$TRAVIS_COMMIT_RANGE \
--env TRAVIS_COMMIT=$TRAVIS_COMMIT \
--env TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG \
--env TRAVIS_BRANCH=$TRAVIS_BRANCH \
--env TRAVIS_EVENT_TYPE=$TRAVIS_EVENT_TYPE \
--env COVERITY_SCAN_TOKEN=$COVERITY_SCAN_TOKEN \
--env COVERITY_SCAN_NOTIFICATION_EMAIL=$COVERITY_SCAN_NOTIFICATION_EMAIL \
$ndctl_enable \
-v $HOST_WORKDIR:$WORKDIR \
-v /etc/localtime:/etc/localtime \
-w $SCRIPTSDIR \
$imageName $command
| 4,637 | 36.104 | 112 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/run-coverity.sh
|
#!/usr/bin/env bash
#
# Copyright 2017-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# run-coverity.sh - runs the Coverity scan build
#
set -e
# Prepare build environment
./prepare-for-build.sh
# Download Coverity certificate
echo -n | openssl s_client -connect scan.coverity.com:443 | \
sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | \
sudo tee -a /etc/ssl/certs/ca-;
# Build librpmem even if libfabric is not compiled with ibverbs
export RPMEM_DISABLE_LIBIBVERBS=y
export COVERITY_SCAN_PROJECT_NAME="$TRAVIS_REPO_SLUG"
[[ "$TRAVIS_EVENT_TYPE" == "cron" ]] \
&& export COVERITY_SCAN_BRANCH_PATTERN="master" \
|| export COVERITY_SCAN_BRANCH_PATTERN="coverity_scan"
export COVERITY_SCAN_BUILD_COMMAND="make -j all"
cd $WORKDIR
# Run the Coverity scan
# XXX: Patch the Coverity script.
# Recently, this script regularly exits with an error, even though
# the build is successfully submitted. Probably because the status code
# is missing in response, or it's not 201.
# Changes:
# 1) change the expected status code to 200 and
# 2) print the full response string.
#
# This change should be reverted when the Coverity script is fixed.
#
# The previous version was:
# curl -s https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh | bash
wget https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh
patch < utils/docker/0001-travis-fix-travisci_build_coverity_scan.sh.patch
bash ./travisci_build_coverity_scan.sh
| 2,957 | 37.921053 | 82 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/run-coverage.sh
|
#!/usr/bin/env bash
#
# Copyright 2017, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# run-coverage.sh - is called inside a Docker container; runs the coverage
# test
#
set -e
# Get and prepare PMDK source
./prepare-for-build.sh
# Build librpmem even if libfabric is not compiled with ibverbs
export RPMEM_DISABLE_LIBIBVERBS=y
# Hush error messages, mainly from Valgrind
export UT_DUMP_LINES=0
# Skip printing mismached files for tests with Valgrind
export UT_VALGRIND_SKIP_PRINT_MISMATCHED=1
# Build all and run tests
cd $WORKDIR
make -j2 USE_LIBUNWIND=1 COVERAGE=1
make -j2 test USE_LIBUNWIND=1 COVERAGE=1
# XXX: unfortunately valgrind raports issues in coverage instrumentation
# which we have to ignore (-k flag), also there is dependency between
# local and remote tests (which cannot be easily removed) we have to
# run local and remote tests separately
cd src/test
make -kj2 pcheck-local-quiet TEST_BUILD=debug || true
make check-remote-quiet TEST_BUILD=debug || true
cd ../..
bash <(curl -s https://codecov.io/bash)
| 2,549 | 37.636364 | 74 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/test_package/test_package.c
|
/*
* Copyright 2018, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <libpmemobj.h>
#include <stdio.h>
#include <sys/stat.h>
#define LAYOUT_NAME "test"
struct my_root {
int foo;
};
int
main(int argc, char *argv[])
{
if (argc < 2) {
printf("usage: %s file-name\n", argv[0]);
return 1;
}
const char *path = argv[1];
PMEMobjpool *pop = pmemobj_create(path, LAYOUT_NAME,
PMEMOBJ_MIN_POOL, S_IWUSR | S_IRUSR);
if (pop == NULL) {
printf("failed to create pool\n");
return 1;
}
PMEMoid root = pmemobj_root(pop, sizeof(struct my_root));
struct my_root *rootp = pmemobj_direct(root);
rootp->foo = 10;
pmemobj_persist(pop, &rootp->foo, sizeof(rootp->foo));
pmemobj_close(pop);
return 0;
}
| 2,250 | 30.704225 | 74 |
c
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/images/install-valgrind.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# install-valgrind.sh - installs valgrind for persistent memory
#
set -e
git clone https://github.com/pmem/valgrind.git
cd valgrind
git checkout b660021d776daec4165c6645bedf66d6d6fc545a
./autogen.sh
./configure
make
make install
cd ..
rm -rf valgrind
| 1,843 | 37.416667 | 73 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/images/build-image.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# build-image.sh <OS-VER> - prepares a Docker image with <OS>-based
# environment for building PMDK project, according
# to the Dockerfile.<OS-VER> file located
# in the same directory.
#
# The script can be run locally.
#
set -e
function usage {
echo "Usage:"
echo " build-image.sh <OS-VER>"
echo "where <OS-VER>, for example, can be 'ubuntu-16.04', provided " \
"a Dockerfile named 'Dockerfile.ubuntu-16.04' exists in the " \
"current directory."
}
# Check if the first argument is nonempty
if [[ -z "$1" ]]; then
usage
exit 1
fi
# Check if the file Dockerfile.OS-VER exists
if [[ ! -f "Dockerfile.$1" ]]; then
echo "ERROR: wrong argument."
usage
exit 1
fi
# Build a Docker image tagged with pmem/pmdk:OS-VER
tag=pmem/pmdk:$1
docker build -t $tag \
--build-arg http_proxy=$http_proxy \
--build-arg https_proxy=$https_proxy \
-f Dockerfile.$1 .
| 2,537 | 34.746479 | 76 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/images/install-libfabric.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# install-libfabric.sh - installs a customized version of libfabric
#
set -e
OS=$1
# Keep in sync with requirements in src/common.inc.
libfabric_ver=1.4.2
libfabric_url=https://github.com/ofiwg/libfabric/archive
libfabric_dir=libfabric-$libfabric_ver
libfabric_tarball=v${libfabric_ver}.zip
wget "${libfabric_url}/${libfabric_tarball}"
unzip $libfabric_tarball
cd $libfabric_dir
./autogen.sh
./configure --prefix=/usr --enable-sockets
make -j2
make install
cd ..
rm -f ${libfabric_tarball}
rm -rf ${libfabric_dir}
| 2,109 | 35.37931 | 73 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/images/install-libndctl.sh
|
#!/usr/bin/env bash
#
# Copyright 2017-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# install-libndctl.sh - installs libndctl
#
set -e
OS=$1
echo "==== clone ndctl repo ===="
git clone https://github.com/pmem/ndctl.git
cd ndctl
git checkout tags/v60.1
if [ "$OS" = "fedora" ]; then
echo "==== setup rpmbuild tree ===="
rpmdev-setuptree
RPMDIR=$HOME/rpmbuild/
VERSION=$(./git-version)
SPEC=./rhel/ndctl.spec
echo "==== create source tarball ====="
git archive --format=tar --prefix="ndctl-${VERSION}/" HEAD | gzip > "$RPMDIR/SOURCES/ndctl-${VERSION}.tar.gz"
echo "==== build ndctl ===="
./autogen.sh
./configure
make
echo "==== update ndctl.spec ===="
# XXX: pre-process ndctl.spec to remove dependency on libpmem
# To be removed once ndctl v60 is available.
sed -i -e "/pkgconfig(libpmem)/d" -e "s/--with-libpmem//g" $SPEC
echo "==== build ndctl packages ===="
rpmbuild -ba $SPEC
echo "==== install ndctl packages ===="
rpm -i $RPMDIR/RPMS/x86_64/*.rpm
echo "==== cleanup ===="
rm -rf $RPMDIR
else
echo "==== build ndctl ===="
./autogen.sh
./configure
make
echo "==== install ndctl ===="
make install
echo "==== cleanup ===="
fi
cd ..
rm -rf ndctl
| 2,672 | 27.741935 | 109 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/utils/docker/images/push-image.sh
|
#!/usr/bin/env bash
#
# Copyright 2016-2018, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# push-image.sh <OS-VER> - pushes the Docker image tagged with OS-VER
# to the Docker Hub.
#
# The script utilizes $DOCKER_USER and $DOCKER_PASSWORD variables to log in to
# Docker Hub. The variables can be set in the Travis project's configuration
# for automated builds.
#
set -e
function usage {
echo "Usage:"
echo " push-image.sh <OS-VER>"
echo "where <OS-VER>, for example, can be 'ubuntu-16.04', provided " \
"a Docker image tagged with pmem/pmdk:ubuntu-16.04 exists " \
"locally."
}
# Check if the first argument is nonempty
if [[ -z "$1" ]]; then
usage
exit 1
fi
# Check if the image tagged with pmdk/OS-VER exists locally
if [[ ! $(docker images -a | awk -v pattern="^pmem/pmdk:$1\$" \
'$1":"$2 ~ pattern') ]]
then
echo "ERROR: wrong argument."
usage
exit 1
fi
# Log in to the Docker Hub
docker login -u="$DOCKER_USER" -p="$DOCKER_PASSWORD"
# Push the image to the repository
docker push pmem/pmdk:$1
| 2,547 | 34.388889 | 78 |
sh
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/rpmemd/rpmemd.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(RPMEMD, 1)
collection: rpmemd
header: PMDK
date: rpmemd version 1.4
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (rpmemd.1.md -- man page for rpmemd)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[OPTIONS](#options)<br />
[CONFIGURATION FILES](#configuration-files)<br />
[EXAMPLE](#example)<br />
[DEFAULT CONFIGURATION](#default-configuration)<br />
[PERSISTENCY METHODS](#persistency-methods)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**rpmemd** - librpmem target node process (EXPERIMENTAL)
# SYNOPSIS #
```
$ rpmemd [--help] [--version] [<args>]
```
# DESCRIPTION #
The **rpmemd** process is executed on target node by **librpmem**(7) library over
**ssh**(1) and facilitates access to persistent memory over RDMA. The **rpmemd**
should not be run manually under normal conditions.
# OPTIONS #
Command line options overwrite the default **rpmemd** configuration, the global
configuration file and the user configuration file.
`-V, --version`
Displays **rpmemd** version and exits.
`-h, --help`
Prints synopsis and list of parameters and exits.
`-c, --config <path>`
Custom configuration file location. If the custom configuration file is
provided others are omitted. See **CONFIGURATION FILES**
section for details.
All options described in **CONFIGURATION FILES** section are
common for both the configuration file and the command line - the equivalent
of the following line in the config file:
`option = value`
is
`--option value`
in the command line.
The following command line options: **--persist-apm**, **--persist-general**
and **--use-syslog** should not be followed by any value. Presence of each of them
in the command line turns on an appropriate option.
See **CONFIGURATION FILES** section for details.
`-r, --remove <poolset>`
Remove a pool described by given pool set file descriptor. It is interpreted
as a path to the pool set file relative to the pool set directory.
`-f, --force`
Ignore errors when removing a pool file using **--remove** option.
# CONFIGURATION FILES #
The **rpmemd** searches for the configuration files with following priorities:
+ The global configuration file located in **/etc/rpmemd/rpmemd.conf**.
+ The user configuration file located in the user home directory
(**$HOME/.rpmemd.conf**).
The **rpmemd** can also read configuration from the custom configuration file
provided using **--config** command line option. See **OPTIONS**
section for details.
The default configuration is described in the
**DEFAULT CONFIGURATION** section.
The configuration file is a plain text file. Each line of the configuration file
can store only one configuration option defined as a *key=value* pair. Empty
lines and lines starting with *#* are omitted.
The allowed options are:
+ `log-file = <path>` - log file location
+ `poolset-dir = <path>` - pool set files directory
+ `persist-apm = {yes|no}` - enable **The Appliance Persistency Method**. This
option must be set only if the target platform has non-allocating writes IO
enabled. See **PERSISTENCY METHODS** section for details.
+ `persist-general = {yes|no}` - enable **The General Purpose Server Persistency
Method**. See **PERSISTENCY METHODS** section for details.
+ `use-syslog = {yes|no}` - use **syslog**(3) for logging messages instead of log
file
+ `log-level = <level>` - set log level value. Accepted *\<level\>* values are:
+ **err** - error conditions
+ **warn** - warning conditions
+ **notice** - normal, but significant conditions
+ **info** - informational message
+ **debug** - debug-level message
The **$HOME** sub-string in the *poolset-dir* path is replaced with the current user
home directory.
# EXAMPLE #
Example of the configuration file:
```
# This is an example of configuration file
log-file = $HOME/.logs/rpmemd.log
poolset-dir = $HOME/poolsets/
persist-apm = yes
persist-general = no
use-syslog = no # Use log file instead of syslog
log-level = info
```
# DEFAULT CONFIGURATION #
The **rpmemd** default configuration is equivalent of the following
configuration file:
```
log-file = /var/log/rpmemd.log
poolset-dir = $HOME
persist-apm = no
persist-general = yes
use-syslog = yes
log-level = err
```
# PERSISTENCY METHODS #
The **librpmem**(7) supports two methods for making data written to remote
persistent memory durable. The difference between the use of the two mechanisms
is based on whether **librpmem**(7) will make use of non-allocating writes on the
remote node.
+ **The General Purpose Server Persistency Method** does not have any
requirements for the platform on which the target daemon runs and can be enabled
by administrator using the *persist-general* option. This method utilize
**libpmem**(7) persistency mechanisms on remote node and requires additional
communication between initiator and remote node using the in-band connection.
+ **The Appliance Persistency Method** requires non-allocating writes enabled on
the platform and can be enabled by administrator using *persist-apm* option.
This method requires to issue an RDMA READ operation after the RDMA WRITE
operations performed on requested chunk of memory.
"Non-allocating write requests" is the Intel Integrated IO Controller mode
where all incoming PCIe writes will utilize non-allocating buffers for the write
requests. Non-allocating writes are guaranteed to bypass all of the CPU caches
and force the write requests to flow directly to the Integrated Memory
Controller without delay.
The **rpmemd** dynamically choose the appropriate persistency method and the
flushing to persistence primitive for GPSPM for each opened pool set name
depending on available persistency methods and whether all pool set parts are
stored in the persistent memory.
If the **Appliance Persistency Method** is enabled and the pool set is stored
in the persistent memory **rpmemd** will use the **Appliance Persistency
Method**. If the pool set is NOT stored in the persistent memory it will
fallback to the **General Puropose Server Persistency Method** with
**pmem_msync**(3).
If the **General Puropose Server Persistency Method** is enabled and the pool
set is stored in the persistent memory **rpmemd** will use **pmem_persist**(3).
If the pool set is NOT stored in the persistent momory it will use
**pmem_msync**(3).
See **pmem_persist**(3) and **pmem_msync**(3) for more details.
# SEE ALSO #
**ssh**(1), **pmem_msync**(3), **pmem_persist**(3),
**syslog**(3), **libpmem**(7), **libpmemobj**(7),
**librpmem**(7) and **<http://pmem.io>**
| 8,469 | 34.439331 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemlog/pmemlog_create.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMLOG_CREATE, 3)
collection: libpmemlog
header: PMDK
date: pmemlog API version 1.1
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemlog_create.3 -- man page for libpmemlog create, open, close and validate)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[CAVEATS](#caveats)<br />
[SEE ALSO](#see-also)<br />
# NAME #
_UW(pmemlog_create), _UW(pmemlog_open),
**pmemlog_close**(), _UW(pmemlog_check)
- create, open, close and validate persistent memory resident log file
# SYNOPSIS #
```c
#include <libpmemlog.h>
_UWFUNCR(PMEMlogpool, *pmemlog_open, *path)
_UWFUNCR1(PMEMlogpool, *pmemlog_create, *path, =q=size_t poolsize, mode_t mode=e=)
void pmemlog_close(PMEMlogpool *plp);
_UWFUNCR(int, pmemlog_check, *path)
```
_UNICODE()
# DESCRIPTION #
The _UW(pmemlog_create) function creates a log memory pool with the given
total *poolsize*. Since the transactional nature of a log memory pool requires
some space overhead in the memory pool, the resulting available log size is
less than *poolsize*, and is made available to the caller via the
**pmemlog_nbyte**(3) function. *path* specifies the name of the memory pool
file to be created. *mode* specifies the permissions to use when creating the
file as described by **creat**(2). The memory pool file is fully allocated
to the size *poolsize* using **posix_fallocate**(3).
The caller may choose to take responsibility for creating the memory pool file
by creating it before calling _UW(pmemlog_create) and then specifying
*poolsize* as zero. In this case _UW(pmemlog_create) will take the pool size
from the size of the existing file and will verify that the file appears to be
empty by searching for any non-zero data in the pool header at the beginning of
the file. The net pool size of a pool file is equal to the file size.
The minimum net pool size allowed by the library for a log pool
is defined in **\<libpmemlog.h\>** as **PMEMLOG_MIN_POOL**.
Depending on the configuration of the system, the available non-volatile
memory space may be divided into multiple memory devices.
In such case, the maximum size of the pmemlog memory pool
could be limited by the capacity of a single memory device.
**libpmemlog**(7) allows building persistent memory
resident logs spanning multiple memory devices by creation of
persistent memory pools consisting of multiple files, where each part of
such a *pool set* may be stored on a different memory device
or pmem-aware filesystem.
Creation of all the parts of the pool set can be done with _UW(pmemlog_create);
however, the recommended method for creating pool sets is with the
**pmempool**(1) utility.
When creating a pool set consisting of multiple files, the *path* argument
passed to _UW(pmemlog_create) must point to the special *set* file that defines
the pool layout and the location of all the parts of the pool set. The
*poolsize* argument must be 0. The meaning of the *mode* argument
does not change, except that the same *mode* is used for creation of all the
parts of the pool set.
The set file is a plain text file, the structure of which is described in
**poolset**(5).
The _UW(pmemlog_open) function opens an existing log memory pool.
Similar to _UW(pmemlog_create), *path* must identify either an existing
log memory pool file, or the *set* file used to create a pool set.
The application must have permission to open the file and memory map the
file or pool set with read/write permissions.
The **pmemlog_close**() function closes the memory pool indicated by *plp*
and deletes the memory pool handle. The log memory pool itself lives on in
the file that contains it and may be re-opened at a later time using
_UW(pmemlog_open) as described above.
The _UW(pmemlog_check) function performs a consistency check of the file
indicated by *path*. _UW(pmemlog_check) opens the given *path* read-only so
it never makes any changes to the file. This function is not supported on
Device DAX.
# RETURN VALUE #
On success, _UW(pmemlog_create) returns a *PMEMlogpool\** handle to the
memory pool that is used with most of the functions from **libpmemlog**(7).
If an error prevents any of the pool set files from being
created, it returns NULL and sets *errno* appropriately.
On success, _UW(pmemlog_open) returns a *PMEMlogpool\** handle to the
memory pool that is used with most of the functions from **libpmemlog**(7).
If an error prevents the pool from being opened, or a pool set is being
opened and the actual size of any file does not match the corresponding part
size defined in the *set* file, _UW(pmemlog_open) returns NULL and sets
*errno* appropriately.
The **pmemlog_close**() function returns no value.
The _UW(pmemlog_check) function returns 1 if the persistent memory
resident log file is found to be consistent.
Any inconsistencies will cause _UW(pmemlog_check) to return 0,
in which case the use of the file with **libpmemlog** will result
in undefined behavior. The debug version of **libpmemlog** will provide
additional details on inconsistencies when **PMEMLOG_LOG_LEVEL** is at least 1,
as described in the **DEBUGGING AND ERROR HANDLING** section in
**libpmemlog**(7). _UW(pmemlog_check) will return -1 and set *errno* if it
cannot perform the consistency check due to other errors.
# CAVEATS #
Not all file systems support **posix_fallocate**(3). _UW(pmemlog_create) will
fail if the underlying file system does not support **posix_fallocate**(3).
# SEE ALSO #
**pmempool**(1), **creat**(2), **posix_fallocate**(3),
**pmemlog_nbyte**(3), **poolset**(5), **libpmemlog**(7)
and **<http://pmem.io>**
| 7,541 | 44.433735 | 93 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemlog/pmemlog_tell.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMLOG_TELL, 3)
collection: libpmemlog
header: PMDK
date: pmemlog API version 1.1
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemlog_tell.3 -- man page for pmemlog_tell, pmemlog_rewind and pmemlog_walk functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemlog_tell**(), **pmemlog_rewind**(),
**pmemlog_walk**() - checks current write point for the log or walks through the log
# SYNOPSIS #
```c
#include <libpmemlog.h>
long long pmemlog_tell(PMEMlogpool *plp);
void pmemlog_rewind(PMEMlogpool *plp);
void pmemlog_walk(PMEMlogpool *plp, size_t chunksize,
int (*process_chunk)(const void *buf, size_t len, void *arg),
void *arg);
```
# DESCRIPTION #
The **pmemlog_tell**() function returns the current write point for the log,
expressed as a byte offset into the usable log space in the memory pool.
This offset starts off as zero on a newly-created log,
and is incremented by each successful append operation.
This function can be used to determine how much data is currently in the log.
The **pmemlog_rewind**() function resets the current write point for the log to zero.
After this call, the next append adds to the beginning of the log.
The **pmemlog_walk**() function walks through the log *plp*, from beginning to
end, calling the callback function *process_chunk* for each *chunksize* block
of data found. The argument *arg* is also passed to the callback to help
avoid the need for global state. The *chunksize* argument is useful for logs
with fixed-length records and may be specified as 0 to cause a single call
to the callback with the entire log contents passed as the *buf* argument. The
*len* argument tells the *process_chunk* function how much data *buf* is
holding. The callback function should return 1 if **pmemlog_walk**() should
continue walking through the log, or 0 to terminate the walk. The callback
function is called while holding **libpmemlog**(7) internal locks that make
calls atomic, so the callback function must not try to append to the log itself
or deadlock will occur.
# RETURN VALUE #
On success, **pmemlog_tell**() returns the current write point for the log.
On error, it returns -1 and sets *errno* appropriately.
The **pmemlog_rewind**() and **pmemlog_walk**() functions return no value.
# SEE ALSO #
**libpmemlog**(7) and **<http://pmem.io>**
| 4,347 | 42.48 | 102 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemlog/libpmemlog.7.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(LIBPMEMLOG, 7)
collection: libpmemlog
header: PMDK
date: pmemlog API version 1.1
...
[comment]: <> (Copyright 2016-2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (libpmemlog.7 -- man page for libpmemlog)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[CAVEATS](#caveats)<br />
[LIBRARY API VERSIONING](#library-api-versioning-1)<br />
[MANAGING LIBRARY BEHAVIOR](#managing-library-behavior-1)<br />
[DEBUGGING AND ERROR HANDLING](#debugging-and-error-handling)<br />
[EXAMPLE](#example)<br />
[BUGS](#bugs)<br />
[ACKNOWLEDGEMENTS](#acknowledgements)<br />
[SEE ALSO](#see-also)
# NAME #
**libpmemlog** - persistent memory resident log file
# SYNOPSIS #
```c
#include <libpmemlog.h>
cc ... -lpmemlog -lpmem
```
_UNICODE()
##### Library API versioning: #####
```c
_UWFUNC(pmemlog_check_version, =q=
unsigned major_required,
unsigned minor_required=e=)
```
##### Managing library behavior: #####
```c
void pmemlog_set_funcs(
void *(*malloc_func)(size_t size),
void (*free_func)(void *ptr),
void *(*realloc_func)(void *ptr, size_t size),
char *(*strdup_func)(const char *s));
```
##### Error handling: #####
```c
_UWFUNCR(int, pmemlog_check, *path)
```
##### Other library functions: #####
A description of other **libpmemlog** functions can be found on the following
manual pages:
**pmemlog_append**(3), **pmemlog_create**(3), **pmemlog_ctl_exec**(3),
**pmemlog_ctl_get**(3), **pmemlog_ctl_set**(3), **pmemlog_nbyte**(3),
**pmemlog_tell**(3)
# DESCRIPTION #
**libpmemlog**
provides a log file in *persistent memory* (pmem) such that
additions to the log are appended atomically. This library is intended
for applications using direct access storage (DAX), which is storage
that supports load/store access without paging blocks from a block
storage device. Some types of *non-volatile memory DIMMs* (NVDIMMs) provide
this type of byte addressable access to storage. A *persistent memory aware
file system* is typically used to expose the direct access to applications.
Memory mapping a file from this type of file system
results in the load/store, non-paged access to pmem.
**libpmemlog** builds on thistype of memory mapped file.
This library is for applications that need a persistent log file
updated atomically (the updates cannot be *torn* by program interruption
such as power failures). This library builds on the low-level pmem
support provided by **libpmem**(7), handling the transactional update of
the log, flushing to persistence, and recovery for the application.
**libpmemlog** is one of a collection of persistent memory libraries available.
The others are:
+ **libpmemobj**(7), a general use persistent memory API,
providing memory allocation and transactional operations on variable-sized objects.
+ **libpmemblk**(7), providing pmem-resident arrays of fixed-sized blocks with atomic updates.
+ **libpmemcto**(7), providing close-to-open persistence.
+ **libpmem**(7), low-level persistent memory support.
Under normal usage, **libpmemlog** will never print messages or intentionally
cause the process to exit. The only exception to this is the debugging
information, when enabled, as described under **DEBUGGING AND ERROR HANDLING** below.
To use the pmem-resident log file provided by **libpmemlog**, a *memory pool* is
first created. This is done with the **pmemlog_create**(3) function.
The other functions mentioned above in SYNOPSIS section
then operate on the resulting log memory pool.
Once created, the memory pool is represented by an opaque handle,
of type *PMEMlogpool\**, which is passed to most of the other
functions from **libpmemlog**. Internally, **libpmemlog** will use
either **pmem_persist**(3) or **msync**(2) when it needs to flush changes,
depending on whether the memory pool appears to be persistent memory
or a regular file (see the **pmem_is_pmem**(3) function in **libpmem**(7)
for more information). There is no need for applications to flush
changes directly when using the log memory API provided by **libpmemlog**.
# CAVEATS #
**libpmemlog** relies on the library destructor being called from the main
thread. For this reason, all functions that might trigger destruction (e.g.
**dlclose**(3)) should be called in the main thread. Otherwise some of the
resources associated with that thread might not be cleaned up properly.
# LIBRARY API VERSIONING #
This section describes how the library API is versioned,
allowing applications to work with an evolving API.
The _UW(pmemlog_check_version) function is used to determine whether the
installed **libpmemlog** supports the version of the library API required by
an application. The easiest way to do this is for the application to supply
the compile-time version information provided by defines in
**\<libpmemlog.h\>**, like this:
```c
reason = _U(pmemlog_check_version)(PMEMLOG_MAJOR_VERSION,
PMEMLOG_MINOR_VERSION);
if (reason != NULL) {
/* version check failed, reason string tells you why */
}
```
Any mismatch in the major version number is considered a failure,
but a library with a newer minor version number will pass this check
since increasing minor versions imply backwards compatibility.
An application can also check specifically for the existence of an interface
by checking for the version where that interface was introduced. These versions
are documented in this man page as follows: unless otherwise specified, all
interfaces described here are available in version 1.0 of the library. Interfaces
added after version 1.0 will contain the text *introduced
in version x.y* in the section of this manual describing the feature.
On success, _UW(pmemlog_check_version) returns NULL. Otherwise, the return
value is a static string describing the reason the version check failed. The
string returned by _UW(pmemlog_check_version) must not be modified or freed.
# MANAGING LIBRARY BEHAVIOR #
The **pmemlog_set_funcs**() function allows an application to override
memory allocation calls used internally by **libpmemlog**.
Passing in NULL for any of the handlers will cause the
**libpmemlog** default function to be used. The library does not make
heavy use of the system malloc functions, but it does
allocate approximately 4-8 kilobytes for each memory pool in use.
# DEBUGGING AND ERROR HANDLING #
The _UW(pmemlog_errormsg) function returns a pointer to a static buffer
containing the last error message logged for the current thread. If *errno*
was set, the error message may include a description of the corresponding
error code as returned by **strerror**(3). The error message buffer is
thread-local; errors encountered in one thread do not affect its value in
other threads. The buffer is never cleared by any library function; its
content is significant only when the return value of the immediately preceding
call to a **libpmemlog** function indicated an error, or if *errno* was set.
The application must not modify or free the error message string, but it may
be modified by subsequent calls to other library functions.
Two versions of **libpmemlog** are typically available on a development
system. The normal version, accessed when a program is linked using the
**-lpmemlog** option, is optimized for performance. That version skips checks
that impact performance and never logs any trace information or performs any
run-time assertions.
A second version of **libpmemlog**, accessed when a program uses the libraries
under _DEBUGLIBPATH(), contains run-time assertions and trace points. The
typical way to access the debug version is to set the environment variable
**LD_LIBRARY_PATH** to _LDLIBPATH(). Debugging output is
controlled using the following environment variables. These variables have
no effect on the non-debug version of the library.
+ **PMEMLOG_LOG_LEVEL**
The value of **PMEMLOG_LOG_LEVEL** enables trace points in the debug version
of the library, as follows:
+ **0** - This is the default level when **PMEMLOG_LOG_LEVEL** is not set.
No log messages are emitted at this level.
+ **1** - Additional details on any errors detected are logged,
in addition to returning the *errno*-based errors as usual.
The same information may be retrieved using _UW(pmemlog_errormsg).
+ **2** - A trace of basic operations is logged.
+ **3** - Enables a very verbose amount of function call tracing in the library.
+ **4** - Enables voluminous and fairly obscure tracing information
that is likely only useful to the **libpmemlog** developers.
Unless **PMEMLOG_LOG_FILE** is set, debugging output is written to *stderr*.
+ **PMEMLOG_LOG_FILE**
Specifies the name of a file name where all logging information should be
written. If the last character in the name is "-", the *PID* of the current
process will be appended to the file name when the log file is created. If
**PMEMLOG_LOG_FILE** is not set, logging output is written to *stderr*.
See also **libpmem**(7) for information about other environment
variables affecting **libpmemlog** behavior.
# EXAMPLE #
The following example illustrates how the **libpmemlog** API is used.
```c
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <libpmemlog.h>
/* size of the pmemlog pool -- 1 GB */
#define POOL_SIZE ((size_t)(1 << 30))
/*
* printit -- log processing callback for use with pmemlog_walk()
*/
int
printit(const void *buf, size_t len, void *arg)
{
fwrite(buf, len, 1, stdout);
return 0;
}
int
main(int argc, char *argv[])
{
const char path[] = "/pmem-fs/myfile";
PMEMlogpool *plp;
size_t nbyte;
char *str;
/* create the pmemlog pool or open it if it already exists */
plp = _U(pmemlog_create)(path, POOL_SIZE, 0666);
if (plp == NULL)
plp = _U(pmemlog_open)(path);
if (plp == NULL) {
perror(path);
exit(1);
}
/* how many bytes does the log hold? */
nbyte = pmemlog_nbyte(plp);
printf("log holds %zu bytes", nbyte);
/* append to the log... */
str = "This is the first string appended";
if (pmemlog_append(plp, str, strlen(str)) < 0) {
perror("pmemlog_append");
exit(1);
}
str = "This is the second string appended";
if (pmemlog_append(plp, str, strlen(str)) < 0) {
perror("pmemlog_append");
exit(1);
}
/* print the log contents */
printf("log contains:");
pmemlog_walk(plp, 0, printit, NULL);
pmemlog_close(plp);
}
```
See <http://pmem.io/pmdk/libpmemlog>
for more examples using the **libpmemlog** API.
# BUGS #
Unlike **libpmemobj**(7), data replication is not supported in **libpmemlog**.
Thus, specifying replica sections in pool set files is not allowed.
# ACKNOWLEDGEMENTS #
**libpmemlog** builds on the persistent memory programming model recommended
by the SNIA NVM Programming Technical Work Group:
<http://snia.org/nvmp>
# SEE ALSO #
**msync**(2), **pmemlog_append**(3), **pmemlog_create**(3),
**pmemlog_ctl_exec**(3), **pmemlog_ctl_get**(3), **pmemlog_ctl_set**(3),
**pmemlog_nbyte**(3), **pmemlog_tell**(3), **strerror**(3),
**libpmem**(7), **libpmemblk**(7), **libpmemcto**(7), **libpmemobj**(7)
and **<http://pmem.io>**
| 12,972 | 35.543662 | 94 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemlog/pmemlog_ctl_get.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMLOG_CTL_GET, 3)
collection: libpmemlog
header: PMDK
date: pmemlog API version 1.1
...
[comment]: <> (Copyright 2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemlog_ctl_get.3 -- man page for libpmemlog CTL)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[CTL NAMESPACE](#ctl-namespace)<br />
[CTL EXTERNAL CONFIGURATION](#ctl-external-configuration)<br />
[SEE ALSO](#see-also)<br />
# NAME #
_UW(pmemlog_ctl_get),
_UW(pmemlog_ctl_set),
_UW(pmemlog_ctl_exec)
-- Query and modify libpmemlog internal behavior (EXPERIMENTAL)
# SYNOPSIS #
```c
#include <libpmemlog.h>
_UWFUNCR2(int, pmemlog_ctl_get, PMEMlogpool *plp, *name, void *arg,
=q= (EXPERIMENTAL)=e=)
_UWFUNCR2(int, pmemlog_ctl_set, PMEMlogpool *plp, *name, void *arg,
=q= (EXPERIMENTAL)=e=)
_UWFUNCR2(int, pmemlog_ctl_exec, PMEMlogpool *plp, *name, void *arg,
=q= (EXPERIMENTAL)=e=)
```
_UNICODE()
# DESCRIPTION #
The _UW(pmemlog_ctl_get), _UW(pmemlog_ctl_set) and _UW(pmemlog_ctl_exec)
functions provide a uniform interface for querying and modifying the internal
behavior of **libpmemlog**(7) through the control (CTL) namespace.
See more in **pmem_ctl**(5) man page.
# CTL NAMESPACE #
prefault.at_create | rw | global | int | int | - | boolean
If set, every page of the pool will be touched and written to when the pool
is created, in order to trigger page allocation and minimize the performance
impact of pagefaults. Affects only the _UW(pmemlog_create) function.
Always returns 0.
prefault.at_open | rw | global | int | int | - | boolean
If set, every page of the pool will be touched and written to when the pool
is opened, in order to trigger page allocation and minimize the performance
impact of pagefaults. Affects only the _UW(pmemlog_open) function.
Always returns 0.
# CTL EXTERNAL CONFIGURATION #
In addition to direct function call, each write entry point can also be set
using two alternative methods.
The first method is to load a configuration directly from the **PMEMLOG_CONF**
environment variable.
The second method of loading an external configuration is to set the
**PMEMLOG_CONF_FILE** environment variable to point to a file that contains
a sequence of ctl queries.
See more in **pmem_ctl**(5) man page.
# SEE ALSO #
**libpmemlog**(7), **pmem_ctl**(5) and **<http://pmem.io>**
| 4,219 | 35.695652 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemlog/pmemlog_nbyte.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMLOG_NBYTE, 3)
collection: libpmemlog
header: PMDK
date: pmemlog API version 1.1
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemlog_nbyte.3 -- man page for pmemlog_nbyte function)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemlog_nbyte**() - checks the amount of usable space in the log pool.
# SYNOPSIS #
```c
#include <libpmemlog.h>
size_t pmemlog_nbyte(PMEMlogpool *plp);
```
# DESCRIPTION #
The **pmemlog_nbyte**() function checks the amount of usable space in the log *plp*.
This function may be used on a log to determine how much usable space is
available after **libpmemlog**(7) has added its metadata to the memory pool.
# RETURN VALUE #
The **pmemlog_nbyte**() function returns the amount of usable space in the log *plp*.
# SEE ALSO #
**libpmemlog**(7) and **<http://pmem.io>**
| 2,845 | 37.459459 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemlog/pmemlog_append.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMLOG_APPEND, 3)
collection: libpmemlog
header: PMDK
date: pmemlog API version 1.1
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemlog_append.3 -- man page for pmemlog_append and pmemlog_appendv functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[NOTES](#notes)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemlog_append**(), **pmemlog_appendv**() - append bytes to the persistent
memory resident log file
# SYNOPSIS #
```c
#include <libpmemlog.h>
int pmemlog_append(PMEMlogpool *plp, const void *buf, size_t count);
int pmemlog_appendv(PMEMlogpool *plp, const struct iovec *iov, int iovcnt);
```
# DESCRIPTION #
The **pmemlog_append**() function appends *count* bytes from *buf*
to the current write offset in the log memory pool *plp*.
Calling this function is analogous to appending to a file.
The append is atomic and cannot be torn by a program failure or system crash.
The **pmemlog_appendv**() function appends to the log memory pool *plp* from
the scatter/gather list *iov* in a manner
similar to **writev**(2). The entire list of buffers is appended atomically,
as if the buffers in *iov* were concatenated in order.
The append is atomic and cannot be torn by a program failure or system crash.
# RETURN VALUE #
On success, **pmemlog_append**() and **pmemlog_appendv**() return 0.
On error, they return -1 and set *errno* appropriately.
# ERRORS #
**EINVAL** The vector count *iovcnt* is less than zero.
**ENOSPC** There is no room for the data in the log file.
**EROFS** The log file is open in read-only mode.
# NOTES #
Since **libpmemlog**(3) is designed as a low-latency code path,
many of the checks routinely done by the operating system for **writev**(2)
are not practical in the library's implementation of **pmemlog_appendv**().
No attempt is made to detect NULL or incorrect pointers, for example.
# SEE ALSO #
**writev**(2), **libpmemlog**(7) and **<http://pmem.io>**
| 3,915 | 37.392157 | 93 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/librpmem/rpmem_persist.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(RPMEM_PERSIST, 3)
collection: librpmem
header: PMDK
date: rpmem API version 1.2
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (rpmem_persist.3 -- man page for rpmem persist and read functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**rpmem_persist**(), **rpmem_read**(),
- functions to copy and read remote pools
# SYNOPSIS #
```c
#include <librpmem.h>
int rpmem_persist(RPMEMpool *rpp, size_t offset,
size_t length, unsigned lane, unsigned flags);
int rpmem_deep_persist(RPMEMpool *rpp, size_t offset,
size_t length, unsigned lane);
int rpmem_read(RPMEMpool *rpp, void *buff, size_t offset,
size_t length, unsigned lane);
```
# DESCRIPTION #
The **rpmem_persist**() function copies data of given *length* at given
*offset* from the associated local memory pool and makes sure the data is
persistent on the remote node before the function returns. The remote node
is identified by the *rpp* handle which must be returned from either
**rpmem_open**(3) or **rpmem_create**(3). The *offset* is relative
to the *pool_addr* specified in the **rpmem_open**(3) or **rpmem_create**(3)
call. If the remote pool was created using **rpmem_create**() with non-NULL
*create_attr* argument, *offset* has to be greater or equal to 4096.
In that case the first 4096 bytes of the pool is used for storing the pool
matadata and cannot be overwritten.
If the pool was created with NULL *create_attr* argument, the pool metadata
is not stored with the pool and *offset* can be any nonnegative number.
The *offset* and *length* combined must not exceed the
*pool_size* passed to **rpmem_open**(3) or **rpmem_create**(3).
The **rpmem_persist**() operation is performed using the given *lane* number.
The lane must be less than the value returned by **rpmem_open**(3) or
**rpmem_create**(3) through the *nlanes* argument (so it can take a value
from 0 to *nlanes* - 1). The *flags* argument can be 0 or RPMEM_PERSIST_RELAXED
which means the persist operation will be done without any guarantees regarding
atomicity of memory transfer.
The **rpmem_deep_persist**() function works in the same way as
**rpmem_persist**(3) function, but additionally it flushes the data to the
lowest possible persistency domain available from software.
Please see **pmem_deep_persist**(3) for details.
The **rpmem_read**() function reads *length* bytes of data from a remote pool
at *offset* and copies it to the buffer *buff*. The operation is performed on
the specified *lane*. The lane must be less than the value returned by
**rpmem_open**(3) or **rpmem_create**(3) through the *nlanes* argument
(so it can take a value from 0 to *nlanes* - 1). The *rpp* must point to a
remote pool opened or created previously by **rpmem_open**(3) or
**rpmem_create**(3).
# RETURN VALUE #
The **rpmem_persist**() function returns 0 if the entire memory area was
made persistent on the remote node. Otherwise it returns a non-zero value
and sets *errno* appropriately.
The **rpmem_read**() function returns 0 if the data was read entirely.
Otherwise it returns a non-zero value and sets *errno* appropriately.
# SEE ALSO #
**rpmem_create**(3), **rpmem_open**(3), **rpmem_persist**(3),
**sysconf**(3), **limits.conf**(5), **libpmemobj**(7)
and **<http://pmem.io>**
| 5,266 | 43.635593 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/librpmem/librpmem.7.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(LIBRPMEM, 7)
collection: librpmem
header: PMDK
date: rpmem API version 1.2
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (librpmem.7 -- man page for librpmem)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[TARGET NODE ADDRESS FORMAT](#target-node-address-format)<br />
[REMOTE POOL ATTRIBUTES](#remote-pool-attributes)<br />
[SSH](#ssh)<br />
[FORK](#fork)<br />
[CAVEATS](#caveats)<br />
[LIBRARY API VERSIONING](#library-api-versioning-1)<br />
[ENVIRONMENT](#environment)<br />
[DEBUGGING AND ERROR HANDLING](#debugging-and-error-handling)<br />
[EXAMPLE](#example)<br />
[ACKNOWLEDGEMENTS](#acknowledgements)<br />
[SEE ALSO](#see-also)
# NAME #
**librpmem** - remote persistent memory support library (EXPERIMENTAL)
# SYNOPSIS #
```c
#include <librpmem.h>
cc ... -lrpmem
```
##### Library API versioning: #####
```c
const char *rpmem_check_version(
unsigned major_required,
unsigned minor_required);
```
##### Error handling: #####
```c
const char *rpmem_errormsg(void);
```
##### Other library functions: #####
A description of other **librpmem** functions can be found on the following
manual pages:
+ **rpmem_create**(3), **rpmem_persist**(3)
# DESCRIPTION #
**librpmem** provides low-level support for remote access to
*persistent memory* (pmem) utilizing RDMA-capable RNICs. The library can be
used to remotely replicate a memory region over the RDMA protocol. It utilizes
an appropriate persistency mechanism based on the remote node's platform
capabilities. **librpmem** utilizes the **ssh**(1) client to authenticate
a user on the remote node, and for encryption of the connection's out-of-band
configuration data. See **SSH**, below, for details.
The maximum replicated memory region size can not be bigger than the maximum
locked-in-memory address space limit. See **memlock** in **limits.conf**(5)
for more details.
This library is for applications that use remote persistent memory directly,
without the help of any library-supplied transactions or memory
allocation. Higher-level libraries that build on **libpmem**(7) are
available and are recommended for most applications, see:
+ **libpmemobj**(7), a general use persistent memory API, providing memory
allocation and transactional operations on variable-sized objects.
# TARGET NODE ADDRESS FORMAT #
```
[<user>@]<hostname>[:<port>]
```
The target node address is described by the *hostname* which the client
connects to, with an optional *user* name. The user must be authorized
to authenticate to the remote machine without querying for password/passphrase.
The optional *port* number is used to establish the SSH connection. The default
port number is 22.
# REMOTE POOL ATTRIBUTES #
The *rpmem_pool_attr* structure describes a remote pool and is stored in remote
pool's metadata. This structure must be passed to the **rpmem_create**(3)
function by caller when creating a pool on remote node. When opening the pool
using **rpmem_open**(3) function the appropriate fields are read from pool's
metadata and returned back to the caller.
```c
#define RPMEM_POOL_HDR_SIG_LEN 8
#define RPMEM_POOL_HDR_UUID_LEN 16
#define RPMEM_POOL_USER_FLAGS_LEN 16
struct rpmem_pool_attr {
char signature[RPMEM_POOL_HDR_SIG_LEN];
uint32_t major;
uint32_t compat_features;
uint32_t incompat_features;
uint32_t ro_compat_features;
unsigned char poolset_uuid[RPMEM_POOL_HDR_UUID_LEN];
unsigned char uuid[RPMEM_POOL_HDR_UUID_LEN];
unsigned char next_uuid[RPMEM_POOL_HDR_UUID_LEN];
unsigned char prev_uuid[RPMEM_POOL_HDR_UUID_LEN];
unsigned char user_flags[RPMEM_POOL_USER_FLAGS_LEN];
};
```
The *signature* field is an 8-byte field which describes the pool's on-media
format.
The *major* field is a major version number of the pool's on-media format.
The *compat_features* field is a mask describing compatibility of pool's
on-media format optional features.
The *incompat_features* field is a mask describing compatibility of pool's
on-media format required features.
The *ro_compat_features* field is a mask describing compatibility of pool's
on-media format features. If these features are not available,
the pool shall be opened in read-only mode.
The *poolset_uuid* field is an UUID of the pool which the remote pool is
associated with.
The *uuid* field is an UUID of a first part of the remote pool. This field can
be used to connect the remote pool with other pools in a list.
The *next_uuid* and *prev_uuid* fields are UUIDs of next and previous replicas
respectively. These fields can be used to connect the remote pool with other
pools in a list.
The *user_flags* field is a 16-byte user-defined flags.
# SSH #
**librpmem** utilizes the **ssh**(1) client to login and execute the
**rpmemd**(1) process on the remote node. By default, **ssh**(1)
is executed with the **-4** option, which forces using **IPv4** addressing.
For debugging purposes, both the ssh client and the commands executed
on the remote node may be overridden by setting the **RPMEM_SSH** and
**RPMEM_CMD** environment variables, respectively. See **ENVIRONMENT**
for details.
# FORK #
The **ssh**(1) client is executed
by **rpmem_open**(3) and **rpmem_create**(3) after forking a child process
using **fork**(2). The application must take this into account when
using **wait**(2) and **waitpid**(2), which may return the *PID* of
the **ssh**(1) process executed by **librpmem**.
If **fork**(2) support is not enabled in **libibverbs**,
**rpmem_open**(3) and **rpmem_create**(3) will fail.
By default, **fabric**(7) initializes **libibverbs** with **fork**(2) support
by calling the **ibv_fork_init**(3) function. See **fi_verbs**(7) for more
details.
# CAVEATS #
**librpmem** relies on the library destructor being called from the main thread.
For this reason, all functions that might trigger destruction (e.g.
**dlclose**(3)) should be called in the main thread. Otherwise some of the
resources associated with that thread might not be cleaned up properly.
**librpmem** registers a pool as a single memory region. A Chelsio T4 and T5
hardware can not handle a memory region greater than or equal to 8GB due to
a hardware bug. So *pool_size* value for **rpmem_create**(3) and **rpmem_open**(3)
using this hardware can not be greater than or equal to 8GB.
# LIBRARY API VERSIONING #
This section describes how the library API is versioned,
allowing applications to work with an evolving API.
The **rpmem_check_version**() function is used to see if the installed
**librpmem** supports the version of the library API required by an
application. The easiest way to do this is for the application to supply
the compile-time version information, supplied by defines in
**\<librpmem.h\>**, like this:
```c
reason = rpmem_check_version(RPMEM_MAJOR_VERSION,
RPMEM_MINOR_VERSION);
if (reason != NULL) {
/* version check failed, reason string tells you why */
}
```
Any mismatch in the major version number is considered a failure, but a
library with a newer minor version number will pass this check since
increasing minor versions imply backwards compatibility.
An application can also check specifically for the existence of an
interface by checking for the version where that interface was
introduced. These versions are documented in this man page as follows:
unless otherwise specified, all interfaces described here are available
in version 1.0 of the library. Interfaces added after version 1.0 will
contain the text *introduced in version x.y* in the section of this
manual describing the feature.
When the version check performed by **rpmem_check_version**() is
successful, the return value is NULL. Otherwise the return value is a
static string describing the reason for failing the version check. The
string returned by **rpmem_check_version**() must not be modified or
freed.
# ENVIRONMENT #
**librpmem** can change its default behavior based on the following
environment variables. These are largely intended for testing and are
not normally required.
+ **RPMEM_SSH**=*ssh_client*
Setting this environment variable overrides the default **ssh**(1) client
command name.
+ **RPMEM_CMD**=*cmd*
Setting this environment variable overrides the default command executed on
the remote node using either **ssh**(1) or the alternative remote shell command
specified by **RPMEM_SSH**.
**RPMEM_CMD** can contain multiple commands separated by a vertical bar (`|`).
Each consecutive command is executed on the remote node in order read from a
pool set file. This environment variable is read when the library is
initialized, so **RPMEM_CMD** must be set prior to application launch (or
prior to **dlopen**(3) if **librpmem** is being dynamically loaded).
+ **RPMEM_ENABLE_SOCKETS**=0\|1
Setting this variable to 1 enables using **fi_sockets**(7) provider for
in-band RDMA connection. The *sockets* provider does not support IPv6.
It is required to disable IPv6 system wide if **RPMEM_ENABLE_SOCKETS** == 1 and
*target* == localhost (or any other loopback interface address) and
**SSH_CONNECTION** variable (see **ssh**(1) for more details) contains IPv6
address after ssh to loopback interface. By default the *sockets* provider is
disabled.
* **RPMEM_ENABLE_VERBS**=0\|1
Setting this variable to 0 disables using **fi_verbs**(7) provider for
in-band RDMA connection. The *verbs* provider is enabled by default.
* **RPMEM_MAX_NLANES**=*num*
Limit the maximum number of lanes to *num*. See **LANES**, in **rpmem_create**(3), for details.
# DEBUGGING AND ERROR HANDLING #
If an error is detected during the call to a **librpmem** function, the
application may retrieve an error message describing the reason for the failure
from **rpmem_errormsg**(). This function returns a pointer to a static buffer
containing the last error message logged for the current thread. If *errno*
was set, the error message may include a description of the corresponding
error code as returned by **strerror**(3). The error message buffer is
thread-local; errors encountered in one thread do not affect its value in
other threads. The buffer is never cleared by any library function; its
content is significant only when the return value of the immediately preceding
call to a **librpmem** function indicated an error, or if *errno* was set.
The application must not modify or free the error message string, but it may
be modified by subsequent calls to other library functions.
Two versions of **librpmem** are typically available on a development
system. The normal version, accessed when a program is linked using the
**-lrpmem** option, is optimized for performance. That version skips checks
that impact performance and never logs any trace information or performs any
run-time assertions.
A second version of **librpmem**, accessed when a program uses the libraries
under _DEBUGLIBPATH(), contains run-time assertions and trace points. The
typical way to access the debug version is to set the environment variable
**LD_LIBRARY_PATH** to _LDLIBPATH(). Debugging output is
controlled using the following environment variables. These variables have
no effect on the non-debug version of the library.
+ **RPMEM_LOG_LEVEL**
The value of **RPMEM_LOG_LEVEL** enables trace points in the debug version
of the library, as follows:
+ **0** - This is the default level when **RPMEM_LOG_LEVEL** is not set.
No log messages are emitted at this level.
+ **1** - Additional details on any errors detected are logged
(in addition to returning the *errno*-based errors as usual).
The same information may be retrieved using **rpmem_errormsg**().
+ **2** - A trace of basic operations is logged.
+ **3** - Enables a very verbose amount of function call
tracing in the library.
+ **4** - Enables voluminous and fairly obscure tracing information
that is likely only useful to the **librpmem** developers.
Unless **RPMEM_LOG_FILE** is set, debugging output is written to *stderr*.
+ **RPMEM_LOG_FILE**
Specifies the name of a file where all logging information should be written.
If the last character in the name is "-", the *PID* of the current process will
be appended to the file name when the log file is created. If
**RPMEM_LOG_FILE** is not set, logging output is written to *stderr*.
# EXAMPLE #
The following example uses **librpmem** to create a remote pool on given
target node identified by given pool set name. The associated local memory
pool is zeroed and the data is made persistent on remote node. Upon success
the remote pool is closed.
```c
#include <stdio.h>
#include <string.h>
#include <librpmem.h>
#define POOL_SIZE (32 * 1024 * 1024)
#define NLANES 4
unsigned char pool[POOL_SIZE];
int
main(int argc, char *argv[])
{
int ret;
unsigned nlanes = NLANES;
/* fill pool_attributes */
struct rpmem_pool_attr pool_attr;
memset(&pool_attr, 0, sizeof(pool_attr));
/* create a remote pool */
RPMEMpool *rpp = rpmem_create("localhost", "pool.set",
pool, POOL_SIZE, &nlanes, &pool_attr);
if (!rpp) {
fprintf(stderr, "rpmem_create: %s\n", rpmem_errormsg());
return 1;
}
/* store data on local pool */
memset(pool, 0, POOL_SIZE);
/* make local data persistent on remote node */
ret = rpmem_persist(rpp, 0, POOL_SIZE, 0, 0);
if (ret) {
fprintf(stderr, "rpmem_persist: %s\n", rpmem_errormsg());
return 1;
}
/* close the remote pool */
ret = rpmem_close(rpp);
if (ret) {
fprintf(stderr, "rpmem_close: %s\n", rpmem_errormsg());
return 1;
}
return 0;
}
```
# NOTE #
The **librpmem** API is experimental and may be subject to change in the future.
However, using the remote replication in **libpmemobj**(7) is safe and backward
compatibility will be preserved.
# ACKNOWLEDGEMENTS #
**librpmem** builds on the persistent memory programming model
recommended by the SNIA NVM Programming Technical Work Group:
<http://snia.org/nvmp>
# SEE ALSO #
**rpmemd**(1), **ssh**(1), **fork**(2), **dlclose**(3), **dlopen**(3),
**ibv_fork_init**(3), **rpmem_create**(3), **rpmem_open**(3),
**rpmem_persist**(3), **strerror**(3), **limits.conf**(5), **fabric**(7),
**fi_sockets**(7), **fi_verbs**(7), **libpmem**(7), **libpmemblk**(7),
**libpmemcto**(7), **libpmemlog**(7), **libpmemobj**(7)
and **<http://pmem.io>**
| 16,153 | 36.050459 | 95 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/librpmem/rpmem_create.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(RPMEM_CREATE, 3)
collection: librpmem
header: PMDK
date: rpmem API version 1.2
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (rpmem_create.3 -- man page for most commonly used librpmem functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[NOTES](#notes)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**rpmem_create**(), **rpmem_open**(),
**rpmem_set_attr**(), **rpmem_close**(), **rpmem_remove**()
- most commonly used functions for remote access to *persistent memory*
# SYNOPSIS #
```c
#include <librpmem.h>
RPMEMpool *rpmem_create(const char *target, const char *pool_set_name,
void *pool_addr, size_t pool_size, unsigned *nlanes,
const struct rpmem_pool_attr *create_attr);
RPMEMpool *rpmem_open(const char *target, const char *pool_set_name,
void *pool_addr, size_t pool_size, unsigned *nlanes,
struct rpmem_pool_attr *open_attr);
int rpmem_set_attr(RPMEMpool *rpp, const struct rpmem_pool_attr *attr);
int rpmem_close(RPMEMpool *rpp);
int rpmem_remove(const char *target, const char *pool_set_name, int flags);
```
# DESCRIPTION #
The **rpmem_create**() function creates a remote pool on a given *target* node,
using pool *set* file *pool_set_name* to map the remote pool. *pool_set_name*
is a relative path in the root config directory on the *target* node.
For pool set file format and options see **poolset**(5).
*pool_addr* is a pointer to the associated local memory pool with size
*pool_size*. Both *pool_addr* and *pool_size* must be aligned to the system's
page size (see **sysconf**(3)). The size of the remote pool must be at least
*pool_size*. See **REMOTE POOL SIZE**, below, for details.
*nlanes* points to the maximum number of lanes which the caller is requesting.
Upon successful creation of the remote pool, \**nlanes* is set to the
maximum number of lanes supported by both the local and remote nodes.
See **LANES**, below, for details.
The *create_attr* structure contains the attributes used for creating the
remote pool. If the *create_attr* structure is not NULL, a pool with internal
metadata is created. The metadata is stored in the first 4096
bytes of the pool and can be read when opening the remote pool with
**rpmem_open**(). To prevent user from overwriting the pool metadata, this
region is not accessible to the user via **rpmem_persist**().
If *create_attr* is NULL or zeroed, remote pool set file must contain
the *NOHDRS* option. In that case the remote pool is created without internal
metadata in it and the entire pool space is available to the user.
See **rpmem_persist**(3) for details.
The **rpmem_open**() function opens the existing remote pool with *set* file
*pool_set_name* on remote node *target*. *pool_set_name* is a relative path
in the root config directory on the *target* node. *pool_addr* is a pointer to
the associated local memory pool of size *pool_size*.
Both *pool_addr* and *pool_size* must be aligned to the system's page
size (see **sysconf**(3)). The size of the remote pool must be at least
*pool_size*. See **REMOTE POOL SIZE**, below, for details.
*nlanes* points to the maximum number of lanes which the caller is requesting.
Upon successful opening of the remote pool, \**nlanes* is set to the
maximum number of lanes supported by both the local and remote nodes.
See **LANES**, below, for details.
The **rpmem_set_attr**() function overwrites the pool's attributes.
The *attr* structure contains the attributes used for overwriting the remote
pool attributes that were passed to **rpmem_create**() at pool creation.
If *attr* is NULL, a zeroed structure with attributes will be used.
New attributes are stored in the pool's metadata.
The **rpmem_close**() function closes the remote pool *rpp*. All resources
are released on both the local and remote nodes. The remote pool itself
persists on the remote node and may be re-opened at a later time using
**rpmem_open**().
The **rpmem_remove**() function removes the remote pool with *set* file name
*pool_set_name* from node *target*. The *pool_set_name* is a relative path in
the root config directory on the *target* node. By default only the pool part
files are removed; the pool *set* file is left untouched. If the pool is not
consistent, the **rpmem_remove**() function fails.
The *flags* argument determines the behavior of **rpmem_remove**(). *flags* may
be either 0 or the bitwise OR of one or more of the following flags:
+ **RPMEM_REMOVE_FORCE** - Ignore errors when opening an inconsistent pool.
The pool *set* file must still be in appropriate format for the pool to be
removed.
+ **RPMEM_REMOVE_POOL_SET** - Remove the pool *set* file after removing the
pool described by this pool set.
# RETURN VALUE #
On success, **rpmem_create**() returns an opaque handle to the remote pool
for use in subsequent **librpmem** calls. If any error prevents
the remote pool from being created, **rpmem_create**() returns
NULL and sets *errno* appropriately.
On success, **rpmem_open**() returns an opaque handle to the remote
pool for subsequent **librpmem** calls. If the *open_attr* argument
is not NULL, the remote pool attributes are returned in the provided structure.
If the remote pool was created without internal metadata, zeroes are returned
in the *open_attr* structure on successful call to **rpmem_open**().
If any error prevents the remote pool from being opened, **rpmem_open**()
returns NULL and sets *errno* appropriately.
On success, **rpmem_set_attr**() returns 0. On error, it returns -1 and sets
*errno* appropriately.
On success, **rpmem_close**() returns 0. On error, it returns a non-zero value
and sets *errno* appropriately.
On success, **rpmem_remove**() returns 0. On error, it returns a non-zero value
and sets *errno* appropriately.
# NOTES #
## REMOTE POOL SIZE ##
The size of a remote pool depends on the configuration in the pool set file
on the remote node (see **poolset**(5)). If no pool set options is used in
the remote pool set file, the remote pool size is the sum of the sizes of all
part files, decreased by 4096 bytes per part file. 4096 bytes of each part file
are utilized for storing internal metadata.
If the *SINGLEHDR* option is used in the remote pool set file, the remote pool
size is the sum of sizes of all part files, decreased once by 4096 bytes.
In this case only the first part contains internal metadata.
If a remote pool set file contains the *NOHDRS* option, the remote pool size
is the sum of sizes of all its part files. In this case none of the parts
contains internal metadata. For other consequences of using the *SINGLEHDR* and
*NOHDRS* options see **rpmem_persist**(3).
**RPMEM_MIN_PART** and **RPMEM_MIN_POOL** in **\<librpmem.h\>** define
the minimum size allowed by **librpmem** for a part file and a remote pool,
respectively.
## LANES ##
The term *lane* means an isolated path of execution. The underlying hardware
utilized by both local and remote nodes may have limited resources that
restrict the maximum number of parallel **rpmem_persist**(3) operations.
The maximum number of supported lanes is returned by the **rpmem_open**() and
**rpmem_create**() function calls. The caller passes the maximum number of
lanes requested in \**nlanes*. If the pool is successfully created or opened,
\**nlanes* is updated to reflect the minimum of the number of lanes requested
by the caller and the maximum number of lanes supported by underlying hardware.
The application is obligated to use at most the returned number of
lanes in parallel.
**rpmem_persist**(3) does not provide any locking mechanism; thus any
serialization of calls must be performed by the application if required.
Each lane requires a separate connection, represented by a file descriptor.
If the system runs out of free file descriptors during **rpmem_create**() or
**rpmem_open**(), these functions will fail. See **nofile** in
**limits.conf**(5) for more details.
# SEE ALSO #
**rpmem_persist**(3), **sysconf**(3), **limits.conf**(5),
**libpmemobj**(7), **librpmem**(7) and **<http://pmem.io>**
| 9,985 | 47.712195 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemcto/pmemcto_open.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMCTO_OPEN, 3)
collection: libpmemcto
header: PMDK
date: libpmemcto API version 1.0
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemcto_open.3 -- man page for libpmemcto)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[ERRORS](#errors)<br />
[CAVEATS](#caveats)<br />
[BUGS](#bugs)<br />
[SEE ALSO](#see-also)<br />
# NAME #
_UW(pmemcto_create), _UW(pmemcto_open),
**pmemcto_close**(), _UW(pmemcto_check)
- create, open, close and validate close-to-open persistence pool
# SYNOPSIS #
```c
#include <libpmemcto.h>
_UWFUNCR1(PMEMctopool, *pmemcto_create, *path, =q=const char *layout,
size_t poolsize, mode_t mode=e=)
_UWFUNCR1(PMEMctopool, *pmemcto_open, *path, const char *layout)
void pmemcto_close(PMEMctopool *pcp);
_UWFUNCR1(int, pmemcto_check, *path, const char *layout)
```
_UNICODE()
# DESCRIPTION #
The _UW(pmemcto_create) function creates a close-to-open persistence pool with
the given total *poolsize*. The resulting pool is then used with
functions like **pmemcto_malloc**(3) and **pmemcto_free**(3) to provide the
familiar *malloc-like* programming model for the memory pool.
*path* specifies the name of the memory pool file to be
created. *layout* specifies the application's layout type in the form of a
string. The layout name is not interpreted by **libpmemcto**(7), but may be
used as a check when _UW(pmemcto_open) is called. The layout name, including
the terminating null byte ('\\0'), cannot be longer than **PMEMCTO_MAX_LAYOUT**
as defined in **\<libpmemcto.h\>**. A NULL *layout* is equivalent
to using an empty string as a layout name. *mode* specifies the permissions to
use when creating the file, as described by **creat**(2). The memory pool file
is fully allocated to the size *poolsize* using **posix_fallocate**(3). The
caller may choose to take responsibility for creating the memory pool file
by creating it before calling _UW(pmemcto_create), and then specifying
*poolsize* as zero. In this case _UW(pmemcto_create) will take the pool size
from the size of the existing file and will verify that the file appears to be
empty by searching for any non-zero data in the pool header at the beginning of
the file. The minimum net pool size allowed by the library for a local
close-to-open persistence pool is defined in **\<libpmemcto.h\>** as
**PMEMCTO_MIN_POOL**.
Depending on the configuration of the system, the available non-volatile
memory space may be divided into multiple memory devices. In such case, the
maximum size of the pmemcto memory pool could be limited by the capacity of a
single memory device. **libpmemcto**(7) allows building a close-to-open
persistence pool spanning multiple memory devices by creation of persistent
memory pools consisting of multiple files, where each part of such a *pool set*
may be stored on a different memory device or pmem-aware filesystem.
Creation of all the parts of the pool set can be done with _UW(pmemcto_create);
however, the recommended method for creating pool sets is by using the
**pmempool**(1) utility.
When creating a pool set consisting of multiple files, the *path* argument
passed to _UW(pmemcto_create) must point to the special *set* file that defines
the pool layout and the location of all the parts of the pool set. The
*poolsize* argument must be 0. The meaning of the *layout* and *mode* arguments
does not change, except that the same *mode* is used for creation of all the
parts of the pool set.
For more information on pool set format, see **poolset**(5).
The _UW(pmemcto_open) function opens an existing close-to-open persistence
memory pool.
*path* must be an existing file containing a pmemcto memory pool as created
by _UW(pmemcto_create). If *layout* is non-NULL, it is compared to the layout
name provided to _UW(pmemcto_create) when the pool was first created. This can
be used to verify that the layout of the pool matches what was expected.
The application must have permission to open the file and memory map it with
read/write permissions.
The **pmemcto_close**() function closes the memory pool indicated by *pcp*
and deletes the memory pool handle. The close-to-open memory pool itself
lives on in the file that contains it and may be re-opened at a later time
using _UW(pmemcto_open) as described above.
If the pool was not closed gracefully due to abnormal program
termination or power failure, the pool is in an inconsistent state
causing subsequent pool opening to fail.
The _UW(pmemcto_check) function performs a consistency check of the file
indicated by *path*, and returns 1 if the memory pool is found to be consistent.
If the pool is found not to be consistent, further use of the
file with **libpmemcto**(7) will result in undefined behavior.
The debug version of **libpmemcto**(7) will provide additional details
on inconsistencies when **PMEMCTO_LOG_LEVEL** is at least 1, as described
in the **DEBUGGING AND ERROR HANDLING** section of **libpmemcto**(7).
_UW(pmemcto_check) will return -1 and set *errno* if it cannot perform
the consistency check due to other errors. _UW(pmemcto_check) opens
the given *path* read-only so it never makes any changes to the file.
This function is not supported on Device DAX.
# RETURN VALUE #
On success, _UW(pmemcto_create) returns a *PMEMctopool\** handle to the
close-to-open persistence memory pool. On error, it returns NULL and sets
*errno* appropriately.
On success, _UW(pmemcto_open) returns a *PMEMctopool\** handle that can be
used with most of the functions in **libpmemcto**(7). On error, it returns
NULL and sets *errno* appropriately.
The **pmemcto_close**() function returns no value.
_UW(pmemcto_check) returns 1 if the memory pool is found to be consistent.
If the check is successfully performed but the pool is found to be inconsistent,
_UW(pmemcto_check) returns 0. If the consistency check cannot be performed,
_UW(pmemcto_check) returns -1 and sets *errno* appropriately.
This includes the case where *layout* is non-NULL and does not match
the layout string given when the pool was created.
# ERRORS #
**EINVAL** "layout" string does not match the layout stored in pool header.
**EINVAL** "layout" string is longer than **PMEMCTO_MAX_LAYOUT**.
**EINVAL** *poolsize* is less than **PMEMCTO_MIN_POOL**.
**EINVAL** Invalid format of the pool set file.
**EINVAL** Invalid pool header.
**EEXIST** *path* passed to _UW(pmemcto_create) points to a pool set file,
but *poolsize* is not zero.
**EEXIST** *path* passed to _UW(pmemcto_create) points to an existing file,
but *poolsize* is not zero.
**EEXIST** *path* passed to _UW(pmemcto_create) points to an existing file,
which is not-empty.
**EAGAIN** The pmemcto pool pointed by *path* is already open.
**EACCES** No write access permission to the pool file(s).
**ENOMEM** The pool cannot be mapped at the address it was created.
# CAVEATS #
Not all file systems support **posix_fallocate**(3). _UW(pmemcto_create) will
fail if the underlying file system does not support **posix_fallocate**(3).
# BUGS #
Unlike **libpmemobj**(7), data replication is not supported in
**libpmemcto**(7).
Thus, it is not allowed to specify replica sections in pool set files.
# SEE ALSO #
**ndctl-create-namespace**(1), **pmempool-create**(1),
**jemalloc**(3), **poolset**(5),
**libpmemcto**(7), **libpmemobj**(7) and **<http://pmem.io>**
| 9,309 | 42.915094 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemcto/pmemcto_malloc_usable_size.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMCTO_MALLOC_USABLE_SIZE, 3)
collection: libpmemcto
header: PMDK
date: libpmemcto API version 1.0
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemcto_malloc_usable_size.3 -- man page for libpmemcto)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
pmemcto_malloc_usable_size - obtain size of block of memory allocated from pool
# SYNOPSIS #
```c
#include <libpmemcto.h>
size_t pmemcto_malloc_usable_size(PMEMctopool *pcp, void *ptr);
```
# DESCRIPTION #
The **pmemcto_malloc_usable_size**() function provides the same semantics
as **malloc_usable_size**(3), but operates on the memory pool *pcp* instead
of the process heap supplied by the system. It returns the number of usable
bytes in the block of allocated memory pointed to by *ptr*, a pointer to
a block of memory allocated by **pmemcto_malloc**(3) or a related function.
# RETURN VALUE #
The **pmemcto_malloc_usable_size**() function returns the number of usable
bytes in the block of allocated memory pointed to by *ptr*.
If *ptr* is NULL, 0 is returned.
# SEE ALSO #
**jemalloc**(3), **malloc**(3), **malloc_usable_size**(3),
**pmemcto_malloc**(3),
**libpmemcto**(7) and **<http://pmem.io>**
| 3,200 | 38.036585 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemcto/pmemcto_set_root_pointer.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMCTO_SET_ROOT_POINTER, 3)
collection: libpmemcto
header: PMDK
date: libpmemcto API version 1.0
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemcto_set_root_pointer.3 -- man page for libpmemcto)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
pmemcto_set_root_pointer, pmemcto_get_root_pointer
- set or obtain the root object pointer
# SYNOPSIS #
```c
#include <libpmemcto.h>
void pmemcto_set_root_pointer(PMEMctopool *pcp, void *ptr);
void *pmemcto_get_root_pointer(PMEMctopool *pcp);
```
# DESCRIPTION #
The root object of persistent memory pool is an entry point for all other
persistent objects allocated using the **libpmemcto**(7) APIs. In other words,
every single object stored in persistent memory pool should have the root
object at the end of its reference path.
There is exactly one root object in each pool.
The **pmemcto_set_root_pointer**() function saves the pointer to the root
object in given pool. The *ptr* must have been returned by a previous call
to **pmemcto_malloc**(3), **pmemcto_calloc**(3), **pmemcto_realloc**(3)
or **pmemcto_aligned_alloc**(3) for *the same pool of memory*.
The **pmemcto_get_root_pointer**() function returns the pointer to the root
object in given pool, or NULL if the root pointer was never set.
# RETURN VALUE #
The **pmemcto_set_root_pointer**() function returns no value.
The **pmemcto_get_root_pointer**() function returns the pointer to the root
object in given pool, or NULL if the root pointer was never set.
# SEE ALSO #
**pmemcto_aligned_alloc**(3), **pmemcto_calloc**(3), **pmemcto_malloc**(3),
**pmemcto_realloc**(3),
**libpmemcto**(7) and **<http://pmem.io>**
| 3,675 | 38.526882 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemcto/libpmemcto.7.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(LIBPMEMCTO, 7)
collection: libpmemcto
header: PMDK
date: libpmemcto API version 1.0
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (libpmemcto.7 -- man page for libpmemcto)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[CAVEATS](#caveats)<br />
[LIBRARY API VERSIONING](#library-api-versioning-1)<br />
[MANAGING LIBRARY BEHAVIOR](#managing-library-behavior-1)<br />
[DEBUGGING AND ERROR HANDLING](#debugging-and-error-handling)<br />
[EXAMPLE](#example)<br />
[BUGS](#bugs)<br />
[NOTES](#notes)<br />
[AVAILABILITY](#availability)<br />
[ACKNOWLEDGEMENTS](#acknowledgements)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**libpmemcto** - close-to-open persistence (EXPERIMENTAL)
# SYNOPSIS #
```c
#include <libpmemcto.h>
cc ... -lpmemcto -lpmem
```
_UNICODE()
##### Library API versioning: #####
```c
_UWFUNC(pmemcto_check_version, =q=
unsigned major_required,
unsigned minor_required=e=)
```
##### Managing library behavior: #####
```c
void pmemcto_set_funcs(
void *(*malloc_func)(size_t size),
void (*free_func)(void *ptr),
void *(*realloc_func)(void *ptr, size_t size),
char *(*strdup_func)(const char *s),
void (*print_func)(const char *s));
```
##### Error handling: #####
```c
_UWFUNC(pmemcto_errormsg, void)
```
##### Other library functions: #####
A description of other **libpmemcto** functions can be found on the following
manual pages:
**pmemcto_aligned_alloc**(3), **pmemcto_malloc**(3),
**pmemcto_malloc_usable_size**(3), **pmemcto_open**(3),
**pmemcto_set_root_pointer**(3), **pmemcto_stats_print**(3),
**pmemcto_strdup**(3), **pmemcto_wcsdup**(3)
# DESCRIPTION #
**libpmemcto** is a *persistent memory* allocator with no overhead imposed by
run-time flushing or transactional updates:
+ It runs at traditional **volatile** memory allocator speeds - there is
no flushing or consistency check at run-time.
+ An overhead imposed only when program exits normally and have to flush
the file.
+ The program flushes the pool contents when it exits, and then rebuilds
the pool on the next run.
+ If the program crashes before flushing the file (or if flushing fails),
the pool is in an inconsistent state causing subsequent pool opening to fail.
**libpmemcto** provides common *malloc-like* interfaces to persistent memory
pools built on memory-mapped files. **libpmemcto** uses the **mmap**(2) system
call to create a pool of persistent memory. The library is intended for
applications using *Direct Access* storage (DAX), which is memory-addressable
persistent storage that supports load/store access without being paged via
the system page cache. A Persistent Memory-aware file system is typically used
to provide this type of access. Memory-mapping a file from
a Persistent Memory-aware file system provides the raw memory pools, and this
library supplies the more familiar *malloc-like* interfaces on top
of those pools. **libpmemcto** is one of a collection of persistent memory
libraries available, the others are:
+ **libpmemobj**(7), a general use persistent memory API, providing memory
allocation and transactional operations on variable-sized objects.
+ **libpmemblk**(7), providing pmem-resident arrays of fixed-sized blocks with
atomic updates.
+ **libpmemlog**(7), providing a pmem-resident log file.
+ **libpmem**(7), low-level persistent memory support.
Under normal usage, **libpmemcto** will never print messages or intentionally
cause the process to exit. Exceptions to this are prints caused by calls to
**pmemcto_stats_print**(3), or by enabling debugging as described under
**DEBUGGING AND ERROR HANDLING** below. The library uses **pthreads**(7)
to be fully MT-safe, but never creates or destroys threads itself.
The library does not make use of any signals, networking, and never calls
**select**() or **poll**().
The system memory allocation routines like **malloc**() and **free**()
are used by **libpmemcto** for managing a small amount of run-time state,
but applications are allowed to override these calls if necessary
(see **pmemcto_set_funcs**()).
This library builds on the low-level pmem support provided by **libpmem**(7).
To use close-to-open persistence supplied by **libpmemcto**, a *memory pool*
is first created using the _UW(pmemcto_create) function described
in **pmemcto_open**(3). The other **libpmemcto** functions operate on
the resulting block memory pool using the opaque handle, of type
*PMEMctopool\**, that is returned by _UW(pmemcto_create) or _UW(pmemcto_open).
Internally, **libpmemcto** will use either
**pmem_persist**(3) or **msync**(2) when it needs to flush changes, depending
on whether the memory pool appears to be persistent memory or a regular file
(see the **pmem_is_pmem**(3) function in **libpmem**(7) for more information).
There is no need for applications to flush changes directly when using the
close-to-open persistence memory API provided by **libpmemcto**.
# CAVEATS #
**libpmemcto** relies on the library destructor being called from the main
thread. For this reason, all functions that might trigger destruction (e.g.
**dlclose**(3)) should be called in the main thread. Otherwise some of the
resources associated with that thread might not be cleaned up properly.
# LIBRARY API VERSIONING #
This section describes how the library API is versioned,
allowing applications to work with an evolving API.
The _UW(pmemcto_check_version) function is used to determine whether the
installed **libpmemcto** supports the version of the library API required
by an application. The easiest way to do this is for the application to
supply the compile-time version information, supplied by defines in
**\<ibpmemcto.h\>**, like this:
```c
reason = _U(pmemcto_check_version)(PMEMCTO_MAJOR_VERSION,
PMEMCTO_MINOR_VERSION);
if (reason != NULL) {
/* version check failed, reason string tells you why */
}
```
Any mismatch in the major version number is considered a failure, but a library
with a newer minor version number will pass this check since increasing minor
versions imply backwards compatibility.
An application can also check specifically for the existence of an interface
by checking for the version where that interface was introduced. These versions
are documented in this man page as follows: unless otherwise specified, all
interfaces described here are available in version 1.0 of the library.
Interfaces added after version 1.0 will contain the text *introduced in
version x.y* in the section of this manual describing the feature.
When the version check performed by _UW(pmemcto_check_version) is successful,
the return value is NULL. Otherwise the return value is a static string
describing the reason for failing the version check. The string returned by
_UW(pmemcto_check_version) must not be modified or freed.
# MANAGING LIBRARY BEHAVIOR #
The **pmemcto_set_funcs**() function allows an application to override memory
allocation calls used internally by **libpmemcto**.
Passing in NULL for any of the handlers will cause
the **libpmemcto** default function to be used.
The library does not make heavy use of the system malloc functions,
but it does allocate approximately 4-8 kilobytes for each memory pool in use.
# DEBUGGING AND ERROR HANDLING #
The _UW(pmemcto_errormsg) function returns a pointer to a static buffer
containing the last error message logged for the current thread. If *errno* was
set, the error message may include a description of the corresponding error
code, as returned by **strerror**(3). The error message buffer is thread-local;
errors encountered in one thread do not affect its value in other threads. The
buffer is never cleared by any library function; its content is significant
only when the return value of the immediately preceding call to a
**libpmemcto** function indicated an error, or if *errno* was set. The
application must not modify or free the error message string, but it may be
modified by subsequent calls to other library functions.
Two versions of **libpmemcto** are typically available on a development system.
The normal version, accessed when a program is linked using the **-lpmemcto**
option, is optimized for performance. That version skips checks that impact
performance and never logs any trace information or performs any run-time
assertions. If an error is detected in a call to **libpmemcto**,
the error message describing the failure may be retrieved with
_UW(pmemcto_errormsg) as described above.
A second version of **libpmemcto**, accessed when a program uses the libraries
under _DEBUGLIBPATH(), contains run-time assertions and trace points. The
typical way to access the debug version is to set the **LD_LIBRARY_PATH**
environment variable to _LDLIBPATH(). Debugging output is
controlled using the following environment variables. These variables have
no effect on the non-debug version of the library.
+ **PMEMCTO_LOG_LEVEL**
The value of **PMEMCTO_LOG_LEVEL** enables trace points in the debug version
of the library, as follows:
+ **0** - This is the default level when **PMEMCTO_LOG_LEVEL** is not set.
No log messages are emitted at this level.
+ **1** - Additional details on any errors detected are logged,
in addition to returning the *errno*-based errors as usual.
The same information may be retrieved using _UW(pmemcto_errormsg).
+ **2** - A trace of basic operations is logged.
+ **3** - Enables a very verbose amount of function call tracing
in the library.
+ **4** - Enables voluminous and fairly obscure tracing information
that is likely only useful to the **libpmemcto** developers.
Unless **PMEMCTO_LOG_FILE** is set, debugging output is written to *stderr*.
+ **PMEMCTO_LOG_FILE**
Specifies the name of a file
where all logging information should be written. If the last character in the
name is "-", the *PID* of the current process will be appended to the file name
when the log file is created. If **PMEMCTO_LOG_FILE** is not set, the logging
output is written to *stderr*.
See also **libpmem**(7) for information on other environment variables
that may affect **libpmemcto** behavior.
# EXAMPLE #
The following example creates a memory pool, allocates some memory
to contain the string "hello, world", and then frees that memory.
```c
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <libpmemcto.h>
/* size of the pmemcto pool -- 1 GB */
#define POOL_SIZE ((size_t)(1 << 30))
/* name of our layout in the pool */
#define LAYOUT_NAME "example_layout"
struct root {
char *str;
char *data;
};
int
main(int argc, char *argv[])
{
const char path[] = "/pmem-fs/myfile";
PMEMctopool *pcp;
/* create the pmemcto pool or open it if already exists */
pcp = pmemcto_create(path, LAYOUT_NAME, POOL_SIZE, 0666);
if (pcp == NULL)
pcp = pmemcto_open(path, LAYOUT_NAME);
if (pcp == NULL) {
perror(path);
exit(1);
}
/* get the root object pointer */
struct root *rootp = pmemcto_get_root_pointer(pcp);
if (rootp == NULL) {
/* allocate root object */
rootp = pmemcto_malloc(pcp, sizeof(*rootp));
if (rootp == NULL) {
perror(pmemcto_errormsg());
exit(1);
}
/* save the root object pointer */
pmemcto_set_root_pointer(pcp, rootp);
rootp->str = pmemcto_strdup(pcp, "Hello World!");
rootp->data = NULL;
}
/* ... */
pmemcto_close(pcp);
}
```
See <http://pmem.io/pmdk/libpmemcto> for more examples using the
**libpmemcto** API.
# BUGS #
Unlike **libpmemobj**(3), data replication is not supported in **libpmemcto**.
Thus, it is not allowed to specify replica sections in pool set files.
# NOTES #
Unlike the normal **malloc**(), which asks the system for additional
memory when it runs out, **libpmemcto** allocates the size it is told
to and never attempts to grow or shrink that memory pool.
# AVAILABILITY #
**libpmemcto** is part of the PMDK since version 1.4 and is available
from <https://github.com/pmem/pmdk>
# ACKNOWLEDGEMENTS #
**libpmemcto** depends on jemalloc, written by Jason Evans, to do the heavy
lifting of managing dynamic memory allocation. See:
<http://www.canonware.com/jemalloc>
**libpmemcto** builds on the persistent memory programming model recommended
by the SNIA NVM Programming Technical Work Group:
<http://snia.org/nvmp>
# SEE ALSO #
**ndctl-create-namespace**(1), **dlclose**(2), **mmap**(2),
**jemalloc**(3), **malloc**(3),
**pmemcto_aligned_alloc**(3), **pmemcto_errormsg**(3), **pmemcto_malloc**(3),
**pmemcto_malloc_usable_size**(3), **pmemcto_open**(3),
**pmemcto_set_root_pointer**(3), **pmemcto_stats_print**(3),
**pmemcto_strdup**(3), **pmemcto_wcsdup**(3),
**libpmem**(7), **libpmemblk**(7), **libpmemlog**(7), **libpmemobj**(7)
and **<http://pmem.io>**
| 14,677 | 35.879397 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemcto/pmemcto_malloc.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMCTO_MALLOC, 3)
collection: libpmemcto
header: PMDK
date: libpmemcto API version 1.0
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemcto_malloc.3 -- man page for libpmemcto)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[ERRORS](#errors)<br />
[NOTES](#notes)<br />
[SEE ALSO](#see-also)<br />
# NAME #
pmemcto_malloc, pmemcto_free, pmemcto_calloc, pmemcto_realloc
- allocate and free persistent memory
# SYNOPSIS #
```c
#include <libpmemcto.h>
void *pmemcto_malloc(PMEMctopool *pcp, size_t size);
void pmemcto_free(PMEMctopool *pcp, void *ptr);
void *pmemcto_calloc(PMEMctopool *pcp, size_t nmemb, size_t size);
void *pmemcto_realloc(PMEMctopool *pcp, void *ptr, size_t size);
```
# DESCRIPTION #
The **pmemcto_malloc**() function provides the same semantics
as **malloc**(3), but operates on the memory pool *pcp* instead of
the process heap supplied by the system. It allocates *size* bytes and
returns a pointer to the allocated memory. *The memory is not initialized*.
If *size* is 0, then **pmemcto_malloc**() returns either NULL, or a unique
pointer value that can later be successfully passed to **pmemcto_free**().
The **pmemcto_free**() function provides the same semantics as **free**(3),
but operates on the memory pool *pcp* instead of the process heap supplied
by the system. It frees the memory space pointed to by *ptr*, which must
have been returned by a previous call to **pmemcto_malloc**(),
**pmemcto_calloc**() or **pmemcto_realloc**() for *the same pool of memory*.
Undefined behavior occurs if frees do not correspond to allocated memory
from the same memory pool. If *ptr* is NULL, no operation is performed.
The **pmemcto_calloc**() function provides the same semantics
as **calloc**(3), but operates on the memory pool *pcp* instead of
the process heap supplied by the system. It allocates memory for an array
of *nmemb* elements of *size* bytes each and returns a pointer to the
allocated memory. The memory is set to zero. If *nmemb* or *size* is 0,
then **pmemcto_calloc**() returns either NULL, or a unique pointer value
that can later be successfully passed to **pmemcto_free**().
The **pmemcto_realloc**() function provides the same semantics
as **realloc**(3), but operates on the memory pool *pcp* instead of
the process heap supplied by the system. It changes the size of
the memory block pointed to by *ptr* to *size* bytes. The contents will be
unchanged in the range from the start of the region up to the minimum
of the old and new sizes. If the new size is larger than the old size,
the added memory will *not* be initialized. If *ptr* is NULL,
then the call is equivalent to *pmemcto_malloc(pcp, size)*, for all values
of *size*; if *size* is equal to zero and *ptr* is not NULL, then the call
is equivalent to *pmemcto_free(pcp, ptr)*. Unless *ptr* is NULL,
it must have been returned by an earlier call to **pmemcto_malloc**(),
**pmemcto_calloc**(), **pmemcto_realloc**() or **pmemcto_aligned_alloc**(3).
If the area pointed to was moved, a *pmemcto_free(pcp, ptr)* is done.
# RETURN VALUE #
On success, **pmemcto_malloc**() and **pmemcto_calloc**() functions return
a pointer to the allocated memory. If the allocation request cannot be
satisfied, a NULL pointer is returned and *errno* is set appropriately.
The **pmemcto_free**() function returns no value.
On success, **pmemcto_realloc**() function returns a pointer to the newly
allocated memory, or NULL if it is unable to satisfy the allocation request.
If *size* was equal to 0, either NULL or a pointer suitable to be passed
to **pmemcto_free**() is returned. If **pmemcto_realloc**() fails
the original block is left untouched; it is not freed or moved.
# ERRORS #
**ENOMEM** Insufficient memory available to satisfy allocation request.
# NOTES #
Unlike the normal **malloc**(), which asks the system for additional
memory when it runs out, **libpmemcto**(7) allocates the size it is told
to and never attempts to grow or shrink that memory pool.
# SEE ALSO #
**jemalloc**(3), **malloc**(3),
**pmemcto_aligned_alloc**(3),
**libpmemcto**(7)
and **<http://pmem.io>**
| 6,106 | 42.935252 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemcto/pmemcto_stats_print.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMCTO_STATS_PRINT, 3)
collection: libpmemcto
header: PMDK
date: libpmemcto API version 1.0
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemcto_stats_print.3 -- man page for libpmemcto)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[SEE ALSO](#see-also)<br />
# NAME #
pmemcto_stats_print - write human-readable memory pool statistics
# SYNOPSIS #
```c
#include <libpmemcto.h>
void pmemcto_stats_print(PMEMctopool *pcp, const char *opts);
```
# DESCRIPTION #
The **pmemcto_stats_print**() function produces messages containing statistics
about the given memory pool. The output is printed using **libpmemcto**(7)
internal *print_func* function (see **pmemcto_set_funcs**(3)). That means
the output typically appears on *stderr* unless the caller supplies
a replacement *print_func* or sets the environment variable
**PMEMCTO_LOG_FILE** to direct output elsewhere. The *opts* string can either
be NULL or it can contain a list of options that change the stats printed.
General information that never changes during execution can be omitted
by specifying "g" as a character within the opts string. The characters
"m" and "a" can be specified to omit merged arena and per arena statistics,
respectively; "b" and "l" can be specified to omit per size class statistics
for bins and large objects, respectively. Unrecognized characters are silently
ignored. Note that thread caching may prevent some statistics from being
completely up to date.
See **jemalloc**(3) for more detail (the description of the available *opts*
above was taken from that man page).
# SEE ALSO #
**jemalloc**(3), **libpmemcto**(7) and **<http://pmem.io>**
| 3,605 | 42.445783 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemcto/pmemcto_strdup.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMCTO_STRDUP, 3)
collection: libpmemcto
header: PMDK
date: libpmemcto API version 1.0
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemcto_strdup.3 -- man page for libpmemcto)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[ERRORS](#errors)<br />
[SEE ALSO](#see-also)<br />
# NAME #
pmemcto_strdup - duplicate a string
# SYNOPSIS #
```c
#include <libpmemcto.h>
char *pmemcto_strdup(PMEMctopool *pcp, const char *s);
```
# DESCRIPTION #
The **pmemcto_strdup**() function provides the same semantics as **strdup**(3),
but operates on the memory pool *pcp* instead of the process heap supplied
by the system. It returns a pointer to a new string which is a duplicate
of the string *s*. Memory for the new string is obtained with
**pmemcto_malloc**(3), on the given memory pool, and can be freed with
**pmemcto_free**(3) on the same memory pool.
# RETURN VALUE #
On success, the **pmemcto_strdup**() function returns a pointer to
the duplicated string. If **pmemcto_strdup**() is unable to satisfy the
allocation request, a NULL pointer is returned and *errno* is set appropriately.
# ERRORS #
**ENOMEM** Insufficient memory available to allocate duplicated string.
# SEE ALSO #
**jemalloc**(3), **malloc**(3), **strdup**(3), **wcsdup**(3),
**pmemcto_malloc**(3), **pmemcto_wcsdup**(3),
**libpmemcto**(7) and **<http://pmem.io>**
| 3,343 | 37 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemcto/pmemcto_wcsdup.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMCTO_WCSDUP, 3)
collection: libpmemcto
header: PMDK
date: libpmemcto API version 1.0
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemcto_wcsdup.3 -- man page for libpmemcto)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[ERRORS](#errors)<br />
[SEE ALSO](#see-also)<br />
# NAME #
pmemcto_wcsdup - duplicate a wide-char string
# SYNOPSIS #
```c
#include <libpmemcto.h>
wchar_t *pmemcto_wcsdup(PMEMctopool *pcp, const wchar_t *s);
```
# DESCRIPTION #
The **pmemcto_wcsdup**() function provides the same semantics as **wcsdup**(3),
but operates on the memory pool *pcp* instead of the process heap supplied
by the system. It returns a pointer to a new wide-char string which is
a duplicate of the string *s*. Memory for the new string is obtained with
**pmemcto_malloc**(3), on the given memory pool, and can be freed with
**pmemcto_free**(3) on the same memory pool.
# RETURN VALUE #
On success, the **pmemcto_wcsdup**() function returns a pointer to
the duplicated string. If **pmemcto_wcsdup**() is unable to satisfy the
allocation request, a NULL pointer is returned and *errno* is set appropriately.
# ERRORS #
**ENOMEM** Insufficient memory available to allocate duplicated string.
# SEE ALSO #
**jemalloc**(3), **malloc**(3), **strdup**(3), **wcsdup**(3),
**pmemcto_malloc**(3), **pmemcto_strdup**(3),
**libpmemcto**(7) and **<http://pmem.io>**
| 3,369 | 37.295455 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemcto/pmemcto_aligned_alloc.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMCTO_ALIGNED_ALLOC, 3)
collection: libpmemcto
header: PMDK
date: libpmemcto API version 1.0
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemcto_aligned_alloc.3 -- man page for libpmemcto)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[ERRORS](#errors)<br />
[SEE ALSO](#see-also)<br />
# NAME #
pmemcto_aligned_alloc - allocate aligned memory
# SYNOPSIS #
```c
#include <libpmemcto.h>
void *pmemcto_aligned_alloc(PMEMctopool *pcp, size_t alignment, size_t size);
```
# DESCRIPTION #
The **pmemcto_aligned_alloc**() function provides the same semantics
as **aligned_alloc**(3), but operates on the memory pool *pcp* instead
of the process heap supplied by the system. It allocates *size* bytes from
the memory pool and returns a pointer to the allocated memory.
The memory is not zeroed.
The memory address will be a multiple of *alignment*, which must be a power
of two.
# RETURN VALUE #
On success, **pmemcto_aligned_alloc**() function returns a pointer to the
allocated memory.
If *size* is 0, then **pmemcto_aligned_alloc**() returns either NULL,
or a unique pointer value that can later be successfully passed
to **pmemcto_free**(3). If **pmemcto_aligned_alloc**() is unable to satisfy
the allocation request, a NULL pointer is returned and *errno* is set
appropriately.
# ERRORS #
**EINVAL** *alignment* was not a power of two.
**ENOMEM** Insufficient memory available to satisfy allocation request.
# SEE ALSO #
**aligned_alloc**(3), **malloc**(3), **jemalloc**(3),
**pmemcto_malloc**(3),
**libpmemcto**(7) and **<http://pmem.io>**
| 3,557 | 36.452632 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/pmreorder/pmreorder.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMREORDER, 1)
collection: pmreorder
header: PMDK
date: pmreorder version 1.5
...
[comment]: <> (Copyright 2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmreorder.1 -- man page for pmreorder)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[OPTIONS](#options)<br />
[ENGINES](#engines)<br />
[INSTRUMENTATION](#instrumentation)<br />
[PMEMCHECK STORE LOG](#pmemcheck-store-log)<br />
[ENVIRONMENT](#environment)<br />
[EXAMPLE](#example)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmreorder** - performs a persistent consistency check
using a store reordering mechanism
# SYNOPSIS #
```
$ python pmreorder <options>
```
# DESCRIPTION #
The pmreorder tool is a collection of python scripts designed
to parse and replay operations logged by pmemcheck -
a persistent memory checking tool.
Pmreorder performs the store reordering between persistent
memory barriers - a sequence of flush-fence operations.
It uses a consistency checking routine provided in the
command line options to check whether files are in a
consistent state.
Considering that logging, replaying and reordering of operations
are very time consuming, it is recommended to use as few stores as
possible in test workloads.
# OPTIONS #
`-h, --help`
Prints synopsis and list of options.
`-l <store_log>, --logfile <store_log>`
The pmemcheck log file to process.
`-c <prog|lib>, --checker <prog|lib>`
Consistency checker type.
`-p <path>, --path <path>`
Path to the consistency checker. Checker function has to return 0 for consistent cases and 1 otherwise.
`-n <name>, --name <name>`
The symbol name of the consistency checking function
in the library. Valid only if the checker type is `lib`.
`-o <pmreorder_output>, --output <pmreorder_output>`
Set the logger output file.
`-e <debug|info|warning|error|critical>,
--output-level <debug|info|warning|error|critical>`
Set the output log level.
`-r <NoReorderNoCheck|
NoReorderDoCheck|
ReorderFull|
ReorderPartial|
ReorderAccumulative|
ReorderReverseAccumulative>,
--default-engine <NoReorderNoCheck|
NoReorderDoCheck|
ReorderFull|
ReorderPartial|
ReorderAccumulative|
ReorderReverseAccumulative>`
Set the initial reorder engine. Default value is `NoReorderNoCheck`.
`-x <cli_macros|config_file>, --extended-macros <cli_macros|config_file>`
Assign an engine types to the defined marker.
# ENGINES #
By default, the **NoReorderNoCheck** engine is used,
which means that for each set of stores, the tool
will pass-through all sequences of stores not reordered
and will not run consistency checker on them.
To enable different types of the reorder engine and
begin proper reordering tests, a number of other
engines exist:
+ **NoReorderDoCheck** - pass-through of unchanged operations.
Checks correctness of the stores as they were logged.
Useful for operations that do not require fail safety.
```
Example:
input: (a, b, c)
output: (a, b, c)
```
+ **ReorderAccumulative** - checks correctness on a growing
subset of the original sequence.
```
Example:
input: (a, b, c)
output:
()
(a)
(a, b)
(a, b, c)
```
+ **ReorderReverseAccumulative** - checks correctness on a reverted growing
subset of the original sequence.
```
Example:
input: (a, b, c)
output:
()
(c)
(c, b)
(c, b, a)
```
+ **ReorderPartial** - checks consistency on 3 randomly selected sequences
from a set of 1000 combinations of the original log, without repetitions.
```
Example:
input: (a, b, c)
output:
(b, c)
(b)
(a, b, c)
```
+ **ReorderFull** - for each set of stores generates and checks consistency
of all possible store permutations.
This might prove to be very computationally expensive for most workloads.
It can be useful for critical sections of code with limited number of stores.
```
Example:
input: (a, b, c)
output:
()
(a)
(b)
(c)
(a, b)
(a, c)
(b, a)
(b, c)
(c, a)
(c, b)
(a, b, c)
(a, c, b)
(b, a, c)
(b, c, a)
(c, a, b)
(c, b, a)
```
When the engine is passed with an `-r` option, it will be used
for each logged set of stores.
Additionally, the `-x` parameter can be used to switch engines
separately for any marked code sections.
For more details about `-x` extended macros functionality see section
INSTRUMENTATION below.
# INSTRUMENTATION #
The core of **pmreorder** is based on user-provided named markers.
Sections of code can be 'marked' depending on their importance,
and the degree of reordering can be customized by the use of various
provided engines.
For this purpose, Valgrind's pmemcheck tool exposes a
generic marker macro:
+ **VALGRIND_EMIT_LOG(value)**
It emits log to *store_log* during pmemcheck processing.
*value* is a user-defined marker name.
For more details about pmemcheck execution see
PMEMCHECK STORE LOG section below.
Example:
```
main.c
.
.
.
VALGRIND_EMIT_LOG("PMREORDER_MEMSET_PERSIST.BEGIN");
pmem_memset_persist(...);
VALGRIND_EMIT_LOG("PMREORDER_MEMSET_PERSIST.END");
.
.
.
```
There are a few rules for macros creation:
+ Valid macro can have any name,
but begin and end section have to match -
they are case sensitive.
+ Macro must have `.BEGIN` or `.END` suffix.
+ Macros can't be crossed.
Defined markers can be assigned engines types and configured
through the **pmreorder** tool using the `-x` parameter.
There are two ways to set macro options:
+ Using command line interface in format:
```PMREORDER_MARKER_NAME1=ReorderName1,PMREORDER_MARKER_NAME2=ReorderName2```
+ Using configutation file in .json format:
```
{
"PMREORDER_MARKER_NAME1"="ReorderName1",
"PMREORDER_MARKER_NAME2"="ReorderName2"
}
```
For more details about available
engines types, see ENGINES section above.
**libpmemobj**(7) also provides set of macros that allows change
reordering engine on library or function level:
`<library_name|api_function_name>`
Example of configutation on function level:
```
{
"pmemobj_open"="NoReorderNoCheck",
"pmemobj_memcpy_persist"="ReorderPartial"
}
```
Example of configutation on library level
(affecting all library functions):
```
{
"libpmemobj"="NoReorderNoCheck"
}
```
List of marked **libpmemobj**(7) API functions:
```
pmemobj_alloc
pmemobj_cancel
pmemobj_check
pmemobj_close
pmemobj_create
pmemobj_ctl_exec
pmemobj_ctl_set
pmemobj_free
pmemobj_list_insert
pmemobj_list_insert_new
pmemobj_list_move
pmemobj_list_remove
pmemobj_memcpy
pmemobj_memmove
pmemobj_memset
pmemobj_memcpy_persist
pmemobj_memset_persist
pmemobj_open
pmemobj_publish
pmemobj_realloc
pmemobj_reserve
pmemobj_root
pmemobj_root_construct
pmemobj_strdup
pmemobj_tx_abort
pmemobj_tx_add_range
pmemobj_tx_add_range_direct
pmemobj_tx_alloc
pmemobj_tx_commit
pmemobj_tx_free
pmemobj_tx_publish
pmemobj_tx_realloc
pmemobj_tx_strdup
pmemobj_tx_wcsdup
pmemobj_tx_xadd_range
pmemobj_tx_xadd_range_direct
pmemobj_tx_xalloc
pmemobj_tx_zalloc
pmemobj_tx_zrealloc
pmemobj_wcsdup
pmemobj_xalloc
pmemobj_xreserve
pmemobj_zalloc
pmemobj_zrealloc
```
# PMEMCHECK STORE LOG #
To generate *store_log* for **pmreorder** run pmemcheck
with additional parameters:
```
valgrind \
--tool=pmemcheck \
-q \
--log-stores=yes \
--print-summary=no \
--log-file=store_log.log \
--log-stores-stacktraces=yes \
--log-stores-stacktraces-depth=2 \
--expect-fence-after-clflush=yes \
test_binary writer_parameter
```
For further details of pmemcheck parameters see [pmemcheck documentation](https://github.com/pmem/valgrind/blob/pmem-3.13/pmemcheck/docs/pmc-manual.xml)
# ENVIRONMENT #
By default all logging from PMDK libraries is disabled.
To enable API macros logging set environment variable:
+ **PMREORDER_EMIT_LOG**=1
# EXAMPLE #
```
python pmreorder.py \
-l store_log.log \
-r NoReorderDoCheck \
-o pmreorder_out.log \
-c prog \
-x PMREORDER_MARKER_NAME=ReorderPartial \
-p checker_binary checker_parameter
```
Checker binary will be used to run consistency checks on
"store_log.log", output of pmemcheck tool. Any inconsistent
stores found during **pmreorder** analysis will be logged
to `pmreorder_out.log`.
# SEE ALSO #
**<http://pmem.io>**
| 10,441 | 24.593137 | 152 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemblk/libpmemblk.7.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(LIBPMEMBLK, 7)
collection: libpmemblk
header: PMDK
date: pmemblk API version 1.1
...
[comment]: <> (Copyright 2016-2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (libpmemblk.7 -- man page for libpmemblk)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[LIBRARY API VERSIONING](#library-api-versioning-1)<br />
[MANAGING LIBRARY BEHAVIOR](#managing-library-behavior-1)<br />
[DEBUGGING AND ERROR HANDLING](#debugging-and-error-handling)<br />
[EXAMPLE](#example)<br />
[BUGS](#bugs)<br />
[ACKNOWLEDGEMENTS](#acknowledgements)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**libpmemblk** - persistent memory resident array of blocks
# SYNOPSIS #
```c
#include <libpmemblk.h>
cc ... -lpmemblk -lpmem
```
_UNICODE()
##### Library API versioning: #####
```c
_UWFUNC(pmemblk_check_version, =q=
unsigned major_required,
unsigned minor_required=e=)
```
##### Managing library behavior: #####
```c
void pmemblk_set_funcs(
void *(*malloc_func)(size_t size),
void (*free_func)(void *ptr),
void *(*realloc_func)(void *ptr, size_t size),
char *(*strdup_func)(const char *s));
```
##### Error handling: #####
```c
_UWFUNC(pmemblk_errormsg, void)
```
##### Other library functions: #####
A description of other **libpmemblk** functions can be found on the following
manual pages:
**pmemblk_bsize**(3), **pmemblk_create**(3),
**pmemblk_ctl_exec**(3), **pmemblk_ctl_get**(3), **pmemblk_ctl_set**(3),
**pmemblk_read**(3), **pmemblk_set_zero**(3),
# DESCRIPTION #
**libpmemblk**
provides an array of blocks in *persistent memory* (pmem) such that updates
to a single block are atomic. This library is intended for applications
using direct access storage (DAX), which is storage that supports load/store
access without paging blocks from a block storage device. Some types of
*non-volatile memory DIMMs* (NVDIMMs) provide this type of byte addressable
access to storage. A *persistent memory aware file system* is typically used
to expose the direct access to applications. Memory mapping a file from this
type of file system results in the load/store, non-paged access to pmem.
**libpmemblk** builds on this type of memory mapped file.
This library is for applications that need a potentially large array of blocks,
all the same size, where any given block is updated atomically (the update
cannot be *torn* by program interruption such as power failures). This library
builds on the low-level pmem support provided by **libpmem**(3), handling the
transactional update of the blocks, flushing to persistence, and recovery for
the application. **libpmemblk** is one of a collection of persistent memory
libraries available, the others are:
+ **libpmemobj**(7), a general use persistent memory API, providing memory
allocation and transactional operations on variable-sized objects.
+ **libpmemlog**(7), providing a pmem-resident log file.
+ **libpmemcto**(7), providing close-to-open persistence.
+ **libpmem**(7), low-level persistent memory support.
Under normal usage, **libpmemblk** will never print messages or intentionally
cause the process to exit. The only exception to this is the debugging
information, when enabled, as described under **DEBUGGING AND ERROR HANDLING**
below.
To use the atomic block arrays supplied by **libpmemblk**, a *memory pool*
is first created using the _UW(pmemblk_create) function described
in **pmemblk_create**(3). The other **libpmemblk** functions operate on
the resulting block memory pool using the opaque handle, of type
*PMEMblkpool\**, that is returned by _UW(pmemblk_create) or _UW(pmemblk_open).
Internally, **libpmemblk** will use either
**pmem_persist**(3) or **msync**(2) when it needs to flush changes, depending
on whether the memory pool appears to be persistent memory or a regular file
(see the **pmem_is_pmem**(3) function in **libpmem**(7) for more information).
There is no need for applications to flush changes directly when using the
block memory API provided by **libpmemblk**.
# CAVEATS #
**libpmemblk** relies on the library destructor being called from the main
thread. For this reason, all functions that might trigger destruction (e.g.
**dlclose**(3)) should be called in the main thread. Otherwise some of the
resources associated with that thread might not be cleaned up properly.
# LIBRARY API VERSIONING #
This section describes how the library API is versioned,
allowing applications to work with an evolving API.
The _UW(pmemblk_check_version) function is used to determine whether the
installed **libpmemblk** supports the version of the library API required
by an application. The easiest way to do this is for the application to
supply the compile-time version information, supplied by defines in
**\<ibpmemblk.h\>**, like this:
```c
reason = _U(pmemblk_check_version)(PMEMBLK_MAJOR_VERSION,
PMEMBLK_MINOR_VERSION);
if (reason != NULL) {
/* version check failed, reason string tells you why */
}
```
Any mismatch in the major version number is considered a failure, but a library
with a newer minor version number will pass this check since increasing minor
versions imply backwards compatibility.
An application can also check specifically for the existence of an interface
by checking for the version where that interface was introduced. These versions
are documented in this man page as follows: unless otherwise specified, all
interfaces described here are available in version 1.0 of the library.
Interfaces added after version 1.0 will contain the text *introduced in
version x.y* in the section of this manual describing the feature.
When the version check performed by _UW(pmemblk_check_version) is successful,
the return value is NULL. Otherwise the return value is a static string
describing the reason for failing the version check. The string returned by
_UW(pmemblk_check_version) must not be modified or freed.
# MANAGING LIBRARY BEHAVIOR #
The **pmemblk_set_funcs**() function allows an application to override memory
allocation calls used internally by **libpmemblk**.
Passing in NULL for any of the handlers will cause
the **libpmemblk** default function to be used.
The library does not make heavy use of the system malloc functions,
but it does allocate approximately 4-8 kilobytes for each memory pool in use.
# DEBUGGING AND ERROR HANDLING #
The _UW(pmemblk_errormsg) function returns a pointer to a static buffer
containing the last error message logged for the current thread. If *errno* was
set, the error message may include a description of the corresponding error
code, as returned by **strerror**(3). The error message buffer is thread-local;
errors encountered in one thread do not affect its value in other threads. The
buffer is never cleared by any library function; its content is significant
only when the return value of the immediately preceding call to a
**libpmemblk** function indicated an error, or if *errno* was set. The
application must not modify or free the error message string, but it may be
modified by subsequent calls to other library functions.
Two versions of **libpmemblk** are typically available on a development system.
The normal version, accessed when a program is linked using the **-lpmemblk**
option, is optimized for performance. That version skips checks that impact
performance and never logs any trace information or performs any run-time
assertions. If an error is detected in a call to **libpmemblk**,
the error message describing the failure may be retrieved with
_UW(pmemblk_errormsg) as described above.
A second version of **libpmemblk**, accessed when a program uses the libraries
under _DEBUGLIBPATH(), contains run-time assertions and trace points. The
typical way to access the debug version is to set the **LD_LIBRARY_PATH**
environment variable to _LDLIBPATH(). Debugging output is
controlled using the following environment variables. These variables have
no effect on the non-debug version of the library.
+ **PMEMBLK_LOG_LEVEL**
The value of **PMEMBLK_LOG_LEVEL** enables trace points in the debug version
of the library, as follows:
+ **0** - This is the default level when **PMEMBLK_LOG_LEVEL** is not set.
No log messages are emitted at this level.
+ **1** - Additional details on any errors detected are logged,
in addition to returning the *errno*-based errors as usual.
The same information may be retrieved using _UW(pmemblk_errormsg).
+ **2** - A trace of basic operations is logged.
+ **3** - Enables a very verbose amount of function call tracing
in the library.
+ **4** - Enables voluminous and fairly obscure tracing information
that is likely only useful to the **libpmemblk** developers.
Unless **PMEMBLK_LOG_FILE** is set, debugging output is written to *stderr*.
+ **PMEMBLK_LOG_FILE**
Specifies the name of a file
where all logging information should be written. If the last character in the
name is "-", the *PID* of the current process will be appended to the file name
when the log file is created. If **PMEMBLK_LOG_FILE** is not set, the logging
output is written to *stderr*.
See also **libpmem**(7) for information on other environment variables
that may affect **libpmemblk** behavior.
# EXAMPLE #
The following example illustrates how the **libpmemblk** API is used.
```c
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <libpmemblk.h>
/* size of the pmemblk pool -- 1 GB */
#define POOL_SIZE ((size_t)(1 << 30))
/* size of each element in the pmem pool */
#define ELEMENT_SIZE 1024
int
main(int argc, char *argv[])
{
const char path[] = "/pmem-fs/myfile";
PMEMblkpool *pbp;
size_t nelements;
char buf[ELEMENT_SIZE];
/* create the pmemblk pool or open it if it already exists */
pbp = _U(pmemblk_create)(path, ELEMENT_SIZE, POOL_SIZE, 0666);
if (pbp == NULL)
pbp = _U(pmemblk_open)(path, ELEMENT_SIZE);
if (pbp == NULL) {
perror(path);
exit(1);
}
/* how many elements fit into the file? */
nelements = pmemblk_nblock(pbp);
printf("file holds %zu elements", nelements);
/* store a block at index 5 */
strcpy(buf, "hello, world");
if (pmemblk_write(pbp, buf, 5) < 0) {
perror("pmemblk_write");
exit(1);
}
/* read the block at index 10 (reads as zeros initially) */
if (pmemblk_read(pbp, buf, 10) < 0) {
perror("pmemblk_read");
exit(1);
}
/* zero out the block at index 5 */
if (pmemblk_set_zero(pbp, 5) < 0) {
perror("pmemblk_set_zero");
exit(1);
}
/* ... */
pmemblk_close(pbp);
}
```
See <http://pmem.io/pmdk/libpmemblk> for more examples using the **libpmemblk** API.
# BUGS #
Unlike **libpmemobj**(7), data replication is not supported in **libpmemblk**.
Thus, specifying replica sections in pool set files is not allowed.
# ACKNOWLEDGEMENTS #
**libpmemblk** builds on the persistent memory programming model recommended
by the SNIA NVM Programming Technical Work Group:
<http://snia.org/nvmp>
# SEE ALSO #
**msync**(2), **dlclose**(3), **pmemblk_bsize**(3), **pmemblk_create**(3),
**pmemblk_ctl_exec**(3), **pmemblk_ctl_get**(3), **pmemblk_ctl_set**(3),
**pmemblk_read**(3), **pmemblk_set_zero**(3), **pmem_is_pmem**(3),
**pmem_persist**(3), **strerror**(3), **libpmem**(7), **libpmemcto**(7),
**libpmemlog**(7), **libpmemobj**(7) and **<http://pmem.io>**
| 13,163 | 36.397727 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemblk/pmemblk_bsize.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMBLK_BSIZE, 3)
collection: libpmemblk
header: PMDK
date: pmemblk API version 1.1
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemblk_bsize.3 -- man page for functions that check number of available blocks or usable space in block memory pool)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemblk_bsize**(), **pmemblk_nblock**() - check number of available blocks or
usable space in block memory pool
# SYNOPSIS #
```c
#include <libpmemblk.h>
size_t pmemblk_bsize(PMEMblkpool *pbp);
size_t pmemblk_nblock(PMEMblkpool *pbp);
```
# DESCRIPTION #
The **pmemblk_bsize**() function returns the block size of the specified
block memory pool, that is, the value which was passed as *bsize* to
_UW(pmemblk_create). *pbp* must be a block memory pool handle as returned by
**pmemblk_open**(3) or **pmemblk_create**(3).
The **pmemblk_nblock**() function returns the usable space in the block memory
pool. *pbp* must be a block memory pool handle as returned by
**pmemblk_open**(3) or **pmemblk_create**(3).
# RETURN VALUE #
The **pmemblk_bsize**() function returns the block size of the specified block
memory pool.
The **pmemblk_nblock**() function returns the usable space in the block memory
pool, expressed as the number of blocks available.
# SEE ALSO #
**pmemblk_create**(3), **pmemblk_open**(3),
**libpmemblk**(7) and **<http://pmem.io>**
| 3,389 | 37.965517 | 132 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemblk/pmemblk_create.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMBLK_CREATE, 3)
collection: libpmemblk
header: PMDK
date: pmemblk API version 1.1
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemblk_create.3 -- man page for libpmemblk create, open, close and validate functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
_UW(pmemblk_create), _UW(pmemblk_open),
**pmemblk_close**(), _UW(pmemblk_check)
- create, open, close and validate block pool
# SYNOPSIS #
```c
#include <libpmemblk.h>
_UWFUNCR1(PMEMblkpool, *pmemblk_create, *path, =q=size_t bsize,
size_t poolsize, mode_t mode=e=)
_UWFUNCR1(PMEMblkpool, *pmemblk_open, *path, size_t bsize)
void pmemblk_close(PMEMblkpool *pbp);
_UWFUNCR1(int, pmemblk_check, *path, size_t bsize)
```
_UNICODE()
# DESCRIPTION #
The _UW(pmemblk_create) function creates a block memory pool with the given
total *poolsize*, divided into as many elements of size *bsize* as will fit in
the pool. Since the transactional nature of a block memory pool requires some
space overhead in the memory pool, the resulting number of available blocks is
less than *poolsize*/*bsize*, and is made available to the caller via the
**pmemblk_nblock**(3) function. Given the specifics of the implementation, the
number of available blocks for the user cannot be less than 256. This
translates to at least 512 internal blocks. *path* specifies the name of the
memory pool file to be created. *mode* specifies the permissions to use when
creating the file, as described by **creat**(2). The memory pool file is fully
allocated to the size *poolsize* using **posix_fallocate**(3). The caller may
choose to take responsibility for creating the memory pool file by creating it
before calling _UW(pmemblk_create), and then specifying *poolsize* as zero. In
this case _UW(pmemblk_create) will take the pool size from the size of the
existing file, and will verify that the file appears to be empty by searching
for any non-zero data in the pool header at the beginning of the file. The net
pool size of a pool file is equal to the file size. The minimum net pool size
allowed by the library for a block pool is defined in **\<libpmemblk.h\>** as
**PMEMBLK_MIN_POOL**. *bsize* can be any non-zero value; however,
**libpmemblk** will silently round up
the given size to **PMEMBLK_MIN_BLK**, as defined in **\<libpmemblk.h\>**.
Depending on the configuration of the system, the available non-volatile
memory space may be divided into multiple memory devices. In such case, the
maximum size of the pmemblk memory pool could be limited by the capacity of a
single memory device. **libpmemblk**(7) allows building a persistent memory
resident array spanning multiple memory devices by creation of persistent
memory pools consisting of multiple files, where each part of such a *pool set*
may be stored on a different memory device or pmem-aware filesystem.
Creation of all the parts of the pool set can be done with _UW(pmemblk_create);
however, the recommended method for creating pool sets is by using the
**pmempool**(1) utility.
When creating a pool set consisting of multiple files, the *path* argument
passed to _UW(pmemblk_create) must point to the special *set* file that defines
the pool layout and the location of all the parts of the pool set. The
*poolsize* argument must be 0. The meaning of the *mode* argument
does not change, except that the same *mode* is used for creation of all the
parts of the pool set.
For more information on pool set format, see **poolset**(5).
The _UW(pmemblk_open) function opens an existing block memory pool.
As with _UW(pmemblk_create), *path* must identify either an existing
block memory pool file, or the *set* file used to create a pool set.
The application must have permission to open the file and memory map the
file or pool set with read/write permissions. If *bsize* is non-zero,
_UW(pmemblk_open) will verify that the given block size matches the block
size used when the pool was created. Otherwise, _UW(pmemblk_open) will open
the pool without verifying the block size. The *bsize* can be determined
using the **pmemblk_bsize**(3) function.
The **pmemblk_close**() function closes the memory pool
indicated by *pbp* and deletes the memory pool handle.
The block memory pool itself lives on in the file that contains it and may be
re-opened at a later time using _UW(pmemblk_open) as described above.
The _UW(pmemblk_check) function performs a consistency check of the file
indicated by *path*, and returns 1 if the memory pool is found to be
consistent. If the pool is found not to be consistent, further use of the
file with **libpmemblk** will result in undefined behavior. The debug version
of **libpmemblk** will provide additional details on inconsistencies when
**PMEMBLK_LOG_LEVEL** is at least 1, as described in the **DEBUGGING AND ERROR
HANDLING** section in **libpmemblk**(7). _UW(pmemblk_check) opens the given
*path* read-only so it never makes any changes to the file. This function is
not supported on Device DAX.
# RETURN VALUE #
On success, _UW(pmemblk_create) returns a *PMEMblkpool\** handle to the block
memory pool. On error, it returns NULL and sets *errno* appropriately.
On success, _UW(pmemblk_open) returns a *PMEMblkpool\** handle that can be
used with most of the functions in **libpmemblk**(7). On error, it returns
NULL and sets *errno* appropriately. Possible errors include:
+ failure to open *path*
+ *path* specifies a *set* file and any of the pool set files cannot be opened
+ *path* specifies a *set* file and the actual size of any file does not
match the corresponding part size defined in the *set* file
+ *bsize* is non-zero and does not match the block size given when the pool
was created. *errno* is set to **EINVAL** in this case.
The **pmemblk_close**() function returns no value.
_UW(pmemblk_check) returns 1 if the memory pool is found to be consistent.
If the check is successfully performed but the pool is found to be inconsistent,
_UW(pmemblk_check) returns 0. This includes the case where *bsize* is non-zero
and does not match the block size given when the pool was created. If the
consistency check cannot be performed, _UW(pmemblk_check) returns -1 and sets
*errno* appropriately.
# CAVEATS #
Not all file systems support **posix_fallocate**(3). _UW(pmemblk_create) will
fail if the underlying file system does not support **posix_fallocate**(3).
# SEE ALSO #
**pmempool**(1), **creat**(2), **pmemblk_nblock**(3),
**posix_fallocate**(3), **poolset**(5),
**libpmemblk**(7) and **<http://pmem.io>**
| 8,524 | 46.893258 | 102 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemblk/pmemblk_read.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMBLK_READ, 3)
collection: libpmemblk
header: PMDK
date: pmemblk API version 1.1
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemblk_read.3 -- man page for libpmemblk read and write functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemblk_read**(), **pmemblk_write**() - read or write a block from a block
memory pool
# SYNOPSIS #
```c
#include <libpmemblk.h>
int pmemblk_read(PMEMblkpool *pbp, void *buf, long long blockno);
int pmemblk_write(PMEMblkpool *pbp, const void *buf, long long blockno);
```
# DESCRIPTION #
The **pmemblk_read**() function reads the block with block number *blockno*
from memory pool *pbp* into the buffer *buf*. Reading a block that has never
been written by **pmemblk_write**() will return a block of zeroes.
The **pmemblk_write**() function writes a block from *buf* to block number
*blockno* in the memory pool *pbp*. The write is atomic with respect to other
reads and writes. In addition, the write cannot be torn by program failure or
system crash; on recovery the block is guaranteed to contain either the old
data or the new data, never a mixture of both.
# RETURN VALUE #
On success, the **pmemblk_read**() and **pmemblk_write**() functions return 0.
On error, they return -1 and set *errno* appropriately.
# SEE ALSO #
**libpmemblk**(7) and **<http://pmem.io>**
| 3,360 | 39.493976 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemblk/pmemblk_ctl_get.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMBLK_CTL_GET, 3)
collection: libpmemblk
header: PMDK
date: pmemblk API version 1.1
...
[comment]: <> (Copyright 2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemblk_ctl_get.3 -- man page for libpmemblk CTL)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[CTL NAMESPACE](#ctl-namespace)<br />
[CTL EXTERNAL CONFIGURATION](#ctl-external-configuration)<br />
[SEE ALSO](#see-also)<br />
# NAME #
_UW(pmemblk_ctl_get),
_UW(pmemblk_ctl_set),
_UW(pmemblk_ctl_exec)
- Query and modify libpmemblk internal behavior (EXPERIMENTAL)
# SYNOPSIS #
```c
#include <libpmemblk.h>
_UWFUNCR2(int, pmemblk_ctl_get, PMEMblkpool *pbp, *name, void *arg,
=q= (EXPERIMENTAL)=e=)
_UWFUNCR2(int, pmemblk_ctl_set, PMEMblkpool *pbp, *name, void *arg,
=q= (EXPERIMENTAL)=e=)
_UWFUNCR2(int, pmemblk_ctl_exec, PMEMblkpool *pbp, *name, void *arg,
=q= (EXPERIMENTAL)=e=)
```
_UNICODE()
# DESCRIPTION #
The _UW(pmemblk_ctl_get), _UW(pmemblk_ctl_set) and _UW(pmemblk_ctl_exec)
functions provide a uniform interface for querying and modifying the internal
behavior of **libpmemblk**(7) through the control (CTL) namespace.
See more in **pmem_ctl**(5) man page.
# CTL NAMESPACE #
prefault.at_create | rw | global | int | int | - | boolean
If set, every page of the pool will be touched and written to when the pool
is created, in order to trigger page allocation and minimize the performance
impact of pagefaults. Affects only the _UW(pmemblk_create) function.
Always returns 0.
prefault.at_open | rw | global | int | int | - | boolean
If set, every page of the pool will be touched and written to when the pool
is opened, in order to trigger page allocation and minimize the performance
impact of pagefaults. Affects only the _UW(pmemblk_open) function.
Always returns 0.
# CTL EXTERNAL CONFIGURATION #
In addition to direct function call, each write entry point can also be set
using two alternative methods.
The first method is to load a configuration directly from the **PMEMBLK_CONF**
environment variable.
The second method of loading an external configuration is to set the
**PMEMBLK_CONF_FILE** environment variable to point to a file that contains
a sequence of ctl queries.
See more in **pmem_ctl**(5) man page.
# SEE ALSO #
**libpmemblk**(7), **pmem_ctl**(5) and **<http://pmem.io>**
| 4,219 | 35.37931 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemblk/pmemblk_set_zero.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMBLK_SET_ZERO, 3)
collection: libpmemblk
header: PMDK
date: pmemblk API version 1.1
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemblk_set_zero.3 -- man page for block management functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemblk_set_zero**(), **pmemblk_set_error**() - block management functions
# SYNOPSIS #
```c
#include <libpmemblk.h>
int pmemblk_set_zero(PMEMblkpool *pbp, long long blockno);
int pmemblk_set_error(PMEMblkpool *pbp, long long blockno);
```
# DESCRIPTION #
The **pmemblk_set_zero**() function writes zeros to block number *blockno* in
persistent memory resident array of blocks *pbp*. Using this function is faster
than actually writing a block of zeros since **libpmemblk**(7) uses metadata to
indicate the block should read back as zero.
The **pmemblk_set_error**() function sets the error state for block number
*blockno* in persistent memory resident array of blocks *pbp*.
A block in the error state returns *errno* **EIO** when read.
Writing the block clears the error state and returns the block to normal use.
# RETURN VALUE #
On success, **pmemblk_set_zero**() and **pmemblk_set_error**() return 0.
On error, they return -1 and set *errno* appropriately.
# SEE ALSO #
**libpmemblk**(7) and **<http://pmem.io>**
| 3,310 | 38.891566 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pmemobj_list_insert.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMOBJ_LIST_INSERT, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemobj_list_insert.3 -- man page for non-transactional persistent atomic lists)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemobj_list_insert**(), **pmemobj_list_insert_new**(),
**pmemobj_list_move**(), **pmemobj_list_remove**()
- non-transactional persistent atomic lists functions
# SYNOPSIS #
```c
#include <libpmemobj.h>
int pmemobj_list_insert(PMEMobjpool *pop, size_t pe_offset, void *head,
PMEMoid dest, int before, PMEMoid oid);
PMEMoid pmemobj_list_insert_new(PMEMobjpool *pop, size_t pe_offset,
void *head, PMEMoid dest, int before, size_t size,
uint64_t type_num, pmemobj_constr constructor, void arg);
int pmemobj_list_move(PMEMobjpool *pop,
size_t pe_old_offset, void *head_old,
size_t pe_new_offset, void *head_new,
PMEMoid dest, int before, PMEMoid oid);
int pmemobj_list_remove(PMEMobjpool *pop, size_t pe_offset,
void *head, PMEMoid oid, int free);
```
# DESCRIPTION #
In addition to the container operations on internal object collections
described in **pmemobj_first**(3), **libpmemobj**(7) provides
a mechanism for organizing persistent objects in user-defined, persistent,
atomic, circular, doubly-linked lists. All the routines and macros operating
on the persistent lists provide atomicity with respect to any power-fail
interruptions. If any of those operations is torn by program failure or system
crash, on recovery they are guaranteed to be entirely completed or discarded,
leaving the lists, persistent memory heap and internal object containers in a
consistent state.
The persistent atomic circular doubly linked lists support the following functionality:
+ Insertion of an object at the head of the list, or at the end of the list.
+ Insertion of an object before or after any element in the list.
+ Atomic allocation and insertion of a new object at the head of the list, or at the end of the list.
+ Atomic allocation and insertion of a new object before or after any element in the list.
+ Atomic moving of an element from one list to the specific location on another list.
+ Removal of any object in the list.
+ Atomic removal and freeing of any object in the list.
+ Forward or backward traversal through the list.
A list is headed by a *list_head* structure containing the object handle of the
first element on the list. The elements are doubly linked so that an arbitrary
element can be removed without the need to traverse the list. New elements can
be added to the list before or after an existing element, at the head of the
list, or at the tail of the list. A list may be traversed in either direction.
The user-defined structure of each element must contain a field of type
*list_entry* that holds the object handles to the previous and next element
on the list. Both the *list_head* and the *list_entry* structures are
declared in **\<libpmemobj.h\>**.
The functions below are intended to be used outside transactions - transactional
variants are described in manpages to functions mentioned at **TRANSACTIONAL OBJECT
MANIPULATION** in **libpmemobj**(7). Note that operations performed using this
non-transactional API are independent from their transactional counterparts.
If any non-transactional allocations or list manipulations are performed within
an open transaction, the changes will not be rolled back if such a transaction
is aborted or interrupted.
The list insertion and move functions use a common set of arguments to define
where an object will be inserted into the list. *dest* identifies the element
before or after which the object will be inserted, or, if *dest* is
**OID_NULL**, indicates that the object should be inserted at the head or
tail of the list. *before* determines where the object will be inserted:
+ **POBJ_LIST_DEST_BEFORE** - insert the element before the existing
element *dest*
+ **POBJ_LIST_DEST_AFTER** - insert the element after the existing element
*dest*
+ **POBJ_LIST_DEST_HEAD** - when *dest* is **OID_NULL**, insert the element
at the head of the list
+ **POBJ_LIST_DEST_TAIL** - when *dest* is **OID_NULL**, insert the element
at the tail of the list
>NOTE: Earlier versions of **libpmemobj**(7) do not define
**POBJ_LIST_DEST_BEFORE** and **POBJ_LIST_DEST_AFTER**. Use 1 for before,
and 0 for after.
The **pmemobj_list_insert**() function inserts the element represented by
object handle *oid* into the list referenced by *head*, at the location
specified by *dest* and *before* as described above. *pe_offset*
specifies the offset of the structure that connects the elements in
the list. All the handles *head*, *dest* and *oid* must point to objects
allocated from memory pool *pop*. *head* and *oid* cannot be **OID_NULL**.
The **pmemobj_list_insert_new**() function atomically allocates a new object
of given *size* and type *type_num* and inserts it into the list referenced
by *head* at the location specified by *dest* and *before* as described
above. *pe_offset* specifies the offset of the structure that connects the
elements in the list. The handles *head* and *dest* must point to objects
allocated from memory pool *pop*. Before returning,
**pmemobj_list_insert_new**() calls the *constructor* function, passing the
pool handle *pop*, the pointer to the newly allocated object *ptr*, and the
*arg* argument. It is guaranteed that the allocated object is either properly
initialized or, if the allocation is interrupted before the constructor
completes, the memory space reserved for the object is reclaimed. *head*
cannot be **OID_NULL**. The allocated object is also added to the internal
container associated with *type_num*, as described in **POBJ_FOREACH**(3).
The **pmemobj_list_move**() function moves the object represented by object
handle *oid* from the list referenced by *head_old* to the list referenced
by *head_new*, inserting it at the location specified by *dest* and *before*
as described above. *pe_old_offset* and *pe_new_offset* specify the offsets
of the structures that connect the elements in the old and new lists,
respectively. All the handles *head_old*, *head_new*, *dest* and *oid* must
point to objects allocated from memory pool *pop*. *head_old*, *head_new*
and *oid* cannot be **OID_NULL**.
The **pmemobj_list_remove**() function removes the object represented by object
handle *oid* from the list referenced by *head*. If *free* is set, it also
removes the object from the internal object container and frees the associated
memory space. *pe_offset* specifies the offset of the structure that connects
the elements in the list. Both *head* and *oid* must point to objects allocated
from memory pool *pop* and cannot be **OID_NULL**.
# RETURN VALUE #
On success, **pmemobj_list_insert**(), **pmemobj_list_remove**() and
**pmemobj_list_move**() return 0. On error, they return -1 and set
*errno* appropriately.
On success, **pmemobj_list_insert_new**() returns a handle to the newly
allocated object. If the constructor returns a non-zero value, the allocation
is canceled, -1 is returned, and *errno* is set to **ECANCELED**.
On other errors, **OID_NULL** is returned and *errno* is set appropriately.
# SEE ALSO #
**pmemobj_first**(3), **POBJ_FOREACH**(3), **libpmemobj**(7)
and **<http://pmem.io>**
| 9,350 | 47.450777 | 101 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/toid_declare.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(TOID_DECLARE, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (toid_declare.3 -- man page for obj type safety mechanism)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**TOID_DECLARE**(), **TOID_DECLARE_ROOT**(), **TOID**(),
**TOID_TYPE_NUM**(), **TOID_TYPE_NUM_OF**(), **TOID_VALID**(),
**OID_INSTANCEOF**(), **TOID_ASSIGN**(), **TOID_IS_NULL**(),
**TOID_EQUALS**(), **TOID_TYPEOF**(), **TOID_OFFSETOF**(),
**DIRECT_RW**(), **D_RW**(), **DIRECT_RO**(),
**D_RO**() - libpmemobj type safety mechanism
# SYNOPSIS #
```c
#include <libpmemobj.h>
TOID_DECLARE(TYPE, uint64_t type_num)
TOID_DECLARE_ROOT(ROOT_TYPE)
TOID(TYPE)
TOID_TYPE_NUM(TYPE)
TOID_TYPE_NUM_OF(TOID oid)
TOID_VALID(TOID oid)
OID_INSTANCEOF(PMEMoid oid, TYPE)
TOID_ASSIGN(TOID o, VALUE)
TOID_IS_NULL(TOID o)
TOID_EQUALS(TOID lhs, TOID rhs)
TOID_TYPEOF(TOID o)
TOID_OFFSETOF(TOID o, FILED)
DIRECT_RW(TOID oid)
D_RW(TOID oid)
DIRECT_RO(TOID oid)
D_RO(TOID oid)
```
# DESCRIPTION #
Operating on untyped object handles, as well as on direct untyped object
pointers (*void\**), may be confusing and error-prone. To facilitate
type safety, **libpmemobj**(7) defines a set of macros that provide static
type enforcement, catching potential errors at compile time. For example,
a compile-time error is generated when an attempt is made to assign a handle to
an object of one type to the object handle variable of another type of object.
The **TOID_DECLARE**() macro declares a typed *OID* of user-defined type
*TYPE* and type number *type_num*.
The **TOID_DECLARE_ROOT**() macro declares a typed *OID* of user-defined type
*ROOT_TYPE* and root object type number **POBJ_ROOT_TYPE_NUM**.
The **TOID**() macro declares a handle to an object of type *TYPE*,
where *TYPE* is the name of a user-defined structure. The typed *OID* must
be declared first using the **TOID_DECLARE**(), **TOID_DECLARE_ROOT**(),
**POBJ_LAYOUT_TOID**(3) or **POBJ_LAYOUT_ROOT**(3) macros.
The **TOID_TYPE_NUM**() macro returns the type number of the type specified
by *TYPE*.
The **TOID_TYPE_NUM_OF**() macro returns the type number of the object
specified by *oid*. The type number is read from the typed *OID*.
The **TOID_VALID**() macro validates whether the type number stored in
the object's metadata is equal to the type number read from the typed *OID*.
The **OID_INSTANCEOF**() macro checks whether the *oid* is of type *TYPE*.
The **TOID_ASSIGN**() macro assigns the object handle *VALUE* to typed *OID*
*o*.
The **TOID_IS_NULL**() macro evaluates to true if the object handle
represented by *o* is **OID_NULL**.
The **TOID_EQUALS**() macro evaluates to true if both the *lhs* and *rhs*
object handles reference the same persistent object.
The **TOID_TYPEOF**() macro returns the type of the object handle represented
by typed *OID* *o*.
The **TOID_OFFSETOF**() macro returns the offset of the *FIELD* member from
the start of the object represented by *o*.
The **DIRECT_RW**() macro and its shortened form **D_RW**() return a typed
write pointer (*TYPE\**) to an object represented by *oid*. If *oid* is
**OID_NULL**, the macro evaluates to NULL.
The **DIRECT_RO**() macro and its shortened form **D_RO**() return a typed
read-only (const) pointer (*TYPE\**) to an object represented by *oid*. If
*oid* is **OID_NULL**, the macro evaluates to NULL.
# SEE ALSO #
**OID_IS_NULL**(3), **POBJ_LAYOUT_ROOT**(3), **POBJ_LAYOUT_TOID**(3),
**libpmemobj**(7) and **<http://pmem.io>**
| 5,497 | 38.84058 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pmemobj_first.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMOBJ_FIRST, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemobj_first.3 -- man page for pmemobj container operations)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemobj_first**(), **pmemobj_next**(),
**POBJ_FIRST**(), **POBJ_FIRST_TYPE_NUM**(),
**POBJ_NEXT**(), **POBJ_NEXT_TYPE_NUM**(),
**POBJ_FOREACH**(), **POBJ_FOREACH_SAFE**(),
**POBJ_FOREACH_TYPE**(), **POBJ_FOREACH_SAFE_TYPE**()
- pmemobj container operations
# SYNOPSIS #
```c
#include <libpmemobj.h>
PMEMoid pmemobj_first(PMEMobjpool *pop);
PMEMoid pmemobj_next(PMEMoid oid);
POBJ_FIRST(PMEMobjpool *pop, TYPE)
POBJ_FIRST_TYPE_NUM(PMEMobjpool *pop, uint64_t type_num)
POBJ_NEXT(TOID oid)
POBJ_NEXT_TYPE_NUM(PMEMoid oid)
POBJ_FOREACH(PMEMobjpool *pop, PMEMoid varoid)
POBJ_FOREACH_SAFE(PMEMobjpool *pop, PMEMoid varoid, PMEMoid nvaroid)
POBJ_FOREACH_TYPE(PMEMobjpool *pop, TOID var)
POBJ_FOREACH_SAFE_TYPE(PMEMobjpool *pop, TOID var, TOID nvar)
```
# DESCRIPTION #
The **libpmemobj**(7) container operations provide a mechanism that allows
iteration through the internal object collection, either looking for a
specific object, or performing a specific operation on each object of a given
type. Software should not make any assumptions about the order of the objects
in the internal object containers.
The **pmemobj_first**() function returns the first object from the pool.
The **POBJ_FIRST**() macro returns the first object from the pool of
the type specified by *TYPE*.
The **POBJ_FIRST_TYPE_NUM**() macro returns the first object from the pool
of the type specified by *type_num*.
The **pmemobj_next**() function returns the next object from the pool.
The **POBJ_NEXT**() macro returns the next object of the same type
as the object referenced by *oid*.
The **POBJ_NEXT_TYPE_NUM**() macro returns the next object of the same type
number as the object referenced by *oid*.
The following four macros provide a more convenient way to iterate through the
internal collections, performing a specific operation on each object.
The **POBJ_FOREACH**() macro performs a specific operation on each allocated
object stored in the persistent memory pool *pop*. It traverses the internal
collection of all the objects, assigning a handle to each element in turn to
*varoid*.
The **POBJ_FOREACH_TYPE**() macro performs a specific operation on each
allocated object stored in the persistent memory pool *pop* that has the same
type as *var*. It traverses the internal collection of all the objects of the
specified type, assigning a handle to each element in turn to *var*.
The macros **POBJ_FOREACH_SAFE**() and **POBJ_FOREACH_SAFE_TYPE**() work in a
similar fashion as **POBJ_FOREACH**() and **POBJ_FOREACH_TYPE**(), except that
prior to performing the operation on the object, they preserve a handle to the
next object in the collection by assigning it to *nvaroid* or *nvar*,
respectively. This allows safe deletion of selected objects while iterating
through the collection.
# RETURN VALUE #
**pmemobj_first**() returns the first object from the pool, or, if the pool
is empty, **OID_NULL**.
**pmemobj_next**() returns the next object from the pool. If the object
referenced by *oid* is the last object in the collection, or if *oid*
is *OID_NULL*, **pmemobj_next**() returns **OID_NULL**.
# SEE ALSO #
**libpmemobj**(7) and **<http://pmem.io>**
| 5,400 | 39.916667 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pmemobj_alloc.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMOBJ_ALLOC, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemobj_alloc.3 -- man page for non-transactional atomic allocations)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemobj_alloc**(), **pmemobj_xalloc**(), **pmemobj_zalloc**(),
**pmemobj_realloc**(), **pmemobj_zrealloc**(), **pmemobj_strdup**(),
**pmemobj_wcsdup**(), **pmemobj_alloc_usable_size**(),
**POBJ_NEW**(), **POBJ_ALLOC**(), **POBJ_ZNEW**(), **POBJ_ZALLOC**(),
**POBJ_REALLOC**(), **POBJ_ZREALLOC**(), **POBJ_FREE**()
- non-transactional atomic allocations
# SYNOPSIS #
```c
#include <libpmemobj.h>
typedef int (*pmemobj_constr)(**PMEMobjpool *pop, void *ptr, void *arg);
int pmemobj_alloc(PMEMobjpool *pop, PMEMoid *oidp, size_t size,
uint64_t type_num, pmemobj_constr constructor, void *arg);
int pmemobj_xalloc(PMEMobjpool *pop, PMEMoid *oidp, size_t size,
uint64_t type_num, uint64_t flags, pmemobj_constr constructor,
void *arg); (EXPERIMENTAL)
int pmemobj_zalloc(PMEMobjpool *pop, PMEMoid *oidp, size_t size,
uint64_t type_num);
void pmemobj_free(PMEMoid *oidp);
int pmemobj_realloc(PMEMobjpool *pop, PMEMoid *oidp, size_t size,
uint64_t type_num);
int pmemobj_zrealloc(PMEMobjpool *pop, PMEMoid *oidp, size_t size,
uint64_t type_num);
int pmemobj_strdup(PMEMobjpool *pop, PMEMoid *oidp, const char *s,
uint64_t type_num);
int pmemobj_wcsdup(PMEMobjpool *pop, PMEMoid *oidp, const wchar_t *s,
uint64_t type_num);
size_t pmemobj_alloc_usable_size(PMEMoid oid);
POBJ_NEW(PMEMobjpool *pop, TOID *oidp, TYPE, pmemobj_constr constructor,
void *arg)
POBJ_ALLOC(PMEMobjpool *pop, TOID *oidp, TYPE, size_t size,
pmemobj_constr constructor, void *arg)
POBJ_ZNEW(PMEMobjpool *pop, TOID *oidp, TYPE)
POBJ_ZALLOC(PMEMobjpool *pop, TOID *oidp, TYPE, size_t size)
POBJ_REALLOC(PMEMobjpool *pop, TOID *oidp, TYPE, size_t size)
POBJ_ZREALLOC(PMEMobjpool *pop, TOID *oidp, TYPE, size_t size)
POBJ_FREE(TOID *oidp)
```
# DESCRIPTION #
Functions described in this document provide the mechanism to allocate,
resize and free objects from the persistent memory pool in a thread-safe
and fail-safe manner. All the routines are atomic with respect to other threads
and any power-fail interruptions. If any of these operations is torn by program
failure or system crash, on recovery they are guaranteed to be entirely completed
or discarded, leaving the persistent memory heap and internal object containers
in a consistent state.
All these functions can be used outside transactions. Note that operations
performed using the non-transactional API are considered durable after
completion, even if executed within an open transaction. Such non-transactional
changes will not be rolled back if the transaction is aborted or interrupted.
The allocations are always aligned to a cache-line boundary.
The *pmemobj_constr* type represents a constructor for atomic allocation
from the persistent memory heap associated with memory pool *pop*. *ptr*
is a pointer to the allocated memory area and *arg* is a user-defined
argument passed to the constructor.
The **pmemobj_alloc**() function allocates a new object from the persistent
memory heap associated with memory pool *pop*. The *PMEMoid* of the allocated
object is stored in *oidp*. If *oidp* is NULL, then the newly allocated object
may be accessed only by iterating objects in the object container associated
with the type number *type_num*, as described in **POBJ_FOREACH**(3). If *oidp*
points to a memory location from the **pmemobj** heap, *oidp* is modified
atomically. Before returning, **pmemobj_alloc**() calls the *constructor*
function, passing the pool handle *pop*, the pointer to the newly allocated
object in *ptr*, and the *arg* argument. It is guaranteed that the
allocated object is either properly initialized, or if the allocation
is interrupted before the constructor completes, the memory space reserved
for the object is reclaimed. *size* can be any non-zero value; however,
due to internal padding and object metadata, the actual size of the allocation
will differ from the requested size by at least 64 bytes. For this reason,
making allocations of a size less than 64 bytes is extremely inefficient
and discouraged. The allocated object is added to the internal container
associated with *type_num*.
**pmemobj_xalloc**() is equivalent to **pmemobj_alloc**(), but with an
additional *flags* argument that is a bitmask of the following values:
+ **POBJ_XALLOC_ZERO** - zero the object (equivalent of **pmemobj_zalloc**())
+ **POBJ_CLASS_ID(class_id)** - allocate the object from allocation class
*class_id*. The class id cannot be 0.
The **pmemobj_zalloc**() function allocates a new zeroed object from
the persistent memory heap associated with memory pool *pop*. The *PMEMoid*
of the allocated object is stored in *oidp*. If *oidp* is NULL, then
the newly allocated object may be accessed only by iterating objects in the
object container associated with the type number *type_num*, as described in
**POBJ_FOREACH**(3). If *oidp* points to a memory location from the **pmemobj**
heap, *oidp* is modified atomically. *size* can be any non-zero value;
however, due to internal padding and object metadata, the actual size
of the allocation will differ from the requested one by at least 64 bytes.
For this reason, making allocations of a size less than 64 bytes is extremely
inefficient and discouraged. The allocated object is added to the internal
container associated with *type_num*.
The **pmemobj_free**() function frees the memory space represented by *oidp*,
which must have been allocated by a previous call to **pmemobj_alloc**(),
**pmemobj_xalloc**(), **pmemobj_zalloc**(), **pmemobj_realloc**(), or
**pmemobj_zrealloc**(). **pmemobj_free**() provides the same semantics as
**free**(3), but instead of operating on the process heap supplied by the
system, it operates on the persistent memory heap. If *oidp* is **OID_NULL**,
no operation is performed. If *oidp* is NULL or if it points to the root
object's *OID*, the behavior of **pmemobj_free**() is undefined. *oidp* is
set to **OID_NULL** after the memory is freed. If *oidp* points to a memory
location from the **pmemobj** heap, *oidp* is modified atomically.
The **pmemobj_realloc**() function changes the size of the object represented
by *oidp* to *size* bytes. **pmemobj_realloc**() provides similar semantics to
**realloc**(3), but operates on the persistent memory heap associated with
memory pool *pop*. The resized object is also added or moved to the internal
container associated with type number *type_num*. The contents will be
unchanged in the range from the start of the region up to the minimum of the
old and new sizes. If the new size is larger than the old size, the added
memory will *not* be initialized. If *oidp* is *OID_NULL*, then the call is
equivalent to *pmemobj_alloc(pop, size, type_num)*. If *size* is equal to zero,
and *oidp* is not **OID_NULL**, then the call is equivalent to
*pmemobj_free(oid)*. Unless *oidp* is **OID_NULL**, it must have been allocated
by an earlier call to **pmemobj_alloc**(), **pmemobj_xalloc**(),
**pmemobj_zalloc**(), **pmemobj_realloc**(), or **pmemobj_zrealloc**(). Note
that the object handle value may change as a result of reallocation. If the
object was moved, the memory space represented by *oid* is reclaimed. If
*oidp* points to a memory location from the **pmemobj** heap, *oidp* is
modified atomically. If *oidp* is NULL or if it points to the root
object's *OID*, the behavior of **pmemobj_realloc**() is undefined.
**pmemobj_zrealloc**() is equivalent to **pmemobj_realloc**(), except that
if the new size is larger than the old size, the added memory will be zeroed.
The **pmemobj_strdup**() function stores a handle to a new object in *oidp*
which is a duplicate of the string *s*. **pmemobj_strdup**() provides the
same semantics as **strdup**(3), but operates on the persistent memory heap
associated with memory pool *pop*. If *oidp* is NULL, then the newly allocated
object may be accessed only by iterating objects in the object container
associated with type number *type_num*, as described in **POBJ_FOREACH**(3).
If *oidp* points to a memory location from the **pmemobj** heap, *oidp*
is modified atomically. The allocated string object is also added to the
internal container associated with type number *type_num*. Memory for the new
string is obtained with **pmemobj_alloc**(), on the given memory pool, and can
be freed with **pmemobj_free**() on the same memory pool.
**pmemobj_wcsdup**() is equivalent to **pmemobj_strdup**(), but operates on
a wide character string (wchar_t) rather than a standard character string.
The **pmemobj_alloc_usable_size**() function provides the same semantics as
**malloc_usable_size**(3), but instead of the process heap supplied by the
system, it operates on the persistent memory heap.
The **POBJ_NEW**() macro is a wrapper around the **pmemobj_alloc**() function.
Instead of taking a pointer to *PMEMoid*, it takes a pointer to the typed *OID*
of type name *TYPE*, and passes the size and type number from the typed *OID*
to **pmemobj_alloc**().
The **POBJ_ALLOC**() macro is equivalent to **POBJ_NEW**, except that instead
of using the size of the typed *OID*, passes *size* to **pmemobj_alloc**().
The **POBJ_ZNEW**() macro is a wrapper around the **pmemobj_zalloc**()
function. Instead of taking a pointer to *PMEMoid*, it takes a pointer to the
typed *OID* of type name *TYPE*, and passes the size and type number from
the typed *OID* to **pmemobj_zalloc**().
The **POBJ_ZALLOC**() macro is equivalent to **POBJ_ZNEW**, except that instead
of using the size of the typed *OID*, passes *size* to **pmemobj_zalloc**().
The **POBJ_REALLOC**() macro is a wrapper around the **pmemobj_realloc**()
function. Instead of taking a pointer to *PMEMoid*, it takes a pointer to the
typed *OID* of type name *TYPE*, and passes the type number from the typed
*OID* to **pmemobj_realloc**().
The **POBJ_ZREALLOC**() macro is a wrapper around the **pmemobj_zrealloc**()
function. Instead of taking a pointer to *PMEMoid*, it takes a pointer to the
typed *OID* of type name *TYPE*, and passes the type number from the typed
*OID* to **pmemobj_zrealloc**().
The **POBJ_FREE**() macro is a wrapper around the **pmemobj_free**() function
which takes a pointer to the typed *OID* instead of to *PMEMoid*.
# RETURN VALUE #
On success, **pmemobj_alloc**() and **pmemobj_xalloc** return 0. If *oidp*
is not NULL, the *PMEMoid* of the newly allocated object is stored in *oidp*.
If the allocation fails, -1 is returned and *errno* is set appropriately. If
the constructor returns a non-zero value, the allocation is canceled, -1 is
returned, and *errno* is set to **ECANCELED**. If *size* equals 0, or the
*flags* for **pmemobj_xalloc** are invalid, -1 is returned, *errno* is set
to **EINVAL**, and *oidp* is left untouched.
On success, **pmemobj_zalloc**() returns 0. If *oidp* is not NULL, the
*PMEMoid* of the newly allocated object is stored in *oidp*. If the allocation
fails, it returns -1 and sets *errno* appropriately. If *size* equals 0, it
returns -1, sets *errno* to **EINVAL**, and leaves *oidp* untouched.
The **pmemobj_free**() function returns no value.
On success, **pmemobj_realloc**() and **pmemobj_zrealloc**() return 0 and
update *oidp* if necessary. On error, they return -1 and set *errno*
appropriately.
On success, **pmemobj_strdup**() and **pmemobj_wcsdup**() return 0. If
*oidp* is not NULL, the *PMEMoid* of the duplicated string object is stored
in *oidp*. If *s* is NULL, they return -1, set *errno* to **EINVAL**, and
leave *oidp* untouched. On other errors, they return -1 and set *errno*
appropriately.
The **pmemobj_alloc_usable_size**() function returns the number of usable bytes
in the object represented by *oid*. If *oid* is **OID_NULL**, it returns 0.
# SEE ALSO #
**free**(3), **POBJ_FOREACH**(3), **realloc**(3),
**strdup**(3), **wcsdup**(3), **libpmemobj**(7)
and **<http://pmem.io>**
| 14,079 | 50.95572 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pmemobj_mutex_zero.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMOBJ_MUTEX_ZERO, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemobj_mutex_zero.3 -- man page for locking functions from libpmemobj library)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemobj_mutex_zero**(), **pmemobj_mutex_lock**(), **pmemobj_mutex_timedlock**(),
**pmemobj_mutex_trylock**(), **pmemobj_mutex_unlock**(),
**pmemobj_rwlock_zero**(), **pmemobj_rwlock_rdlock**(), **pmemobj_rwlock_wrlock**(),
**pmemobj_rwlock_timedrdlock**(), **pmemobj_rwlock_timedwrlock**(), **pmemobj_rwlock_tryrdlock**(),
**pmemobj_rwlock_trywrlock**(), **pmemobj_rwlock_unlock**(),
**pmemobj_cond_zero**(), **pmemobj_cond_broadcast**(), **pmemobj_cond_signal**(),
**pmemobj_cond_timedwait**(), **pmemobj_cond_wait**()
- pmemobj synchronization primitives
# SYNOPSIS #
```c
#include <libpmemobj.h>
void pmemobj_mutex_zero(PMEMobjpool *pop, PMEMmutex *mutexp);
int pmemobj_mutex_lock(PMEMobjpool *pop, PMEMmutex *mutexp);
int pmemobj_mutex_timedlock(PMEMobjpool *pop, PMEMmutex *restrict mutexp,
const struct timespec *restrict abs_timeout);
int pmemobj_mutex_trylock(PMEMobjpool *pop, PMEMmutex *mutexp);
int pmemobj_mutex_unlock(PMEMobjpool *pop, PMEMmutex *mutexp);
void pmemobj_rwlock_zero(PMEMobjpool *pop, PMEMrwlock *rwlockp);
int pmemobj_rwlock_rdlock(PMEMobjpool *pop, PMEMrwlock *rwlockp);
int pmemobj_rwlock_wrlock(PMEMobjpool *pop, PMEMrwlock *rwlockp);
int pmemobj_rwlock_timedrdlock(PMEMobjpool *pop, PMEMrwlock *restrict rwlockp,
const struct timespec *restrict abs_timeout);
int pmemobj_rwlock_timedwrlock(PMEMobjpool *pop, PMEMrwlock *restrict rwlockp,
const struct timespec *restrict abs_timeout);
int pmemobj_rwlock_tryrdlock(PMEMobjpool *pop, PMEMrwlock *rwlockp);
int pmemobj_rwlock_trywrlock(PMEMobjpool *pop, PMEMrwlock *rwlockp);
int pmemobj_rwlock_unlock(PMEMobjpool *pop, PMEMrwlock *rwlockp);
void pmemobj_cond_zero(PMEMobjpool *pop, PMEMcond *condp);
int pmemobj_cond_broadcast(PMEMobjpool *pop, PMEMcond *condp);
int pmemobj_cond_signal(PMEMobjpool *pop, PMEMcond *condp);
int pmemobj_cond_timedwait(PMEMobjpool *pop, PMEMcond *restrict condp,
PMEMmutex *restrict mutexp, const struct timespec *restrict abs_timeout);
int pmemobj_cond_wait(PMEMobjpool *pop, PMEMcond *restrict condp,
PMEMmutex *restrict mutexp);
```
# DESCRIPTION #
**libpmemobj**(7) provides several types of synchronization primitives
designed to be used with persistent memory. The pmem-aware lock implementation
is based on the standard POSIX Threads Library, as described in
**pthread_mutex_init**(3), **pthread_rwlock_init**(3) and
**pthread_cond_init**(3). Pmem-aware locks provide semantics similar to
standard **pthread** locks, except that they are embedded in pmem-resident
objects and are considered initialized by zeroing them. Therefore, locks
allocated with **pmemobj_zalloc**(3) or **pmemobj_tx_zalloc**(3) do not require
another initialization step. For performance reasons, they are also padded up
to 64 bytes (cache line size).
On FreeBSD, since all **pthread** locks are dynamically
allocated, while the lock object is still padded up to 64 bytes
for consistency with Linux, only the pointer to the lock is embedded in the
pmem-resident object. **libpmemobj**(7) transparently manages freeing of the
locks when the pool is closed.
The fundamental property of pmem-aware locks is their automatic
reinitialization every time the persistent object store pool is opened. Thus,
all the pmem-aware locks may be considered initialized (unlocked) immediately
after the pool is opened, regardless of their state at the time the pool was
closed for the last time.
Pmem-aware mutexes, read/write locks and condition variables must be declared
with the *PMEMmutex*, *PMEMrwlock*, or *PMEMcond* type, respectively.
The **pmemobj_mutex_zero**() function explicitly initializes the pmem-aware
mutex *mutexp* by zeroing it. Initialization is not necessary if the object
containing the mutex has been allocated using **pmemobj_zalloc**(3) or
**pmemobj_tx_zalloc**(3).
The **pmemobj_mutex_lock**() function locks the pmem-aware mutex *mutexp*.
If the mutex is already locked, the calling thread will block until the mutex
becomes available. If this is the first use of the mutex since the opening of
the pool *pop*, the mutex is automatically reinitialized and then locked.
**pmemobj_mutex_timedlock**() performs the same action as
**pmemobj_mutex_lock**(), but will not wait beyond *abs_timeout* to obtain the
lock before returning.
The **pmemobj_mutex_trylock**() function locks pmem-aware mutex *mutexp*.
If the mutex is already locked, **pthread_mutex_trylock**() will not block
waiting for the mutex, but will return an error. If this is the first
use of the mutex since the opening of the pool *pop*, the mutex is
automatically reinitialized and then locked.
The **pmemobj_mutex_unlock**() function unlocks the pmem-aware mutex
*mutexp*. Undefined behavior follows if a thread tries to unlock a
mutex that has not been locked by it, or if a thread tries to release a mutex
that is already unlocked or has not been initialized.
The **pmemobj_rwlock_zero**() function is used to explicitly initialize the
pmem-aware read/write lock *rwlockp* by zeroing it. Initialization is not
necessary if the object containing the lock has been allocated using
**pmemobj_zalloc**(3) or **pmemobj_tx_zalloc**(3).
The **pmemobj_rwlock_rdlock**() function acquires a read lock on *rwlockp*,
provided that the lock is not presently held for writing and no writer threads
are presently blocked on the lock. If the read lock cannot be acquired
immediately, the calling thread blocks until it can acquire the lock. If this
is the first use of the lock since the opening of the pool *pop*, the lock is
automatically reinitialized and then acquired.
**pmemobj_rwlock_timedrdlock**() performs the same action as
**pmemobj_rwlock_rdlock**(), but will not wait beyond *abs_timeout* to obtain
the lock before returning. A thread may hold multiple concurrent read locks.
If so, **pmemobj_rwlock_unlock**() must be called once for each lock obtained.
The results of acquiring a read lock while the calling thread holds a write
lock are undefined.
The **pmemobj_rwlock_wrlock**() function blocks until a write lock can be
acquired against read/write lock *rwlockp*. If this is the first use of the
lock since the opening of the pool *pop*, the lock is automatically
reinitialized and then acquired.
**pmemobj_rwlock_timedwrlock**() performs the same action, but will not wait
beyond *abs_timeout* to obtain the lock before returning.
The **pmemobj_rwlock_tryrdlock**() function performs the same action as
**pmemobj_rwlock_rdlock**(), but does not block if the lock cannot be
immediately obtained. The results are undefined if the calling thread already
holds the lock at the time the call is made.
The **pmemobj_rwlock_trywrlock**() function performs the same action as
**pmemobj_rwlock_wrlock**(), but does not block if the lock cannot be immediately
obtained. The results are undefined if the calling thread already holds the lock
at the time the call is made.
The **pmemobj_rwlock_unlock**() function is used to release the read/write
lock previously obtained by **pmemobj_rwlock_rdlock**(),
**pmemobj_rwlock_wrlock**(), **pthread_rwlock_tryrdlock**(), or
**pmemobj_rwlock_trywrlock**().
The **pmemobj_cond_zero**() function explicitly initializes the pmem-aware
condition variable *condp* by zeroing it. Initialization is not necessary if
the object containing the condition variable has been allocated using
**pmemobj_zalloc**(3) or **pmemobj_tx_zalloc**(3).
The difference between **pmemobj_cond_broadcast**() and
**pmemobj_cond_signal**() is that the former unblocks all threads waiting
for the condition variable, whereas the latter blocks only one waiting thread.
If no threads are waiting on *condp*, neither function has any effect. If more
than one thread is blocked on a condition variable, the used scheduling policy
determines the order in which threads are unblocked. The same mutex used for
waiting must be held while calling either function. Although neither function
strictly enforces this requirement, undefined behavior may follow if the mutex
is not held.
The **pmemobj_cond_timedwait**() and **pmemobj_cond_wait**() functions block
on a condition variable. They must be called with mutex *mutexp* locked by
the calling thread, or undefined behavior results. These functions atomically
release mutex *mutexp* and cause the calling thread to block on the condition
variable *condp*; atomically here means "atomically with respect to access by
another thread to the mutex and then the condition variable". That is, if
another thread is able to acquire the mutex after the about-to-block thread
has released it, then a subsequent call to **pmemobj_cond_broadcast**() or
**pmemobj_cond_signal**() in that thread will behave as if it were issued
after the about-to-block thread has blocked. Upon successful return, the mutex
will be locked and owned by the calling thread.
# RETURN VALUE #
The **pmemobj_mutex_zero**(), **pmemobj_rwlock_zero**()
and **pmemobj_cond_zero**() functions return no value.
Other locking functions return 0 on success. Otherwise, an error
number will be returned to indicate the error.
# SEE ALSO #
**pmemobj_tx_zalloc**(3), **pmemobj_zalloc**(3), **pthread_cond_init**(3),
**pthread_mutex_init**(3), **pthread_rwlock_init**(3), **libpmem**(7),
**libpmemobj**(7) and **<http://pmem.io>**
| 11,544 | 49.195652 | 99 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pmemobj_root.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMOBJ_ROOT, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemobj_root.3 -- man page for root object management)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemobj_root**(), **pmemobj_root_construct**()
**POBJ_ROOT**(), **pmemobj_root_size**() - root object management
# SYNOPSIS #
```c
#include <libpmemobj.h>
PMEMoid pmemobj_root(PMEMobjpool *pop, size_t size);
PMEMoid pmemobj_root_construct(PMEMobjpool *pop, size_t size,
pmemobj_constr constructor, void *arg);
POBJ_ROOT(PMEMobjpool *pop, TYPE)
size_t pmemobj_root_size(PMEMobjpool *pop);
```
# DESCRIPTION #
The root object of a persistent memory pool is an entry point for all other
persistent objects allocated using the **libpmemobj** API. In other words,
every object stored in the persistent memory pool has the root
object at the end of its reference path. It may be assumed that for each
persistent memory pool the root object always exists, and there is exactly
one root object in each pool.
The **pmemobj_root**() function creates or resizes the root object for the
persistent memory pool *pop*. If this is the first call to **pmemobj_root**(),
the requested *size* is greater than zero and the root object does not exist,
it is implicitly allocated
in a thread-safe manner, so the function may be called by more than one
thread simultaneously (as long as all threads use the identical *size* value).
The size of the root object is guaranteed to be not less than the requested
*size*. If the requested size is larger than the current size, the root
object is automatically resized. In such case, the old data is preserved and
the extra space is zeroed. If the requested size is equal to or smaller than
the current size, the root object remains unchanged.
If the requested *size* is equal to zero, the root object is not allocated.
**pmemobj_root_construct**() performs the same actions as **pmemobj_root**(),
but instead of zeroing the newly allocated object a *constructor* function
is called to initialize the object. The constructor is also called on
reallocations.
The **POBJ_ROOT**() macro works the same way as the **pmemobj_root**() function
except it returns a typed *OID* value.
The **pmemobj_root_size**() function returns the current size of the root object
associated with the persistent memory pool *pop*.
# RETURN VALUE #
Upon success, **pmemobj_root**() returns a handle to the root object associated
with the persistent memory pool *pop*. The same root object handle is returned
in all the threads. If the requested object size is larger than the maximum
allocation size supported for the pool, or if there is not enough free
space in the pool to satisfy a reallocation request, **pmemobj_root**() returns
**OID_NULL** and sets *errno* to ENOMEM.
If the *size* was equal to zero and the root object has not been allocated,
**pmemobj_root**() returns **OID_NULL** and sets *errno* to EINVAL.
If the **pmemobj_root_construct**() constructor fails, the allocation is
canceled, **pmemobj_root_construct**() returns *OID_NULL*, and *errno* is set
to **ECANCELED**. **pmemobj_root_size**() can be used in the constructor to
check whether this is the first call to the constructor.
**POBJ_ROOT**() returns a typed *OID* of type *TYPE* instead of the
*PMEMoid* returned by **pmemobj_root**().
The **pmemobj_root_size**() function returns the current size of the root object
associated with the persistent memory pool *pop*. The returned size is the
largest value requested by any of the earlier **pmemobj_root**() calls. If the
root object has not been allocated yet, **pmemobj_root_size**() returns 0.
# SEE ALSO #
**libpmemobj**(7) and **<http://pmem.io>**
| 5,762 | 44.377953 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pmemobj_open.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMOBJ_OPEN, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemobj_open.3 -- man page for most commonly used functions from libpmemobj library)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[CAVEATS](#caveats)<br />
[SEE ALSO](#see-also)<br />
# NAME #
_UW(pmemobj_open), _UW(pmemobj_create),
**pmemobj_close**(), _UW(pmemobj_check)
- create, open, close and validate persistent memory transactional object store
# SYNOPSIS #
```c
#include <libpmemobj.h>
_UWFUNCR1(PMEMobjpool, *pmemobj_open, *path, const char *layout)
_UWFUNCR1(PMEMobjpool, *pmemobj_create, *path, =q=const char *layout,
size_t poolsize, mode_t mode=e=)
void pmemobj_close(PMEMobjpool *pop);
_UWFUNCR1(int, pmemobj_check, *path, const char *layout)
```
_UNICODE()
# DESCRIPTION #
To use the pmem-resident transactional object store provided by
**libpmemobj**(7), a *memory pool* must first be created
with the _UW(pmemobj_create) function described below. Existing pools
may be opened with the _UW(pmemobj_open) function.
None of the three functions described below is thread-safe with respect
to any other **libpmemobj**(7) functions. In other words, when creating,
opening or deleting a pool, nothing else in the library can happen in parallel,
and therefore these functions should be called from the main thread.
Once created, the memory pool is represented by an opaque handle,
of type *PMEMobjpool\**, which is passed to most of the other **libpmemobj**(7)
functions. Internally, **libpmemobj**(7) will use either **pmem_persist**(3)
or **msync**(2) when it needs to flush changes, depending on whether the memory
pool appears to be persistent memory or a regular file (see the
**pmem_is_pmem**(3) function in **libpmem**(7) for more information). There is
no need for applications to flush changes directly when using the object
memory API provided by **libpmemobj**(7).
The _UW(pmemobj_create) function creates a transactional object store with the
given total *poolsize*. *path* specifies the name of the memory pool file to be
created. *layout* specifies the application's layout type in the form of a
string. The layout name is not interpreted by **libpmemobj**(7), but may be
used as a check when _UW(pmemobj_open) is called. The layout name, including
the terminating null byte ('\0'), cannot be longer than **PMEMOBJ_MAX_LAYOUT**
as defined in **\<libpmemobj.h\>**. A NULL *layout* is equivalent
to using an empty string as a layout name. *mode* specifies the permissions to
use when creating the file, as described by **creat**(2). The memory pool file
is fully allocated to the size *poolsize* using **posix_fallocate**(3). The
caller may choose to take responsibility for creating the memory pool file
by creating it before calling _UW(pmemobj_create), and then specifying
*poolsize* as zero. In this case _UW(pmemobj_create) will take the pool size
from the size of the existing file and will verify that the file appears to be
empty by searching for any non-zero data in the pool header at the beginning of
the file. The minimum net pool size allowed by the library for a local
transactional object store is defined in **\<libpmemobj.h\>** as
**PMEMOBJ_MIN_POOL**. _WINUX(,=q=For remote replicas the minimum file size
is defined in **\<librpmem.h\>** as **RPMEM_MIN_PART**.=e=)
Depending on the configuration of the system, the available non-volatile
memory space may be divided into multiple memory devices.
In such case, the maximum size of the pmemobj memory pool
could be limited by the capacity of a single memory device.
**libpmemobj**(7) allows building persistent memory
resident object store spanning multiple memory devices by creation of
persistent memory pools consisting of multiple files, where each part of
such a *pool set* may be stored on a different memory device
or pmem-aware filesystem.
Creation of all the parts of the pool set can be done with _UW(pmemobj_create);
however, the recommended method for creating pool sets is with the
**pmempool**(1) utility.
When creating a pool set consisting of multiple files, the *path* argument
passed to _UW(pmemobj_create) must point to the special *set* file that defines
the pool layout and the location of all the parts of the pool set. The
*poolsize* argument must be 0. The meaning of the *layout* and *mode* arguments
does not change, except that the same *mode* is used for creation of all the
parts of the pool set.
The *set* file is a plain text file, the structure of which is described in
**poolset**(5).
The _UW(pmemobj_open) function opens an existing object store memory pool.
Similar to _UW(pmemobj_create), *path* must identify either an existing
obj memory pool file, or the *set* file used to create a pool set.
If *layout* is non-NULL, it is compared to the layout
name provided to _UW(pmemobj_create) when the pool was first created. This can
be used to verify that the layout of the pool matches what was expected.
The application must have permission to open the file and memory map it with
read/write permissions.
The **pmemobj_close**() function closes the memory pool indicated by *pop* and
deletes the memory pool handle. The object store itself lives on in the file
that contains it and may be re-opened at a later time using
_UW(pmemobj_open) as described above.
The _UW(pmemobj_check) function performs a consistency check of the file
indicated by *path*. _UW(pmemobj_check) opens the given *path* read-only so
it never makes any changes to the file. This function is not supported on
Device DAX.
# RETURN VALUE #
The _UW(pmemobj_create) function returns a memory pool handle to be used with
most of the functions in **libpmemobj**(7). On error it returns NULL
and sets *errno* appropriately.
The _UW(pmemobj_open) function returns a memory pool handle to be used with
most of the functions in **libpmemobj**(7). If an error prevents the pool
from being opened, or if the given *layout* does not match the pool's layout,
_UW(pmemobj_open) returns NULL and sets *errno* appropriately.
The **pmemobj_close**() function returns no value.
The _UW(pmemobj_check) function returns 1 if the memory pool is found to be
consistent. Any inconsistencies found will cause _UW(pmemobj_check) to
return 0, in which case the use of the file with **libpmemobj**(7) will result
in undefined behavior. The debug version of **libpmemobj**(7) will provide
additional details on inconsistencies when **PMEMOBJ_LOG_LEVEL** is at least 1,
as described in the **DEBUGGING AND ERROR HANDLING** section in
**libpmemobj**(7). _UW(pmemobj_check) returns -1 and sets *errno* if it cannot
perform the consistency check due to other errors.
# CAVEATS #
Not all file systems support **posix_fallocate**(3). _UW(pmemobj_create) will
fail if the underlying file system does not support **posix_fallocate**(3).
# SEE ALSO #
**creat**(2), **msync**(2), **pmem_is_pmem**(3), **pmem_persist**(3),
**posix_fallocate**(3), **libpmem**(7), **libpmemobj**(7)
and **<http://pmem.io>**
| 9,016 | 47.219251 | 99 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pmemobj_ctl_get.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMOBJ_CTL_GET, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017-2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemobj_ctl_get.3 -- man page for libpmemobj CTL)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[CTL NAMESPACE](#ctl-namespace)<br />
[CTL EXTERNAL CONFIGURATION](#ctl-external-configuration)<br />
[SEE ALSO](#see-also)<br />
# NAME #
_UW(pmemobj_ctl_get),
_UW(pmemobj_ctl_set),
_UW(pmemobj_ctl_exec)
- Query and modify libpmemobj internal behavior (EXPERIMENTAL)
# SYNOPSIS #
```c
#include <libpmemobj.h>
_UWFUNCR2(int, pmemobj_ctl_get, PMEMobjpool *pop, *name, void *arg,
=q= (EXPERIMENTAL)=e=)
_UWFUNCR2(int, pmemobj_ctl_set, PMEMobjpool *pop, *name, void *arg,
=q= (EXPERIMENTAL)=e=)
_UWFUNCR2(int, pmemobj_ctl_exec, PMEMobjpool *pop, *name, void *arg,
=q= (EXPERIMENTAL)=e=)
```
_UNICODE()
# DESCRIPTION #
The _UW(pmemobj_ctl_get), _UW(pmemobj_ctl_set) and _UW(pmemobj_ctl_exec)
functions provide a uniform interface for querying and modifying the internal
behavior of **libpmemobj**(7) through the control (CTL) namespace.
See more in **pmem_ctl**(5) man page.
# CTL NAMESPACE #
prefault.at_create | rw | global | int | int | - | boolean
If set, every page of the pool will be touched and written to when the pool
is created, in order to trigger page allocation and minimize the performance
impact of pagefaults. Affects only the _UW(pmemobj_create) function.
Always returns 0.
prefault.at_open | rw | global | int | int | - | boolean
If set, every page of the pool will be touched and written to when the pool
is opened, in order to trigger page allocation and minimize the performance
impact of pagefaults. Affects only the _UW(pmemobj_open) function.
Always returns 0.
tx.debug.skip_expensive_checks | rw | - | int | int | - | boolean
Turns off some expensive checks performed by the transaction module in "debug"
builds. Ignored in "release" builds.
tx.cache.size | rw | - | long long | long long | - | integer
Size in bytes of the transaction snapshot cache. In a larger cache the
frequency of persistent allocations is lower, but with higher fixed cost.
This should be set to roughly the sum of sizes of the snapshotted regions in
an average transaction in the pool.
This value must be a in a range between 0 and **PMEMOBJ_MAX_ALLOC_SIZE**.
This entry point is not thread safe and should not be modified if there are any
transactions currently running.
Returns 0 if successful, -1 otherwise.
tx.cache.threshold | rw | - | long long | long long | - | integer
This entry point is deprecated.
All snapshots, regardless of the size, use the transactional cache.
Returns 0 if successful, -1 otherwise.
tx.post_commit.queue_depth | rw | - | int | int | - | integer
Controls the depth of the post-commit tasks queue. A post-commit task is the
collection of work items that need to be performed on the persistent state after
a successfully completed transaction. This includes freeing no longer needed
objects and cleaning up various caches. By default, this queue does not exist
and the post-commit task is executed synchronously in the same thread that
ran the transaction. By changing this parameter, one can offload this task to
a separate worker. If the queue is full, the algorithm, instead of waiting,
performs the post-commit in the current thread.
The task is performed on a finite resource (lanes, of which there are 1024),
and if the worker threads that process this queue are unable to keep up with
the demand, regular threads might start to block waiting for that resource.
This will happen if the queue depth value is too large.
As a general rule, this value should be set to approximately 1024 minus the
average number of threads in the application (not counting the post-commit
workers); however, this may vary from workload to workload.
The queue depth value must also be a power of two.
This entry point is not thread-safe and must be called when no transactions are
currently being executed.
Returns 0 if successful, -1 otherwise.
tx.post_commit.worker | r- | - | void * | - | - | -
The worker function launched in a thread to perform asynchronous processing
of post-commit tasks. This function returns only after a stop entry point is
called. There may be many worker threads at a time. If there is no work to be
done, this function sleeps instead of polling.
Always returns 0.
tx.post_commit.stop | r- | - | void * | - | - | -
This function forces all the post-commit worker functions to exit and return
control back to the calling thread. This should be called before the application
terminates and the post commit worker threads need to be shutdown.
After the invocation of this entry point, the post-commit task queue can no
longer be used. If worker threads must be restarted after a stop,
the tx.post_commit.queue_depth needs to be set again.
This entry point must be called when no transactions are currently being
executed.
Always returns 0.
heap.alloc_class.[class_id].desc | rw | - | `struct pobj_alloc_class_desc` |
`struct pobj_alloc_class_desc` | - | integer, integer, integer, string
Describes an allocation class. Allows one to create or view the internal
data structures of the allocator.
Creating custom allocation classes can be beneficial for both raw allocation
throughput, scalability and, most importantly, fragmentation. By carefully
constructing allocation classes that match the application workload,
one can entirely eliminate external and internal fragmentation. For example,
it is possible to easily construct a slab-like allocation mechanism for any
data structure.
The `[class_id]` is an index field. Only values between 0-254 are valid.
If setting an allocation class, but the `class_id` is already taken, the
function will return -1.
The values between 0-127 are reserved for the default allocation classes of the
library and can be used only for reading.
The recommended method for retrieving information about all allocation classes
is to call this entry point for all class ids between 0 and 254 and discard
those results for which the function returns an error.
This entry point takes a complex argument.
```
struct pobj_alloc_class_desc {
size_t unit_size;
size_t alignment;
unsigned units_per_block;
enum pobj_header_type header_type;
unsigned class_id;
};
```
The first field, `unit_size`, is an 8-byte unsigned integer that defines the
allocation class size. While theoretically limited only by
**PMEMOBJ_MAX_ALLOC_SIZE**, for most workloads this value should be between
8 bytes and 2 megabytes.
The `alignment` field specifies the user data alignment of objects allocated
using the class. If set, must be a power of two and an even divisor of unit
size. Alignment is limited to maximum of 2 megabytes.
All objects have default alignment of 64 bytes, but the user data alignment
is affected by the size of the chosen header.
The `units_per_block` field defines how many units a single block of memory
contains. This value will be rounded up to match the internal size of the
block (256 kilobytes or a multiple thereof). For example, given a class with
a `unit_size` of 512 bytes and a `units_per_block` of 1000, a single block of
memory for that class will have 512 kilobytes.
This is relevant because the bigger the block size, the less frequently blocks
need to be fetched, resulting in lower contention on global heap state.
The `header_type` field defines the header of objects from the allocation class.
There are three types:
- **POBJ_HEADER_LEGACY**, string value: `legacy`. Used for allocation classes
prior to version 1.3 of the library. Not recommended for use.
Incurs a 64 byte metadata overhead for every object.
Fully supports all features.
- **POBJ_HEADER_COMPACT**, string value: `compact`. Used as default for all
predefined allocation classes.
Incurs a 16 byte metadata overhead for every object.
Fully supports all features.
- **POBJ_HEADER_NONE**, string value: `none`. Header type that
incurs no metadata overhead beyond a single bitmap entry. Can be used
for very small allocation classes or when objects must be adjacent to
each other.
This header type does not support type numbers (type number is always
0) or allocations that span more than one unit.
The `class_id` field is an optional, runtime-only variable that allows the
user to retrieve the identifier of the class. This will be equivalent to the
provided `[class_id]`. This field cannot be set from a config file.
The allocation classes are a runtime state of the library and must be created
after every open. It is highly recommended to use the configuration file to
store the classes.
This structure is declared in the `libpmemobj/ctl.h` header file. Please refer
to this file for an in-depth explanation of the allocation classes and relevant
algorithms.
Allocation classes constructed in this way can be leveraged by explicitly
specifying the class using **POBJ_CLASS_ID(id)** flag in **pmemobj_tx_xalloc**()/**pmemobj_xalloc**()
functions.
Example of a valid alloc class query string:
```
heap.alloc_class.128.desc=500,0,1000,compact
```
This query, if executed, will create an allocation class with an id of 128 that
has a unit size of 500 bytes, has at least 1000 units per block and uses
a compact header.
For reading, function returns 0 if successful, if the allocation class does
not exist it sets the errno to **ENOENT** and returns -1;
For writing, function returns 0 if the allocation class has been successfully
created, -1 otherwise.
heap.alloc_class.new.desc | -w | - | - | `struct pobj_alloc_class_desc` | - | integer, integer, integer, string
Same as `heap.alloc_class.[class_id].desc`, but instead of requiring the user
to provide the class_id, it automatically creates the allocation class with the
first available identifier.
This should be used when it's impossible to guarantee unique allocation class
naming in the application (e.g. when writing a library that uses libpmemobj).
The required class identifier will be stored in the `class_id` field of the
`struct pobj_alloc_class_desc`.
This function returns 0 if the allocation class has been successfully created,
-1 otherwise.
stats.enabled | rw | - | int | int | - | boolean
Enables or disables runtime collection of statistics. Statistics are not
recalculated after enabling; any operations that occur between disabling and
re-enabling will not be reflected in subsequent values.
Statistics are disabled by default. Enabling them may have non-trivial
performance impact.
Always returns 0.
stats.heap.curr_allocated | r- | - | int | - | - | -
Returns the number of bytes currently allocated in the heap. If statistics were
disabled at any time in the lifetime of the heap, this value may be
inaccurate.
heap.size.granularity | rw- | - | uint64_t | uint64_t | - | long long
Reads or modifies the granularity with which the heap grows when OOM.
Valid only if the poolset has been defined with directories.
A granularity of 0 specifies that the pool will not grow automatically.
This function returns 0 if the granularity value is 0, or is larger than
*PMEMOBJ_MIN_PART*, -1 otherwise.
heap.size.extend | --x | - | - | - | uint64_t | -
Extends the heap by the given size. Must be larger than *PMEMOBJ_MIN_PART*.
This function returns 0 if successful, -1 otherwise.
debug.heap.alloc_pattern | rw | - | int | int | - | -
Single byte pattern that is used to fill new uninitialized memory allocation.
If the value is negative, no pattern is written. This is intended for
debugging, and is disabled by default.
# CTL EXTERNAL CONFIGURATION #
In addition to direct function call, each write entry point can also be set
using two alternative methods.
The first method is to load a configuration directly from the **PMEMOBJ_CONF**
environment variable.
The second method of loading an external configuration is to set the
**PMEMOBJ_CONF_FILE** environment variable to point to a file that contains
a sequence of ctl queries.
See more in **pmem_ctl**(5) man page.
# SEE ALSO #
**libpmemobj**(7), **pmem_ctl**(5) and **<http://pmem.io>**
| 14,057 | 39.165714 | 111 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/libpmemobj.7.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(LIBPMEMOBJ, 7)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (libpmemobj.7 -- man page for libpmemobj)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[LIBRARY API VERSIONING](#library-api-versioning-1)<br />
[MANAGING LIBRARY BEHAVIOR](#managing-library-behavior)<br />
[DEBUGGING AND ERROR HANDLING](#debugging-and-error-handling)<br />
[EXAMPLE](#example)<br />
[ACKNOWLEDGEMENTS](#acknowledgements)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**libpmemobj** - persistent memory transactional object store
# SYNOPSIS #
```c
#include <libpmemobj.h>
cc _WINUX(,-std=gnu99) ... -lpmemobj -lpmem
```
_UNICODE()
##### Library API versioning: #####
```c
_UWFUNC(pmemobj_check_version, =q=
unsigned major_required,
unsigned minor_required=e=)
```
##### Managing library behavior: #####
```c
void pmemobj_set_funcs(
void *(*malloc_func)(size_t size),
void (*free_func)(void *ptr),
void *(*realloc_func)(void *ptr, size_t size),
char *(*strdup_func)(const char *s));
```
##### Error handling: #####
```c
_UWFUNC(pmemobj_errormsg, void)
```
##### Other library functions: #####
A description of other **libpmemobj** functions can be found on the following
manual pages:
+ control and statistics: **pmemobj_ctl_get**(3)
+ create, open, close and validate: **pmemobj_open**(3)
+ low-level memory manipulation: **pmemobj_memcpy_persist**(3)
+ locking: **pmemobj_mutex_zero**(3)
+ persistent object identifier: **OID_IS_NULL**(3)
+ type-safety: **TOID_DECLARE**(3)
+ layout declaration: **POBJ_LAYOUT_BEGIN**(3)
+ non-transactional atomic allocations: **pmemobj_alloc**(3)
+ root object management: **pmemobj_root**(3)
+ object containers: **pmemobj_first**(3)
+ non-transactional persistent atomic circular doubly-linked list:
**pmemobj_list_insert**(3), **POBJ_LIST_HEAD**(3)
+ transactional object manipulation: **pmemobj_tx_begin**(3),
**pmemobj_tx_add_range**(3), **pmemobj_tx_alloc**(3)
+ delayed atomicity actions: **pmemobj_action**(3) (EXPERIMENTAL)
# DESCRIPTION #
**libpmemobj** provides a transactional object store in *persistent memory*
(pmem) for applications that require transactions and persistent memory
management using direct access storage (DAX), which is storage that supports
load/store access without paging blocks from a block storage device. Some types
of *non-volatile memory DIMMs* (NVDIMMs) provide this type of byte addressable
access to storage. A *persistent memory aware file system* is typically used to
expose the direct access to applications. Memory mapping a file from this type
of file system results in load/store, non-paged access to pmem. **libpmemobj**
builds on this type of memory mapped file using the low-level pmem support
provided by **libpmem**(7), handling the transactional updates, flushing
changes to persistence, and managing recovery for the application.
_WINUX(,=q=**libpmemobj** requires the **-std=gnu99** compilation flag to
build properly.=e=)
**libpmemobj** is one of a collection of persistent memory libraries available.
The others are:
+ **libpmemblk**(7), providing pmem-resident arrays of fixed-sized blocks with
atomic updates.
+ **libpmemlog**(7), providing a pmem-resident log file.
+ **libpmemcto**(7), providing close-to-open persistence.
+ **libpmem**(7), low-level persistent memory support.
Under normal usage, **libpmemobj** will never print messages or intentionally
cause the process to exit. The only exception to this is the debugging
information, when enabled, as described under **DEBUGGING AND ERROR HANDLING**,
below.
# LIBRARY API VERSIONING #
This section describes how the library API is versioned,
allowing applications to work with an evolving API.
The _UW(pmemobj_check_version) function is used to see if the installed
**libpmemobj** supports the version of the library API required by an
application. The easiest way to do this is for the application to supply
the compile-time version information, supplied by defines in
**\<libpmemobj.h\>**, like this:
```c
reason = _U(pmemobj_check_version)(PMEMOBJ_MAJOR_VERSION,
PMEMOBJ_MINOR_VERSION);
if (reason != NULL) {
/* version check failed, reason string tells you why */
}
```
Any mismatch in the major version number is considered a failure, but a library
with a newer minor version number will pass this check since increasing minor
versions imply backwards compatibility.
An application can also check specifically for the existence of an interface
by checking for the version where that interface was introduced. These versions
are documented in this man page as follows: unless otherwise specified, all
interfaces described here are available in version 1.0 of the library. Interfaces
added after version 1.0 will contain the text *introduced in version x.y* in
the section of this manual describing the feature.
On success, _UW(pmemobj_check_version) returns NULL. Otherwise, the return
value is a static string describing the reason the version check failed. The
string returned by _UW(pmemobj_check_version) must not be modified or freed.
# MANAGING LIBRARY BEHAVIOR #
The **pmemobj_set_funcs**() function allows an application to override memory
allocation calls used internally by **libpmemobj**. Passing in NULL for any of
the handlers will cause the **libpmemobj** default function to be used. The
library does not make heavy use of the system malloc functions, but it does
allocate approximately 4-8 kilobytes for each memory pool in use.
By default, **libpmemobj** supports up to 1024 parallel
transactions/allocations. For debugging purposes it is possible to decrease
this value by setting the **PMEMOBJ_NLANES** environment variable to the
desired limit.
# DEBUGGING AND ERROR HANDLING #
If an error is detected during the call to a **libpmemobj** function, the
application may retrieve an error message describing the reason for the failure
from _UW(pmemobj_errormsg). This function returns a pointer to a static buffer
containing the last error message logged for the current thread. If *errno*
was set, the error message may include a description of the corresponding
error code as returned by **strerror**(3). The error message buffer is
thread-local; errors encountered in one thread do not affect its value in
other threads. The buffer is never cleared by any library function; its
content is significant only when the return value of the immediately preceding
call to a **libpmemobj** function indicated an error, or if *errno* was set.
The application must not modify or free the error message string, but it may
be modified by subsequent calls to other library functions.
Two versions of **libpmemobj** are typically available on a development
system. The normal version, accessed when a program is linked using the
**-lpmemobj** option, is optimized for performance. That version skips checks
that impact performance and never logs any trace information or performs any
run-time assertions.
A second version of **libpmemobj**, accessed when a program uses the libraries
under _DEBUGLIBPATH(), contains run-time assertions and trace points. The
typical way to access the debug version is to set the environment variable
**LD_LIBRARY_PATH** to _LDLIBPATH(). Debugging output is
controlled using the following environment variables. These variables have
no effect on the non-debug version of the library.
+ **PMEMOBJ_LOG_LEVEL**
The value of **PMEMOBJ_LOG_LEVEL** enables trace points in the debug version
of the library, as follows:
+ **0** - This is the default level when **PMEMOBJ_LOG_LEVEL** is not set.
No log messages are emitted at this level.
+ **1** - Additional details on any errors detected are logged,
in addition to returning the *errno*-based errors as usual.
The same information may be retrieved using _UW(pmemobj_errormsg).
+ **2** - A trace of basic operations is logged.
+ **3** - Enables a very verbose amount of function call
tracing in the library.
+ **4** - Enables voluminous and fairly obscure tracing information
that is likely only useful to the **libpmemobj** developers.
Unless **PMEMOBJ_LOG_FILE** is set, debugging output is written to *stderr*.
+ **PMEMOBJ_LOG_FILE**
Specifies the name of a file where all logging information should be written.
If the last character in the name is "-", the *PID* of the current process will
be appended to the file name when the log file is created. If
**PMEMOBJ_LOG_FILE** is not set, logging output is written to *stderr*.
See also **libpmem**(7) to get information
about other environment variables affecting **libpmemobj** behavior.
# EXAMPLE #
See <http://pmem.io/pmdk/libpmemobj> for examples using the **libpmemobj** API.
# ACKNOWLEDGEMENTS #
**libpmemobj** builds on the persistent memory programming model recommended
by the SNIA NVM Programming Technical Work Group:
<http://snia.org/nvmp>
# SEE ALSO #
**OID_IS_NULL**(3), **pmemobj_alloc**(3), **pmemobj_ctl_exec**(3), **pmemobj_ctl_get**(3), **pmemobj_ctl_set**(3), **pmemobj_first**(3), **pmemobj_list_insert**(3), **pmemobj_memcpy_persist**(3), **pmemobj_mutex_zero**(3), **pmemobj_open**(3), **pmemobj_root**(3), **pmemobj_tx_add_range**(3), **pmemobj_tx_alloc**(3), **pmemobj_tx_begin**(3), **POBJ_LAYOUT_BEGIN**(3), **POBJ_LIST_HEAD**(3), **strerror**(3), **TOID_DECLARE**(3), **libpmem**(7), **libpmemblk**(7), **libpmemcto**(7), **libpmemlog**(7), **libvmem**(7)
and **<http://pmem.io>**
| 11,414 | 39.767857 | 518 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/oid_is_null.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(OID_IS_NULL, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017-2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (oid_is_null.3 -- man page for persistent object identifier and functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
_WINUX(,[NOTES](#notes)<br />)
[SEE ALSO](#see-also)<br />
# NAME #
**OID_IS_NULL**(), **OID_EQUALS**(),
**pmemobj_direct**(), **pmemobj_oid**(),
**pmemobj_type_num**(), **pmemobj_pool_by_oid**(),
**pmemobj_pool_by_ptr**() - functions that allow mapping
operations between object addresses, object handles, oids or type numbers
# SYNOPSIS #
```c
#include <libpmemobj.h>
OID_IS_NULL(PMEMoid oid)
OID_EQUALS(PMEMoid lhs, PMEMoid rhs)
void *pmemobj_direct(PMEMoid oid);
PMEMoid pmemobj_oid(const void *addr);
uint64_t pmemobj_type_num(PMEMoid oid);
PMEMobjpool *pmemobj_pool_by_oid(PMEMoid oid);
PMEMobjpool *pmemobj_pool_by_ptr(const void *addr);
void *pmemobj_volatile(PMEMobjpool *pop, struct pmemvlt *vlt,
size_t size, void *ptr,
int (*constr)(void *ptr, void *arg), void *arg);
```
# DESCRIPTION #
Each object stored in a persistent memory pool is represented by an object
handle of type *PMEMoid*. In practice, such a handle is a unique Object
IDentifier (*OID*) of global scope, which means that two objects from
different pools will never have the same *OID*. The special **OID_NULL**
macro defines a NULL-like handle that does not represent any object.
The size of a single object is limited by **PMEMOBJ_MAX_ALLOC_SIZE**.
Thus an allocation with a requested size greater than this value will fail.
An *OID* cannot be used as a direct pointer to an object. Each time
the program attempts to read or write object data, it must obtain the current
memory address of the object by converting its *OID* into a pointer.
In contrast to the memory address, the *OID* value for given object does not
change during the life of an object (except for *realloc*), and remains
valid after closing and reopening the pool. For this reason, if an object
contains a reference to another persistent object, for example, to build
some kind of a linked data structure, the reference must be an *OID* and not
a memory address.
**pmemobj_direct**() returns a pointer to the *PMEMoid* object with
handle *oid*.
**pmemobj_oid**() returns a *PMEMoid* handle to the object pointed
to by *addr*.
**pmemobj_type_num**() returns the type number of the *PMEMoid* object with
handle *oid*.
**pmemobj_pool_by_oid**() returns a *PMEMobjpool*\* handle to the pool
containing the *PMEMoid* object with handle *oid*.
**pmemobj_pool_by_ptr**() returns a *PMEMobjpool*\* handle to the pool
containing the address *addr*.
At the time of allocation (or reallocation), each object may be assigned
a number representing its type. Such a *type number* may be used to arrange the
persistent objects based on their actual user-defined structure type, thus
facilitating implementation of a simple run-time type safety mechanism. This
also allows iterating through all the objects of a given type that are stored
in the persistent memory pool. See **pmemobj_first**(3) for more information.
The **OID_IS_NULL**() macro checks if *PMEMoid* represents a NULL object.
The **OID_EQUALS**() macro compares two *PMEMoid* objects.
For special cases where volatile (transient) variables need to be stored on
persistent memory, there's a mechanism composed of *struct pmemvlt* type and
**pmemobj_volatile()** function. To use it, the *struct pmemvlt* needs to
be placed in the neighborhood of transient data region. The *PMEMvlt* macro
can be used to construct such a region.
The *struct pmemvlt* must be zeroed prior to use. This can be easily done in
object constructor or in a transaction directly after an allocation.
When the **pmemobj_volatile()** function is called on a *struct pmemvlt*,
it will return the pointer to the data and it will ensure that the provided
constructor function is called exactly once in the current instance of the
pmemobj pool.
The constructor is called with the *ptr* pointer to the data, and this function
will return the same pointer if the constructor returns *0*, otherwise NULL is
returned. The *size* argument must accurately describe the total size of the
volatile memory region that will be accessed. Calling **pmemobj_volatile()**
on the same region with different sizes is undefined behavior.
For this mechanism to be effective, all accesses to transient variables must
go through it, otherwise there's a risk of the constructor not being called
on the first load.
Maintaining transient state on persistent memory is challenging due to
difficulties with dynamic resources acquisition and subsequent resource release.
For example, one needs to consider what happens with volatile state of an object
which is being freed inside of a transaction, especially with regards to the
possibility of an abort.
It's generally recommended to entirely separate the persistent and transient
states, and when it's not possible, to only store types which do not require
lifecycle management (i.e., primitive types) inside of volatile regions.
# RETURN VALUE #
The **pmemobj_direct**() function returns a pointer to the object represented
by *oid*. If *oid* is **OID_NULL**, **pmemobj_direct**() returns NULL.
The **pmemobj_oid**() function returns a *PMEMoid* handle to the object pointed
to by *addr*. If *addr* is not from within a pmemobj pool, **OID_NULL** is
returned. If *addr* is not the start of an object (does not point to the
beginning of a valid allocation), the resulting *PMEMoid* can be safely used
only with:
+ **pmemobj_pool_by_oid**()
+ **pmemobj_direct**()
+ **pmemobj_tx_add_range**(3)
The **pmemobj_type_num**() function returns the type number of the object
represented by *oid*.
The **pmemobj_pool_by_oid**() function returns a handle to the pool that
contains the object represented by *oid*. If the the pool is not open or
*oid* is **OID_NULL**, **pmemobj_pool_by_oid**() returns NULL.
The **pmemobj_pool_by_ptr**() function returns a handle to the pool that
contains the address, or NULL if the address does not belong to any open pool.
_WINUX(,=q=
# NOTES #
For performance reasons, on Linux and FreeBSD the **pmemobj_direct**()
function is inlined by default. To use the non-inlined variant of
**pmemobj_direct**(), define **PMEMOBJ_DIRECT_NON_INLINE** prior
to the *\#include* of **\<libpmemobj.h\>**, either with *\#define* or with
the *\-D* option to the compiler.=e=)
# EXAMPLES #
The following code shows how to store transient variables on persistent memory.
```c
struct my_data {
PMEMvlt(uint64_t) foo;
uint64_t bar;
};
int
my_data_constructor(void *ptr, void *arg)
{
uint64_t *foo = ptr;
*foo = 0;
return 0;
}
PMEMobjpool *pop = ...;
struct my_data *data = D_RW(...);
uint64_t *foo = pmemobj_volatile(pop, &data->foo.vlt, &data->foo.value,
my_data_constructor, NULL);
assert(*foo == 0);
```
# SEE ALSO #
**libpmemobj**(7) and **<http://pmem.io>**
| 8,958 | 39.908676 | 88 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pmemobj_tx_add_range.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMOBJ_TX_ADD_RANGE, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemobj_tx_add_range.3 -- man page for transactional object manipulation)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemobj_tx_add_range**(), **pmemobj_tx_add_range_direct**(),
**pmemobj_tx_xadd_range**(), **pmemobj_tx_xadd_range_direct**()
**TX_ADD**(), **TX_ADD_FIELD**(),
**TX_ADD_DIRECT**(), **TX_ADD_FIELD_DIRECT**(),
**TX_XADD**(), **TX_XADD_FIELD**(),
**TX_XADD_DIRECT**(), **TX_XADD_FIELD_DIRECT**(),
**TX_SET**(), **TX_SET_DIRECT**(),
**TX_MEMCPY**(), **TX_MEMSET**()
- transactional object manipulation
# SYNOPSIS #
```c
#include <libpmemobj.h>
int pmemobj_tx_add_range(PMEMoid oid, uint64_t off, size_t size);
int pmemobj_tx_add_range_direct(const void *ptr, size_t size);
int pmemobj_tx_xadd_range(PMEMoid oid, uint64_t off, size_t size, uint64_t flags);
int pmemobj_tx_xadd_range_direct(const void *ptr, size_t size, uint64_t flags);
TX_ADD(TOID o)
TX_ADD_FIELD(TOID o, FIELD)
TX_ADD_DIRECT(TYPE *p)
TX_ADD_FIELD_DIRECT(TYPE *p, FIELD)
TX_XADD(TOID o, uint64_t flags)
TX_XADD_FIELD(TOID o, FIELD, uint64_t flags)
TX_XADD_DIRECT(TYPE *p, uint64_t flags)
TX_XADD_FIELD_DIRECT(TYPE *p, FIELD, uint64_t flags)
TX_SET(TOID o, FIELD, VALUE)
TX_SET_DIRECT(TYPE *p, FIELD, VALUE)
TX_MEMCPY(void *dest, const void *src, size_t num)
TX_MEMSET(void *dest, int c, size_t num)
```
# DESCRIPTION #
**pmemobj_tx_add_range**() takes a "snapshot" of the memory block of given
*size*, located at given offset *off* in the object specified by *oid*, and
saves it to the undo log. The application is then free to directly modify the
object in that memory range. In case of a failure or abort, all the changes
within this range will be rolled back. The supplied block of memory has to be
within the pool registered in the transaction. This function must be called
during **TX_STAGE_WORK**.
The **pmemobj_tx_xadd_range**() function behaves exactly the same as
**pmemobj_tx_add_range**() when *flags* equals zero.
*flags* is a bitmask of the following values:
+ **POBJ_XADD_NO_FLUSH** - skip flush on commit
when application deals with flushing or uses pmemobj_memcpy_persist)
**pmemobj_tx_add_range_direct**() behaves the same as
**pmemobj_tx_add_range**() with the exception that it operates on virtual
memory addresses and not persistent memory objects. It takes a "snapshot" of
a persistent memory block of given *size*, located at the given address *ptr*
in the virtual memory space and saves it to the undo log. The application is
then free to directly modify the object in that memory range. In case of a
failure or abort, all the changes within this range will be rolled back.
The supplied block of memory has to be within the pool registered in the
transaction. This function must be called during **TX_STAGE_WORK**.
The **pmemobj_tx_xadd_range_direct**() function behaves exactly the same as
**pmemobj_tx_add_range_direct**() when *flags* equals zero. *flags* is a
bitmask of the following values:
+ **POBJ_XADD_NO_FLUSH** - skip flush on commit
(when application deals with flushing or uses pmemobj_memcpy_persist)
Similarly to the macros controlling the transaction flow, **libpmemobj**
defines a set of macros that simplify the transactional operations on
persistent objects. Note that those macros operate on typed object handles,
thus eliminating the need to specify the size of the object, or the size and
offset of the field in the user-defined structure that is to be modified.
The **TX_ADD_FIELD**() macro saves the current value of given *FIELD* of the
object referenced by a handle *o* in the undo log. The application is then free
to directly modify the specified *FIELD*. In case of a failure or abort, the
saved value will be restored.
The **TX_XADD_FIELD**() macro works exactly like **TX_ADD_FIELD** when *flags*
equals 0. The *flags* argument is a bitmask of values described in
**pmemobj_tx_xadd_range**, above.
The **TX_ADD**() macro takes a "snapshot" of the entire object referenced by
object handle *o* and saves it in the undo log. The object size is determined
from its *TYPE*. The application is then free to directly modify the object.
In case of a failure or abort, all the changes within the object will be
rolled back.
The **TX_XADD**() macro works exactly like **TX_ADD** when *flags* equals 0.
The *flags* argument is a bitmask of values as described in
**pmemobj_tx_xadd_range**, above.
The **TX_ADD_FIELD_DIRECT**() macro saves the current value of the given
*FIELD* of the object referenced by (direct) pointer *p* in the undo log.
The application is then free to directly modify the specified *FIELD*. In case
of a failure or abort, the saved value will be restored.
The **TX_XADD_FIELD_DIRECT**() macro works exactly like **TX_ADD_FIELD_DIRECT**
when *flags* equals 0. The *flags* argument is a bitmask of values as described
in **pmemobj_tx_xadd_range_direct**, above.
The **TX_ADD_DIRECT**() macro takes a "snapshot" of the entire object
referenced by (direct) pointer *p* and saves it in the undo log. The object
size is determined from its *TYPE*. The application is then free to directly
modify the object. In case of a failure or abort, all the changes within the
object will be rolled back.
The **TX_XADD_DIRECT**() macro works exactly like **TX_ADD_DIRECT** when
*flags* equals 0. The *flags* argument is a bitmask of values as described in
**pmemobj_tx_xadd_range_direct**, above.
The **TX_SET**() macro saves the current value of the given *FIELD* of the
object referenced by handle *o* in the undo log, and then sets its new *VALUE*.
In case of a failure or abort, the saved value will be restored.
The **TX_SET_DIRECT**() macro saves in the undo log the current value of given
*FIELD* of the object referenced by (direct) pointer *p*, and then set its new
*VALUE*. In case of a failure or abort, the saved value will be restored.
The **TX_MEMCPY**() macro saves in the undo log the current content of *dest*
buffer and then overwrites the first *num* bytes of its memory area with
the data copied from the buffer pointed by *src*. In case of a failure or abort,
the saved value will be restored.
The **TX_MEMSET**() macro saves the current content of the *dest* buffer in the
undo log and then fills the first *num* bytes of its memory area with the
constant byte *c*. In case of a failure or abort, the saved value will be
restored.
# RETURN VALUE #
On success, **pmemobj_tx_add_range**(), **pmemobj_tx_xadd_range**(),
**pmemobj_tx_add_range_direct**() and **pmemobj_tx_xadd_range_direct**()
return 0. Otherwise, the stage is changed to **TX_STAGE_ONABORT** and an error
number is returned.
# SEE ALSO #
**pmemobj_tx_alloc**(3), **pmemobj_tx_begin**(3),
**libpmemobj**(7) and **<http://pmem.io>**
| 8,858 | 43.742424 | 88 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pmemobj_tx_begin.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMOBJ_TX_BEGIN, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemobj_tx_begin.3 -- man page for transactional object manipulation)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[CAVEATS](#caveats)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemobj_tx_stage**(),
**pmemobj_tx_begin**(), **pmemobj_tx_lock**(),
**pmemobj_tx_abort**(), **pmemobj_tx_commit**(),
**pmemobj_tx_end**(), **pmemobj_tx_errno**(),
**pmemobj_tx_process**(),
**TX_BEGIN_PARAM**(), **TX_BEGIN_CB**(),
**TX_BEGIN**(), **TX_ONABORT**,
**TX_ONCOMMIT**, **TX_FINALLY**, **TX_END**
- transactional object manipulation
# SYNOPSIS #
```c
#include <libpmemobj.h>
enum tx_stage pmemobj_tx_stage(void);
int pmemobj_tx_begin(PMEMobjpool *pop, jmp_buf *env, enum pobj_tx_param, ...);
int pmemobj_tx_lock(enum tx_lock lock_type, void *lockp);
void pmemobj_tx_abort(int errnum);
void pmemobj_tx_commit(void);
int pmemobj_tx_end(void);
int pmemobj_tx_errno(void);
void pmemobj_tx_process(void);
TX_BEGIN_PARAM(PMEMobjpool *pop, ...)
TX_BEGIN_CB(PMEMobjpool *pop, cb, arg, ...)
TX_BEGIN(PMEMobjpool *pop)
TX_ONABORT
TX_ONCOMMIT
TX_FINALLY
TX_END
```
# DESCRIPTION #
The non-transactional functions and macros described in **pmemobj_alloc**(3),
**pmemobj_list_insert**(3) and **POBJ_LIST_HEAD**(3) only guarantee the
atomicity of a single operation on an object. In case of more complex changes
involving multiple operations on an object, or allocation and modification
of multiple objects, data consistency and fail-safety may be provided only
by using *atomic transactions*.
A transaction is defined as series of operations on persistent memory
objects that either all occur, or nothing occurs. In particular,
if the execution of a transaction is interrupted by a power failure
or a system crash, it is guaranteed that after system restart,
all the changes made as a part of the uncompleted transaction
will be rolled back, restoring the consistent state of the memory
pool from the moment when the transaction was started.
Note that transactions do not provide atomicity with respect
to other threads. All the modifications performed within the transactions
are immediately visible to other threads. Therefore it is the responsibility
of the application to implement a proper thread synchronization mechanism.
Each thread may have only one transaction open at a time, but that
transaction may be nested. Nested transactions are flattened. Committing
the nested transaction does not commit the outer transaction; however, errors
in the nested transaction are propagated up to the outermost level, resulting
in the interruption of the entire transaction.
Each transaction is visible only for the thread that started it.
No other threads can add operations, commit or abort the transaction
initiated by another thread. Multiple threads may have transactions open on a
given memory pool at the same time.
Please see the **CAVEATS** section below for known limitations of the
transactional API.
The **pmemobj_tx_stage**() function returns the current *transaction stage*
for a thread. Stages are changed only by the **pmemobj_tx_\***() functions.
Transaction stages are defined as follows:
+ **TX_STAGE_NONE** - no open transaction in this thread
+ **TX_STAGE_WORK** - transaction in progress
+ **TX_STAGE_ONCOMMIT** - successfully committed
+ **TX_STAGE_ONABORT** - starting the transaction failed or transaction aborted
+ **TX_STAGE_FINALLY** - ready for clean up
The **pmemobj_tx_begin**() function starts a new transaction in the current
thread. If called within an open transaction, it starts a nested transaction.
The caller may use the *env* argument to provide a pointer to a
calling environment to be restored in case of transaction abort. This
information must be provided by the caller using the **setjmp**(3) macro.
A new transaction may be started only if the current stage is **TX_STAGE_NONE**
or **TX_STAGE_WORK**. If successful, the *transaction stage* changes to
**TX_STAGE_WORK**. Otherwise, the stage is changed to **TX_STAGE_ONABORT**.
Optionally, a list of parameters for the transaction may be provided.
Each parameter consists of a type followed by a type-specific number
of values. Currently there are 4 types:
+ **TX_PARAM_NONE**, used as a termination marker. No following value.
+ **TX_PARAM_MUTEX**, followed by one value, a pmem-resident PMEMmutex
+ **TX_PARAM_RWLOCK**, followed by one value, a pmem-resident PMEMrwlock
+ **TX_PARAM_CB**, followed by two values: a callback function
of type *pmemobj_tx_callback*, and a void pointer
Using **TX_PARAM_MUTEX** or **TX_PARAM_RWLOCK** causes the specified lock to
be acquired at the beginning of the transaction. **TX_PARAM_RWLOCK** acquires
the lock for writing. It is guaranteed that **pmemobj_tx_begin**() will acquire
all locks prior to successful completion, and they will be held by the current
thread until the outermost transaction is finished. Locks are taken in order
from left to right. To avoid deadlocks, the user is responsible for proper
lock ordering.
**TX_PARAM_CB** registers the specified callback function to be executed at
each transaction stage. For **TX_STAGE_WORK**, the callback is executed prior
to commit. For all other stages, the callback is executed as the first
operation after a stage change. It will also be called after each transaction;
in this case the *stage* parameter will be set to **TX_STAGE_NONE**.
*pmemobj_tx_callback* must be compatible with:
```void func(PMEMobjpool *pop, enum pobj_tx_stage stage, void *arg)```
*pop* is a pool identifier used in **pmemobj_tx_begin**(), *stage* is a current
transaction stage and *arg* is the second parameter of **TX_PARAM_CB**.
Without considering transaction nesting, this mechanism can be considered an
alternative method for executing code between stages (instead of
**TX_ONCOMMIT**, **TX_ONABORT**, etc). However, there are 2 significant
differences when nested transactions are used:
+ The registered function is executed only in the outermost transaction,
even if registered in an inner transaction.
+ There can be only one callback in the entire transaction, that is, the
callback cannot be changed in an inner transaction.
Note that **TX_PARAM_CB** does not replace the **TX_ONCOMMIT**, **TX_ONABORT**,
etc. macros. They can be used together: the callback will be executed *before*
a **TX_ONCOMMIT**, **TX_ONABORT**, etc. section.
**TX_PARAM_CB** can be used when the code dealing with transaction stage
changes is shared between multiple users or when it must be executed only
in the outer transaction. For example it can be very useful when the
application must synchronize persistent and transient state.
The **pmemobj_tx_lock**() function acquires the lock *lockp* of type
*lock_type* and adds it to the current transaction. *lock_type* may be
**TX_LOCK_MUTEX** or **TX_LOCK_RWLOCK**; *lockp* must be of type
*PMEMmutex* or *PMEMrwlock*, respectively. If *lock_type* is **TX_LOCK_RWLOCK**
the lock is acquired for writing. If the lock is not successfully
acquired, the stage is changed to **TX_STAGE_ONABORT**. This function must be
called during **TX_STAGE_WORK**.
**pmemobj_tx_abort**() aborts the current transaction and causes a transition
to **TX_STAGE_ONABORT**. If *errnum* is equal to 0, the transaction
error code is set to **ECANCELED**; otherwise, it is set to *errnum*.
This function must be called during **TX_STAGE_WORK**.
The **pmemobj_tx_commit**() function commits the current open transaction and
causes a transition to **TX_STAGE_ONCOMMIT**. If called in the context of the
outermost transaction, all the changes may be considered as durably written
upon successful completion. This function must be called during
**TX_STAGE_WORK**.
The **pmemobj_tx_end**() function performs a cleanup of the current
transaction. If called in the context of the outermost transaction, it releases
all the locks acquired by **pmemobj_tx_begin**() for outer and nested
transactions. If called in the context of a nested transaction, it returns
to the context of the outer transaction in **TX_STAGE_WORK**, without releasing
any locks. The **pmemobj_tx_end**() function can be called during
**TX_STAGE_NONE** if transitioned to this stage using **pmemobj_tx_process**().
If not already in **TX_STAGE_NONE**, it causes the transition to
**TX_STAGE_NONE**. **pmemobj_tx_end** must always be called for each
**pmemobj_tx_begin**(), even if starting the transaction failed. This function
must *not* be called during **TX_STAGE_WORK**.
The **pmemobj_tx_errno**() function returns the error code of the last transaction.
The **pmemobj_tx_process**() function performs the actions associated with the
current stage of the transaction, and makes the transition to the next stage.
It must be called in a transaction. The current stage must always be obtained
by a call to **pmemobj_tx_stage**(). **pmemobj_tx_process**() performs
the following transitions in the transaction stage flow:
+ **TX_STAGE_WORK** -> **TX_STAGE_ONCOMMIT**
+ **TX_STAGE_ONABORT** -> **TX_STAGE_FINALLY**
+ **TX_STAGE_ONCOMMIT** -> **TX_STAGE_FINALLY**
+ **TX_STAGE_FINALLY** -> **TX_STAGE_NONE**
+ **TX_STAGE_NONE** -> **TX_STAGE_NONE**
**pmemobj_tx_process**() must not be called after calling **pmemobj_tx_end**()
for the outermost transaction.
In addition to the above API, **libpmemobj**(7) offers a more intuitive method
of building transactions using the set of macros described below. When using
these macros, the complete transaction flow looks like this:
```c
TX_BEGIN(Pop) {
/* the actual transaction code goes here... */
} TX_ONCOMMIT {
/*
* optional - executed only if the above block
* successfully completes
*/
} TX_ONABORT {
/*
* optional - executed only if starting the transaction fails,
* or if transaction is aborted by an error or a call to
* pmemobj_tx_abort()
*/
} TX_FINALLY {
/*
* optional - if exists, it is executed after
* TX_ONCOMMIT or TX_ONABORT block
*/
} TX_END /* mandatory */
```
```c
TX_BEGIN_PARAM(PMEMobjpool *pop, ...)
TX_BEGIN_CB(PMEMobjpool *pop, cb, arg, ...)
TX_BEGIN(PMEMobjpool *pop)
```
The **TX_BEGIN_PARAM**(), **TX_BEGIN_CB**() and **TX_BEGIN**() macros start
a new transaction in the same way as **pmemobj_tx_begin**(), except that instead
of the environment buffer provided by a caller, they set up the local *jmp_buf*
buffer and use it to catch the transaction abort. The **TX_BEGIN**() macro
starts a transaction without any options. **TX_BEGIN_PARAM** may be used when
there is a need to acquire locks prior to starting a transaction (such as
for a multi-threaded program) or set up a transaction stage callback.
**TX_BEGIN_CB** is just a wrapper around **TX_BEGIN_PARAM** that validates
the callback signature. (For compatibility there is also a **TX_BEGIN_LOCK**
macro, which is an alias for **TX_BEGIN_PARAM**). Each of these macros must be
followed by a block of code with all the operations that are to be performed
atomically.
The **TX_ONABORT** macro starts a block of code that will be executed only
if starting the transaction fails due to an error in **pmemobj_tx_begin**(),
or if the transaction is aborted. This block is optional, but in practice
it should not be omitted. If it is desirable to crash the application when a
transaction aborts and there is no **TX_ONABORT** section, the application can
define the **POBJ_TX_CRASH_ON_NO_ONABORT** macro before inclusion of
**\<libpmemobj.h\>**. This provides a default **TX_ONABORT** section which
just calls **abort**(3).
The **TX_ONCOMMIT** macro starts a block of code that will be executed only
if the transaction is successfully committed, which means that the execution
of code in the **TX_BEGIN**() block has not been interrupted by an error or by
a call to **pmemobj_tx_abort**(). This block is optional.
The **TX_FINALLY** macro starts a block of code that will be executed regardless
of whether the transaction is committed or aborted. This block is optional.
The **TX_END** macro cleans up and closes the transaction started by the
**TX_BEGIN**() / **TX_BEGIN_PARAM**() / **TX_BEGIN_CB**() macros.
It is mandatory to terminate each transaction with this macro. If the transaction
was aborted, *errno* is set appropriately.
# RETURN VALUE #
The **pmemobj_tx_stage**() function returns the stage of the current transaction
stage for a thread.
On success, **pmemobj_tx_begin**() returns 0. Otherwise, an error number is
returned.
The **pmemobj_tx_begin**() and **pmemobj_tx_lock**() functions return
zero if *lockp* is successfully added to the transaction.
Otherwise, an error number is returned.
The **pmemobj_tx_abort**() and **pmemobj_tx_commit**() functions return no value.
The **pmemobj_tx_end**() function returns 0 if the transaction was successful.
Otherwise it returns the error code set by **pmemobj_tx_abort**().
Note that **pmemobj_tx_abort**() can be called internally by the library.
The **pmemobj_tx_errno**() function returns the error code of the last transaction.
The **pmemobj_tx_process**() function returns no value.
# CAVEATS #
Transaction flow control is governed by the **setjmp**(3) and **longjmp**(3)
macros, and they are used in both the macro and function flavors of the API.
The transaction will longjmp on transaction abort. This has one major drawback,
which is described in the ISO C standard subsection 7.13.2.1. It says that
**the values of objects of automatic storage duration that are local to the
function containing the setjmp invocation that do not have volatile-qualified
type and have been changed between the setjmp invocation and longjmp call are
indeterminate.**
The following example illustrates the issue described above.
```c
int *bad_example_1 = (int *)0xBAADF00D;
int *bad_example_2 = (int *)0xBAADF00D;
int *bad_example_3 = (int *)0xBAADF00D;
int * volatile good_example = (int *)0xBAADF00D;
TX_BEGIN(pop) {
bad_example_1 = malloc(sizeof(int));
bad_example_2 = malloc(sizeof(int));
bad_example_3 = malloc(sizeof(int));
good_example = malloc(sizeof(int));
/* manual or library abort called here */
pmemobj_tx_abort(EINVAL);
} TX_ONCOMMIT {
/*
* This section is longjmp-safe
*/
} TX_ONABORT {
/*
* This section is not longjmp-safe
*/
free(good_example); /* OK */
free(bad_example_1); /* undefined behavior */
} TX_FINALLY {
/*
* This section is not longjmp-safe on transaction abort only
*/
free(bad_example_2); /* undefined behavior */
} TX_END
free(bad_example_3); /* undefined behavior */
```
Objects which are not volatile-qualified, are of automatic storage duration
and have been changed between the invocations of **setjmp**(3) and
**longjmp**(3) (that also means within the work section of the transaction
after **TX_BEGIN**()) should not be used after a transaction abort, or should
be used with utmost care. This also includes code after the **TX_END** macro.
**libpmemobj**(7) is not cancellation-safe. The pool will never be corrupted
because of a canceled thread, but other threads may stall waiting on locks
taken by that thread. If the application wants to use **pthread_cancel**(3),
it must disable cancellation before calling any **libpmemobj**(7) APIs (see
**pthread_setcancelstate**(3) with **PTHREAD_CANCEL_DISABLE**), and re-enable
it afterwards. Deferring cancellation (**pthread_setcanceltype**(3) with
**PTHREAD_CANCEL_DEFERRED**) is not safe enough, because **libpmemobj**(7)
internally may call functions that are specified as cancellation points in POSIX.
**libpmemobj**(7) relies on the library destructor being called from the main
thread. For this reason, all functions that might trigger destruction (e.g.
**dlclose**(3)) should be called in the main thread. Otherwise some of the
resources associated with that thread might not be cleaned up properly.
# SEE ALSO #
**dlclose**(3), **longjmp**(3), **pmemobj_tx_add_range**(3),
**pmemobj_tx_alloc**(3), **pthread_setcancelstate**(3),
**pthread_setcanceltype**(3), **setjmp**(3),
**libpmemobj**(7) and **<http://pmem.io>**
| 18,061 | 42.418269 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pmemobj_memcpy_persist.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMOBJ_MEMCPY_PERSIST, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017-2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemobj_memcpy_persist.3 -- man page for Low-level memory manipulation)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[EXAMPLES](#examples)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemobj_persist**(), **pmemobj_xpersist**(), **pmemobj_flush**(),
**pmemobj_xflush**(), **pmemobj_drain**(), **pmemobj_memcpy**(),
**pmemobj_memmove**(), **pmemobj_memset**(), **pmemobj_memcpy_persist**(),
**pmemobj_memset_persist**() - low-level memory manipulation functions
# SYNOPSIS #
```c
#include <libpmemobj.h>
void pmemobj_persist(PMEMobjpool *pop, const void *addr,
size_t len);
void pmemobj_flush(PMEMobjpool *pop, const void *addr,
size_t len);
void pmemobj_drain(PMEMobjpool *pop);
int pmemobj_xpersist(PMEMobjpool *pop, const void *addr,
size_t len, unsigned flags);
int pmemobj_xflush(PMEMobjpool *pop, const void *addr,
size_t len, unsigned flags);
void *pmemobj_memcpy(PMEMobjpool *pop, void *dest,
const void *src, size_t len, unsigned flags);
void *pmemobj_memmove(PMEMobjpool *pop, void *dest,
const void *src, size_t len, unsigned flags);
void *pmemobj_memset(PMEMobjpool *pop, void *dest,
int c, size_t len, unsigned flags);
void *pmemobj_memcpy_persist(PMEMobjpool *pop, void *dest,
const void *src, size_t len);
void *pmemobj_memset_persist(PMEMobjpool *pop, void *dest,
int c, size_t len);
```
# DESCRIPTION #
The **libpmemobj**-specific low-level memory manipulation functions described
here leverage the knowledge of the additional configuration options available
for **libpmemobj**(7) pools, such as replication. They also take advantage of
the type of storage behind the pool and use appropriate flush/drain functions.
It is advised to use these functions in conjunction with **libpmemobj**(7)
objects rather than using low-level memory manipulation functions from
**libpmem**.
**pmemobj_persist**() forces any changes in the range \[*addr*, *addr*+*len*)
to be stored durably in persistent memory. Internally this may call either
**pmem_msync**(3) or **pmem_persist**(3). There are no alignment restrictions
on the range described by *addr* and *len*, but **pmemobj_persist**() may
expand the range as necessary to meet platform alignment requirements.
>WARNING:
Like **msync**(2), there is nothing atomic or transactional about this call.
Any unwritten stores in the given range will be written, but some stores may
have already been written by virtue of normal cache eviction/replacement
policies. Correctly written code must not depend on stores waiting until
**pmemobj_persist**() is called to become persistent - they can become
persistent at any time before **pmemobj_persist**() is called.
The **pmemobj_flush**() and **pmemobj_drain**() functions provide partial
versions of the **pmemobj_persist**() function described above.
These functions allow advanced programs to create their own variations of
**pmemobj_persist**().
For example, a program that needs to flush several discontiguous ranges can
call **pmemobj_flush**() for each range and then follow up by calling
**pmemobj_drain**() once. For more information on partial flushing operations,
see **pmem_flush**(3).
**pmemobj_xpersist**() is a version of **pmemobj_persist**() function with
additional *flags* argument.
It supports only the **PMEMOBJ_F_RELAXED** flag.
This flag indicates that memory transfer operation does
not require 8-byte atomicity guarantees.
**pmemobj_xflush**() is a version of **pmemobj_flush**() function with
additional *flags* argument.
It supports only the **PMEMOBJ_F_RELAXED** flag.
The **pmemobj_memmove**(), **pmemobj_memcpy**() and **pmemobj_memset**() functions
provide the same memory copying as their namesakes **memmove**(3), **memcpy**(3),
and **memset**(3), and ensure that the result has been flushed to persistence
before returning (unless **PMEMOBJ_MEM_NOFLUSH** flag was used).
Valid flags for those functions:
+ **PMEMOBJ_F_RELAXED** - This flag indicates that memory transfer operation
does not require 8-byte atomicity guarantees.
+ **PMEMOBJ_F_MEM_NOFLUSH** - Don't flush anything.
This implies **PMEMOBJ_F_MEM_NODRAIN**.
Using this flag only makes sense when it's followed by any function that
flushes data.
The remaining flags say *how* the operation should be done, and are merely hints.
+ **PMEMOBJ_F_MEM_NONTEMPORAL** - Use non-temporal instructions.
This flag is mutually exclusive with **PMEMOBJ_F_MEM_TEMPORAL**.
On x86\_64 this flag is mutually exclusive with **PMEMOBJ_F_MEM_NOFLUSH**.
+ **PMEMOBJ_F_MEM_TEMPORAL** - Use temporal instructions.
This flag is mutually exclusive with **PMEMOBJ_F_MEM_NONTEMPORAL**.
+ **PMEMOBJ_F_MEM_WC** - Use write combining mode.
This flag is mutually exclusive with **PMEMOBJ_F_MEM_WB**.
On x86\_64 this is an alias for **PMEMOBJ_F_MEM_NONTEMPORAL**.
On x86\_64 this flag is mutually exclusive with **PMEMOBJ_F_MEM_NOFLUSH**.
+ **PMEMOBJ_F_MEM_WB** - Use write back mode.
This flag is mutually exclusive with **PMEMOBJ_F_MEM_WC**.
On x86\_64 this is an alias for **PMEMOBJ_F_MEM_TEMPORAL**.
**pmemobj_memcpy_persist**() is an alias for **pmemobj_memcpy**() with flags equal to 0.
**pmemobj_memset_persist**() is an alias for **pmemobj_memset**() with flags equal to 0.
# RETURN VALUE #
**pmemobj_memmove**(), **pmemobj_memcpy**(), **pmemobj_memset**(),
**pmemobj_memcpy_persist**() and **pmemobj_memset_persist**() return destination
buffer.
**pmemobj_persist**(), **pmemobj_flush**() and **pmemobj_drain**()
**pmemobj_xpersist**() and **pmemobj_xflush**() returns non-zero value and
sets errno to EINVAL only if not supported flags has been provided.
do not return any value.
# EXAMPLES #
The following code is functionally equivalent to
**pmemobj_memcpy_persist**():
```c
void *
pmemobj_memcpy_persist(PMEMobjpool *pop, void *dest,
const void *src, size_t len)
{
void *retval = memcpy(dest, src, len);
pmemobj_persist(pop, dest, len);
return retval;
}
```
**pmemobj_persist**() can be thought of as this:
```c
void
pmemobj_persist(PMEMobjpool *pop, const void *addr, size_t len)
{
/* flush the processor caches */
pmemobj_flush(pop, addr, len);
/* wait for any pmem stores to drain from HW buffers */
pmemobj_drain(pop);
}
```
# SEE ALSO #
**memcpy**(3), **memset**(3), **pmem_msync**(3),
**pmem_persist**(3), **libpmem**(7) **libpmemobj**(7)
and **<http://pmem.io>**
| 8,463 | 38.367442 | 88 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pobj_list_head.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(POBJ_LIST_HEAD, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pobj_list_head.3 -- man page for type-safe non-transactional persistent atomic lists)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**POBJ_LIST_HEAD**(),
**POBJ_LIST_ENTRY**(),
**POBJ_LIST_FIRST**(),
**POBJ_LIST_LAST**(),
**POBJ_LIST_EMPTY**(),
**POBJ_LIST_NEXT**(),
**POBJ_LIST_PREV**(),
**POBJ_LIST_FOREACH**(),
**POBJ_LIST_FOREACH_REVERSE**(),
**POBJ_LIST_INSERT_HEAD**(),
**POBJ_LIST_INSERT_TAIL**(),
**POBJ_LIST_INSERT_AFTER**(),
**POBJ_LIST_INSERT_BEFORE**(),
**POBJ_LIST_INSERT_NEW_HEAD**(),
**POBJ_LIST_INSERT_NEW_TAIL**(),
**POBJ_LIST_INSERT_NEW_AFTER**(),
**POBJ_LIST_INSERT_NEW_BEFORE**(),
**POBJ_LIST_REMOVE**(),
**POBJ_LIST_REMOVE_FREE**(),
**POBJ_LIST_MOVE_ELEMENT_HEAD**(),
**POBJ_LIST_MOVE_ELEMENT_TAIL**(),
**POBJ_LIST_MOVE_ELEMENT_AFTER**(),
**POBJ_LIST_MOVE_ELEMENT_BEFORE**()
- type-safe non-transactional persistent atomic lists
# SYNOPSIS #
```c
#include <libpmemobj.h>
POBJ_LIST_HEAD(HEADNAME, TYPE)
POBJ_LIST_ENTRY(TYPE)
POBJ_LIST_FIRST(POBJ_LIST_HEAD *head)
POBJ_LIST_LAST(POBJ_LIST_HEAD *head, POBJ_LIST_ENTRY FIELD)
POBJ_LIST_EMPTY(POBJ_LIST_HEAD *head)
POBJ_LIST_NEXT(TOID elm, POBJ_LIST_ENTRY FIELD)
POBJ_LIST_PREV(TOID elm, POBJ_LIST_ENTRY FIELD)
POBJ_LIST_FOREACH(TOID var, POBJ_LIST_HEAD *head, POBJ_LIST_ENTRY FIELD)
POBJ_LIST_FOREACH_REVERSE(TOID var, POBJ_LIST_HEAD *head, POBJ_LIST_ENTRY FIELD)
POBJ_LIST_INSERT_HEAD(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
TOID elm, POBJ_LIST_ENTRY FIELD)
POBJ_LIST_INSERT_TAIL(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
TOID elm, POBJ_LIST_ENTRY FIELD)
POBJ_LIST_INSERT_AFTER(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
TOID listelm, TOID elm, POBJ_LIST_ENTRY FIELD)
POBJ_LIST_INSERT_BEFORE(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
TOID listelm, TOID elm, POBJ_LIST_ENTRY FIELD)
POBJ_LIST_INSERT_NEW_HEAD(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
POBJ_LIST_ENTRY FIELD, size_t size,
pmemobj_constr constructor, void *arg)
POBJ_LIST_INSERT_NEW_TAIL(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
POBJ_LIST_ENTRY FIELD, size_t size,
pmemobj_constr constructor, void *arg)
POBJ_LIST_INSERT_NEW_AFTER(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
TOID listelm, POBJ_LIST_ENTRY FIELD, size_t size,
pmemobj_constr constructor, void *arg)
POBJ_LIST_INSERT_NEW_BEFORE(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
TOID listelm, POBJ_LIST_ENTRY FIELD, size_t size,
pmemobj_constr constructor, void *arg)
POBJ_LIST_REMOVE(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
TOID elm, POBJ_LIST_ENTRY FIELD)
POBJ_LIST_REMOVE_FREE(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
TOID elm, POBJ_LIST_ENTRY FIELD)
POBJ_LIST_MOVE_ELEMENT_HEAD(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
POBJ_LIST_HEAD *head_new, TOID elm, POBJ_LIST_ENTRY FIELD,
POBJ_LIST_ENTRY field_new)
POBJ_LIST_MOVE_ELEMENT_TAIL(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
POBJ_LIST_HEAD *head_new, TOID elm, POBJ_LIST_ENTRY FIELD,
POBJ_LIST_ENTRY field_new)
POBJ_LIST_MOVE_ELEMENT_AFTER(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
POBJ_LIST_HEAD *head_new, TOID listelm, TOID elm,
POBJ_LIST_ENTRY FIELD, POBJ_LIST_ENTRY field_new)
POBJ_LIST_MOVE_ELEMENT_BEFORE(PMEMobjpool *pop, POBJ_LIST_HEAD *head,
POBJ_LIST_HEAD *head_new, TOID listelm, TOID elm,
POBJ_LIST_ENTRY FIELD, POBJ_LIST_ENTRY field_new)
```
# DESCRIPTION #
The following macros define and operate on a type-safe persistent
atomic circular doubly linked list data structure that consist of
a set of persistent objects of a well-known type. Unlike the functions
described in the previous section, these macros provide type enforcement
by requiring declaration of type of the objects stored in given list,
and not allowing mixing objects of different types in a single list.
The functionality and semantics of those macros is similar to circular
queues defined in **queue**(3).
The majority of the macros must specify the handle to the memory pool *pop* and
the name of the *field* in the user-defined structure, which must be of type
*POBJ_LIST_ENTRY* and is used to connect the elements in the list.
A list is headed by a structure defined by the **POBJ_LIST_HEAD**() macro.
This structure contains an object handle of the first element on the list.
The elements are doubly linked so that an arbitrary element can be removed
without a need to traverse the list. New elements can be added to the list
before or after an existing element, at the head of the list, or at the end
of the list. A list may be traversed in either direction. A *POBJ_LIST_HEAD*
structure is declared as follows:
```c
#define POBJ_LIST_HEAD(HEADNAME, TYPE)
struct HEADNAME
{
TOID(TYPE) pe_first;
PMEMmutex lock;
};
```
In the macro definitions, *TYPE* is the name of a user-defined structure,
that must contain a field of type *POBJ_LIST_ENTRY*. The argument *HEADNAME*
is the name of a user-defined structure that must be declared using the macro
*POBJ_LIST_HEAD*. See the examples below for further explanation of how these
macros are used.
The macro *POBJ_LIST_ENTRY* declares a structure that connects the elements
in the list.
```c
#define POBJ_LIST_ENTRY(TYPE)
struct
{
TOID(TYPE) pe_next;
TOID(TYPE) pe_prev;
};
```
The macro **POBJ_LIST_FIRST**() returns the first element on the list
referenced by *head*. If the list is empty **OID_NULL** is returned.
The macro **POBJ_LIST_LAST**() returns the last element on the list
referenced by *head*. If the list is empty **OID_NULL** is returned.
The macro **POBJ_LIST_EMPTY**() evaluates to 1 if the list referenced
by *head* is empty. Otherwise, 0 is returned.
The macro **POBJ_LIST_NEXT**() returns the element next to the element *elm*.
The macro **POBJ_LIST_PREV**() returns the element preceding the element *elm*.
The macro **POBJ_LIST_FOREACH**() traverses the list referenced by *head*
assigning a handle to each element in turn to *var* variable.
The macro **POBJ_LIST_FOREACH_REVERSE**() traverses the list referenced
by *head* in reverse order, assigning a handle to each element in turn to
*var* variable. The *field* argument is the name of the field of type
*POBJ_LIST_ENTRY* in the element structure.
The macro **POBJ_LIST_INSERT_HEAD**() inserts the element *elm* at the head
of the list referenced by *head*.
The macro **POBJ_LIST_INSERT_TAIL**() inserts the element *elm* at the end
of the list referenced by *head*.
The macro **POBJ_LIST_INSERT_AFTER**() inserts the element *elm* into
the list referenced by *head* after the element *listelm*. If *listelm*
value is **TOID_NULL**, the object is inserted at the end of the list.
The macro **POBJ_LIST_INSERT_BEFORE**() inserts the element *elm* into
the list referenced by *head* before the element *listelm*. If *listelm*
value is **TOID_NULL**, the object is inserted at the head of the list.
The macro **POBJ_LIST_INSERT_NEW_HEAD**() atomically allocates a new
object of size *size* and inserts it at the head of the list referenced
by *head*. The newly allocated object is also added to the internal object
container associated with a type number which is retrieved from the typed
*OID* of the first element on list.
The macro **POBJ_LIST_INSERT_NEW_TAIL**() atomically allocates a new
object of size *size* and inserts it at the tail of the list referenced
by *head*. The newly allocated object is also added to the internal object
container associated with with a type number which is retrieved from
the typed *OID* of the first element on list.
The macro **POBJ_LIST_INSERT_NEW_AFTER**() atomically allocates a new
object of size *size* and inserts it into the list referenced by *head*
after the element *listelm*. If *listelm* value is **TOID_NULL**,
the object is inserted at the end of the list. The newly allocated object
is also added to the internal object container associated with with a type
number which is retrieved from the typed *OID* of the first element on list.
The macro **POBJ_LIST_INSERT_NEW_BEFORE**() atomically allocates a new
object of size *size* and inserts it into the list referenced by *head*
before the element *listelm*. If *listelm* value is **TOID_NULL**,
the object is inserted at the head of the list. The newly allocated object
is also added to the internal object container associated with with a type
number which is retrieved from the typed *OID* of the first element on list.
The macro **POBJ_LIST_REMOVE**() removes the element *elm* from the list
referenced by *head*.
The macro **POBJ_LIST_REMOVE_FREE**() removes the element *elm* from the list
referenced by *head* and frees the memory space represented by this element.
The macro **POBJ_LIST_MOVE_ELEMENT_HEAD**() moves the element *elm* from the
list referenced by *head* to the head of the list *head_new*. The *field* and
*field_new* arguments are the names of the fields of type *POBJ_LIST_ENTRY* in
the element structure that are used to connect the elements in both lists.
The macro **POBJ_LIST_MOVE_ELEMENT_TAIL**() moves the element *elm* from the
list referenced by *head* to the end of the list *head_new*. The *field* and
*field_new* arguments are the names of the fields of type *POBJ_LIST_ENTRY* in
the element structure that are used to connect the elements in both lists.
The macro **POBJ_LIST_MOVE_ELEMENT_AFTER**() atomically removes the element *elm*
from the list referenced by *head* and inserts it into the list referenced by
*head_new* after the element *listelm*. If *listelm* value is *TOID_NULL*,
the object is inserted at the end of the list. The *field* and *field_new*
arguments are the names of the fields of type *POBJ_LIST_ENTRY* in the element
structure that are used to connect the elements in both lists.
The macro **POBJ_LIST_MOVE_ELEMENT_BEFORE**() atomically removes the element
*elm* from the list referenced by *head* and inserts it into the list referenced
by *head_new* before the element *listelm*. If *listelm* value is **TOID_NULL**,
the object is inserted at the head of the list. The *field* and *field_new*
arguments are the names of the fields of type *POBJ_LIST_ENTRY* in the element
structure that are used to connect the elements in both lists.
# SEE ALSO #
**queue**(3), **libpmemobj**(7) and **<http://pmem.io>**
| 12,195 | 42.557143 | 100 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pmemobj_action.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMOBJ_ACTION, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017-2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemobj_action.3 -- Delayed atomicity actions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[EXAMPLES](#examples)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemobj_reserve**(), **pmemobj_xreserve**(), **pmemobj_defer_free**(),
**pmemobj_set_value**(), **pmemobj_publish**(), **pmemobj_tx_publish**(),
**pmemobj_cancel**(), **POBJ_RESERVE_NEW**(), **POBJ_RESERVE_ALLOC**(),
**POBJ_XRESERVE_NEW**(),**POBJ_XRESERVE_ALLOC**()
- Delayed atomicity actions (EXPERIMENTAL)
# SYNOPSIS #
```c
#include <libpmemobj.h>
PMEMoid pmemobj_reserve(PMEMobjpool *pop, struct pobj_action *act,
size_t size, uint64_t type_num); (EXPERIMENTAL)
PMEMoid pmemobj_xreserve(PMEMobjpool *pop, struct pobj_action *act,
size_t size, uint64_t type_num, uint64_t flags); (EXPERIMENTAL)
void pmemobj_defer_free(PMEMobjpool *pop, PMEMoid oid, struct pobj_action *act);
void pmemobj_set_value(PMEMobjpool *pop, struct pobj_action *act,
uint64_t *ptr, uint64_t value); (EXPERIMENTAL)
int pmemobj_publish(PMEMobjpool *pop, struct pobj_action *actv,
size_t actvcnt); (EXPERIMENTAL)
int pmemobj_tx_publish(struct pobj_action *actv, size_t actvcnt); (EXPERIMENTAL)
pmemobj_cancel(PMEMobjpool *pop, struct pobj_action *actv,
size_t actvcnt); (EXPERIMENTAL)
POBJ_RESERVE_NEW(pop, t, act) (EXPERIMENTAL)
POBJ_RESERVE_ALLOC(pop, t, size, act) (EXPERIMENTAL)
POBJ_XRESERVE_NEW(pop, t, act, flags) (EXPERIMENTAL)
POBJ_XRESERVE_ALLOC(pop, t, size, act, flags) (EXPERIMENTAL)
```
# DESCRIPTION #
All of the functions described so far have an immediate effect on the persistent
state of the pool, and as such, the cost of maintaining fail-safety is paid
outright and, most importantly, in the calling thread. This behavior makes
implementing algorithms involving relaxed consistency guarantees difficult, if
not outright impossible.
The following set of functions introduce a mechanism that allows one to delay
the persistent publication of a set of prepared actions to an arbitrary moment
in time of the execution of a program.
The publication is fail-safe atomic in the scope of the entire collection of
actions. If a program exits without publishing the actions, or the actions are
canceled, any resources reserved by those actions are released and placed back in
the pool.
A single action is represented by a single `struct pobj_action`. Functions that
create actions take that structure by pointer, whereas functions that publish
actions take array of actions and the size of the array. The actions can be
created, and published, from different threads.
When creating actions, the *act* argument must be non-NULL and point to a
`struct pobj_action`, the structure will be populated by the function and must
not be modified or deallocated until after publishing.
The **pmemobj_reserve**() functions performs a transient reservation of an object.
Behaves similarly to **pmemobj_alloc**(3), but performs no modification to the
persistent state.
The object returned by this function can be freely modified without worrying
about fail-safe atomicity until the object has been published. Any modifications
of the object must be manually persisted, just like in the case of the atomic API.
**pmemobj_xreserve**() is equivalent to **pmemobj_reserve**(), but with an
additional *flags* argument that is a bitmask of the following values:
+ **POBJ_XALLOC_ZERO** - zero the object (and persist it)
+ **POBJ_CLASS_ID(class_id)** - allocate the object from allocation class
*class_id*. The class id cannot be 0.
**pmemobj_defer_free**() function creates a deferred free action, meaning that
the provided object will be freed when the action is published. Calling this
function with a NULL OID is invalid and causes undefined behavior.
The **pmemobj_set_value** function prepares an action that, once published, will
modify the memory location pointed to by *ptr* to *value*.
The **pmemobj_publish** function publishes the provided set of actions. The
publication is fail-safe atomic. Once done, the persistent state will reflect
the changes contained in the actions.
The **pmemobj_tx_publish** function moves the provided actions to the scope of
the transaction in which it is called. Only object reservations are supported
in transactional publish. Once done, the reserved objects will follow normal
transactional semantics. Can only be called during *TX_STAGE_WORK*.
The **pmemobj_cancel** function releases any resources held by the provided
set of actions and invalidates all actions.
The **POBJ_RESERVE_NEW** macro is a typed variant of **pmemobj_reserve**.
The size of the reservation is determined from the provided type *t*.
The **POBJ_RESERVE_ALLOC** macro is a typed variant of **pmemobj_reserve**.
The *size* of the reservation is user-provided.
The **POBJ_XRESERVE_NEW** and the **POBJ_XRESERVE_ALLOC** macros are equivalent
to **POBJ_RESERVE_NEW** and the **POBJ_RESERVE_ALLOC**, but with an additional
*flags* argument defined for **pmemobj_xreserve**().
# EXAMPLES #
The following code shows atomic append of two objects into a singly linked list.
```c
struct list_node {
int value;
PMEMoid next;
};
/* statically allocate the array of actions */
struct pobj_action actv[4];
/* reserve, populate and persist the first object */
PMEMoid tail = pmemobj_reserve(pop, &actv[0], sizeof(struct list_node), 0);
if (TOID_IS_NULL(tail))
return -1;
D_RW(tail)->value = 1;
D_RW(tail)->next = OID_NULL;
pmemobj_persist(pop, D_RW(tail), sizeof(struct list_node));
/* reserve, populate and persist the second object */
PMEMoid head = pmemobj_reserve(pop, &actv[1], sizeof(struct list_node), 0);
if (TOID_IS_NULL(head))
return -1;
D_RW(head)->value = 2;
D_RW(head)->next = tail;
pmemobj_persist(pop, D_RW(head), sizeof(struct list_node));
/* create actions to set the PMEMoid to the new values */
pmemobj_set_value(pop, &actv[2], &D_RO(root)->head.pool_uuid_lo, head.pool_uuid_lo);
pmemobj_set_value(pop, &actv[3], &D_RO(root)->head.off, head.off);
/* atomically publish the above actions */
pmemobj_publish(pop, actv, 4);
```
# RETURN VALUE #
On success, **pmemobj_reserve**() functions return a handle to the newly
reserved object, otherwise an *OID_NULL* is returned.
On success, **pmemobj_tx_publish**() returns 0, otherwise,
stage changes to *TX_STAGE_ONABORT* and *errno* is set appropriately
On success, **pmemobj_publish**() returns 0, otherwise, returns -1 and *errno*
is set appropriately.
# SEE ALSO #
**pmemobj_alloc**(3), **pmemobj_tx_alloc**(3), **libpmemobj**(7)
and **<http://pmem.io>**
| 8,626 | 42.135 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pmemobj_tx_alloc.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMOBJ_TX_ALLOC, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmemobj_tx_alloc.3 -- man page for transactional object manipulation)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmemobj_tx_alloc**(), **pmemobj_tx_zalloc**(),
**pmemobj_tx_xalloc**(), **pmemobj_tx_realloc**(),
**pmemobj_tx_zrealloc**(), **pmemobj_tx_strdup**(),
**pmemobj_tx_wcsdup**(), **pmemobj_tx_free**(),
**TX_NEW**(), **TX_ALLOC**(),
**TX_ZNEW**(), **TX_ZALLOC**(),
**TX_XALLOC**(), **TX_REALLOC**(),
**TX_ZREALLOC**(), **TX_STRDUP**(),
**TX_WCSDUP**(), **TX_FREE**()
- transactional object manipulation
# SYNOPSIS #
```c
#include <libpmemobj.h>
PMEMoid pmemobj_tx_alloc(size_t size, uint64_t type_num);
PMEMoid pmemobj_tx_zalloc(size_t size, uint64_t type_num);
PMEMoid pmemobj_tx_xalloc(size_t size, uint64_t type_num, uint64_t flags);
PMEMoid pmemobj_tx_realloc(PMEMoid oid, size_t size, uint64_t type_num);
PMEMoid pmemobj_tx_zrealloc(PMEMoid oid, size_t size, uint64_t type_num);
PMEMoid pmemobj_tx_strdup(const char *s, uint64_t type_num);
PMEMoid pmemobj_tx_wcsdup(const wchar_t *s, uint64_t type_num);
int pmemobj_tx_free(PMEMoid oid);
TX_NEW(TYPE)
TX_ALLOC(TYPE, size_t size)
TX_ZNEW(TYPE)
TX_ZALLOC(TYPE, size_t size)
TX_XALLOC(TYPE, size_t size, uint64_t flags)
TX_REALLOC(TOID o, size_t size)
TX_ZREALLOC(TOID o, size_t size)
TX_STRDUP(const char *s, uint64_t type_num)
TX_WCSDUP(const wchar_t *s, uint64_t type_num)
TX_FREE(TOID o)
```
# DESCRIPTION #
The **pmemobj_tx_alloc**() function transactionally allocates a new object of
given *size* and *type_num*. In contrast to the non-transactional allocations,
the objects are added to the internal object containers of given *type_num*
only after the transaction is committed, making the objects visible to the
**POBJ_FOREACH_\***() macros. This function must be called during
**TX_STAGE_WORK**.
The **pmemobj_tx_zalloc**() function transactionally allocates a new zeroed
object of given *size* and *type_num*. This function must be called during
**TX_STAGE_WORK**.
The **pmemobj_tx_xalloc**() function transactionally allocates a new object
of given *size* and *type_num*. The *flags* argument is a bitmask of the
following values:
+ **POBJ_XALLOC_ZERO** - zero the object (equivalent of pmemobj_tx_zalloc)
+ **POBJ_XALLOC_NO_FLUSH** - skip flush on commit
(when application deals with flushing or uses pmemobj_memcpy_persist)
+ **POBJ_CLASS_ID(class_id)** - allocate the object from the allocation
class with id equal to *class_id*
This function must be called during **TX_STAGE_WORK**.
The **pmemobj_tx_realloc**() function transactionally resizes an existing
object to the given *size* and changes its type to *type_num*. If *oid* is
**OID_NULL**, then the call is equivalent to *pmemobj_tx_alloc(pop, size,
type_num)*. If *size* is equal to zero and *oid* is not **OID_NULL**, then
the call is equivalent to *pmemobj_tx_free(oid)*. If the new size is larger
than the old size, the added memory will *not* be initialized. This function
must be called during **TX_STAGE_WORK**.
The **pmemobj_tx_zrealloc**() function transactionally resizes an existing
object to the given *size* and changes its type to *type_num*. If the new
size is larger than the old size, the extended new space is zeroed. This
function must be called during **TX_STAGE_WORK**.
The **pmemobj_tx_strdup**() function transactionally allocates a new object
containing a duplicate of the string *s* and assigns it a type *type_num*.
This function must be called during **TX_STAGE_WORK**.
The **pmemobj_tx_wcsdup**() function transactionally allocates a new object
containing a duplicate of the wide character string *s* and assigns it a type
*type_num*. This function must be called during **TX_STAGE_WORK**.
The **pmemobj_tx_free**() function transactionally frees an existing object
referenced by *oid*. This function must be called during **TX_STAGE_WORK**.
The **TX_NEW**() macro transactionally allocates a new object of given *TYPE*
and assigns it a type number read from the typed *OID*. The allocation size is
determined from the size of the user-defined structure *TYPE*. If successful
and called during **TX_STAGE_WORK** it returns a handle to the newly allocated
object. Otherwise, the stage is changed to **TX_STAGE_ONABORT**, **OID_NULL**
is returned, and *errno* is set appropriately.
The **TX_ALLOC**() macro transactionally allocates a new object of given *TYPE*
and assigns it a type number read from the typed *OID*. The allocation size is
passed by *size* parameter. If successful and called during **TX_STAGE_WORK**
it returns a handle to the newly allocated object. Otherwise, the stage is set
to **TX_STAGE_ONABORT**, **OID_NULL** is returned, and *errno* is set
appropriately.
The **TX_ZNEW**() macro transactionally allocates a new zeroed object of given
*TYPE* and assigns it a type number read from the typed *OID*. The allocation
size is determined from the size of the user-defined structure *TYPE*. If
successful and called during **TX_STAGE_WORK** it returns a handle to the newly
allocated object. Otherwise, stage changes to **TX_STAGE_ONABORT**, **OID_NULL**
is returned, and *errno* is set appropriately.
The **TX_ZALLOC**() macro transactionally allocates a new zeroed object of
given *TYPE* and assigns it a type number read from the typed *OID*. The
allocation size is passed by *size* argument. If successful and called during
**TX_STAGE_WORK** it returns a handle to the newly allocated object. Otherwise,
the stage is changed to **TX_STAGE_ONABORT**, **OID_NULL** is returned, and
*errno* is set appropriately.
The **TX_XALLOC**() macro transactionally allocates a new object of given
*TYPE* and assigns it a type number read from the typed *OID*. The allocation
size is passed by *size* argument. The *flags* argument is a bitmask of values
described in **pmemobj_tx_xalloc** section. If successful and called during
**TX_STAGE_WORK** it returns a handle to the newly allocated object. Otherwise,
the stage is changed to **TX_STAGE_ONABORT**, **OID_NULL** is returned, and
*errno* is set appropriately.
The **TX_REALLOC**() macro transactionally resizes an existing object
referenced by a handle *o* to the given *size*. If successful and called during
**TX_STAGE_WORK** it returns a handle to the reallocated object. Otherwise, the
stage is changed to **TX_STAGE_ONABORT**, **OID_NULL** is returned, and *errno*
is set appropriately.
The **TX_ZREALLOC**() macro transactionally resizes an existing object
referenced by a handle *o* to the given *size*. If the new size is larger than
the old size, the extended new space is zeroed. If successful and called during
**TX_STAGE_WORK** it returns a handle to the reallocated object. Otherwise, the
stage is changed to **TX_STAGE_ONABORT**, **OID_NULL** is returned, and *errno*
is set appropriately.
The **TX_STRDUP**() macro transactionally allocates a new object containing a
duplicate of the string *s* and assigns it type *type_num*. If successful and
called during **TX_STAGE_WORK** it returns a handle to the newly allocated
object. Otherwise, the stage is changed to **TX_STAGE_ONABORT**, **OID_NULL**
is returned, and *errno* is set appropriately.
The **TX_WCSDUP**() macro transactionally allocates a new object containing a
duplicate of the wide character string *s* and assigns it a type *type_num*. If
successful and called during **TX_STAGE_WORK**, it returns a handle to the
newly allocated object. Otherwise, the stage is changed to **TX_STAGE_ONABORT**,
**OID_NULL** is returned, and *errno* is set appropriately.
The **TX_FREE**() macro transactionally frees the memory space represented by
an object handle *o*. If *o* is **OID_NULL**, no operation is performed. If
successful and called during **TX_STAGE_WORK**, **TX_FREE**() returns 0.
Otherwise, the stage is changed to **TX_STAGE_ONABORT** and an error number is
returned.
# RETURN VALUE #
On success, the **pmemobj_tx_alloc**() ,**pmemobj_tx_zalloc**(),
**pmemobj_tx_xalloc**(), **pmemobj_tx_strdup**() and **pmemobj_tx_wcsdup**()
functions return a handle to the newly allocated object. Otherwise, the stage
is changed to **TX_STAGE_ONABORT**, **OID_NULL** is returned, and *errno* is
set appropriately. If *size* equals 0, **OID_NULL** is returned and *errno* is
set appropriately.
On success, **pmemobj_tx_realloc**() and **pmemobj_tx_zrealloc**() return
a handle to the resized object. Otherwise, the stage is changed to
**TX_STAGE_ONABORT**, **OID_NULL** is returned, and *errno* is set
appropriately. Note that the object handle value may change as a result of
reallocation.
On success, **pmemobj_tx_free**() returns 0. Otherwise, the stage is set
to **TX_STAGE_ONABORT** and an error number is returned.
# SEE ALSO #
**pmemobj_tx_add_range**(3), **pmemobj_tx_begin*(3),
**libpmemobj**(7) and **<http://pmem.io>**
| 10,930 | 46.526087 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmemobj/pobj_layout_begin.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(POBJ_LAYOUT_BEGIN, 3)
collection: libpmemobj
header: PMDK
date: pmemobj API version 2.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pobj_layout_begin.3 -- man page for declaration of pool's layout)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[EXAMPLE](#example)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**POBJ_LAYOUT_BEGIN**(), **POBJ_LAYOUT_TOID**(),
**POBJ_LAYOUT_ROOT**(), **POBJ_LAYOUT_NAME**(),
**POBJ_LAYOUT_END**(), **POBJ_LAYOUT_TYPES_NUM**()
- persistent memory transactional object store layout
# SYNOPSIS #
```c
#include <libpmemobj.h>
POBJ_LAYOUT_BEGIN(layout)
POBJ_LAYOUT_TOID(layout, TYPE)
POBJ_LAYOUT_ROOT(layout, ROOT_TYPE)
POBJ_LAYOUT_NAME(layout)
POBJ_LAYOUT_END(layout)
POBJ_LAYOUT_TYPES_NUM(layout)
```
# DESCRIPTION #
**libpmemobj**(7) defines a set of macros for convenient declaration of a
pool's layout. The layout declaration consists of declarations of a number of
used types. The declared types will be assigned consecutive type numbers.
Declared types may be used in conjunction with type safety macros (see
**TOID_DECLARE**(3)). Once created, the layout declaration must not be changed
unless any new types are added at the end of the existing layout declaration.
Modifying any existing declaration may lead to changes in the type numbers of
declared types, which in consequence may cause data corruption.
The **POBJ_LAYOUT_BEGIN**() macro indicates a begin of declaration of layout.
The *LAYOUT* argument is a name of layout. This argument must be passed to all macros
related to the declaration of layout.
The **POBJ_LAYOUT_TOID**() macro declares a typed *OID* for type passed as *TYPE* argument
inside the declaration of layout. All types declared using this macro are assigned with
consecutive type numbers. This macro must be used between the **POBJ_LAYOUT_BEGIN**()
and **POBJ_LAYOUT_END**() macros, with the same name passed as *LAYOUT* argument.
The **POBJ_LAYOUT_ROOT**() macro declares a typed *OID* for type passed as *ROOT_TYPE*
argument inside the declaration of layout. The typed *OID* will be assigned with type number
for root object **POBJ_ROOT_TYPE_NUM**.
The **POBJ_LAYOUT_END**() macro ends the declaration of layout.
The **POBJ_LAYOUT_NAME**() macro returns the name of layout as a null-terminated string.
The **POBJ_LAYOUT_TYPES_NUM**() macro returns number of types declared using the **POBJ_LAYOUT_TOID**()
macro within the layout declaration.
# EXAMPLE #
This is an example of layout declaration:
```c
POBJ_LAYOUT_BEGIN(mylayout);
POBJ_LAYOUT_ROOT(mylayout, struct root);
POBJ_LAYOUT_TOID(mylayout, struct node);
POBJ_LAYOUT_TOID(mylayout, struct foo);
POBJ_LAYOUT_END(mylayout);
struct root
{
TOID(struct node) node;
};
struct node
{
TOID(struct node) next;
TOID(struct foo) foo;
};
```
The name of layout and the number of declared types can be retrieved using the following code:
```c
const char *layout_name = POBJ_LAYOUT_NAME(mylayout);
int num_of_types = POBJ_LAYOUT_TYPES_NUM(mylayout);
```
# SEE ALSO #
**TOID_DECLARE**(3), **libpmemobj**(7) and **<http://pmem.io>**
| 5,022 | 36.485075 | 103 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libvmmalloc/libvmmalloc.7.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(LIBVMMALLOC, 7)
collection: libvmmalloc
header: PMDK
date: vmmalloc API version 1.1
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (libvmmalloc.7 -- man page for libvmmalloc)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[ENVIRONMENT](#environment)<br />
[CAVEATS](#caveats)<br />
[DEBUGGING](#debugging)<br />
[NOTES](#notes)<br />
[BUGS](#bugs)<br />
[ACKNOWLEDGEMENTS](#acknowledgements)<br />
[SEE ALSO](#see-also)
# NAME #
**libvmmalloc** - general purpose volatile memory allocation library
# SYNOPSIS #
```
$ LD_PRELOAD=libvmmalloc.so.1 command [ args... ]
```
or
```c
#include <stdlib.h>
#ifndef __FreeBSD__
#include <malloc.h>
#else
#include <malloc_np.h>
#endif
#include <libvmmalloc.h>
cc [ flag... ] file... -lvmmalloc [ library... ]
```
```c
void *malloc(size_t size);
void free(void *ptr);
void *calloc(size_t number, size_t size);
void *realloc(void *ptr, size_t size);
int posix_memalign(void **memptr, size_t alignment, size_t size);
void *aligned_alloc(size_t alignment, size_t size);
void *memalign(size_t alignment, size_t size);
void *valloc(size_t size);
void *pvalloc(size_t size);
size_t malloc_usable_size(const void *ptr);
void cfree(void *ptr);
```
# DESCRIPTION #
**libvmmalloc** transparently converts all dynamic memory allocations
into Persistent Memory allocations.
The typical usage of **libvmmalloc** does not require any modification of
the target program. It is enough to load **libvmmalloc** before all other
libraries by setting the environment variable **LD_PRELOAD**. When used in
that way, **libvmmalloc** interposes the standard system memory allocation
routines, as defined in **malloc**(3), **posix_memalign**(3) and
**malloc_usable_size**(3), and provides that all dynamic memory allocations
are made from a *memory pool* built on a memory-mapped file, instead of the
system heap. The memory managed by **libvmmalloc** may have different
attributes, depending on the file system containing the memory-mapped file.
In particular, **libvmmalloc** is part of the *Persistent Memory Development Kit*
because it is sometimes useful to use non-volatile memory as a volatile
memory pool, leveraging its capacity, cost, or performance characteristics.
**libvmmalloc** may be also linked to the program, by providing the
**-lvmmalloc* argument to the linker. Then it becomes the default memory
allocator for the program.
>NOTE:
Due to the fact the library operates on a memory-mapped file, **it may not
work properly with programs that perform fork(2) not followed by exec(3).**
There are two variants of experimental **fork**(2) support available in
libvmmalloc. The desired library behavior may be selected by setting the
**VMMALLOC_FORK** environment variable. By default variant #1 is enabled.
See **ENVIRONMENT** for more details.
**libvmmalloc** uses the **mmap**(2) system call to create a pool of
volatile memory. The library is most useful when used with *Direct Access*
storage (DAX), which is memory-addressable persistent storage that supports
load/store access without being paged via the system page cache. A Persistent
Memory-aware file system is typically used to provide this type of access.
Memory-mapping a file from a Persistent Memory-aware file system provides the
raw memory pools, and this library supplies the traditional
*malloc* interfaces on top of those pools.
The memory pool acting as a system heap replacement is created automatically
at library initialization time. The user may control its location and size by
setting the environment variables described in **ENVIRONMENT**, below. The
allocated file space is reclaimed when the process terminates or in case of
system crash.
Under normal usage, **libvmmalloc** will never print messages or intentionally
cause the process to exit. The library uses **pthreads**(7) to be fully
MT-safe, but never creates or destroys threads itself. The library does not
make use of any signals, networking, and never calls **select**(2) or
**poll**(2).
# ENVIRONMENT #
The **VMMALLOC_POOL_DIR** and **VMMALLOC_POOL_SIZE** environment variables
**must** be set for **libvmmalloc** to work properly. If either of them is
not specified, or if their values are not valid, the library prints an
appropriate error message and terminates the process. Any other environment
variables are optional.
+ **VMMALLOC_POOL_DIR**=*path*
Specifies a path to the directory where the memory pool file should be created.
The directory must exist and be writable.
+ **VMMALLOC_POOL_SIZE**=*len*
Defines the desired size (in bytes) of the memory pool file. It must be not
less than the minimum allowed size **VMMALLOC_MIN_POOL** as defined in
**\<libvmmalloc.h\>**.
>NOTE:
Due to the fact the library adds some metadata to the memory pool, the amount of
actual usable space is typically less than the size of the memory pool file.
+ **VMMALLOC_FORK**=*val* (EXPERIMENTAL)
**VMMALLOC_FORK** controls the behavior of **libvmmalloc** in case of
**fork**(3), and can be set to the following values:
+ **0** - **fork**(2) support is disabled. The behavior of **fork**(2) is
undefined in this case, but most likely results in memory pool corruption
and a program crash due to segmentation fault.
+ **1** - The memory pool file is remapped with the **MAP_PRIVATE** flag before
the fork completes. From this moment, any access to memory that modifies the
heap pages, both in the parent and in the child process, will trigger creation
of a copy of those pages in RAM (copy-on-write). The benefit of this approach
is that it does not significantly increase the time of the initial fork
operation, and does not require additional space on the file system. However,
all subsequent memory allocations, and modifications of any memory allocated
before fork, will consume system memory resources instead of the memory pool.
This is the default option if **VMMALLOC_FORK** is not set.
+ **2** - A copy of the entire memory pool file is created for the use of the
child process. This requires additional space on the file system, but both the
parent and the child process may still operate on their memory pools, not
consuming system memory resources.
>NOTE:
In case of large memory pools, creating a copy of the pool file may stall
the fork operation for a quite long time.
+ **3** - The library first attempts to create a copy of the memory pool
(as for option #2), but if it fails (i.e. because of insufficient free
space on the file system), it will fall back to option #1.
>NOTE: Options **2** and **3** are not currently supported on FreeBSD.
Environment variables used for debugging are described in **DEBUGGING**,
below.
# CAVEATS #
**libvmmalloc** relies on the library destructor being called from the main
thread. For this reason, all functions that might trigger destruction (e.g.
**dlclose**(3)) should be called in the main thread. Otherwise some of the
resources associated with that thread might not be cleaned up properly.
# DEBUGGING #
Two versions of **libvmmalloc** are typically available on a development
system. The normal version is optimized for performance. That version skips
checks that impact performance and never logs any trace information or
performs any run-time assertions. A second version, accessed when using
libraries from _DEBUGLIBPATH(), contains run-time assertions and trace
points. The typical way to access the debug version is to set the
**LD_LIBRARY_PATH** environment variable to _LDLIBPATH(). Debugging output is
controlled using the following environment variables. These variables have
no effect on the non-debug version of the library.
+ **VMMALLOC_LOG_LEVEL**
The value of **VMMALLOC_LOG_LEVEL** enables trace points in the debug version
of the library, as follows:
+ **0** - Tracing is disabled. This is the default level when
**VMMALLOC_LOG_LEVEL** is not set.
+ **1** - Additional details on any errors detected are logged, in addition to
returning the *errno*-based errors as usual.
+ **2** - A trace of basic operations is logged.
+ **3** - Enables a very verbose amount of function call tracing
in the library.
+ **4** - Enables voluminous tracing information about all memory
allocations and deallocations.
Unless **VMMALLOC_LOG_FILE** is set, debugging output is written to *stderr*.
+ **VMMALLOC_LOG_FILE**
Specifies the name of a file where
all logging information should be written. If the last character in the name
is "-", the *PID* of the current process will be appended to the file name when
the log file is created. If **VMMALLOC_LOG_FILE** is not set, output is
written to *stderr*.
+ **VMMALLOC_LOG_STATS**
Setting **VMMALLOC_LOG_STATS** to 1 enables logging human-readable
summary statistics at program termination.
# NOTES #
Unlike the normal **malloc**(3), which asks the system for additional memory
when it runs out, **libvmmalloc** allocates the size it is told to and never
attempts to grow or shrink that memory pool.
# BUGS #
**libvmmalloc** may not work properly with programs that perform **fork**(2)
and do not call **exec**(3) immediately afterwards. See **ENVIRONMENT**
for more details about experimental **fork**(2) support.
If logging is enabled in the debug version of the library and the process
performs **fork**(2), no new log file is created for the child process, even if
the configured log file name ends with "-". All logging information from
the child process will be written to the log file owned by the parent process,
which may lead to corruption or partial loss of log data.
Malloc hooks (see **malloc_hook**(3)), are not supported when using
**libvmmalloc**.
# ACKNOWLEDGEMENTS #
**libvmmalloc** depends on jemalloc, written by Jason Evans, to do the heavy
lifting of managing dynamic memory allocation. See:
<http://www.canonware.com/jemalloc>
# SEE ALSO #
**fork**(2), **dlclose(3)**, **exec**(3), **malloc**(3),
**malloc_usable_size**(3), **posix_memalign**(3),
**libpmem**(7), **libvmem**(7) and **<http://pmem.io>**
On Linux:
**jemalloc**(3), **malloc_hook**(3), **pthreads**(7), **ld.so**(8)
On FreeBSD:
**ld.so**(1), **pthread**(3)
| 12,044 | 38.884106 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmempool/pmempool_rm.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL_RM, 3)
collection: libpmempool
header: PMDK
date: pmempool API version 1.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool_rm.3 -- man page for pool set management functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
_UW(pmempool_rm) - remove persistent memory pool
# SYNOPSIS #
```c
#include <libpmempool.h>
_UWFUNCR1(int, pmempool_rm, *path, int flags)
```
_UNICODE()
# DESCRIPTION #
The _UW(pmempool_rm) function removes the pool pointed to by *path*. The *path*
can point to a regular file, device dax or pool set file. If *path* is a pool
set file, _UW(pmempool_rm) will remove all part files from local replicas
using **unlink**(2)_WINUX(,=q=, and all remote replicas using **rpmem_remove**(3)
(see **librpmem**(7)),=e=) before removing the pool set file itself.
The *flags* argument determines the behavior of _UW(pmempool_rm).
It is either 0 or the bitwise OR of one or more of the following flags:
+ **PMEMPOOL_RM_FORCE** - Ignore all errors when removing part files from
local _WINUX(,or remote )replicas.
+ **PMEMPOOL_RM_POOLSET_LOCAL** - Also remove local pool set file.
_WINUX(,
+ **PMEMPOOL_RM_POOLSET_REMOTE** - Also remove remote pool set file.)
# RETURN VALUE #
On success, _UW(pmempool_rm) returns 0. On error, it returns -1 and sets
*errno* accordingly.
# SEE ALSO #
**rpmem_remove**(3), **unlink**(3), **libpmemlog**(7),
**libpmemobj**(7), **librpmem**(7) and **<http://pmem.io>**
| 3,471 | 36.73913 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmempool/pmempool_feature_query.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL_FEATURE_QUERY, 3)
collection: libpmempool
header: PMDK
date: pmempool API version 1.3
...
[comment]: <> (Copyright 2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool_feature_query.3 -- man page for toggle and query pool
set features)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[COMPATIBILITY](#compatibility)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
_UW(pmempool_feature_query), _UW(pmempool_feature_enable),
_UW(pmempool_feature_disable) - toggle or query pool set features
# SYNOPSIS #
```c
#include <libpmempool.h>
_UWFUNCR1(int, pmempool_feature_query, *path, =q=enum pmempool_feature feature, unsigned flags=e=)
_UWFUNCR1(int, pmempool_feature_enable, *path, =q=enum pmempool_feature feature, unsigned flags=e=)
_UWFUNCR1(int, pmempool_feature_disable, *path, =q=enum pmempool_feature feature, unsigned flags=e=)
```
_UNICODE()
# DESCRIPTION #
The *feature* argument accepts following values:
+ **PMEMPOOL_FEAT_SINGLEHDR** - only the first part in each replica contains the
pool part internal metadata. This value can be used only with
**pmempool_feature_query**(). It can not be enabled or disabled. For details see
**poolset**(5).
+ **PMEMPOOL_FEAT_CKSUM_2K** - only the first 2KiB of pool part internal metadata
is checksummed. Other features may depend on this one to store additional metadata
in otherwise unused second 2KiB part of a header.
When **PMEMPOOL_FEAT_CKSUM_2K** is disabled whole 4KiB is checksummed.
+ **PMEMPOOL_FEAT_SHUTDOWN_STATE** - enables additional check performed during
pool open which verifies pool consistency in the presence of dirty shutdown.
**PMEMPOOL_FEAT_CKSUM_2K** has to be enabled prior to
**PMEMPOOL_FEAT_SHUTDOWN_STATE** otherwise enabling **PMEMPOOL_FEAT_SHUTDOWN_STATE** will fail.
+ **PMEMPOOL_FEAT_CHECK_BAD_BLOCKS** - enables checking bad blocks performed
during opening a pool and fixing bad blocks performed by pmempool-sync
during syncing a pool. For details see **pmempool-feature**(1).
The _UW(pmempool_feature_query) function checks state of *feature* in the
pool set pointed by *path*.
The _UW(pmempool_feature_enable) function enables *feature* in the pool set
pointed by *path*.
The _UW(pmempool_feature_disable) function disables *feature* in the pool set
pointed by *path*.
# COMPATIBILITY #
Pool sets with features not defined in this document (e.g. enabled by the newer
software version) are not supported.
# RETURN VALUE #
On success, _UW(pmempool_feature_query) returns 0 if *feature* is disabled or
1 if it is enabled. On error, it returns -1 and sets *errno* accordingly.
On success, _UW(pmempool_feature_enable) returns 0. On error, it returns -1
and sets *errno* accordingly.
On success, _UW(pmempool_feature_disable) returns 0. On error, it returns -1
and sets *errno* accordingly.
If non zero *flags* are provided **errno** is set to EINVAL and function
returns -1.
# SEE ALSO #
**poolset**(5) and **<http://pmem.io>**
| 4,901 | 38.853659 | 100 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmempool/pmempool_sync.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL_SYNC, 3)
collection: libpmempool
header: PMDK
date: pmempool API version 1.3
...
[comment]: <> (Copyright 2017-2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool_sync.3 -- man page for pmempool sync and transform)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[ERRORS](#errors)<br />
[NOTES](#notes)<br />
[SEE ALSO](#see-also)<br />
# NAME #
_UW(pmempool_sync), _UW(pmempool_transform) - pool set synchronization and transformation
# SYNOPSIS #
```c
#include <libpmempool.h>
_UWFUNCR1(int, pmempool_sync, *poolset_file,=q=
unsigned flags=e=, =q= (EXPERIMENTAL)=e=)
_UWFUNCR12(int, pmempool_transform, *poolset_file_src,
*poolset_file_dst, unsigned flags, =q= (EXPERIMENTAL)=e=)
```
_UNICODE()
# DESCRIPTION #
The _UW(pmempool_sync) function synchronizes data between replicas within
a pool set.
_UW(pmempool_sync) accepts two arguments:
* *poolset_file* - a path to a pool set file,
* *flags* - a combination of flags (ORed) which modify how synchronization
is performed.
>NOTE: Only the pool set file used to create the pool should be used
for syncing the pool.
>NOTE: The _UW(pmempool_sync) cannot do anything useful if there
are no replicas in the pool set. In such case, it fails with an error.
>NOTE: At the moment, replication is only supported for **libpmemobj**(7)
pools, so _UW(pmempool_sync) cannot be used with other pool types
(**libpmemlog**(7), **libpmemblk**(7), **libpmemcto**(7)).
The following flags are available:
* **PMEMPOOL_SYNC_DRY_RUN** - do not apply changes, only check for viability of
synchronization.
_UW(pmempool_sync) checks that the metadata of all replicas in
a pool set is consistent, i.e. all parts are healthy, and if any of them is
not, the corrupted or missing parts are recreated and filled with data from
one of the healthy replicas.
_WINUX(,=q=If a pool set has the option *SINGLEHDR* (see **poolset**(5)),
the internal metadata of each replica is limited to the beginning of the first
part in the replica. If the option *NOHDRS* is used, replicas contain no
internal metadata. In both cases, only the missing parts or the ones which
cannot be opened are recreated with the _UW(pmempool_sync) function.=e=)
_UW(pmempool_transform) modifies the internal structure of a pool set.
It supports the following operations:
* adding one or more replicas,
* removing one or more replicas _WINUX(.,=q=,
* adding or removing pool set options.=e=)
Only one of the above operations can be performed at a time.
_UW(pmempool_transform) accepts three arguments:
* *poolset_file_src* - pathname of the pool *set* file for the source
pool set to be changed,
* *poolset_file_dst* - pathname of the pool *set* file that defines the new
structure of the pool set,
* *flags* - a combination of flags (ORed) which modify how synchronization
is performed.
The following flags are available:
* **PMEMPOOL_TRANSFORM_DRY_RUN** - do not apply changes, only check for viability of
transformation.
_WINUX(=q=When adding or deleting replicas, the two pool set files can differ only in the
definitions of replicas which are to be added or deleted. One cannot add and
remove replicas in the same step. Only one of these operations can be performed
at a time. Reordering replicas is not supported.
Also, to add a replica it is necessary for its effective size to match or
exceed the pool size. Otherwise the whole operation fails and no changes are
applied. The effective size of a replica is the sum of sizes of all its part
files decreased by 4096 bytes per each part file. The 4096 bytes of each part
file is utilized for storing internal metadata of the pool part files.=e=)
_WINUX(,=q=When adding or deleting replicas, the two pool set files can differ
only in the definitions of replicas which are to be added or deleted. When
adding or removing pool set options (see **poolset**(5)), the rest of both pool
set files have to be of the same structure. The operation of adding/removing
a pool set option can be performed on a pool set with local replicas only. To
add/remove a pool set option to/from a pool set with remote replicas, one has
to remove the remote replicas first, then add/remove the option, and finally
recreate the remote replicas having added/removed the pool set option to/from
the remote replicas' poolset files.
To add a replica it is necessary for its effective size to match or exceed the
pool size. Otherwise the whole operation fails and no changes are applied.
If none of the pool set options is used, the effective size of a replica is the
sum of sizes of all its part files decreased by 4096 bytes per each part file.
The 4096 bytes of each part file is utilized for storing internal metadata of
the pool part files.
If the option *SINGLEHDR* is used, the effective size of a replica is the sum of
sizes of all its part files decreased once by 4096 bytes. In this case only
the first part contains internal metadata.
If the option *NOHDRS* is used, the effective size of a replica is the sum of
sizes of all its part files. In this case none of the parts contains internal
metadata.=e=)
>NOTE: At the moment, *transform* operation is only supported for
**libpmemobj**(7) pools, so _UW(pmempool_transform) cannot be used with other
pool types (**libpmemlog**(7), **libpmemblk**(7), **libpmemcto**(7)).
# RETURN VALUE #
_UW(pmempool_sync) and _UW(pmempool_transform) return 0 on success.
Otherwise, they return -1 and set *errno* appropriately.
# ERRORS #
**EINVAL** Invalid format of the input/output pool set file.
**EINVAL** Unsupported *flags* value.
**EINVAL** There is only master replica defined in the input pool set passed
to _UW(pmempool_sync).
**EINVAL** The source pool set passed to _UW(pmempool_transform) is not a
**libpmemobj** pool.
**EINVAL** The input and output pool sets passed to _UW(pmempool_transform)
are identical.
**EINVAL** Attempt to perform more than one transform operation at a time.
**ENOTSUP** The pool set contains a remote replica, but remote replication
is not supported (**librpmem**(7) is not available).
# NOTES #
The _UW(pmempool_sync) API is experimental and it may change in future
versions of the library.
The _UW(pmempool_transform) API is experimental and it may change in future
versions of the library.
# SEE ALSO #
**libpmemlog**(7), **libpmemobj**(7) and **<http://pmem.io>**
| 8,306 | 38.746411 | 89 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmempool/libpmempool.7.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(LIBPMEMPOOL, 7)
collection: libpmempool
header: PMDK
date: pmempool API version 1.3
...
[comment]: <> (Copyright 2016-2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (libpmempool.7 -- man page for libpmempool)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[LIBRARY API VERSIONING](#library-api-versioning-1)<br />
[DEBUGGING AND ERROR HANDLING](#debugging-and-error-handling)<br />
[EXAMPLE](#example)<br />
[ACKNOWLEDGEMENTS](#acknowledgements)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**libpmempool** - persistent memory pool management library
# SYNOPSIS #
```c
#include <libpmempool.h>
cc _WINUX(,-std=gnu99) ... -lpmempool -lpmem
```
_UNICODE()
##### Library API versioning: #####
```c
_UWFUNC(pmempool_check_version, =q=
unsigned major_required,
unsigned minor_required=e=)
```
##### Error handling: #####
```c
_UWFUNC(pmempool_errormsg, void)
```
##### Other library functions: #####
A description of other **libpmempool** functions can be found on the following
manual pages:
+ health check functions: **pmempool_check_init**(3)
+ pool set synchronization and transformation: **pmempool_sync**(3)
+ pool set management functions: **pmempool_rm**(3)
+ toggle or query pool set features: **pmempool_feature_query**(3)
# DESCRIPTION #
**libpmempool**
provides a set of utilities for off-line analysis and
manipulation of a *pool*. A *pool* in this
manpage means a pmemobj pool, pmemblk pool, pmemlog pool or
BTT layout, independent of the underlying storage. Some
**libpmempool** functions are required to work without
any impact on the *pool* but some may create a new or modify
an existing *pool*.
**libpmempool**
is for applications that need high reliability or built-in
troubleshooting. It may be useful for testing and debugging
purposes also.
**libpmempool** introduces functionality of pool set health check,
synchronization, transformation and removal.
# CAVEATS #
**libpmempool** relies on the library destructor being called from the main
thread. For this reason, all functions that might trigger destruction (e.g.
**dlclose**(3)) should be called in the main thread. Otherwise some of the
resources associated with that thread might not be cleaned up properly.
_WINUX(,=q=**libpmempool** requires the **-std=gnu99** compilation flag to
build properly.=e=)
# LIBRARY API VERSIONING #
This section describes how the library API is versioned,
allowing applications to work with an evolving API.
The _UW(pmempool_check_version) function is used to see if
the installed **libpmempool** supports the version of the
library API required by an application. The easiest way to
do this for the application is to supply the compile-time
version information, supplied by defines in **\<libpmempool.h\>**, like this:
```c
reason = _U(pmempool_check_version)(PMEMPOOL_MAJOR_VERSION,
PMEMPOOL_MINOR_VERSION);
if (reason != NULL) {
/* version check failed, reason string tells you why */
}
```
Any mismatch in the major version number is considered a failure, but a
library with a newer minor version number will pass this
check since increasing minor versions imply backwards compatibility.
An application can also check specifically for the existence of an
interface by checking for the version where that interface
was introduced. These versions are documented in this man
page as follows: unless otherwise specified, all interfaces
described here are available in version 1.0 of the library.
Interfaces added after version 1.0 will contain the text
*introduced in version x.y* in the section of this manual
describing the feature.
When the version check performed by _UW(pmempool_check_version)
is successful, the return value is NULL. Otherwise the
return value is a static string describing the reason for
failing the version check. The string returned by
_UW(pmempool_check_version) must not be modified or freed.
# DEBUGGING AND ERROR HANDLING #
If an error is detected during the call to a **libpmempool** function, the
application may retrieve an error message describing the reason for the failure
from _UW(pmempool_errormsg). This function returns a pointer to a static buffer
containing the last error message logged for the current thread. If *errno*
was set, the error message may include a description of the corresponding
error code as returned by **strerror**(3). The error message buffer is
thread-local; errors encountered in one thread do not affect its value in
other threads. The buffer is never cleared by any library function; its
content is significant only when the return value of the immediately preceding
call to a **libpmempool** function indicated an error, or if *errno* was set.
The application must not modify or free the error message string, but it may
be modified by subsequent calls to other library functions.
Two versions of **libpmempool** are typically available on a development
system. The normal version, accessed when a program is linked using the
**-lpmempool** option, is optimized for performance. That version skips checks
that impact performance and never logs any trace information or performs any
run-time assertions.
A second version of **libpmempool**, accessed when a program uses the libraries
under _DEBUGLIBPATH(), contains run-time assertions and trace points. The
typical way to access the debug version is to set the environment variable
**LD_LIBRARY_PATH** to _LDLIBPATH(). Debugging output is
controlled using the following environment variables. These variables have
no effect on the non-debug version of the library.
+ **PMEMPOOL_LOG_LEVEL**
The value of **PMEMPOOL_LOG_LEVEL** enables trace points in the debug version
of the library, as follows:
+ **0** - This is the default level when **PMEMPOOL_LOG_LEVEL** is not set.
No log messages are emitted at this level.
+ **1** - Additional details on any errors detected are logged (in addition
to returning the *errno*-based errors as usual). The same information
may be retrieved using _UW(pmempool_errormsg).
+ **2** - A trace of basic operations is logged.
+ **3** - Enables a very verbose amount of function call tracing in the library.
+ **4** - Enables voluminous and fairly obscure tracing
information that is likely only useful to the **libpmempool** developers.
Unless **PMEMPOOL_LOG_FILE** is set, debugging output is written to *stderr*.
+ **PMEMPOOL_LOG_FILE**
Specifies the name of a file where
all logging information should be written. If the last character in the name
is "-", the *PID* of the current process will be appended to the file name when
the log file is created. If **PMEMPOOL_LOG_FILE** is not set, output is
written to *stderr*.
# EXAMPLE #
The following example illustrates how the **libpmempool** API is used.
The program detects the type and checks consistency of given pool.
If there are any issues detected, the pool is automatically repaired.
```c
#include <stddef.h>_WINUX(,=q=
#include <unistd.h>=e=)
#include <stdlib.h>
#include <stdio.h>
#include <libpmempool.h>
#define PATH "./pmem-fs/myfile"
#define CHECK_FLAGS (PMEMPOOL_CHECK_FORMAT_STR|PMEMPOOL_CHECK_REPAIR|\
PMEMPOOL_CHECK_VERBOSE)
int
main(int argc, char *argv[])
{
PMEMpoolcheck *ppc;
struct _U(pmempool_check_status) *status;
enum pmempool_check_result ret;
/* arguments for check */
struct _U(pmempool_check_args) args = {
.path = PATH,
.backup_path = NULL,
.pool_type = PMEMPOOL_POOL_TYPE_DETECT,
.flags = CHECK_FLAGS
};
/* initialize check context */
if ((ppc = _U(pmempool_check_init)(&args, sizeof(args))) == NULL) {
perror("_U(pmempool_check_init)");
exit(EXIT_FAILURE);
}
/* perform check and repair, answer 'yes' for each question */
while ((status = _U(pmempool_check)(ppc)) != NULL) {
switch (status->type) {
case PMEMPOOL_CHECK_MSG_TYPE_ERROR:
printf("%s\n", status->str.msg);
break;
case PMEMPOOL_CHECK_MSG_TYPE_INFO:
printf("%s\n", status->str.msg);
break;
case PMEMPOOL_CHECK_MSG_TYPE_QUESTION:
printf("%s\n", status->str.msg);
status->str.answer = "yes";
break;
default:
pmempool_check_end(ppc);
exit(EXIT_FAILURE);
}
}
/* finalize the check and get the result */
ret = pmempool_check_end(ppc);
switch (ret) {
case PMEMPOOL_CHECK_RESULT_CONSISTENT:
case PMEMPOOL_CHECK_RESULT_REPAIRED:
return 0;
default:
return 1;
}
}
```
See <http://pmem.io/pmdk/libpmempool> for more examples using the
**libpmempool** API.
# ACKNOWLEDGEMENTS #
**libpmempool** builds on the persistent memory programming model
recommended by the SNIA NVM Programming Technical Work Group:
<http://snia.org/nvmp>
# SEE ALSO #
**dlclose**(3), **pmempool_check_init**(3), **pmempool_feature_query**(3),
**pmempool_rm**(3), **pmempool_sync**(3), **strerror**(3), **libpmem**(7),
**libpmemblk**(7), **libpmemcto**(7), **libpmemlog**(7), **libpmemobj**(7)**
and **<http://pmem.io>**
| 10,807 | 34.552632 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmempool/pmempool_check_init.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL_CHECK_INIT, 3)
collection: libpmempool
header: PMDK
date: pmempool API version 1.3
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool_check_init.3 -- man page for pmempool health check functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[EXAMPLE](#example)<br />
[NOTES](#notes)<br />
[SEE ALSO](#see-also)<br />
# NAME #
_UW(pmempool_check_init), _UW(pmempool_check),
**pmempool_check_end**() - checks pmempool health
# SYNOPSIS #
```c
#include <libpmempool.h>
_UWFUNCR1UW(PMEMpoolcheck, *pmempool_check_init, struct pmempool_check_args,
*args,=q=
size_t args_size=e=)
_UWFUNCRUW(struct pmempool_check_status, *pmempool_check, PMEMpoolcheck *ppc)
enum pmempool_check_result pmempool_check_end(PMEMpoolcheck *ppc);
```
_UNICODE()
# DESCRIPTION #
To perform the checks provided by **libpmempool**, a *check context*
must first be initialized using the _UW(pmempool_check_init)
function described in this section. Once initialized, the
*check context* is represented by an opaque handle of
type *PMEMpoolcheck\**, which is passed to all of the
other functions available in **libpmempool**
To execute checks, _UW(pmempool_check) must be called iteratively.
Each call generates a new check status, represented by a
_UWS(pmempool_check_status) structure. Status messages are described
later below.
When the checks are completed, _UW(pmempool_check) returns NULL. The check
must be finalized using **pmempool_check_end**(), which returns an
*enum pmempool_check_result* describing the results of the entire check.
_UW(pmempool_check_init) initializes the check context. *args* describes
parameters of the check context. *args_size* should be equal to the size of
the _UWS(pmempool_check_args). _UWS(pmempool_check_args) is defined as follows:
_WINUX(=q=
```c
struct pmempool_check_argsU
{
/* path to the pool to check */
const char *path;
/* optional backup path */
const char *backup_path;
/* type of the pool */
enum pmempool_pool_type pool_type;
/* parameters */
int flags;
};
struct pmempool_check_argsW
{
/* path to the pool to check */
const wchar_t *path;
/* optional backup path */
const wchar_t *backup_path;
/* type of the pool */
enum pmempool_pool_type pool_type;
/* parameters */
int flags;
};
```
=e=,=q=
```c
struct pmempool_check_args
{
/* path to the pool to check */
const char *path;
/* optional backup path */
const char *backup_path;
/* type of the pool */
enum pmempool_pool_type pool_type;
/* parameters */
int flags;
};
```
=e=)
The *flags* argument accepts any combination of the following values (ORed):
+ **PMEMPOOL_CHECK_REPAIR** - perform repairs
+ **PMEMPOOL_CHECK_DRY_RUN** - emulate repairs, not supported on Device DAX
+ **PMEMPOOL_CHECK_ADVANCED** - perform hazardous repairs
+ **PMEMPOOL_CHECK_ALWAYS_YES** - do not ask before repairs
+ **PMEMPOOL_CHECK_VERBOSE** - generate info statuses
+ **PMEMPOOL_CHECK_FORMAT_STR** - generate string format statuses
*pool_type* must match the type of the *pool* being processed. Pool type
detection may be enabled by setting *pool_type* to
**PMEMPOOL_POOL_TYPE_DETECT**. A pool type detection failure ends the check.
*backup_path* may be:
+ NULL. No backup will be performed.
+ a non-existent file: *backup_path* will be created and backup will be
performed. *path* must be a single file *pool*.
+ an existing *pool set* file: Backup will be performed as defined by the
*backup_path* pool set. *path* must be a pool set, and *backup_path* must have
the same structure (the same number of parts with exactly the same size) as the
*path* pool set.
Backup is supported only if the source *pool set* has no defined replicas.
Neither *path* nor *backup_path* may specify a pool set with remote replicas.
The _UW(pmempool_check) function starts or resumes the check indicated by *ppc*.
When the next status is generated, the check is paused and _UW(pmempool_check)
returns a pointer to the _UWS(pmempool_check_status) structure:
_WINUX(=q=
{
```c
struct pmempool_check_statusU
{
enum pmempool_check_msg_type type; /* type of the status */
struct
{
const char *msg; /* status message string */
const char *answer; /* answer to message if applicable */
} str;
};
struct pmempool_check_statusW
{
enum pmempool_check_msg_type type; /* type of the status */
struct
{
const wchar_t *msg; /* status message string */
const wchar_t *answer; /* answer to message if applicable */
} str;
};
```
=e=,=q=
```c
struct pmempool_check_status
{
enum pmempool_check_msg_type type; /* type of the status */
struct
{
const char *msg; /* status message string */
const char *answer; /* answer to message if applicable */
} str;
};
```
=e=)
This structure can describe three types of statuses:
+ **PMEMPOOL_CHECK_MSG_TYPE_INFO** - detailed information about the check.
Generated only if a **PMEMPOOL_CHECK_VERBOSE** flag was set.
+ **PMEMPOOL_CHECK_MSG_TYPE_ERROR** - An error was encountered.
+ **PMEMPOOL_CHECK_MSG_TYPE_QUESTION** - question. Generated only if an
**PMEMPOOL_CHECK_ALWAYS_YES** flag was not set. It requires *answer* to be
set to "yes" or "no" before continuing.
After calling _UW(pmempool_check) again, the previously provided
_UWS(pmempool_check_status) pointer must be considered invalid.
The **pmempool_check_end**() function finalizes the check and releases all
related resources. *ppc* is invalid after calling **pmempool_check_end**().
# RETURN VALUE #
_UW(pmempool_check_init) returns an opaque handle of type *PMEMpoolcheck\**.
If the provided parameters are invalid or the initialization process fails,
_UW(pmempool_check_init) returns NULL and sets *errno* appropriately.
Each call to _UW(pmempool_check) returns a pointer to a
_UWS(pmempool_check_status) structure when a status is generated. When the
check completes, _UW(pmempool_check) returns NULL.
The **pmempool_check_end**() function returns an *enum pmempool_check_result*
summarizing the results of the finalized check. **pmempool_check_end**() can
return one of the following values:
+ **PMEMPOOL_CHECK_RESULT_CONSISTENT** - the *pool* is consistent
+ **PMEMPOOL_CHECK_RESULT_NOT_CONSISTENT** - the *pool* is not consistent
+ **PMEMPOOL_CHECK_RESULT_REPAIRED** - the *pool* has issues but all repair
steps completed successfully
+ **PMEMPOOL_CHECK_RESULT_CANNOT_REPAIR** - the *pool* has issues which
can not be repaired
+ **PMEMPOOL_CHECK_RESULT_ERROR** - the *pool* has errors or the check
encountered an issue
+ **PMEMPOOL_CHECK_RESULT_SYNC_REQ** - the *pool* has single healthy replica.
To fix remaining issues use **pmempool_sync**(3).
# EXAMPLE #
This is an example of a *check context* initialization:
```c
struct _U(pmempool_check_args) args =
{
.path = "/path/to/blk.pool",
.backup_path = NULL,
.pool_type = PMEMPOOL_POOL_TYPE_BLK,
.flags = PMEMPOOL_CHECK_REPAIR | PMEMPOOL_CHECK_DRY_RUN |
PMEMPOOL_CHECK_VERBOSE | PMEMPOOL_CHECK_FORMAT_STR
};
```
```c
PMEMpoolcheck *ppc = _U(pmempool_check_init)(&args, sizeof(args));
```
The check will process a *pool* of type **PMEMPOOL_POOL_TYPE_BLK**
located in the path */path/to/blk.pool*. Before the check it will
not create a backup of the *pool* (*backup_path == NULL*).
If the check finds any issues it will try to
perform repair steps (**PMEMPOOL_CHECK_REPAIR**), but it
will not make any changes to the *pool*
(**PMEMPOOL_CHECK_DRY_RUN**) and it will not perform any
dangerous repair steps (no **PMEMPOOL_CHECK_ADVANCED**).
The check will ask before performing any repair steps (no
**PMEMPOOL_CHECK_ALWAYS_YES**). It will also generate
detailed information about the check (**PMEMPOOL_CHECK_VERBOSE**).
The **PMEMPOOL_CHECK_FORMAT_STR** flag indicates string
format statuses (*struct pmempool_check_status*).
Currently this is the only supported status format so this flag is required.
# NOTES #
Currently, checking the consistency of a *pmemobj* pool is
**not** supported.
# SEE ALSO #
**libpmemlog**(7), **libpmemobj**(7) and **<http://pmem.io>**
| 9,987 | 31.219355 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmem/pmem_flush.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEM_FLUSH, 3)
collection: libpmem
header: PMDK
date: pmem API version 1.1
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmem_flush.3 -- man page for partial flushing operations
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmem_flush**(), **pmem_drain**(),
**pmem_persist**(), **pmem_msync**(),
**pmem_deep_flush**(), **pmem_deep_drain**(), **pmem_deep_persist**(),
**pmem_has_hw_drain**(), **pmem_has_auto_flush**() - check persistency,
store persistent data and delete mappings
# SYNOPSIS #
```c
#include <libpmem.h>
void pmem_persist(const void *addr, size_t len);
int pmem_msync(const void *addr, size_t len);
void pmem_flush(const void *addr, size_t len);
void pmem_deep_flush(const void *addr, size_t len); (EXPERIMENTAL)
int pmem_deep_drain(const void *addr, size_t len); (EXPERIMENTAL)
int pmem_deep_persist(const void *addr, size_t len); (EXPERIMENTAL)
void pmem_drain(void);
int pmem_has_auto_flush(void); (EXPERIMENTAL)
int pmem_has_hw_drain(void);
```
# DESCRIPTION #
The functions in this section provide access to the stages of flushing
to persistence, for the less common cases where an application needs more
control of the flushing operations than the **pmem_persist**() function.
>WARNING:
Using **pmem_persist**() on a range where **pmem_is_pmem**(3)
returns false may not do anything useful -- use **msync**(2) instead.
The **pmem_persist**() function force any changes in the range
\[*addr*, *addr*+*len*) to be stored durably in
persistent memory. This is equivalent to calling **msync**(2)
but may be more optimal and will avoid calling into the kernel if
possible. There are no alignment restrictions on the range described by
*addr* and *len*, but **pmem_persist**() may expand the range as
necessary to meet platform alignment requirements.
>WARNING:
Like **msync**(2), there is nothing atomic or transactional
about this call. Any unwritten stores in the given range will be
written, but some stores may have already been written by virtue of
normal cache eviction/replacement policies. Correctly written code must
not depend on stores waiting until **pmem_persist**() is called to
become persistent -- they can become persistent at any time before
**pmem_persist**() is called.
The **pmem_msync**() function is like **pmem_persist**() in that it
forces any changes in the range \[*addr*, *addr*+*len*) to be stored
durably. Since it calls **msync**(), this function works on either
persistent memory or a memory mapped file on traditional storage.
**pmem_msync**() takes steps to ensure the alignment of addresses and
lengths passed to **msync**() meet the requirements of that system call.
It calls **msync**() with the **MS_SYNC** flag as described in
**msync**(2). Typically the application only checks for the existence of
persistent memory once, and then uses that result throughout the
program, for example:
```c
/* do this call once, after the pmem is memory mapped */
int is_pmem = pmem_is_pmem(rangeaddr, rangelen);
/* ... make changes to a range of pmem ... */
/* make the changes durable */
if (is_pmem)
pmem_persist(subrangeaddr, subrangelen);
else
pmem_msync(subrangeaddr, subrangelen);
/* ... */
```
_WINUX(,=q=
>WARNING:
On Linux, **pmem_msync**() and **msync**(2) have no effect on memory ranges
mapped from Device DAX. In case of memory ranges where **pmem_is_pmem**(3)
returns true use **pmem_persist**() to force the changes to be stored durably
in persistent memory.
=e=)
The **pmem_flush**() and **pmem_drain**() functions provide
partial versions of the **pmem_persist**() function.
**pmem_persist**() can be thought of as this:
```c
void
pmem_persist(const void *addr, size_t len)
{
/* flush the processor caches */
pmem_flush(addr, len);
/* wait for any pmem stores to drain from HW buffers */
pmem_drain();
}
```
These functions allow advanced programs to create their own variations
of **pmem_persist**(). For example, a program that needs to flush
several discontiguous ranges can call **pmem_flush**() for each range
and then follow up by calling **pmem_drain**() once.
The semantics of **pmem_deep_flush**() function is the same as
**pmem_flush**() function except that **pmem_deep_flush**() is indifferent to
**PMEM_NO_FLUSH** environment variable (see **ENVIRONMENT** section in **libpmem**(7))
and always flushes processor caches.
The behavior of **pmem_deep_persist**() function is the same as **pmem_persist**(),
except that it provides higher reliability by flushing persistent memory stores to
the most reliable persistence domain available to software rather than depending on
automatic WPQ (write pending queue) flush on power failure (ADR).
The **pmem_deep_flush**() and **pmem_deep_drain**() functions provide
partial varsions of **pmem_deep_persist**() function.
**pmem_deep_persist**() can be thought of as this:
```
int pmem_deep_persist(const void *addr, size_t len)
{
/* flush the processor caches */
pmem_deep_flush(addr, len);
/* wait for any pmem stores to drain from HW buffers */
return pmem_deep_drain(addr, len);
}
```
Since this operation is usually much more expensive than **pmem_persist**(),
it should be used rarely. Typically the application should use this function
only to flush the most critical data, which are required to recover after
the power failure.
The **pmem_has_auto_flush**() function checks if the machine supports automatic
CPU cache flush on power failure or system crash.
Function returns true only when each NVDIMM in the system is covered by this
mechanism.
The **pmem_has_hw_drain**() function checks if the machine
supports an explicit *hardware drain*
instruction for persistent memory.
# RETURN VALUE #
The **pmem_persist**() function returns no value.
The **pmem_msync**() return value is the return value of
**msync**(), which can return -1 and set *errno* to indicate an error.
The **pmem_flush**(), **pmem_drain**() and **pmem_deep_flush**()
functions return no value.
The **pmem_deep_persist**() and **pmem_deep_drain**() return 0 on success.
Otherwise it returns -1 and sets *errno* appropriately. If *len* is equal zero
**pmem_deep_persist**() and **pmem_deep_drain**() return 0 but no flushing take place.
The **pmem_has_auto_flush**() function returns 1 if given platform supports
processor cache flushing on a power loss event. Otherwise it returns 0.
On error it returns -1 and sets *errno* appropriately.
The **pmem_has_hw_drain**() function returns true if the machine
supports an explicit *hardware drain*
instruction for persistent memory.
On Intel processors with persistent memory,
stores to persistent memory are considered persistent
once they are flushed from the CPU caches, so this
function always returns false. Despite that, programs using
**pmem_flush**() to flush ranges of memory should still follow up by calling
**pmem_drain**() once to ensure the flushes are complete. As mentioned above,
**pmem_persist**() handles calling both **pmem_flush**() and **pmem_drain**().
# SEE ALSO #
**msync**(2), **pmem_is_pmem**(3), **libpmem**(7)
and **<http://pmem.io>**
| 9,087 | 38.68559 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmem/libpmem.7.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(LIBPMEM, 7)
collection: libpmem
header: PMDK
date: pmem API version 1.1
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (libpmem.7 -- man page for libpmem)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[CAVEATS](#caveats)<br />
[LIBRARY API VERSIONING](#library-api-versioning-1)<br />
[ENVIRONMENT](#environment)<br />
[DEBUGGING AND ERROR HANDLING](#debugging-and-error-handling)<br />
[EXAMPLE](#example)<br />
[ACKNOWLEDGEMENTS](#acknowledgements)<br />
[SEE ALSO](#see-also)
# NAME #
**libpmem** - persistent memory support library
# SYNOPSIS #
```c
#include <libpmem.h>
cc ... -lpmem
```
_UNICODE()
##### Library API versioning: #####
```c
_UWFUNC(pmem_check_version, =q=
unsigned major_required,
unsigned minor_required=e=)
```
##### Error handling: #####
```c
_UWFUNC(pmem_errormsg, void)
```
##### Other library functions: #####
A description of other **libpmem** functions can be found on the following
manual pages:
+ most commonly used functions: **pmem_is_pmem**(3)
+ partial flushing operations: **pmem_flush**(3)
+ copying to persistent memory: **pmem_memmove_persist**(3)
# DESCRIPTION #
**libpmem** provides low-level *persistent memory* (pmem) support for
applications using direct access storage (DAX), which is storage that
supports load/store access without paging blocks from a block storage
device. Some types of *non-volatile memory DIMMs* (NVDIMMs) provide this
type of byte addressable access to storage. A *persistent memory aware
file system* is typically used to expose the direct access to
applications. Memory mapping a file from this type of file system
results in the load/store, non-paged access to pmem.
This library is for applications that use persistent memory directly,
without the help of any library-supplied transactions or memory
allocation. Higher-level libraries that build on **libpmem** are
available and are recommended for most applications, see:
+ **libpmemobj**(7), a general use persistent memory API, providing memory
allocation and transactional operations on variable-sized objects.
+ **libpmemblk**(7), providing pmem-resident arrays of fixed-sized blocks
with atomic updates.
+ **libpmemlog**(7), providing a pmem-resident log file.
Under normal usage, **libpmem** will never print messages or
intentionally cause the process to exit.
The only exception to this is the debugging information, when enabled,
as described under **DEBUGGING AND ERROR HANDLING** below.
# CAVEATS #
**libpmem** relies on the library destructor being called from the main thread.
For this reason, all functions that might trigger destruction (e.g.
**dlclose**(3)) should be called in the main thread. Otherwise some of the
resources associated with that thread might not be cleaned up properly.
# LIBRARY API VERSIONING #
This section describes how the library API is versioned, allowing
applications to work with an evolving API.
The _UW(pmem_check_version) function is used to determine whether the installed
**libpmem** supports the version of the library API required by an
application. The easiest way to do this is for the application to supply
the compile-time version information, supplied by defines in
**\<libpmem.h\>**, like this:
```c
reason = _U(pmem_check_version)(PMEM_MAJOR_VERSION,
PMEM_MINOR_VERSION);
if (reason != NULL) {
/* version check failed, reason string tells you why */
}
```
Any mismatch in the major version number is considered a failure, but a
library with a newer minor version number will pass this check since
increasing minor versions imply backwards compatibility.
An application can also check specifically for the existence of an
interface by checking for the version where that interface was
introduced. These versions are documented in this man page as follows:
unless otherwise specified, all interfaces described here are available
in version 1.0 of the library. Interfaces added after version 1.0 will
contain the text *introduced in version x.y* in the section of this
manual describing the feature.
When the version check performed by _UW(pmem_check_version) is
successful, the return value is NULL. Otherwise the return value is a
static string describing the reason for failing the version check. The
string returned by _UW(pmem_check_version) must not be modified or
freed.
# ENVIRONMENT #
**libpmem** can change its default behavior based on the following
environment variables. These are largely intended for testing and are
not normally required.
+ **PMEM_IS_PMEM_FORCE**=*val*
If *val* is 0 (zero), then **pmem_is_pmem**(3) will always return
false. Setting *val* to 1 causes **pmem_is_pmem**(3) to always return
true. This variable is mostly used for testing but can be used to force
pmem behavior on a system where a range of pmem is not detectable as
pmem for some reason.
>NOTE:
Unlike the other variables, the value of
**PMEM_IS_PMEM_FORCE** is not queried (and cached) at
library initialization time, but on the first call to
**pmem_is_pmem**(3). This means that in case of
**libpmemlog**(7), **libpmemblk**(7), and **libpmemobj**(7),
**PMEM_IS_PMEM_FORCE** may still be set or modified by the program
until the first attempt to create or open the persistent
memory pool.
+ **PMEM_NO_CLWB**=1
Setting this environment variable to 1 forces **libpmem** to never issue
the **CLWB** instruction on Intel hardware, falling back to other cache
flush instructions instead (**CLFLUSHOPT** or **CLFLUSH** on Intel
hardware). Without this environment variable, **libpmem** will always
use the **CLWB** instruction for flushing processor caches on platforms
that support the instruction. This variable is intended for use during
library testing but may be required for some rare cases where using
**CLWB** has a negative impact on performance.
+ **PMEM_NO_CLFLUSHOPT**=1
Setting this environment variable to 1 forces **libpmem** to never issue
the **CLFLUSHOPT** instruction on Intel hardware, falling back to the
**CLFLUSH** instructions instead. Without this environment variable,
**libpmem** will always use the **CLFLUSHOPT** instruction for flushing
processor caches on platforms that support the instruction, but where
**CLWB** is not available. This variable is intended for use during
library testing.
+ **PMEM_NO_FLUSH**=1
Setting this environment variable to 1 forces most **libpmem** functions
to never issue any of **CLFLUSH**, **CLFLUSHOPT** or **CLWB** instructions
on Intel hardware. The only exceptions are **pmem_deep_flush**(3) and
**pmem_deep_persist**(3) functions.
+ **PMEM_NO_FLUSH**=0
Setting this environment variable to 0 forces to always flush CPU caches
using one of **CLFLUSH**, **CLFLUSHOPT** or **CLWB** instructions
even if **pmem_has_auto_flush**(3) function returns true and the platform
supports flushing the processor caches on power loss or system crash.
+ **PMEM_NO_MOVNT**=1
Setting this environment variable to 1 forces **libpmem** to never use
the *non-temporal* move instructions on Intel hardware. Without this
environment variable, **libpmem** will use the non-temporal instructions
for copying larger ranges to persistent memory on platforms that support
the instructions. This variable is intended for use during library
testing.
+ **PMEM_MOVNT_THRESHOLD**=*val*
This environment variable allows overriding the minimum length of
the **pmem_memmove_persist**(3) operations, for which **libpmem** uses
*non-temporal* move instructions. Setting this environment variable to 0
forces **libpmem** to always use the *non-temporal* move instructions if
available. It has no effect if **PMEM_NO_MOVNT** is set to 1.
This variable is intended for use during library testing.
+ **PMEM_MMAP_HINT**=*val*
This environment variable allows overriding
the hint address used by _UW(pmem_map_file). If set, it also disables
mapping address randomization. This variable is intended for use during
library testing and debugging. Setting it to some fairly large value
(i.e. 0x10000000000) will very likely result in mapping the file at the
specified address (if not used) or at the first unused region above
given address, without adding any random offset. When debugging, this
makes it easier to calculate the actual address of the persistent memory
block, based on its offset in the file. In case of **libpmemobj** it
simplifies conversion of a persistent object identifier (OID) into a
direct pointer to the object.
>NOTE:
**Setting this environment variable
affects all the PMDK libraries,** disabling mapping address randomization
and causing the specified address to be used as a hint about where to
place the mapping.
# DEBUGGING AND ERROR HANDLING #
If an error is detected during the call to a **libpmem** function, the
application may retrieve an error message describing the reason for the failure
from _UW(pmem_errormsg). This function returns a pointer to a static buffer
containing the last error message logged for the current thread. If *errno*
was set, the error message may include a description of the corresponding
error code as returned by **strerror**(3). The error message buffer is
thread-local; errors encountered in one thread do not affect its value in
other threads. The buffer is never cleared by any library function; its
content is significant only when the return value of the immediately preceding
call to a **libpmem** function indicated an error, or if *errno* was set.
The application must not modify or free the error message string, but it may
be modified by subsequent calls to other library functions.
Two versions of **libpmem** are typically available on a development
system. The normal version, accessed when a program is linked using the
**-lpmem** option, is optimized for performance. That version skips checks
that impact performance and never logs any trace information or performs any
run-time assertions.
A second version of **libpmem**, accessed when a program uses the libraries
under _DEBUGLIBPATH(), contains run-time assertions and trace points. The
typical way to access the debug version is to set the environment variable
**LD_LIBRARY_PATH** to _LDLIBPATH(). Debugging output is
controlled using the following environment variables. These variables have
no effect on the non-debug version of the library.
+ **PMEM_LOG_LEVEL**
The value of **PMEM_LOG_LEVEL** enables trace points in the debug version
of the library, as follows:
+ **0** - This is the default level when **PMEM_LOG_LEVEL** is not set.
No log messages are emitted at this level.
+ **1** - Additional details on any errors detected are logged, in addition
to returning the *errno*-based errors as usual. The same information
may be retrieved using _UW(pmem_errormsg).
+ **2** - A trace of basic operations is logged.
+ **3** - Enables a very verbose amount of function call tracing in the
library.
+ **4** - Enables voluminous and fairly obscure tracing
information that is likely only useful to the **libpmem** developers.
Unless **PMEM_LOG_FILE** is set, debugging output is written to *stderr*.
+ **PMEM_LOG_FILE**
Specifies the name of a file where
all logging information should be written. If the last character in the name
is "-", the *PID* of the current process will be appended to the file name when
the log file is created. If **PMEM_LOG_FILE** is not set, output is
written to *stderr*.
# EXAMPLE #
The following example uses **libpmem** to flush changes made to raw,
memory-mapped persistent memory.
>WARNING:
There is nothing transactional about the **pmem_persist**(3) or
**pmem_msync**(3) calls in this example. Interrupting the program may
result in a partial write to pmem. Use a transactional library such as
**libpmemobj**(7) to avoid torn updates.
```c
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <libpmem.h>
/* using 4k of pmem for this example */
#define PMEM_LEN 4096
#define PATH "/pmem-fs/myfile"
int
main(int argc, char *argv[])
{
char *pmemaddr;
size_t mapped_len;
int is_pmem;
/* create a pmem file and memory map it */
if ((pmemaddr = _U(pmem_map_file)(PATH, PMEM_LEN, PMEM_FILE_CREATE,
0666, &mapped_len, &is_pmem)) == NULL) {
perror("_U(pmem_map_file)");
exit(1);
}
/* store a string to the persistent memory */
strcpy(pmemaddr, "hello, persistent memory");
/* flush above strcpy to persistence */
if (is_pmem)
pmem_persist(pmemaddr, mapped_len);
else
pmem_msync(pmemaddr, mapped_len);
/*
* Delete the mappings. The region is also
* automatically unmapped when the process is
* terminated.
*/
pmem_unmap(pmemaddr, mapped_len);
}
```
See <http://pmem.io/pmdk/libpmem>
for more examples using the **libpmem** API.
# ACKNOWLEDGEMENTS #
**libpmem** builds on the persistent memory programming model
recommended by the SNIA NVM Programming Technical Work Group:
<http://snia.org/nvmp>
# SEE ALSO #
**dlclose**(3),
**pmem_flush**(3), **pmem_is_pmem**(3), **pmem_memmove_persist**(3),
**pmem_msync**(3), **pmem_persist**(3), **strerror**(3),
**libpmemblk**(7), **libpmemcto**(7), **libpmemlog**(7), **libpmemobj**(7)
and **<http://pmem.io>**
| 15,139 | 36.661692 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmem/pmem_is_pmem.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEM_IS_PMEM, 3)
collection: libpmem
header: PMDK
date: pmem API version 1.1
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmem_is_pmem.3 -- man page for libpmem persistence and mapping functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[NOTES](#notes)<br />
[CAVEATS](#caveats)<br />
[BUGS](#bugs)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmem_is_pmem**(), _UW(pmem_map_file),
**pmem_unmap**() - check persistency, create and delete mappings
# SYNOPSIS #
```c
#include <libpmem.h>
int pmem_is_pmem(const void *addr, size_t len);
_UWFUNCR1(void, *pmem_map_file, *path, =q=size_t len, int flags,
mode_t mode, size_t *mapped_lenp, int *is_pmemp=e=)
int pmem_unmap(void *addr, size_t len);
```
_UNICODE()
# DESCRIPTION #
Most pmem-aware applications will take advantage of higher level
libraries that alleviate the need for the application to call into **libpmem**
directly. Application developers that wish to access raw memory mapped
persistence directly (via **mmap**(2)) and that wish to take on the
responsibility for flushing stores to persistence will find the
functions described in this section to be the most commonly used.
The **pmem_is_pmem**() function detects if the entire range
\[*addr*, *addr*+*len*) consists of persistent memory.
The implementation of **pmem_is_pmem**() requires a non-trivial amount
of work to determine if the given range is entirely persistent memory.
For this reason, it is better to call **pmem_is_pmem**() once when a
range of memory is first encountered, save the result, and use the saved
result to determine whether **pmem_persist**(3) or **msync**(2) is
appropriate for flushing changes to persistence. Calling
**pmem_is_pmem**() each time changes are flushed to persistence will
not perform well.
The _UW(pmem_map_file) function creates a new read/write mapping for a
file. If **PMEM_FILE_CREATE** is not specified in *flags*, the entire existing
file *path* is mapped, *len* must be zero, and *mode* is ignored. Otherwise,
*path* is opened or created as specified by *flags* and *mode*, and *len*
must be non-zero. _UW(pmem_map_file) maps the file using **mmap**(2), but it
also takes extra steps to make large page mappings more likely.
On success, _UW(pmem_map_file) returns a pointer to the mapped area. If
*mapped_lenp* is not NULL, the length of the mapping is stored into
\**mapped_lenp*. If *is_pmemp* is not NULL, a flag indicating whether the
mapped file is actual pmem, or if **msync**() must be used to flush writes
for the mapped range, is stored into \**is_pmemp*.
The *flags* argument is 0 or the bitwise OR of one or more of the
following file creation flags:
+ **PMEM_FILE_CREATE** - Create the file named *path* if it does not exist.
*len* must be non-zero and specifies the size of the file to be created.
If the file already exists, it will be extended or truncated to *len.*
The new or existing file is then fully allocated to size *len* using
**posix_fallocate**(3).
*mode* specifies the mode to use in case a new file is created (see
**creat**(2)).
The remaining flags modify the behavior of _UW(pmem_map_file) when
**PMEM_FILE_CREATE** is specified.
+ **PMEM_FILE_EXCL** - If specified in conjunction with **PMEM_FILE_CREATE**,
and *path* already exists, then _UW(pmem_map_file) will fail with **EEXIST**.
Otherwise, has the same meaning as **O_EXCL** on **open**(2), which is
generally undefined.
+ **PMEM_FILE_SPARSE** - When specified in conjunction with
**PMEM_FILE_CREATE**, create a sparse (holey) file using **ftruncate**(2)
rather than allocating it using **posix_fallocate**(3). Otherwise ignored.
+ **PMEM_FILE_TMPFILE** - Create a mapping for an unnamed temporary file.
Must be specified with **PMEM_FILE_CREATE**. *len* must be non-zero,
*mode* is ignored (the temporary file is always created with mode 0600),
and *path* must specify an existing directory name. If the underlying file
system supports **O_TMPFILE**, the unnamed temporary file is created in
the filesystem containing the directory *path*; if **PMEM_FILE_EXCL**
is also specified, the temporary file may not subsequently be linked into
the filesystem (see **open**(2)).
Otherwise, the file is created in *path* and immediately unlinked.
The *path* can point to a Device DAX. In this case only the
**PMEM_FILE_CREATE** and **PMEM_FILE_SPARSE** flags are valid, but they are
both ignored. For Device DAX mappings, *len* must be equal to
either 0 or the exact size of the device.
To delete mappings created with _UW(pmem_map_file), use **pmem_unmap**().
The **pmem_unmap**() function deletes all the mappings for the
specified address range, and causes further references to addresses
within the range to generate invalid memory references. It will use the
address specified by the parameter *addr*, where *addr* must be a
previously mapped region. **pmem_unmap**() will delete the mappings
using **munmap**(2).
# RETURN VALUE #
The **pmem_is_pmem**() function returns true only if the entire range
\[*addr*, *addr*+*len*) consists of persistent memory. A true return
from **pmem_is_pmem**() means it is safe to use **pmem_persist**(3)
and the related functions to make changes durable for that memory
range. See also **CAVEATS**.
On success, _UW(pmem_map_file) returns a pointer to the memory-mapped region
and sets \**mapped_lenp* and \**is_pmemp* if they are not NULL.
On error, it returns NULL, sets *errno* appropriately, and does not modify
\**mapped_lenp* or \**is_pmemp*.
On success, **pmem_unmap**() returns 0. On error, it returns -1 and sets
*errno* appropriately.
# NOTES #
On Linux, **pmem_is_pmem**() returns true only if the entire range
is mapped directly from Device DAX (/dev/daxX.Y) without an intervening
file system. In the future, as file systems become available that support
flushing with **pmem_persist**(3), **pmem_is_pmem**() will return true
as appropriate.
# CAVEATS #
The result of **pmem_is_pmem**() query is only valid for the mappings
created using _UW(pmem_map_file). For other memory regions, in particular
those created by a direct call to **mmap**(2), **pmem_is_pmem**() always
returns false, even if the queried range is entirely persistent memory.
Not all file systems support **posix_fallocate**(3). _UW(pmem_map_file) will
fail if **PMEM_FILE_CREATE** is specified without **PMEM_FILE_SPARSE** and
the underlying file system does not support **posix_fallocate**(3).
# SEE ALSO #
**creat**(2), **ftruncate**(2), **mmap**(2), **msync**(2), **munmap**(2),
**open**(2), **pmem_persist**(3),
**posix_fallocate**(3), **libpmem**(7) and **<http://pmem.io>**
| 8,615 | 43.875 | 88 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libpmem/pmem_memmove_persist.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEM_MEMMOVE_PERSIST, 3)
collection: libpmem
header: PMDK
date: pmem API version 1.1
...
[comment]: <> (Copyright 2017-2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmem_memmove_persist.3 -- man page for functions that provide optimized copying to persistent memory
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmem_memmove**(), **pmem_memcpy**(), **pmem_memset**(),
**pmem_memmove_persist**(), **pmem_memcpy_persist**(), **pmem_memset_persist**(),
**pmem_memmove_nodrain**(), **pmem_memcpy_nodrain**(), **pmem_memset_nodrain**()
- functions that provide optimized copying to persistent memory
# SYNOPSIS #
```c
#include <libpmem.h>
void *pmem_memmove(void *pmemdest, const void *src, size_t len, unsigned flags);
void *pmem_memcpy(void *pmemdest, const void *src, size_t len, unsigned flags);
void *pmem_memset(void *pmemdest, int c, size_t len, unsigned flags);
void *pmem_memmove_persist(void *pmemdest, const void *src, size_t len);
void *pmem_memcpy_persist(void *pmemdest, const void *src, size_t len);
void *pmem_memset_persist(void *pmemdest, int c, size_t len);
void *pmem_memmove_nodrain(void *pmemdest, const void *src, size_t len);
void *pmem_memcpy_nodrain(void *pmemdest, const void *src, size_t len);
void *pmem_memset_nodrain(void *pmemdest, int c, size_t len);
```
# DESCRIPTION #
**pmem_memmove**(), **pmem_memcpy**() and **pmem_memset**() functions provide
the same memory copying as their namesakes **memmove**(3), **memcpy**(3) and
**memset**(3), and ensure that the result has been flushed to persistence before
returning (unless **PMEM_F_MEM_NOFLUSH** flag was used).
For example, the following code is functionally equivalent to **pmem_memmove**() (with flags equal to 0):
```c
memmove(dest, src, len);
pmem_persist(dest, len);
```
Calling **pmem_memmove**() may out-perform the above code, because
**libpmem**(7) implementation may take advantage of the fact that *pmemdest*
is persistent memory and use instructions such as *non-temporal* stores to
avoid the need to flush processor caches.
>WARNING:
Using these functions where **pmem_is_pmem**(3) returns false
may not do anything useful. Use libc functions in that case.
Unlike libc implementation, **libpmem** functions guarantee that if destination
buffer address and length are 8 byte aligned then all stores will be performed
using at least 8 byte store instructions. This means that a series of 8 byte
stores followed by **pmem_persist**(3) can be safely replaced by a single call
to one of the above functions.
The *flags* argument of all of the above functions has the same meaning.
It can be 0 or a bitwise OR of one or more of the following flags:
+ **PMEM_F_MEM_NODRAIN** - modifies the behavior to skip the final
**pmem_drain**() step. This allows applications to optimize cases where
several ranges are being copied to persistent memory, followed by a single
call to **pmem_drain**(). The following example illustrates how this flag
might be used to avoid multiple calls to **pmem_drain**() when copying several
ranges of memory to pmem:
```c
/* ... write several ranges to pmem ... */
pmem_memcpy(pmemdest1, src1, len1, PMEM_F_MEM_NODRAIN);
pmem_memcpy(pmemdest2, src2, len2, PMEM_F_MEM_NODRAIN);
/* ... */
/* wait for any pmem stores to drain from HW buffers */
pmem_drain();
```
+ **PMEM_F_MEM_NOFLUSH** - Don't flush anything. This implies **PMEM_F_MEM_NODRAIN**.
Using this flag only makes sense when it's followed by any function that
flushes data.
The remaining flags say *how* the operation should be done, and are merely hints.
+ **PMEM_F_MEM_NONTEMPORAL** - Use non-temporal instructions.
This flag is mutually exclusive with **PMEM_F_MEM_TEMPORAL**.
On x86\_64 this flag is mutually exclusive with **PMEM_F_MEM_NOFLUSH**.
+ **PMEM_F_MEM_TEMPORAL** - Use temporal instructions.
This flag is mutually exclusive with **PMEM_F_MEM_NONTEMPORAL**.
+ **PMEM_F_MEM_WC** - Use write combining mode.
This flag is mutually exclusive with **PMEM_F_MEM_WB**.
On x86\_64 this is an alias for **PMEM_F_MEM_NONTEMPORAL**.
On x86\_64 this flag is mutually exclusive with **PMEM_F_MEM_NOFLUSH**.
+ **PMEM_F_MEM_WB** - Use write back mode.
This flag is mutually exclusive with **PMEM_F_MEM_WC**.
On x86\_64 this is an alias for **PMEM_F_MEM_TEMPORAL**.
Using an invalid combination of flags has undefined behavior.
Without any of the above flags **libpmem** will try to guess the best strategy
based on size. See **PMEM_MOVNT_THRESHOLD** description in **libpmem**(7) for
details.
**pmem_memmove_persist**() is an alias for **pmem_memmove**() with flags equal to 0.
**pmem_memcpy_persist**() is an alias for **pmem_memcpy**() with flags equal to 0.
**pmem_memset_persist**() is an alias for **pmem_memset**() with flags equal to 0.
**pmem_memmove_nodrain**() is an alias for **pmem_memmove**() with flags equal to **PMEM_F_MEM_NODRAIN**.
**pmem_memcpy_nodrain**() is an alias for **pmem_memcpy**() with flags equal to **PMEM_F_MEM_NODRAIN**.
**pmem_memset_nodrain**() is an alias for **pmem_memset**() with flags equal to **PMEM_F_MEM_NODRAIN**.
# RETURN VALUE #
All of the above functions return address of the destination buffer.
# CAVEATS #
After calling any of the functions with **PMEM_F_MEM_NODRAIN** flag you
should not expect memory to be visible to other threads before calling
**pmem_drain**(3) or any of the *\_persist* functions. This is because on
x86\_64 those functions may use non-temporal store instructions, which are
weakly ordered. See "Intel 64 and IA-32 Architectures Software Developer's Manual",
Volume 1, "Caching of Temporal vs. Non-Temporal Data" section for details.
# SEE ALSO #
**memcpy**(3), **memmove**(3), **memset**(3),
**libpmem**(7) and **<http://pmem.io>**
| 7,754 | 42.324022 | 115 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libvmem/vmem_malloc.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(VMEM_MALLOC, 3)
collection: libvmem
header: PMDK
date: vmem API version 1.1
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (vmem_malloc.3 -- man page for memory allocation related functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**vmem_malloc**(), **vmem_calloc**(), **vmem_realloc**(),
**vmem_free**(), **vmem_aligned_alloc**(), **vmem_strdup**(),
**vmem_wcsdup**(), **vmem_malloc_usable_size**() - memory allocation related functions
# SYNOPSIS #
```c
#include <libvmem.h>
void *vmem_malloc(VMEM *vmp, size_t size);
void vmem_free(VMEM *vmp, void *ptr);
void *vmem_calloc(VMEM *vmp, size_t nmemb, size_t size);
void *vmem_realloc(VMEM *vmp, void *ptr, size_t size);
void *vmem_aligned_alloc(VMEM *vmp, size_t alignment, size_t size);
char *vmem_strdup(VMEM *vmp, const char *s);
wchar_t *vmem_wcsdup(VMEM *vmp, const wchar_t *s);
size_t vmem_malloc_usable_size(VMEM *vmp, void *ptr);
```
# DESCRIPTION #
This section describes the *malloc*-like API provided by **libvmem**(7).
These functions provide the same semantics as their libc namesakes,
but operate on the memory pools specified by their first arguments.
The **vmem_malloc**() function provides the same semantics as **malloc**(3),
but operates on the memory pool *vmp* instead of the process heap
supplied by the system. It allocates specified *size* bytes.
The **vmem_free**() function provides the same semantics as **free**(3),
but operates on the memory pool *vmp* instead of the process heap
supplied by the system. It frees the memory space pointed to by *ptr*, which
must have been returned by a previous call to **vmem_malloc**(),
**vmem_calloc**() or **vmem_realloc**() for *the same pool of memory*.
If *ptr* is NULL, no operation is performed.
The **vmem_calloc**() function provides the same semantics as **calloc**(3),
but operates on the memory pool *vmp* instead of the process heap
supplied by the system. It allocates memory for an array of *nmemb* elements of
*size* bytes each. The memory is set to zero.
The **vmem_realloc**() function provides the same semantics as **realloc**(3),
but operates on the memory pool *vmp* instead of the process heap supplied by
the system. It changes the size of the memory block pointed to by *ptr* to
*size* bytes. The contents will be unchanged in the range from the start of the
region up to the minimum of the old and new sizes. If the new size is larger
than the old size, the added memory will *not* be initialized.
Unless *ptr* is NULL, it must have been returned by an earlier call to
**vmem_malloc**(), **vmem_calloc**() or **vmem_realloc**(). If *ptr* is NULL,
then the call is equivalent to *vmem_malloc(vmp, size)*, for all values of
*size*; if *size* is equal to zero, and *ptr* is not NULL, then the call
is equivalent to *vmem_free(vmp, ptr)*.
The **vmem_aligned_alloc**() function provides the same semantics as
**aligned_alloc**(3), but operates on the memory pool *vmp* instead of
the process heap supplied by the system. It allocates *size* bytes from
the memory pool. The memory address will be a multiple of *alignment*,
which must be a power of two.
The **vmem_strdup**() function provides the same semantics as **strdup**(3),
but operates on the memory pool *vmp* instead of the process heap supplied by the
system. Memory for the new string is obtained with **vmem_malloc**(), on the given
memory pool, and can be freed with **vmem_free**() on the same memory pool.
The **vmem_wcsdup**() function provides the same semantics as **wcsdup**(3),
but operates on the memory pool *vmp* instead of the process heap supplied by the
system. Memory for the new string is obtained with **vmem_malloc**(), on the given
memory pool, and can be freed with **vmem_free**() on the same memory pool.
The **vmem_malloc_usable_size**() function provides the same semantics as
**malloc_usable_size**(3), but operates on the memory pool *vmp* instead of the
process heap supplied by the system.
# RETURN VALUE #
On success, **vmem_malloc**() returns a pointer to the allocated memory.
If *size* is 0, then **vmem_malloc**() returns either NULL,
or a unique pointer value that can later be successfully passed to
**vmem_free**(). If **vmem_malloc**() is unable to satisfy the allocation
request, it returns NULL and sets *errno* appropriately.
The **vmem_free**() function returns no value.
Undefined behavior occurs if frees do not correspond to allocated memory
from the same memory pool.
On success, **vmem_calloc**() returns a pointer to the allocated memory. If
*nmemb* or *size* is 0, then **vmem_calloc**() returns either NULL, or a unique
pointer value that can later be successfully passed to **vmem_free**().
If **vmem_calloc**() is unable to satisfy the allocation request, it returns
NULL and sets *errno* appropriately.
On success, **vmem_realloc**() returns a pointer to the allocated memory, which
may be different from *ptr*. If the area pointed to was moved, a
*vmem_free(vmp, ptr)* is done. If **vmem_realloc**() is unable to satisfy the
allocation request, it returns NULL and sets *errno* appropriately.
On success, **vmem_aligned_alloc**() returns a pointer to the allocated memory.
If **vmem_aligned_alloc**() is unable to satisfy the allocation request, it
returns NULL and sets *errno* appropriately.
On success, **vmem_strdup**() returns a pointer to a new string which is a
duplicate of the string *s*. If **vmem_strdup**() is unable to satisfy the
allocation request, it returns NULL and sets *errno* appropriately.
On success, **vmem_wcsdup**() returns a pointer to a new wide character string
which is a duplicate of the wide character string *s*. If **vmem_wcsdup**()
is unable to satisfy the allocation request, it returns NULL and sets *errno*
appropriately.
The **vmem_malloc_usable_size**() function returns the number of usable bytes
in the block of allocated memory pointed to by *ptr*, a pointer to a block of
memory allocated by **vmem_malloc**() or a related function. If *ptr* is NULL,
0 is returned.
# SEE ALSO #
**calloc**(3), **free**(3), **malloc**(3), **malloc_usable_size**(3),
**realloc**(3), **strdup**(3), **wcsdup**(3) **libvmem(7)** and **<http://pmem.io>**
| 8,194 | 46.923977 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libvmem/vmem_create.3.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(VMEM_CREATE, 3)
collection: libvmem
header: PMDK
date: vmem API version 1.1
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (vmem_create.3 -- man page for volatile memory pool management functions)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
[SEE ALSO](#see-also)<br />
# NAME #
_UW(vmem_create), **vmem_create_in_region**(), **vmem_delete**(),
**vmem_check**(), **vmem_stats_print**() - volatile memory pool management
# SYNOPSIS #
```c
#include <libvmem.h>
_UWFUNCR1(VMEM, *vmem_create, *dir, size_t size)
VMEM *vmem_create_in_region(void *addr, size_t size);
void vmem_delete(VMEM *vmp);
int vmem_check(VMEM *vmp);
void vmem_stats_print(VMEM *vmp, const char *opts);
```
_UNICODE()
# DESCRIPTION #
To use **libvmem**, a *memory pool* is first created. This is most commonly
done with the _UW(vmem_create) function described below. The other
**libvmem** functions are for less common cases, where applications have
special needs for creating pools or examining library state.
The _UW(vmem_create) function creates a memory pool and returns an opaque
memory pool handle of type *VMEM\**. The handle is then used with **libvmem**
functions such as **vmem_malloc**() and **vmem_free**() to provide the
familiar *malloc*-like programming model for the memory pool.
The pool is created by allocating a temporary file in the directory *dir*,
in a fashion similar to **tmpfile**(3), so that the file name does not appear
when the directory is listed, and the space is automatically freed when the
program terminates. *size* bytes are allocated and the resulting space is
memory-mapped. The minimum *size* value allowed by the library is defined in
**\<libvmem.h\>** as **VMEM_MIN_POOL**. The maximum allowed size is not
limited by **libvmem**, but by the file system on which *dir* resides.
The *size* passed in is the raw size of the memory pool. **libvmem** will
use some of that space for its own metadata, so the usable space will be less.
_UW(vmem_create) can also be called with the **dir** argument pointing to a
device DAX. In that case the entire device will serve as a volatile pool.
Device DAX is the device-centric analogue of Filesystem DAX. It allows memory
ranges to be allocated and mapped without need of an intervening file system.
For more information please see **ndctl-create-namespace**(1).
**vmem_create_in_region**() is an alternate **libvmem** entry point
for creating a memory pool. It is for the rare case where an application
needs to create a memory pool from an already memory-mapped region. Instead of
allocating space from a file system, **vmem_create_in_region**()
is given the memory region explicitly via the *addr* and *size* arguments.
Any data in the region is lost by calling **vmem_create_in_region**(),
which will immediately store its own data structures for managing the pool
there. As with _UW(vmem_create), the minimum *size* allowed is defined
as **VMEM_MIN_POOL**. The *addr* argument must be page aligned. Undefined
behavior occurs if *addr* does not point to a contiguous memory region in
the virtual address space of the calling process, or if the *size* is larger
than the actual size of the memory region pointed to by *addr*.
The **vmem_delete**() function releases the memory pool *vmp*.
If the memory pool was created using _UW(vmem_create), deleting it
allows the space to be reclaimed.
The **vmem_check**() function performs an extensive consistency
check of all **libvmem** internal data structures in memory pool *vmp*.
Since an error return indicates memory pool corruption, applications
should not continue to use a pool in this state. Additional details about
errors found are logged when the log level is at least 1 (see **DEBUGGING AND
ERROR HANDLING** in **libvmem**(7)). During the consistency check
performed by **vmem_check**(), other operations on the same memory pool are
locked out. The checks are all read-only; **vmem_check**() never modifies the
memory pool. This function is mostly useful for **libvmem** developers during
testing/debugging.
The **vmem_stats_print**() function produces messages containing statistics
about the given memory pool. Output is sent to *stderr* unless the user
sets the environment variable **VMEM_LOG_FILE**, or the application supplies a
replacement *print_func* (see **MANAGING LIBRARY BEHAVIOR** in **libvmem**(7)).
The *opts* string can either be NULL or it can contain a list of options that
change the statistics printed. General information that never changes
during execution can be omitted by specifying "g" as a character within the
opts string. The characters "m" and "a" can be specified to omit merged arena
and per arena statistics, respectively; "b" and "l" can be specified to omit
per size class statistics for bins and large objects, respectively.
Unrecognized characters are silently ignored. Note that thread caching may
prevent some statistics from being completely up to date. See **jemalloc**(3)
for more detail (the description of the available *opts* above was taken from
that man page).
# RETURN VALUE #
On success, _UW(vmem_create) returns an opaque memory pool handle of type
*VMEM\**. On error, it returns NULL and sets *errno* appropriately.
On success, **vmem_create_in_region**() returns an opaque memory pool handle
of type *VMEM\**. On error, it returns NULL and sets *errno* appropriately.
The **vmem_delete**() function returns no value.
The **vmem_check**() function returns 1 if the memory pool is found to be
consistent, and 0 if the check was performed but the memory pool is not
consistent. If the check could not be performed, **vmem_check**() returns -1.
The **vmem_stats_print**() function returns no value.
# SEE ALSO #
**ndctl-create-namespace**(1), **jemalloc**(3), **tmpfile**(3),
**libvmem**(7) and **<http://pmem.io>**
| 7,788 | 47.68125 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/libvmem/libvmem.7.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(LIBVMEM, 7)
collection: libvmem
header: PMDK
date: vmem API version 1.1
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (libvmem.7 -- man page for libvmem)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[MANAGING LIBRARY BEHAVIOR](#managing-library-behavior)<br />
[DEBUGGING AND ERROR HANDLING](#debugging-and-error-handling)<br />
[EXAMPLE](#example)<br />
[BUGS](#bugs)<br />
[ACKNOWLEDGEMENTS](#acknowledgements)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**libvmem** - volatile memory allocation library
# SYNOPSIS #
```c
#include <libvmem.h>
cc ... -lvmem
```
_UNICODE()
##### Managing overall library behavior: #####
```c
_UWFUNC(vmem_check_version, =q=
unsigned major_required,
unsigned minor_required=e=)
void vmem_set_funcs(
void *(*malloc_func)(size_t size),
void (*free_func)(void *ptr),
void *(*realloc_func)(void *ptr, size_t size),
char *(*strdup_func)(const char *s),
void (*print_func)(const char *s));
```
##### Error handling: #####
```c
_UWFUNC(vmem_errormsg, void)
```
##### Other library functions: #####
A description of other **libvmem** functions can be found on the following
manual pages:
+ memory pool management: **vmem_create**(3)
+ memory allocation related functions: **vmem_malloc**(3)
# DESCRIPTION #
**libvmem** provides common *malloc*-like interfaces to memory pools built on
memory-mapped files. These interfaces are for traditional **volatile** memory
allocation but, unlike the functions described in **malloc**(3),
the memory managed by **libvmem** may have different attributes,
depending on the file system containing the memory-mapped files.
In particular, **libvmem** is part of the *Persistent Memory Development Kit*
because it is sometimes useful to use non-volatile memory as a volatile memory
pool, leveraging its capacity, cost, or performance characteristics.
**libvmem** uses the **mmap**(2) system call to create a pool of volatile
memory. The library is most useful when used with *Direct Access* storage
(DAX), which is memory-addressable persistent storage that supports load/store
access without being paged via the system page cache. A Persistent Memory-aware
file system is typically used to provide this type of access. Memory-mapping a
file from a Persistent Memory-aware file system provides the raw memory pools,
and this library supplies the more familiar *malloc*-like interfaces on top
of those pools.
Under normal usage, **libvmem** will never print messages or intentionally
cause the process to exit. Exceptions to this are prints caused by calls to
**vmem_stats_print**(3), or by enabling debugging as described under
**DEBUGGING AND ERROR HANDLING** below. The library uses **pthreads** to be
fully MT-safe, but never creates or destroys threads itself. The library does
not make use of any signals, networking, and never calls **select**(2) or
**poll**(2). The system memory allocation routines like **malloc**(3) and
**free**(3) are used by **libvmem** for managing a small amount of run-time
state, but applications are allowed to override these calls if necessary
(see the description of **vmem_set_funcs**() below).
**libvmem** interfaces are grouped into three categories: those that manage
memory pools, those providing the basic memory allocation functions, and
those interfaces less commonly used for managing the overall library behavior.
# MANAGING LIBRARY BEHAVIOR #
The _UW(vmem_check_version) function is used to see if the installed
**libvmem** supports the version of the library API required by an application.
The easiest way to do this is for the application to supply the compile-time
version information, supplied by defines in **\<libvmem.h\>**, like this:
```c
reason = _U(vmem_check_version)(VMEM_MAJOR_VERSION,
VMEM_MINOR_VERSION);
if (reason != NULL) {
/* version check failed, reason string tells you why */
}
```
Any mismatch in the major version number is considered a failure, but a library
with a newer minor version number will pass this check since increasing minor
versions imply backwards compatibility.
An application can also check specifically for the existence of an interface
by checking for the version where that interface was introduced. These versions
are documented in this man page as follows: unless otherwise specified, all
interfaces described here are available in version 1.0 of the library. Interfaces
added after version 1.0 will contain the text *introduced in version x.y*
in the section of this manual describing the feature.
When the version check is successful, _UW(vmem_check_version) returns NULL.
Otherwise, _UW(vmem_check_version) returns a static string describing the
reason for failing the version check. The returned string must not be modified
or freed.
The **vmem_set_funcs**() function allows an application to override some
interfaces used internally by **libvmem**. Passing NULL for any of the
handlers will cause the **libvmem** default function to be used. The only
functions in the malloc family used by the library are represented by the
first four arguments to **vmem_set_funcs**(). While the library does not make
heavy use of the system malloc functions, it does allocate approximately 4-8
kilobytes for each memory pool in use. The *print_func* function is called by
**libvmem** when the **vmem_stats_print**() entry point is used, or when
additional tracing is enabled in the debug version of the library as described
in **DEBUGGING AND ERROR HANDLING**, below. The default *print_func*
used by the library prints to the file specified by the **VMEM_LOG_FILE**
environment variable, or to *stderr* if that variable is not set.
# CAVEATS #
**libvmem** relies on the library destructor being called from the main thread.
For this reason, all functions that might trigger destruction (e.g.
**dlclose**(3)) should be called in the main thread. Otherwise some of the
resources associated with that thread might not be cleaned up properly.
# DEBUGGING AND ERROR HANDLING #
If an error is detected during the call to a **libvmem** function, the
application may retrieve an error message describing the reason for the failure
from _UW(vmem_errormsg). This function returns a pointer to a static buffer
containing the last error message logged for the current thread. If *errno*
was set, the error message may include a description of the corresponding
error code as returned by **strerror**(3). The error message buffer is
thread-local; errors encountered in one thread do not affect its value in
other threads. The buffer is never cleared by any library function; its
content is significant only when the return value of the immediately preceding
call to a **libvmem** function indicated an error, or if *errno* was set.
The application must not modify or free the error message string, but it may
be modified by subsequent calls to other library functions.
Two versions of **libvmem** are typically available on a development
system. The normal version is optimized for performance. That version skips
checks that impact performance and never logs any trace information or
performs any run-time assertions. A second version, accessed when using
libraries from _DEBUGLIBPATH(), contains run-time assertions and trace
points. The typical way to access the debug version is to set the
**LD_LIBRARY_PATH** environment variable to _LDLIBPATH(). Debugging output is
controlled using the following environment variables. These variables have
no effect on the non-debug version of the library.
+ **VMEM_LOG_LEVEL**
The value of **VMEM_LOG_LEVEL** enables trace points in the debug version
of the library, as follows:
+ **0** - Tracing is disabled. This is the default level when
**VMEM_LOG_LEVEL** is not set. Only statistics are logged, and then only in response to a call to **vmem_stats_print**().
+ **1** - Additional details on any errors detected are logged, in addition to
returning the *errno*-based errors as usual.
+ **2** - A trace of basic operations is logged.
+ **3** - Enables a very verbose amount of function call tracing
in the library.
+ **4** - Enables voluminous tracing information about all memory
allocations and deallocations.
Unless **VMEM_LOG_FILE** is set, debugging output is written to *stderr*.
+ **VMEM_LOG_FILE**
Specifies the name of a file where
all logging information should be written. If the last character in the name
is "-", the *PID* of the current process will be appended to the file name when
the log file is created. If **VMEM_LOG_FILE** is not set, output is
written to *stderr*.
# EXAMPLE #
The following example creates a memory pool, allocates some memory
to contain the string "hello, world", and then frees that memory.
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libvmem.h>
int
main(int argc, char *argv[])
{
VMEM *vmp;
char *ptr;
/* create minimum size pool of memory */
if ((vmp = _U(vmem_create)("/pmem-fs",
VMEM_MIN_POOL)) == NULL) {
perror("_U(vmem_create)");
exit(1);
}
if ((ptr = vmem_malloc(vmp, 100)) == NULL) {
perror("vmem_malloc");
exit(1);
}
strcpy(ptr, "hello, world");
/* give the memory back */
vmem_free(vmp, ptr);
/* ... */
vmem_delete(vmp);
}
```
See <http://pmem.io/pmdk/libvmem> for more examples using the **libvmem** API.
# BUGS #
Unlike the normal **malloc**(3), which asks the system for additional
memory when it runs out, **libvmem** allocates the size it is told
to and never attempts to grow or shrink that memory pool.
# ACKNOWLEDGEMENTS #
**libvmem** depends on jemalloc, written by Jason Evans, to do the heavy
lifting of managing dynamic memory allocation. See:
<http://www.canonware.com/jemalloc>
**libvmem** builds on the persistent memory programming model recommended
by the SNIA NVM Programming Technical Work Group:
<http://snia.org/nvmp>
# SEE ALSO #
**mmap**(2), **dlclose**(3), **malloc**(3),
**strerror**(3), **vmem_create**(3), **vmem_malloc**(3),
and **<http://pmem.io>**
On Linux:
**jemalloc**(3), **pthreads**(7)
On FreeBSD:
**pthread**(3)
| 11,997 | 37.332268 | 121 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/pmempool/pmempool-info.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL-INFO, 1)
collection: pmempool
header: PMDK
date: pmem Tools version 1.4
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool-info.1 -- man page for pmempool-info)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RANGE](#range)<br />
[STATISTICS](#statistics)<br />
[EXAMPLE](#example)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmempool-info** - show information about persistent memory pool
# SYNOPSIS #
```
$ pmempool info [<options>] <file>
```
# DESCRIPTION #
The **pmempool** invoked with *info* command analyzes an existing pool
created by **PMDK** libraries provided by **file** parameter.
The **file** can be either existing pool file, a part file or a poolset file.
The main task of this command is to print all usable information from
pool headers and user data in human readable format. It automatically recognizes the pool
type by parsing and analyzing the pool header. The recognition
is done by checking the signature in the pool header. The main job of *info* command
is to present internal data structures as they are stored in file but *not* for checking
consistency. For this purpose there is the **pmempool-check**(1) command available.
The **pmempool** with *info* command analyzes pool file as long as it is possible
regarding *correctness* of internal meta-data (correct offsets, sizes etc.).
If it is *not* possible to analyze the rest of the file, **pmempool** exits
with error code and prints appropriate error message.
Currently there is lack of interprocess synchronization for pool files,
so the *info* command should be invoked off-line. Using **pmempool** on pool file which
may be modified by another process may lead to unexpected errors in pool file.
A poolset file passed to **pmempool info** may contain multiple replicas,
also remote ones, but **pmempool** currently does not read any data from remote replicas.
It prints only a remote node address and a remote replica descriptor.
**pmempool info** opens pool file in *read-only* mode so the file
will remain untouched after processing.
The *info* command may collect and print basic statistics about data usage.
The statistics are specific to the type of pool. See **STATISTICS** section for details.
Although the pool consistency is *not* checked by the *info* command,
it prints information about checksum errors and/or offsets errors.
##### Common options: #####
By default the *info* command of **pmempool** prints information about the most important
internal data structures from pool. The particular set of headers and meta-data depend on
pool type. The pool type is recognized automatically and appropriate information is displayed
in human-readable format.
To force processing specified file(s) as desired pool type use **-f** option with appropriate
name of pool type. The valid names off pool types are **blk**, **log**, **obj** or **btt**.
This option may be useful when the pool header is corrupted and automatic recognition of
pool type fails.
`-f, --force blk|log|obj|btt`
Force parsing pool as specified pool type.
>NOTE:
By default only pool headers and internal meta-data are displayed.
To display user data use **-d** option. Using **-r** option you can
specify number of blocks/bytes/data chunks or objects using special
text format. See **RANGE** section for details. The range refers to
*block numbers* in case of pmem blk pool type, to *chunk numbers*
in case of pmem log pool type and to *object numbers* in case of
pmem obj pool type.
See **EXAMPLES** section for an example of usage of these options.
`-d, --data`
Dump user data in hexadecimal format.
In case of pmem *blk* pool type data is dumped in *blocks*.
In case of pmem *log* pool type data is dumped as a wholeor in *chunks* if **-w**
option is used (See **Options for PMEMLOG** section for details).
`-r, --range <range>`
Range of blocks/data chunks/objects/zone headers/chunk headers/lanes.
See **RANGE** section for details about range format.
`-n, --human`
Print sizes in human-readable format with appropriate units (e.g. 4k, 8M, 16G)
`-x, --headers-hex`
Print pool's internal data in mixed format which consists of hexadecimal dump of
header's data and parsed format displayed in human-readable format. This
allows one to see how data is stored in file.
`-s, --stats`
Print pool's statistics. See **STATISTICS** section for details.
`-k, --badblocks`
Print bad blocks found in the pool.
`-h, --help`
Display help message and exit.
##### Options for PMEMLOG: #####
`-w, --walk <size>`
Use this option to walk through used data with fixed data chunk size.
See **pmemlog_walk**(3) in **libpmemlog**(7) for details.
##### Options for PMEMBLK: #####
By default the *info* command displays the **pmemblk** header and
BTT (Block Translation Table) Info header in case of **pmemblk** pool type.
To display BTT Map and/or BTT FLOG (Free List and Log) use **-m**
and **-g** options respectively or increase verbosity level.
In order to display BTT Info header backup use **-B** option.
`-m, --map`
Print BTT Map entries.
`-g, --flog`
Print BTT FLOG entries.
`-B, --backup`
Print BTT Info header backup.
>NOTE:
By default the *info* command displays all data blocks when **-d** options is used.
However it is possible to skip blocks marked with *zero* and/or *error* flags.
It is also possible to skip blocks which are *not* marked with any flag. Skipping
blocks has impact on blocks ranges (e.g. display 10 blocks marked with error flag
in the range from 0 to 10000) and statistics.
`-z, --skip-zeros`
Skip blocks marked with *zero* flag.
`-e, --skip-error`
Skip blocks marked with *error* flag.
`-u, --skip-no-flag`
Skip blocks *not* marked with any flag.
##### Options for PMEMOBJ: #####
By default the *info* command displays pool header and **pmemobj** pool descriptor.
In order to print information about other data structures one of the
following options may be used.
`-l, --lanes [<range>]`
Print information about lanes. If range is not specified all lanes are displayed.
The range can be specified using **-r** option right after the **-l** option.
See **RANGE** section for details about range format.
`-R, --recovery`
Print information about only those lanes which require recovery process.
This option requires **-l**, **--lanes** option.
`-O, --object-store`
Print information about all allocated objects.
`-t, --types <range>`
Print information about allocated objects only from specified range of type numbers.
If **-s**, **--stats** option is specified the objects statistics refer to objects from
specified range of type numbers. This option requires **-O**, **--object-store** or **-s**,
**--stats** options. See **RANGE** section for details about range format.
`-E, --no-empty`
Ignore empty lists of objects. This option requires **-O**, **--object-store** option.
`-o, --root`
Print information about a root object.
`-A, --alloc-header`
Print object's allocation header. This option requires **-O**, **--object-store** or **-l**,
**--lanes** or **-o**, **--root** options.
`-a, --oob-header`
Print object's out of band header. This option requires **-O**, **--object-store** or **-l**,
**--lanes** or **-o**, **--root** options.
`-H, --heap`
Print information about **pmemobj** heap. By default only a heap header is displayed.
`-Z, --zones`
If the **-H**, **--heap** option is used, print information about zones from specified range.
If the **-O**, **--object-store** option is used, print information about objects only
from specified range of zones. This option requires **-O**, **--object-store**, **-H**, **--heap**
or **-s**, **--stats** options.
The range can be specified using **-r** option right after the **-Z** option.
See **RANGE** section for details about range format.
`-C, --chunks [<range>]`
If the **-H, --heap** option is used, print information about chunks from specified range.
By default information about chunks of types *used* , *free* and *run* are displayed.
If the **-O, --object-store** option is used, print information about objects from
specified range of chunks within a zone. This option requires **-O, --object-store**,
**-H, --heap** or **-s, --stats** options.
The range can be specified using **-r** option right after the **-C** option.
See **RANGE** section for details about range format.
`-T, --chunk-type used,free,run,footer`
Print only specified type(s) of chunks.
The multiple types may be specified separated by comma.
This option requires **-H, --heap** and **-C, --chunks** options.
`-b, --bitmap`
Print bitmap of used blocks in chunks of type run.
This option requires **-H, --heap** and **-C, --chunks** options.
`-p, --replica <num>`
Print information from *\<num\>* replica. The 0 value means the master pool file.
# RANGE #
Using **-r, --range** option it is possible to dump only a range of user data.
This section describes valid format of *\<range\>* string.
You can specify multiple ranges separated by commas.
`<first>-<last>`
All blocks/bytes/data chunks from *\<first\>* to *\<last\>* will be dumped.
`-<last>`
All blocks/bytes/data chunks up to *\<last\>* will be dumped.
`<first>-`
All blocks/bytes/data chunks starting from *\<first\>* will be dumped.
`<number>`
Only *\<number\>* block/byte/data chunk will be dumped.
# STATISTICS #
Below is the description of statistical measures for specific pool types.
##### PMEMLOG #####
+ **Total** - Total space in pool.
+ **Available** - Size and percentage of available space.
+ **Used** - Size and percentage of used space.
##### PMEMBLK #####
+ **Total blocks** - Total number of blocks in pool.
+ **Zeroed blocks** - Number and percentage of blocks marked with *zero* flag.
+ **Error blocks** - Number and percentage of blocks marked with *error* flag.
+ **Blocks without any flag** - Number and percentage of blocks *not* marked with any flag.
>NOTE:
In case of pmemblk, statistics are evaluated for blocks which meet requirements regarding:
*range* of blocks (**-r** option),
*skipped* types of blocks (**-z**, **-e**, **-u** options).
##### PMEMOBJ #####
+ **Object store**
+ **Number of objects** - Total number of objects and number of objects per type number.
+ **Number of bytes** - Total number of bytes and number of bytes per type number.
+ **Heap**
+ **Number of zones** - Total number of zones in the pool.
+ **Number of used zones** - Number of used zones in the pool.
+ **Zone** The zone's statistics are presented for each zone separately and the aggregated results from all zones.
+ **Number of chunks** - Total number of chunks in the zone and number of chunks of specified type.
+ **Chunks size** - Total size of all chunks in the zone and sum of sizes of chunks of specified type.
+ **Allocation classes**
+ **Units** - Total number of units of specified class.
+ **Used units** - Number of used units of specified class.
+ **Bytes** - Total number of bytes of specified class.
+ **Used bytes** - Number of used bytes of specified class.
+ **Total bytes** - Total number of bytes of all classes.
+ **Total used bytes** - Total number of used bytes of all classes.
# EXAMPLE #
```
$ pmempool info ./pmemblk
```
Parse and print information about "pmemblk" pool file.
```
$ pmempool info -f blk ./pmempool
```
Force parsing "pmempool" file as **pmemblk** pool type.
```
$ pmempool info -d ./pmemlog
```
Print information and data in hexadecimal dump format for file "pmemlog".
```
$ pmempool info -d -r10-100 -eu ./pmemblk
```
Print information from "pmemblk" file. Dump data blocks from 10 to 100,
skip blocks marked with error flag and not marked with any flag.
# SEE ALSO #
**pmempool**(1), **libpmemblk**(7), **libpmemlog**(7),
**libpmemobj**(7) and **<http://pmem.io>**
| 13,723 | 33.482412 | 114 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/pmempool/pmempool-create.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL-CREATE, 1)
collection: pmempool
header: PMDK
date: pmem Tools version 1.4
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool-create.1 -- man page for pmempool-create)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[EXAMPLE](#example)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmempool-create** - create a persistent memory pool
# SYNOPSIS #
```
$ pmempool create [<options>] [<type>] [<bsize>] <file>
```
# DESCRIPTION #
The **pmempool** invoked with *create* command creates a pool file
of specified type. Depending on a pool type it is possible to provide more properties of pool.
Valid pool types are: **blk**, **log** and **obj** which stands for
*pmemblk*, *pmemlog* and *pmemobj* pools respectively. By default
the pool file is created with *minimum* allowed size for specified
pool type. The minimum sizes for **blk**, **log** and **obj** pool
types are **PMEMBLK_MIN_POOL**, **PMEMLOG_MIN_POOL** and **PMEMOBJ_MIN_POOL**
respectively. See **libpmemblk**(7), **libpmemlog**(7)
and **libpmemobj**(7) for details.
For *pmemblk* pool type block size *\<bsize\>* is a required argument.
In order to set custom size of pool use **-s** option, or use **-M** option
to create a pool of maximum available size on underlying file system.
The *size* argument may be passed in format that permits only the upper-case
character for byte - B as specified in IEC 80000-13, IEEE 1541 and the
Metric Interchange Format. Standards accept SI units with obligatory
B - kB, MB, GB, ... which means multiplier by 1000 and IEC units with
optional "iB" - KiB, MiB, GiB, ..., K, M, G, ... - which means multiplier by 1024.
##### Available options: #####
`-s, --size <size>`
Size of pool file.
`-M, --max-size`
Set size of pool to available space of underlying file system.
`-m, --mode <octal>`
Set permissions to <octal> (the default is 0664) when creating the files.
If the file already exist the permissions are not changed.
`-i, --inherit <file>`
Create a new pool of the same size and other properties as *\<file\>*.
`-b, --clearbadblocks`
Clear bad blocks in existing files.
`-f, --force`
Remove the pool before creating.
`-v, --verbose`
Increase verbosity level.
`-h, --help`
Display help message and exit.
##### Options for PMEMBLK: #####
By default when creating a pmem **blk** pool, the **BTT** layout is *not*
written until the first *write operation* of block entry is performed.
Using **-w** option you can force writing the **BTT** layout by writing
zero data to specified block number. By default the *write operation*
is performed to block number 0. Please refer to **libpmemblk**(7) for details.
`-w, --write-layout`
Force writing the **BTT** layout by performing *write operation* to block number zero.
##### Options for PMEMOBJ: #####
By default when creating a pmem **obj** pool, the layout name provided to
the **libpmemobj** library is an empty string. Please refer to
**libpmemobj**(7) for details.
`-l, --layout <layout>`
Layout name of the **pmemobj** pool.
# EXAMPLE #
```
$ pmempool create blk 512 pool.blk
```
Create a blk pool file of minimum allowed size and block size 512 bytes
```
$ pmempool create log -M pool.log
```
Create a log pool file of maximum allowed size
```
$ pmempool create blk --size=4G --write-layout 1K pool.blk
```
Create a blk pool file of size 4G, block size 1K and write the BTT layout
```
$ pmempool create --layout my_layout obj pool.obj
```
Create an obj pool file of minimum allowed size and layout "my_layout"
```
$ pmempool create --inherit=pool.log new_pool.log
```
Create a pool file based on pool.log file
# SEE ALSO #
**pmempool**(1), **libpmemblk**(7), **libpmemlog**(7),
**libpmemobj**(7) and **<http://pmem.io>**
| 5,693 | 30.810056 | 94 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/pmempool/pmempool.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL, 1)
collection: pmempool
header: PMDK
date: pmem Tools version 1.4
...
[comment]: <> (Copyright 2016-2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool.1 -- man page for pmempool)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[OPTIONS](#options)<br />
[COMMANDS](#commands)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmempool** - Persistent Memory Pool Management Tool
# SYNOPSIS #
```
$ pmempool [--help] [--version] <command> [<args>]
```
# DESCRIPTION #
The **pmempool** is a management tool for *Persistent Memory* pool files
created by **PMDK** libraries.
The main purpose of **pmempool** is to provide a user with a set of utilities
for off-line analysis and manipulation of pools created by pmem libraries.
The pmempool is a generic command which consists of subcommands for specific
purposes. Some of subcommands are required to work *without* any impact
on processed pool, but some of them *may* create a new or modify an existing one.
The **pmempool** may be useful for troubleshooting by system administrators
and for software developers who work on applications based on **PMDK**.
The latter may find these tools useful for testing and debugging purposes also.
# OPTIONS #
`-V, --version`
Prints the version of **pmempool**.
`-h, --help`
Prints synopsis and list of commands.
# COMMANDS #
Currently there is a following set of commands available:
+ **pmempool-info**(1) -
Prints information and statistics in human-readable format about specified pool.
+ **pmempool-check**(1) -
Checks pool's consistency and repairs pool if it is not consistent.
+ **pmempool-create**(1) -
Creates a pool of specified type with additional properties specific for this type of pool.
+ **pmempool-dump**(1) -
Dumps usable data from pool in hexadecimal or binary format.
+ **pmempool-rm**(1)
Removes pool file or all pool files listed in pool set configuration file.
+ **pmempool-convert**(1) -
Updates the pool to the latest available layout version.
+ **pmempool-sync**(1) -
Synchronizes replicas within a poolset.
+ **pmempool-transform**(1) -
Modifies internal structure of a poolset.
+ **pmempool-feature**(1) -
Toggle or query a poolset features.
In order to get more information about specific *command* you can use **pmempool help <command>.**
# SEE ALSO #
**libpmemblk**(7), **libpmemlog**(7), **libpmemobj**(7)
and **<http://pmem.io>**
| 4,313 | 34.073171 | 98 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/pmempool/pmempool-feature.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL-FEATURE, 1)
collection: pmempool
header: PMDK
date: pmem Tools version 1.4
...
[comment]: <> (Copyright 2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool-feature.1 -- man page for pmempool-feature)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[EXAMPLE](#example)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmempool-feature** - toggle or query pool set features
# SYNOPSIS #
```
$ pmempool feature (-e|-d|-q feature-name) [options] <file>
```
# DESCRIPTION #
The **pmempool feature** command enables / disables or queries pool set features.
Available pool *feature-names* are:
+ **SINGLEHDR** - only the first part in each replica contains the pool part
internal metadata. This value can be used only with **-q**. It can not be
enabled or disabled. For details see **poolset**(5).
+ **CHECKSUM_2K** - only the first 2KiB of pool part internal metadata
is checksummed. Other features may depend on this one to store additional metadata
in otherwise unused second 2KiB part of a header.
When **CHECKSUM_2K** is disabled whole 4KiB is checksummed.
+ **SHUTDOWN_STATE** - enables additional check performed during
pool open which verifies pool consistency in the presence of dirty shutdown.
**CHECKSUM_2K** has to be enabled prior to **SHUTDOWN_STATE**
otherwise enabling **SHUTDOWN_STATE** will fail.
+ **CHECK_BAD_BLOCKS** - enables checking bad blocks performed during opening
a pool and fixing bad blocks performed by pmempool-sync during syncing a pool.
Currently (Linux kernel v4.19, libndctl v62) checking and fixing bad blocks
require read access to the following resource files (containing physical
addresses) of NVDIMM devices which only root can read by default:
```
/sys/devices/platform/<pmem_device>/ndbus?/region?/resource
/sys/devices/platform/<pmem_device>/ndbus?/region?/dax?.0/resource
/sys/devices/platform/<pmem_device>/ndbus?/region?/pfn?.0/resource
/sys/devices/platform/<pmem_device>/ndbus?/region?/namespace?.0/resource
```
##### Available options: #####
`-h, --help`
Print help message.
`-v, --verbose`
Increase verbosity level.
`-e, --enable feature-name`
Enable feature for pool set.
`-d, --disable feature-name`
Disable feature for pool set.
`-q, --query feature-name`
Print feature status.
# EXAMPLE #
```
$ pmempool feature --enable CHECKSUM_2K pool.set
```
Enables POOL_FEAT_CKSUM_2K incompat feature flag.
```
$ pmempool feature --disable CHECKSUM_2K pool.set
```
Disables POOL_FEAT_CKSUM_2K incompat feature flag.
```
$ pmempool feature --query CHECKSUM_2K pool.set
0
```
Prints POOL_FEAT_CKSUM_2K incompat feature flag value.
# SEE ALSO #
**poolset**(5) and **<http://pmem.io>**
| 4,590 | 32.028777 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/pmempool/pmempool-transform.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL-TRANSFORM, 1)
collection: pmempool
header: PMDK
date: pmem Tools version 1.4
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool-transform.1 -- man page for pmempool-transform)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[EXAMPLES](#examples)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmempool-transform** - Modify internal structure of a pool set.
# SYNOPSIS #
```
pmempool transform [options] <poolset_file_src> <poolset_file_dst>
```
# DESCRIPTION #
The **pmempool transform** command modifies internal structure of a pool set
defined by the `poolset_file_src` file, according to a structure described in
the `poolset_file_dst` file.
The following operations are supported:
* adding replicas - one or more new replicas can be added and synchronized with
other replicas in the pool set,
* removing replicas - one or more replicas can be removed from the pool set
_WINUX(.,=q=,
* adding or removing pool set options.=e=)
Only one of the above operations can be performed at a time.
Currently adding and removing replicas are allowed only for **pmemobj** pools
(see **libpmemobj**(7)).
The *poolset_file_src* argument provides the source pool set to be changed.
The *poolset_file_dst* argument points to the target pool set.
_WINUX(=q=When adding or deleting replicas, the two pool set files can differ only in the
definitions of replicas which are to be added or deleted. One cannot add and
remove replicas in the same step. Only one of these operations can be performed
at a time. Reordering replicas is not supported
Also, to add a replica it is necessary for its effective size to match or exceed
the pool size. Otherwise the whole operation fails and no changes are applied.
Effective size of a replica is the sum of sizes of all its part files decreased
by 4096 bytes per each part file. The 4096 bytes of each part file is
utilized for storing internal metadata of the pool part files.=e=)
_WINUX(,=q=When adding or deleting replicas, the two pool set files can differ
only in the definitions of replicas which are to be added or deleted. When
adding or removing pool set options (see **poolset**(5)), the rest of both pool
set files have to be of the same structure. The operation of adding/removing
a pool set option can be performed on a pool set with local replicas only. To
add/remove a pool set option to/from a pool set with remote replicas, one has
to remove the remote replicas first, then add/remove the option, and finally
recreate the remote replicas having added/removed the pool set option to/from
the remote replicas' poolset files.
To add a replica it is necessary for its effective size to match or exceed the
pool size. Otherwise the whole operation fails and no changes are applied.
If none of the poolset options is used, the effective size of a replica is the
sum of sizes of all its part files decreased by 4096 bytes per each part file.
The 4096 bytes of each part file is utilized for storing internal metadata of
the pool part files.
If the option *SINGLEHDR* is used, the effective size of a replica is the sum of
sizes of all its part files decreased once by 4096 bytes. In this case only
the first part contains internal metadata.
If the option *NOHDRS* is used, the effective size of a replica is the sum of
sizes of all its part files. In this case none of the parts contains internal
metadata.=e=)
##### Available options: #####
`-d, --dry-run`
: Enable dry run mode. In this mode no changes are applied, only check for
viability of the operation is performed.
`-v, --verbose`
: Increase verbosity level.
`-h, --help`
: Display help message and exit.
# EXAMPLES #
##### Example 1. #####
Let files `/path/poolset_file_src` and `/path/poolset_file_dst` have the
following contents:
```
PMEMPOOLSET
20M /0/partfile1
20M /0/partfile2
25M /0/partfile3
REPLICA
40M /1/partfile1
20M /1/partfile2
```
```
PMEMPOOLSET
20M /0/partfile1
20M /0/partfile2
25M /0/partfile3
REPLICA
40M /1/partfile1
20M /1/partfile2
REPLICA
50M /2/partfile1
20M /2/partfile2
```
Then, the command
`pmempool transform /path/poolset_file_src /path/poolset_file_dst`
adds a replica to the pool set. All other replicas remain unchanged and
the size of the pool remains 60M.
##### Example 2. #####
Let files `/path/poolset_file_src` and `/path/poolset_file_dst` have the
following contents:
```
PMEMPOOLSET
20M /0/partfile1
20M /0/partfile2
25M /0/partfile3
REPLICA
40M /1/partfile1
20M /1/partfile2
```
```
PMEMPOOLSET
20M /0/partfile1
20M /0/partfile2
25M /0/partfile3
```
Then
`pmempool_transform /path/poolset_file_src /path/poolset_file_dst`
deletes the second replica from the pool set. The first replica remains
unchanged and the size of the pool is still 60M.
# SEE ALSO #
**pmempool(1)**, **libpmemblk(7)**, **libpmemlog(7)**,
**libpmempool(7)** and **<http://pmem.io>**
| 6,805 | 32.693069 | 89 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/pmempool/pmempool-rm.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL-RM, 1)
collection: pmempool
header: PMDK
date: pmem Tools version 1.4
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool-rm.1 -- man page for pmempool-rm)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[EXAMPLE](#example)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmempool-rm** - remove a persistent memory pool
# SYNOPSIS #
```
$ pmempool rm [<options>] <file>..
```
# DESCRIPTION #
The **pmempool rm** command removes each specified file. If the specified file
is a pool set file, all pool files (single-file pool or part files) and remote
replicas are removed. By default the **pmempool rm** does not remove pool set
files. All local and remote pool files are removed using **unlink**(3) call,
except the pools created on **device dax** which are zeroed instead.
If specified file does not exist, the remote pool is broken or not accessible,
the **pmempool rm** command terminates with an error code. By default it prompts
before removing *write-protected* local files.
See **REMOTE REPLICATION** section for more details about support for remote
pools.
See **EXAMPLES** section for example usage of the *rm* command.
##### Available options: #####
`-h, --help`
Print help message
`-v, --verbose`
Be verbose and print all removing files.
`-s, --only-pools`
Remove only pool files and do not remove pool set files (default behaviour).
`-a, --all`
Remove all pool set files - local and remote.
`-l, --local`
Remove local pool set files.
`-r, --remote`
Remove remote pool set files.
`-f, --force`
Remove all specified files, ignore nonexistent files, never prompt.
`-i, --interactive`
Prompt before removing every single file or remote pool.
# REMOTE REPLICATION #
A remote pool is removed using **rpmem_remove**(3) function if **librpmem**(7)
library is available. If a pool set file contains remote replication but
**librpmem**(7) is not available, the **pmempool rm** command terminates with
an error code, unless the **-f, --force** option is specified.
# EXAMPLE #
```
$ pmempool rm pool.obj pool.blk
```
Remove specified pool files.
```
$ pmempool rm pool.set
```
Remove all pool files from the "pool.set", do not remove *pool.set* itself.
```
$ pmempool rm -a pool.set
```
Remove all pool files from the "pool.set", remove the local pool set file and all
remote pool set files.
# SEE ALSO #
**pmempool**(1), **libpmemblk**(7), **libpmemlog**(7),
**libpmemobj**(7), **librpmem**(7) and **<http://pmem.io>**
| 4,429 | 30.41844 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/pmempool/pmempool-sync.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL-SYNC, 1)
collection: pmempool
header: PMDK
date: pmem Tools version 1.4
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool-sync.1 -- man page for pmempool-sync)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[EXAMPLES](#examples)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmempool-sync** - Synchronize replicas or their parts within a pool set.
# SYNOPSIS #
```
pmempool sync [options] <poolset_file>
```
NOTE: Only the pool set file used to create the pool should be used
for syncing the pool.
# DESCRIPTION #
The **pmempool sync** command synchronizes data between replicas within
a pool set. It checks if metadata of all replicas in a pool set
are consistent, i.e. all parts are healthy, and if any of them is not,
the corrupted or missing parts are recreated and filled with data from one of
the healthy replicas.
Currently synchronizing data is allowed only for **pmemobj** pools (see
**libpmemobj**(7)).
_WINUX(,=q=If a pool set has the option *SINGLEHDR* or *NOHDRS*
(see **poolset**(5)), **pmempool sync** command has limited capability
of checking its metadata. This is due to limited or no, respectively, internal
metadata at the beginning of pool set parts in every replica when either of the
options is used. In that cases, only missing parts or the ones which cannot
be opened are recreated.=e=)
##### Available options: #####
`-b, --bad-blocks`
: Fix bad blocks - it causes creating or reading special recovery files.
When bad blocks are detected, special recovery files have to be created
in order to fix them safely. A separate recovery file is created per each part
containing bad blocks. The recovery files are created in the same directory
where the poolset file is located using the following name pattern:
\<poolset-file-name\> _r \<replica-number\> _p \<part-number\> _badblocks.txt
These recovery files are automatically removed if the sync operation finishes
successfully.
If the last sync operation was interrupted and not finished correctly
(eg. the application crashed) and the bad blocks fixing procedure was
in progress, the bad block recovery files may be left over. In such case
bad blocks might have been cleared and zeroed, but the correct data from these
blocks was not recovered (not copied from a healthy replica), so the recovery
files MUST NOT be deleted manually, because it would cause a data loss.
Pmempool-sync should be run again with the '-b' option set. It will finish
the previously interrupted sync operation and copy correct data to zeroed
bad blocks using the left-over bad block recovery files (the bad blocks
will be read from the saved recovery files). Pmempool will delete the recovery
files automatically at the end of the sync operation.
Using this option may have limitations depending on the operating system.
For details see description of the CHECK_BAD_BLOCKS feature
in **pmempool-feature**(1).
`-d, --dry-run`
: Enable dry run mode. In this mode no changes are applied, only check for
viability of synchronization.
`-v, --verbose`
: Increase verbosity level.
`-h, --help`
: Display help message and exit.
# SEE ALSO #
**pmempool(1)**, **libpmemblk(7)**, **libpmemlog(7)**,
**libpmempool(7)** and **<http://pmem.io>**
| 5,179 | 41.113821 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/pmempool/pmempool-check.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL-CHECK, 1)
collection: pmempool
header: PMDK
date: pmem Tools version 1.4
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool-check.1 -- man page for pmempool-check)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[EXAMPLE](#example)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmempool-check** - check and repair persistent memory pool
# SYNOPSIS #
```
$ pmempool check [<options>] <file>
```
# DESCRIPTION #
The **pmempool** invoked with *check* command checks consistency of a given pool file.
If the pool file is consistent **pmempool** exits with 0 value. If the
pool file is not consistent non-zero error code is returned.
In case of any errors, the proper message is printed. The verbosity level
may be increased using **-v** option. The output messages may be also suppressed using
**-q** option.
It is possible to try to fix encountered problems using **-r** option.
In order to be sure this will not corrupt your data you can either create backup of the
pool file using **-b** option or just print what would be fixed
without modifying original pool using **-N** option.
> NOTE:
Currently, checking the consistency of a *pmemobj* pool is **not** supported.
##### Available options: #####
`-r, --repair`
Try to repair a pool file if possible.
`-y, --yes`
Answer yes on all questions.
`-N, --no-exec`
Don't execute, just show what would be done. Not supported on Device DAX.
`-b, --backup <file>`
Create backup of a pool file before executing. Terminate if it is *not*
possible to create a backup file. This option requires **-r** option.
`-a, --advanced`
Perform advanced repairs. This option enables more aggressive steps in attempts
to repair a pool. This option requires `-r, --repair`.
`-q, --quiet`
Be quiet and don't print any messages.
`-v, --verbose`
Be more verbose.
`-h, --help`
Display help message and exit.
# EXAMPLE #
```
$ pmempool check pool.bin
```
Check consistency of "pool.bin" pool file
```
$ pmempool check --repair --backup pool.bin.backup pool.bin
```
Check consistency of "pool.bin" pool file, create backup and repair
if necessary.
```
$ pmempool check -rvN pool.bin
```
Check consistency of "pool.bin" pool file, print what would be repaired with
increased verbosity level.
# SEE ALSO #
**pmempool**(1), **libpmemblk**(7), **libpmemlog**(7),
**libpmemobj**(7), **libpmempool**(7) and **<http://pmem.io>**
| 4,352 | 30.092857 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/pmempool/pmempool-convert.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL-CONVERT, 1)
collection: pmempool
header: PMDK
date: pmem Tools version 1.4
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool-convert.1 -- man page for pmempool-convert)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[EXAMPLE](#example)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmempool-convert** - this is a wrapper around pmdk-convert tool. More information
can be found in pmdk-convert man page.
# SEE ALSO #
**pmempool**(1), **libpmemblk**(7), **libpmemlog**(7),
**libpmemobj**(7), **libpmempool**(7) and **<http://pmem.io>**
| 2,512 | 44.690909 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/pmempool/pmempool-dump.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(PMEMPOOL-DUMP, 1)
collection: pmempool
header: PMDK
date: pmem Tools version 1.4
...
[comment]: <> (Copyright 2016-2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (pmempool-dump.1 -- man page for pmempool-dump)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RANGE](#range)<br />
[EXAMPLE](#example)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**pmempool-dump** - dump user data from persistent memory pool
# SYNOPSIS #
```
$ pmempool dump [<options>] <file>
```
# DESCRIPTION #
The **pmempool** invoked with *dump* command dumps user data from specified pool file.
The output format may be either binary or hexadecimal.
By default the output format is hexadecimal.
By default data is dumped to standard output. It is possible to dump data to other
file by specifying **-o** option. In this case data will be appended to this file.
Using **-r** option you can specify number of blocks/bytes/data chunks using
special text format. See **RANGE** section for details.
##### Available options: #####
`-b, --binary`
Dump data in binary format.
`-r, --range <range>`
Range of pool file to dump. This may be number of blocks for **blk** pool
type or either number of bytes or number of data chunks for **log** pool type.
`-c, --chunk <size>`
Size of chunk for **log** pool type. See **pmemlog_walk**(3) in **libpmemlog**(7) for details.
`-o, --output <file>`
Name of output file.
`-h, --help`
Display help message and exit.
# RANGE #
Using **-r**, **--range** option it is possible to dump only a range of user data.
This section describes valid format of *\<range\>* string.
You can specify multiple ranges separated by commas.
`<first>-<last>`
All blocks/bytes/data chunks from *\<first\>* to *\<last\>* will be dumped.
`-<last>`
All blocks/bytes/data chunks up to *\<last\>* will be dumped.
`<first>-`
All blocks/bytes/data chunks starting from *\<first\>* will be dumped.
`<number>`
Only *\<number\>* block/byte/data chunk will be dumped.
# EXAMPLE #
```
$ pmempool dump pool.bin
```
Dump user data from pool.bin file to standard output
```
$ pmempool dump -o output.bin -r1,10-100 pool_blk.bin
```
Dump block number 1 and blocks from 10 to 100 from pool_blk.bin
containing pmem blk pool to output.bin file
```
$ pmempool dump -r 1K-2K pool.bin
```
Dump data form 1K to 2K from pool.bin file.
# SEE ALSO #
**pmempool**(1), **libpmemblk**(7), **libpmemlog**(7),
**libpmemobj**(7) and **<http://pmem.io>**
| 4,369 | 28.931507 | 94 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/poolset/poolset.5.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(POOLSET, 5)
collection: poolset
header: PMDK
date: poolset API version 1.0
...
[comment]: <> (Copyright 2017, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (poolset.5 -- man page that describes format of pool set file)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[REPLICAS](#replicas)<br />
[POOL SET OPTIONS](#pool-set-options)<br />
[NOTES](#notes)<br />
[SEE ALSO](#see-also)<br />
# NAME #
poolset - persistent memory pool configuration file format
# SYNOPSIS #
```c
mypool.set
```
# DESCRIPTION #
Depending on the configuration of the system, the available non-volatile
memory space may be divided into multiple memory devices. In such case, the
maximum size of the transactional object store could be limited by the capacity
of a single memory device. Therefore, **libpmemobj**(7), **libpmemblk**(7) and
**libpmemlog**(7) allow building object stores spanning multiple memory devices
by creation of persistent memory pools consisting of multiple files, where each
part of such a *pool set* may be stored on a different pmem-aware filesystem.
To improve reliability and eliminate single point of failure, **libpmemobj**(7)
also allows all the data written to a persistent memory pool to be copied
to local _WINUX(,or remote) pool *replicas*, thereby providing backup for the
persistent memory pool by producing a *mirrored pool set*. In practice,
the pool replicas may be considered as binary copies of the "master" pool set.
Data replication is not supported in **libpmemblk**(7) and **libpmemlog**(7).
The *set* file for each type of pool is a plain text file. Lines in the file
are formatted as follows:
+ The first line of the file must be the literal string "PMEMPOOLSET"
+ The pool parts are specified, one per line, in the format:
*size* *pathname*
+ *Replica* sections, if any, start with the literal string "REPLICA".
See **REPLICAS**, below, for further details.
+ Pool set options, if any, start with literal string *OPTION*.
See **POOL SET OPTIONS** below for details.
+ Lines starting with "#" are considered comments and are ignored.
The *size* must be compliant with the format specified in IEC 80000-13, IEEE 1541
or the Metric Interchange Format. These standards accept SI units with
obligatory B - kB, MB, GB, ... (multiplier by 1000) suffixes, and IEC units
with optional "iB" - KiB, MiB, GiB, ..., K, M, G, ... - (multiplier by 1024)
suffixes.
*pathname* must be an absolute pathname.
The *pathname* of a part can point to a Device DAX. Device DAX is the
device-centric analogue of Filesystem DAX. It allows memory ranges to be
allocated and mapped without need of an intervening file system.
Pools created on Device DAX have additional options and restrictions:
+ The *size* may be set to "AUTO", in which case the size of the device will be
automatically resolved at pool creation time.
+ To concatenate more than one Device DAX device into a single pool set, the
configured internal alignment of the devices must be 4KiB, unless the
*SINGLEHDR* or *NOHDRS* option is used in the pool set file.
See **POOL SET OPTIONS** below for details.
Please see **ndctl-create-namespace**(1) for more information on Device DAX,
including how to configure desired alignment.
The minimum file size of each part of the pool set is defined as follows:
+ For block pools, as **PMEMBLK_MIN_PART** in **\<libpmemblk.h\>**
+ For object pools, as **PMEMOBJ_MIN_PART** in **\<libpmemobj.h\>**
+ For log pools, as **PMEMLOG_MIN_PART** in **\<libpmemlog.h\>**
The net pool size of the pool set is equal to:
```
net_pool_size = sum_over_all_parts(page_aligned_part_size - 4KiB) + 4KiB
```
where
```
page_aligned_part_size = part_size & ~(page_size - 1)
```
Note that page size is OS specific. For more information please see
**sysconf**(3).
The minimum net pool size of a pool set is defined as follows:
+ For block pools, as **PMEMBLK_MIN_POOL** in **\<libpmemblk.h\>**
+ For object pools, as **PMEMOBJ_MIN_POOL** in **\<libpmemobj.h\>**
+ For log pools, as **PMEMLOG_MIN_POOL** in **\<libpmemlog.h\>**
Here is an example "mypool.set" file:
```
PMEMPOOLSET
OPTION NOHDRS
100G /mountpoint0/myfile.part0
200G /mountpoint1/myfile.part1
400G /mountpoint2/myfile.part2
```
The files in the set may be created by running one of the following commands.
To create a block pool:
```
$ pmempool create blk <bsize> mypool.set
```
To create a log pool:
```
$ pmempool create log mypool.set
```
# REPLICAS #
Sections defining replica sets are optional. There may be multiple replica
sections.
Local replica sections begin with a line containing only the literal string
"REPLICA", followed by one or more pool part lines as described above.
_WINUX(,
=q=Remote replica sections consist of the *REPLICA* keyword, followed on
the same line by the address of a remote host and a relative path to a
remote pool set file:
```
REPLICA [<user>@]<hostname> [<relative-path>/]<remote-pool-set-file>
```
+ *hostname* must be in the format recognized by the **ssh**(1) remote login
client
+ *pathname* is relative to the root config directory on the target
node - see **librpmem**(3)
There are no other lines in the remote replica section - the REPLICA line
defines a remote replica entirely.
=e=)
Here is an example "myobjpool.set" file with replicas:
```
PMEMPOOLSET
100G /mountpoint0/myfile.part0
200G /mountpoint1/myfile.part1
400G /mountpoint2/myfile.part2
# local replica
REPLICA
500G /mountpoint3/mymirror.part0
200G /mountpoint4/mymirror.part1 _WINUX(,=q=
# remote replica
REPLICA user@example.com remote-objpool.set=e=)
```
The files in the object pool set may be created by running the following command:
```
$ pmempool create --layout="mylayout" obj myobjpool.set
```
_WINUX(,
=q=Remote replica cannot have replicas, i.e. a remote pool set file cannot
define any replicas.=e=)
# POOL SET OPTIONS #
Pool set options can appear anywhere after the line with *PMEMPOOLSET* string.
Pool set file can contain several pool set options. The following options are
supported:
+ *SINGLEHDR*
+ *NOHDRS*
If the *SINGLEHDR* option is used, only the first part in each replica contains
the pool part internal metadata. In that case the effective size of a replica
is the sum of sizes of all its part files decreased once by 4096 bytes.
The *NOHDRS* option can appear only in the remote pool set file, when
**librpmem** does not serve as a means of replication for **libpmemobj** pool.
In that case none of the pool parts contains internal metadata.
The effective size of such a replica is the sum of sizes of all its part files.
Options *SINGLEHDR* and *NOHDRS* are mutually exclusive. If both are specified
in a pool set file, creating or opening the pool will fail with an error.
When using the *SINGLEHDR* or *NOHDRS* option, one can concatenate more than one
Device DAX devices with any internal alignments in one replica.
The *SINGLEHDR* option concerns only replicas that are local to the pool set
file. That is if one wants to create a pool set with the *SINGLEHDR* option
and with remote replicas, one has to add this option to the local pool set file
as well as to every single remote pool set file.
Using the *SINGLEHDR* and *NOHDRS* options has important implications for data
integrity checking and recoverability in case of a pool set damage.
See _UW(pmempool_sync) API for more information about pool set recovery.
# DIRECTORIES #
Providing a directory as a part's *pathname* allows the pool to dynamically
create files and consequently removes the user-imposed limit on the size
of the pool.
The *size* argument of a part in a directory poolset becomes the size of the
address space reservation required for the pool. In other words, the size
argument is the maximum theoretical size of the mapping. This value can be
freely increased between instances of the application, but decreasing it below
the real required space will result in an error when attempting to open the
pool.
The directory must NOT contain user created files with extension *.pmem*,
otherwise the behavior is undefined. If a file created by the library within
the directory is in any way altered (resized, renamed) the behavior is
undefined.
A directory poolset must exclusively use directories to specify paths -
combining files and directories will result in an error. A single replica can
consist of one or more directories. If there are multiple directories, the
address space reservation is equal to the sum of the sizes.
The order in which the files are created is unspecified, but the library will
try to maintain equal usage of the directories.
By default pools grow in 128 megabyte increments.
Only poolsets with the *SINGLEHDR* option can safely use directories.
# NOTES #
Creation of all the parts of the pool set and the associated replica sets can
be done with the **pmemobj_create**(3), **pmemblk_create**(3) or
**pmemlog_create**(3) function, or by using the **pmempool**(1) utility.
Restoring data from a local _WINUX(,or remote) replica can be done by using the
**pmempool-sync**(1) command or the _UW(pmempool_sync) API from the
**libpmempool**(3) library.
Modifications of a pool set file configuration can be done by using the
**pmempool-transform**(1) command or the _UW(pmempool_transform) API from the
**libpmempool**(3) library.
When creating a pool set consisting of multiple files, or when creating
a replicated pool set, the *path* argument passed to **pmemobj_create**(3),
**pmemblk_create**(3) or **pmemlog_create**(3) must point to the special *set*
file that defines the pool layout and the location of all the parts of the
pool set.
When opening a pool set consisting of multiple files, or when opening a
replicated pool set, the *path* argument passed to **pmemobj_open**(3),
**pmemblk_open**(3) or **pmemlog_open**(3) must point to the same *set* file
that was used for pool set creation.
# SEE ALSO #
**ndctl-create-namespace**(1), **pmemblk_create**(3), **pmemlog_create**(3),
**pmemobj_create**(3), **sysconf**(3), **libpmemblk**(7), **libpmemlog**(7),
**libpmemobj**(7) and **<http://pmem.io>**
| 11,999 | 36.267081 | 87 |
md
|
null |
NearPMSW-main/nearpm/shadow/redis-NDP-sd/deps/pmdk/doc/daxio/daxio.1.md
|
---
layout: manual
Content-Style: 'text/css'
title: _MP(DAXIO, 1)
collection: daxio
header: PMDK
date: daxio version 1.4
...
[comment]: <> (Copyright 2018, Intel Corporation)
[comment]: <> (Redistribution and use in source and binary forms, with or without)
[comment]: <> (modification, are permitted provided that the following conditions)
[comment]: <> (are met:)
[comment]: <> ( * Redistributions of source code must retain the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer.)
[comment]: <> ( * Redistributions in binary form must reproduce the above copyright)
[comment]: <> ( notice, this list of conditions and the following disclaimer in)
[comment]: <> ( the documentation and/or other materials provided with the)
[comment]: <> ( distribution.)
[comment]: <> ( * Neither the name of the copyright holder nor the names of its)
[comment]: <> ( contributors may be used to endorse or promote products derived)
[comment]: <> ( from this software without specific prior written permission.)
[comment]: <> (THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS)
[comment]: <> ("AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR)
[comment]: <> (A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT)
[comment]: <> (OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,)
[comment]: <> (SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT)
[comment]: <> (LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,)
[comment]: <> (DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY)
[comment]: <> (THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT)
[comment]: <> ((INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE)
[comment]: <> (OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.)
[comment]: <> (daxio.1 -- man page for daxio)
[NAME](#name)<br />
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[OPTIONS](#options)<br />
[EXAMPLE](#example)<br />
[SEE ALSO](#see-also)<br />
# NAME #
**daxio** - Perform I/O on Device DAX devices or zero a Device DAX device
# SYNOPSIS #
```
$ daxio [<options>]
```
# DESCRIPTION #
The daxio utility performs I/O on Device DAX devices or zero
a Device DAX device. Since the standard I/O APIs (read/write) cannot be used
with Device DAX, data transfer is performed on a memory-mapped device.
The **daxio** may be used to dump Device DAX data to a file, restore data from
a backup copy, move/copy data to another device or to erase data from
a device.
There must be at least one Device DAX device involved either as the input
or output. If input or output is not specified, it will default to stdin
or stdout respectively.
No length specified will default to input file/device length or to the
output file/device length, if input is a special char file or stdin.
For a Device DAX device, **daxio** will attempts to clear badblocks within
range of writes before performing the I/O.
# OPTIONS #
`-i, --input`
Input device or file to read from.
`-o, --output`
Output device or file to write to.
`-z, --zero`
Zero the output device for *len* size, or the entire device if no
length was provided. The output device must be a Device DAX device.
`-l, --len`
The length in bytes to perform the I/O. To make passing in size easier
for kibi, mebi, gibi, and tebi bytes, *len* may include unit suffix.
The *len* format must be compliant with the format specified in IEC 80000-13,
IEEE 1541 or the Metric Interchange Format. These standards accept SI units
with obligatory B - kB, MB, GB, ... (multiplier by 1000) suffixes,
and IEC units with optional "iB" - KiB, MiB, GiB, ..., K, M, G, ...
(multiplier by 1024) suffixes.
`-s, --seek`
The number of bytes to skip over on the output before performing a write.
The same suffixes are accepted as for *len*.
`-k, --skip`
The number of bytes to skip over on the input before performing a read.
The same suffixes are accepted as for *len*.
`-V, --version`
Prints the version of **daxio**.
`-h, --help`
Prints synopsis and list of options.
# EXAMPLE #
```
# daxio --zero /dev/dax1.0
# daxio --input=/dev/dax1.0 --output=/home/myfile --len=2M --seek=4096
# cat /dev/zero | daxio --output=/dev/dax1.0
# daxio --input=/dev/zero --output=/dev/dax1.0 --skip=4096
```
# SEE ALSO #
**daxctl**(1), **ndctl**(1)
and **<http://pmem.io>**
| 4,577 | 33.421053 | 87 |
md
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.