IBV_OPEN_DEVICE(3)

πŸ“¦
version 64.0 Β· 2 versions
  • 64.0 Β· alpine 3.24, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 65.0 Β· arch rolling, nixpkgs unstable
, in alpine 3.24, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– IBV_OPEN_DEVICE πŸ’–

okay bestie, welcome to ibv_open_device and ibv_close_device β€” the glow-up-and-glow-down of RDMA device contexts. this is from the Libibverbs Programmer's Manual, and it's literally the front door of the whole verbs situation. you open a device, you get a context, you do stuff, you close it. iconic. πŸ‘‘


✨ NAME ✨

ibv_open_device, ibv_close_device β€” open and close an RDMA device context πŸ¦‹


🌸 SYNOPSIS 🌸

#include <infiniband/verbs.h>

struct ibv_context *ibv_open_device(struct ibv_device *device);

int ibv_close_device(struct ibv_context *context);

πŸ’… DESCRIPTION πŸ’…

ibv_open_device() opens the device device and creates a context for further use. it's giving "hi yes i'd like to actually use this hardware please". ✨

ibv_close_device() closes the device context context. bye bestie, thank u for ur service. 🫢


πŸŽ€ RETURN VALUE πŸŽ€

ibv_open_device() returns a pointer to the allocated device context, or NULL if the request fails. so like, check for NULL fr fr, don't just rawdog that pointer. 😭

ibv_close_device() returns 0 on success, -1 on failure. classic.


πŸ”₯ NOTES πŸ”₯

lowkey the most important part, bestie, pay attention πŸ‘€

ibv_close_device() does not release all the resources allocated using context context. to avoid resource leaks, the user should release all associated resources before closing a context. that's a whole lot of cleanup you gotta do yourself β€” the close is not gonna do it for you, it's not your mom. πŸ’€

setting the environment variable RDMAV_ALLOW_DISASSOC_DESTROY tells the library to relate an EIO from destroy commands as a success, as the kernel resources were already released. this comes to prevent memory leakage in the user space area upon device disassociation. applications using this flag cannot call ibv_get_cq_event or ibv_get_async_event concurrently with any call to an object destruction function. no cap, that concurrency thing is a hard no β€” don't do it. 🚫


🌈 SEE ALSO 🌈


πŸ‘‘ AUTHORS πŸ‘‘

Dotan Barak <dotanba@gmail.com>


and that's the whole page, bestie!! this one came from libibverbs, dated 2006-10-31, and you're reading the IBV_OPEN_DEVICE(3) page. go forth and open ur devices responsibly πŸ’œβœ¨

πŸ“¦ where this page comes from