---
name: "rdma_get_devices"
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/rdma_get_devices"
---

# rdma\_get\_devices(3)

Get a list of RDMA devices currently available.

## NAME

rdma\_get\_devices - Get a list of RDMA devices currently available.

## SYNOPSIS

**#include \<rdma/rdma\_cma.h\>**

**struct ibv\_context \*\* rdma\_get\_devices** **(int \****num\_devices***);**

## ARGUMENTS

- num\_devices

  If non-NULL, set to the number of devices returned.

## DESCRIPTION

Return a NULL-terminated array of opened RDMA devices.  Callers can use this routine to allocate resources on specific RDMA devices that will be shared across multiple rdma\_cm\_id's.

## RETURN VALUE

Returns an array of available RDMA devices, or NULL if the request fails.  On failure, errno will be set to indicate the failure reason.

## NOTES

The returned array must be released by calling rdma\_free\_devices.  Devices remain opened while the librdmacm is loaded.

## SEE ALSO

[rdma\_free\_devices(3)](/rdma_free_devices/3.md)
