PMEMLOG_APPENDV(3)
π PMEMLOG_APPEND π
okay bestie, welcome to pmemlog_append() and pmemlog_appendv() β two little legends from the PMDK Programmer's Manual π
β οΈ heads up queen: both of these are DEPRECATED. Like, they still work, but they're giving "we don't talk about that era anymore". Use with the knowledge that the universe is gently side-eyeing them.
They do one thing and they do it fabulously: append bytes to the persistent memory resident log file. periodt. β¨
π SYNOPSIS
#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
β¨ pmemlog_append()
So basically, pmemlog_append() takes count bytes from buf and appends them to the current write offset in the log memory pool plp. It's literally the same energy as appending to a file β you know the vibe.
And here's the slay part: the append is atomic and cannot be torn by a program failure or system crash. no cap. ππ₯
β¨ pmemlog_appendv()
pmemlog_appendv() 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 gets appended atomically, as if the buffers in iov were concatenated in order. π¦
And same deal: the append is atomic and cannot be torn by a program failure or system crash. iconic behaviour fr fr π
π RETURN VALUE
On success, both pmemlog_append() and pmemlog_appendv() return 0. π₯³
On error, they return -1 and set errno appropriately. (yes bestie, that's the standard "something went wrong" ritual.)
π ERRORS
EINVALβ the vector count iovcnt is less than zero. ma'am. that's not a number of buffers, that's a cry for help.ENOSPCβ there is no room for the data in the log file. the log said "full, not accepting new entries, respectfully". π«EROFSβ the log file is open in read-only mode. you cannot write to it. you simply cannot. read-only means read-only, babe. π
π§ NOTES
okay so this is important and lowkey kinda unhinged: since libpmemlog(7) is designed as a low-latency code path, many of the checks that the operating system routinely does for writev(2) are just not practical in the library's implementation of pmemlog_appendv().
π Not a single attempt is made to detect NULL or incorrect pointers. For example. None. Zero. It's giving "you're on your own, bestie, but with love".
So like, please double-check your own pointers. The library trusts you completely and that is both beautiful and terrifying. π«Ά
π SEE ALSO
writev(2), libpmemlog(7) and <https://pmem.io>
PMDK Β· 2023-05-31 β that's the source, the version, and the date, mwah π hope this helped, go forth and append responsibly, ily πβ¨π¦
π¦ where this page comes from
- debian trixie: libpmemlog-dev 1.13.1-1.1+b1 Β· BSD-3-Clause
- ubuntu noble: libpmemlog-dev 1.13.1-1.1ubuntu2 Β· BSD-3-Clause
- ubuntu questing: libpmemlog-dev 1.13.1-1.1ubuntu3
- ubuntu resolute: libpmemlog-dev 1.13.1-1.1ubuntu4 Β· BSD-3-Clause
- ubuntu stonking: libpmemlog-dev 1.13.1-1.1ubuntu5 Β· BSD-3-Clause
- π the page's license: BSD-3-Clause
- Copyright 2017-2023, Intel Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms