---
name: "rpma_mr_reg"
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_mr_reg"
---

# rpma\_mr\_reg(3)

create a local memory registration object

## NAME

**rpma\_mr\_reg** - create a local memory registration object

## SYNOPSIS

```
      #include <librpma.h>
      struct rpma_peer;
      struct rpma_mr_local;
      int rpma_mr_reg(struct rpma_peer *peer, void *ptr, size_t size, int usage,
              struct rpma_mr_local **mr_ptr);
```

## DESCRIPTION

**rpma\_mr\_reg**() registers a memory region and creates a local memory registration object. The usage parameter specifies the operations that can be performed on the given memory region which should be expressed as bitwise-inclusive OR of the following:

- •

  RPMA\_MR\_USAGE\_READ\_SRC - memory used as a source of the read operation

- •

  RPMA\_MR\_USAGE\_READ\_DST - memory used as a destination of the read operation

- •

  RPMA\_MR\_USAGE\_WRITE\_SRC - memory used as a source of the write operation

- •

  RPMA\_MR\_USAGE\_WRITE\_DST - memory used as a destination of the write operation

- •

  RPMA\_MR\_USAGE\_FLUSH\_TYPE\_VISIBILITY - memory with available flush operation

- •

  RPMA\_MR\_USAGE\_FLUSH\_TYPE\_PERSISTENT - memory with available persistent flush operation

- •

  RPMA\_MR\_USAGE\_SEND - memory used for send operation

- •

  RPMA\_MR\_USAGE\_RECV - memory used for receive operation

## RETURN VALUE

The **rpma\_mr\_reg**() function returns 0 on success or a negative error code on failure. **rpma\_mr\_reg**() does not set \*mr\_ptr value on failure.

## ERRORS

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

- •

  RPMA\_E\_INVAL - peer or ptr or mr\_ptr is NULL

- •

  RPMA\_E\_INVAL - size equals 0

- •

  RPMA\_E\_NOMEM - out of memory

- •

  RPMA\_E\_PROVIDER - memory registration failed

## SEE ALSO

[**rpma\_conn\_req\_recv**(3)](/rpma_conn_req_recv/3.md), [**rpma\_mr\_dereg**(3)](/rpma_mr_dereg/3.md), [**rpma\_mr\_get\_descriptor**(3)](/rpma_mr_get_descriptor/3.md), [**rpma\_mr\_get\_descriptor\_size**(3)](/rpma_mr_get_descriptor_size/3.md), [**rpma\_peer\_new**(3)](/rpma_peer_new/3.md), [**rpma\_read**(3)](/rpma_read/3.md), [**rpma\_recv**(3)](/rpma_recv/3.md), [**rpma\_send**(3)](/rpma_send/3.md), [**rpma\_write**(3)](/rpma_write/3.md), [**rpma\_atomic\_write**(3)](/rpma_atomic_write/3.md), [**librpma**(7)](/librpma/7.md) and https://pmem.io/rpma/
