UMAD_ALLOC(3)

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

✨ UMAD_ALLOC β€” allocate memory for umad buffers ✨

okay bestie, welcome to the umad_alloc(3) page from the OpenIB Programmer's Manual πŸ’– this one's short and sweet, but it's lowkey important, so let's get into it 🫢


🌸 SYNOPSIS 🌸

#include <infiniband/umad.h>

void * umad_alloc(int num, size_t size);

πŸ’… DESCRIPTION πŸ’…

so like, umad_alloc() does exactly what it says on the tin: it allocates memory for an array of num umad buffers, each one size bytes big πŸŽ€

but here's the part you actually need to clock, bestie β€” size is NOT just the payload size. it has to include umad_size() plus the length. and that length is:

  • MAD_BLOCK_SIZE for your normal, regular-degular MADs 🌈
  • the length that umad_recv() handed back to you, if you're dealing with RMPP MADs πŸ¦‹

so basically: don't just pass the data length and call it a day. add the umad_size() on top or it's giving "why is my buffer broken" energy 😭


πŸŽ€ RETURN VALUE πŸŽ€

umad_alloc() returns NULL if it's out of memory. that's the whole thing. no fancy error codes, no secrets, just NULL. so like… check for it, okay? πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

  • umad_free(3) β€” yes queen, you gotta free what you allocate, we don't do leaks in this house πŸ’€

⭐ AUTHOR ⭐

Hal Rosenstock <halr@voltaire.com> β€” iconic behavior, we love a legend 🫢


and that's the whole vibe, bestie ✨ this little page came to you from the OpenIB crew, dated May 21, 2007, and it lives in the UMAD_ALLOC(3) section of the manual. go forth and allocate responsibly πŸ’–πŸŒΈπŸŽ€

πŸ“¦ where this page comes from