.\" Automatically generated by Pandoc 2.9.2.1 .\" .TH "" "" "2023-05-26" "PMDK - " "PMDK Programmer's Manual" .hy .\" SPDX-License-Identifier: BSD-3-Clause .\" Copyright 2019-2020, Intel Corporation .SH NAME .PP \f[B]pmem2_source_alignment\f[R]() - returns data source alignment .SH SYNOPSIS .IP .nf \f[C] #include struct pmem2_source; int pmem2_source_alignment(const struct pmem2_source *source, size_t *alignment); \f[R] .fi .SH DESCRIPTION .PP The \f[B]pmem2_source_alignment\f[R]() function retrieves the alignment of offset and length needed for \f[B]pmem2_map_new\f[R](3) to succeed. The alignment is stored in \f[I]*alignment\f[R]. .SH RETURN VALUE .PP The \f[B]pmem2_source_alignment\f[R]() function returns 0 on success. If the function fails, the \f[I]*alignment\f[R] variable is left unmodified and a negative error code is returned. .SH ERRORS .PP The \f[B]pmem2_source_alignment\f[R]() can fail with the following errors: .PP On all systems: .IP \[bu] 2 \f[B]PMEM2_E_INVALID_ALIGNMENT_VALUE\f[R] - operating system returned unexpected alignment value (eg. it is not a power of two). .PP on Linux: .IP \[bu] 2 \f[B]PMEM2_E_INVALID_FILE_TYPE\f[R] - file descriptor points to a character device other than Device DAX. .IP \[bu] 2 \f[B]PMEM2_E_INVALID_ALIGNMENT_FORMAT\f[R] - kernel query for Device DAX alignment returned data in invalid format. .IP \[bu] 2 -\f[B]errno\f[R] set by failing \f[B]fstat\f[R](2), while trying to validate the file descriptor. .IP \[bu] 2 -\f[B]errno\f[R] set by failing \f[B]realpath\f[R](3), while trying to determine whether fd points to a Device DAX. .IP \[bu] 2 -\f[B]errno\f[R] set by failing \f[B]read\f[R](2), while trying to determine Device DAX\[cq]s alignment. .IP \[bu] 2 -\f[B]errno\f[R] set by failing \f[B]strtoull\f[R](3), while trying to determine Device DAX\[cq]s alignment. .PP On FreeBSD: .IP \[bu] 2 \f[B]PMEM2_E_INVALID_FILE_TYPE\f[R] - file descriptor points to a directory, block device, pipe, socket, or character device. .IP \[bu] 2 -\f[B]errno\f[R] set by failing \f[B]fstat\f[R](2), while trying to validate the file descriptor. .SH SEE ALSO .PP \f[B]errno\f[R](3), \f[B]fstat\f[R](2), \f[B]realpath\f[R](3), \f[B]read\f[R](2), \f[B]strtoull\f[R](3), \f[B]pmem2_config_new\f[R](3), \f[B]pmem2_source_from_handle\f[R](3), \f[B]pmem2_source_from_fd\f[R](3), \f[B]libpmem2\f[R](7) and \f[B]\f[R]