pmem2_source_device_usc3
Returns the unsafe shutdown counter value of a device
Usage
-
#include <libpmem2.h>struct pmem2_source;int pmem2_source_device_usc(const struct pmem2_source *source, uint64_t *usc);
Overview
The pmem2_source_device_usc() function retrieves the sum of the unsafe shutdown count(USC) values of all hardware devices backing the data source and stores it in *usc.
Please refer to libpmem2_unsafe_shutdown(7) for detailed description on how to properly consume this information.
Return value
The pmem2_source_device_usc() function returns 0 on success. If the function fails, the *usc variable content is left unmodified and a negative error code is returned.
Errors
The pmem2_source_device_usc() can fail with the following errors:
On all systems:
- •
-
PMEM2_E_NOSUPP- the underlying platform does not expose unsafe shutdown count information.
On Windows:
- •
-
-
errnoequivalent of return code set by failingGetFinalPathNameByHandleW(), while trying to resolve volume path from the file handle.
- •
-
-
errnoset by failing malloc(3), while trying to allocate a buffer for storing volume path.
- •
-
-
errnoequivalent of return code set by failingCreateFileW(), while trying to obtain a handle to the volume.
- •
-
-
errnoequivalent of return code set by failingDeviceIoControl(), while trying to obtain volume USC value.
On Linux:
- •
-
-
errnoset by failing fstat(2), while trying to validate the file descriptor.
- •
-
-
errnoset by failingndctl_new(), while trying to initiate a new NDCTL library context.
- •
-
-
errnoset by failingndctl_dimm_get_dirty_shutdown(), while trying to obtain DIMM USC value.
Releases
3 releases since Debian 11 (Bullseye); the text changed 2 times.