---
name: "rpma_write"
section: "3"
platform: "linux"
package: "librpma-dev"
version: "1.3.0-2+b3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rpma_write"
---

# rpma\_write(3)

initiate the write operation

## NAME

**rpma\_write** - initiate the write operation

## SYNOPSIS

```
      #include <librpma.h>
      struct rpma_conn;
      struct rpma_mr_local;
      struct rpma_mr_remote;
      int rpma_write(struct rpma_conn *conn,
                      struct rpma_mr_remote *dst, size_t dst_offset,
                      const struct rpma_mr_local *src, size_t src_offset,
                      size_t len, int flags, const void *op_context);
```

## DESCRIPTION

**rpma\_write**() initiates transferring data from the local memory to the remote memory. To write a 0 bytes message, set src and dst to NULL and src\_offset, dst\_offset and len to 0.

The attribute flags set the completion notification indicator:

- •

  RPMA\_F\_COMPLETION\_ON\_ERROR - generate the completion on error

- •

  RPMA\_F\_COMPLETION\_ALWAYS - generate the completion regardless of result of the operation.

op\_context is returned in the wr\_id field of the completion (struct ibv\_wc).

## RETURN VALUE

The **rpma\_write**() function returns 0 on success or a negative error code on failure.

## ERRORS

**rpma\_write**() can fail with the following errors:

- •

  RPMA\_E\_INVAL - conn == NULL \|\| flags == 0

- •

  RPMA\_E\_INVAL - dst == NULL && (src != NULL \|\| src\_offset != 0 \|\| dst\_offset != 0 \|\| len != 0)

- •

  RPMA\_E\_INVAL - src == NULL && (dst != NULL \|\| src\_offset != 0 \|\| dst\_offset != 0 \|\| len != 0)

- •

  RPMA\_E\_PROVIDER - [**ibv\_post\_send**(3)](/ibv_post_send/3.md) failed

## SEE ALSO

[**rpma\_conn\_req\_connect**(3)](/rpma_conn_req_connect/3.md), [**rpma\_mr\_reg**(3)](/rpma_mr_reg/3.md), [**rpma\_mr\_remote\_from\_descriptor**(3)](/rpma_mr_remote_from_descriptor/3.md), [**librpma**(7)](/librpma/7.md) and https://pmem.io/rpma/
