---
name: "pmemlog_append"
section: "3"
platform: "linux"
package: "libpmemlog-dev"
version: "1.13.1-1.1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/pmemlog_append"
---

# pmemlog\_append(3)

append bytes to the persistent memory resident log file

## NAME

**pmemlog\_append**()(DEPRECATED), **pmemlog\_appendv**()(DEPRECATED) - append bytes to the persistent memory resident log file

## 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

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)](/writev/2.md). 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**(7)](/libpmemlog/7.md) is designed as a low-latency code path, many of the checks routinely done by the operating system for [**writev**(2)](/writev/2.md) 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)](/writev/2.md), [**libpmemlog**(7)](/libpmemlog/7.md) and **\<https://pmem.io\>**
