---
name: "ibv_alloc_pd"
section: "3"
platform: "linux"
package: "rdma-core"
version: "65.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/ibv_alloc_pd"
---

# ibv\_alloc\_pd(3)

allocate or deallocate a protection domain (PDs)

## NAME

ibv\_alloc\_pd, ibv\_dealloc\_pd - allocate or deallocate a protection domain (PDs)

## SYNOPSIS

```
#include <infiniband/verbs.h>

struct ibv_pd *ibv_alloc_pd(struct ibv_context *context);

int ibv_dealloc_pd(struct ibv_pd *pd);
```

## DESCRIPTION

**ibv\_alloc\_pd()** allocates a PD for the RDMA device context  *context.*

**ibv\_dealloc\_pd()** deallocates the PD *pd.*

## RETURN VALUE

**ibv\_alloc\_pd()** returns a pointer to the allocated PD, or NULL if the request fails, and errno is set to indicate the reason.

**ibv\_dealloc\_pd()** returns 0 on success, or the value of errno on failure (which indicates the failure reason).

## NOTES

**ibv\_dealloc\_pd()** may fail if any other resource is still associated with the PD being freed.

## SEE ALSO

[**ibv\_reg\_mr**(3)](/ibv_reg_mr/3.md), [**ibv\_create\_srq**(3)](/ibv_create_srq/3.md), [**ibv\_create\_qp**(3)](/ibv_create_qp/3.md), [**ibv\_create\_ah**(3)](/ibv_create_ah/3.md), [**ibv\_create\_ah\_from\_wc**(3)](/ibv_create_ah_from_wc/3.md)

## AUTHORS

- Dotan Barak \<dotanba@gmail.com\>
