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

# ibv\_import\_device(3)

import a device from a given command FD

## NAME

ibv\_import\_device - import a device from a given command FD

## SYNOPSIS

-

  ```
  #include <infiniband/verbs.h>
  struct ibv_context *ibv_import_device(int cmd_fd);
  ```

## DESCRIPTION

**ibv\_import\_device()** returns an *ibv\_context* pointer that is associated with the given *cmd\_fd*.

The *cmd\_fd* is obtained from the ibv\_context cmd\_fd member, which must be dup’d (eg by dup(), SCM\_RIGHTS, etc) before being passed to ibv\_import\_device().

Once the *ibv\_context* usage has been ended *ibv\_close\_device()* should be called. This call may cleanup whatever is needed/opposite of the import including closing the command FD.

## RETURN VALUE

**ibv\_import\_device()** returns a pointer to the allocated RDMA context, or NULL if the request fails, and errno is set to indicate the reason.

## SEE ALSO

[**ibv\_open\_device**(3)](/ibv_open_device/3.md), [**ibv\_close\_device**(3)](/ibv_close_device/3.md),

## AUTHOR

Yishai Hadas ⟨yishaih@mellanox.com⟩\\c
