RDMA_GET_DEVICES(3)

✨ NAME ✨

rdma_get_devices β€” bestie, this is how you get a list of all the RDMA devices that are currently available πŸ’–

It lives in the librdmacm Programmer's Manual, so you already know it's about to be cute and powerful at the same time πŸŽ€


🌸 SYNOPSIS 🌸

#include <rdma/rdma_cma.h>

struct ibv_context ** rdma_get_devices (int *num_devices);

okay so she takes one pointer and hands you back a whole array of vibes. no cap. ✨


πŸ¦‹ ARGUMENTS πŸ¦‹

  • num_devices β€” if this is non-NULL, she'll write the number of devices she returned right into it. like, she's doing your bookkeeping for you. queen behavior πŸ‘‘

πŸ’… DESCRIPTION πŸ’…

She returns a NULL-terminated array of opened RDMA devices. literally the whole roster, and the NULL at the end is her little "that's it, that's everybody" periodt πŸ’–

And why do you even care? Because callers can use this routine to allocate resources on specific RDMA devices that will be shared across multiple rdma_cm_id's. so if you've got a bunch of ids and you want them all living their best life on the same device, this is the way. main character resource-sharing energy, fr fr πŸ”₯


⭐ RETURN VALUE ⭐

You get back an array of the available RDMA devices. slay πŸ’…

But if the request fails, you get NULL. not slay 😭 And on failure, errno will be set to indicate the failure reason β€” so always check it, bestie, it's giving free information.

ngl a NULL return with no errno check is how you end up debugging at 3am. don't do that to yourself 🫢

πŸŽ€ NOTES πŸŽ€

  • The returned array must be released by calling rdma_free_devices. yes, she's handing you something, and yes, you have to give it back. clean up after yourself, icon πŸ’–
  • Devices remain opened while the librdmacm is loaded. so they're just... chilling there, open, until librdmacm dips. that's the arrangement 🌈

πŸ‘‘ SEE ALSO πŸ‘‘

  • rdma_free_devices(3) β€” the friend who takes the array back off your hands. you two are a package deal, iykyk 🧚

and that's the whole page, bestie!! this one's from librdmacm, dated 2007-05-15, and it's filed under RDMA_GET_DEVICES(3) β€” go forth and get your devices, you've got this πŸ’œβœ¨πŸ¦‹

πŸ“¦ where this page comes from