| 1 | --- |
| 2 | date: 2020-5-3 |
| 3 | footer: libibverbs |
| 4 | header: "Libibverbs Programmer's Manual" |
| 5 | layout: page |
| 6 | license: 'Licensed under the OpenIB.org BSD license (FreeBSD Variant) - See COPYING.md' |
| 7 | section: 3 |
| 8 | title: ibv_import_device |
| 9 | --- |
| 10 | |
| 11 | # NAME |
| 12 | |
| 13 | ibv_import_device - import a device from a given command FD |
| 14 | |
| 15 | # SYNOPSIS |
| 16 | |
| 17 | ```c |
| 18 | #include <infiniband/verbs.h> |
| 19 | |
| 20 | struct ibv_context *ibv_import_device(int cmd_fd); |
| 21 | |
| 22 | ``` |
| 23 | |
| 24 | |
| 25 | # DESCRIPTION |
| 26 | |
| 27 | **ibv_import_device()** returns an *ibv_context* pointer that is associated with the given |
| 28 | *cmd_fd*. |
| 29 | |
| 30 | The *cmd_fd* is obtained from the ibv_context cmd_fd member, which must be dup'd (eg by dup(), SCM_RIGHTS, etc) |
| 31 | before being passed to ibv_import_device(). |
| 32 | |
| 33 | Once the *ibv_context* usage has been ended *ibv_close_device()* should be called. |
| 34 | This call may cleanup whatever is needed/opposite of the import including closing the command FD. |
| 35 | |
| 36 | # RETURN VALUE |
| 37 | |
| 38 | **ibv_import_device()** returns a pointer to the allocated RDMA context, or NULL if the request fails. |
| 39 | |
| 40 | # SEE ALSO |
| 41 | |
| 42 | **ibv_open_device**(3), |
| 43 | **ibv_close_device**(3), |
| 44 | |
| 45 | # AUTHOR |
| 46 | |
| 47 | Yishai Hadas <[email protected]> |
| 48 |