dma_buf_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… dma_buf_get β€” bestie, let's go get that struct dma_buf

okay so picture this: you're deep in the Kernel API Manual, scrolling through dma_buf_get(9) at 2am, and you just need to know what this little function does. say less. here's the whole thing, no gatekeeping ✨


🌸 SYNOPSIS

struct dma_buf * dma_buf_get (int fd );

that's it. that's the whole vibe. one int in, one struct dma_buf * out 🫢


πŸŽ€ ARGUMENTS

  • fd β€” [in] β€” the file descriptor that's associated with the struct dma_buf you want handed back to you. that's literally it. the fd is the main character here πŸ‘‘

πŸ’– DESCRIPTION

on success, this gives you back the struct dma_buf that goes with that fd. how? it uses the file's refcounting done by fget to bump the refcount up β€” so like, the reference gets incremented and everything stays alive, iconic behavior honestly. and if things don't work out? it returns an ERR_PTR instead. no cap, that's the whole story. πŸ¦‹

lowkey important: the "refcount gets increased" part is fr fr β€” that's fget doing file refcounting for you. your returned pointer comes with a reference attached, so treat it with the respect it deserves πŸ’…

🌈 SEE ALSO

the kernel file lives at ./drivers/dma-buf/dma-buf.c, and honestly the whole friend group is here β€” go say hi to dma_buf_iter_begin(9), dma_buf_iter_next(9), implicit fence polling(9), dma_buf_set_name(9), dma buf device access(9), dma_buf_export(9), dma_buf_fd(9), dma_buf_fd_install(9), dma_buf_put(9), locking convention(9), dma_buf_dynamic_attach(9), dma_buf_attach(9), dma_buf_detach(9), dma_buf_pin(9), dma_buf_unpin(9), dma_buf_map_attachment(9), dma_buf_map_attachment_unlocked(9), dma_buf_unmap_attachment(9), dma_buf_unmap_attachment_unlocked(9), dma_buf_attach_revocable(9), dma_buf_invalidate_mappings(9), cpu access(9), dma_buf_begin_cpu_access(9), dma_buf_end_cpu_access(9), dma_buf_mmap(9), dma_buf_vmap(9), dma_buf_vmap_unlocked(9), dma_buf_vunmap(9), and last but never least dma_buf_vunmap_unlocked(9). the way that's a whole squad πŸ˜­πŸ’œ


and that's the page!! mwah πŸ’‹ this one came straight out of ./drivers/dma-buf, dated October 2026 β€” go read the source, ily, bye πŸ‘‹βœ¨

πŸ“¦ where this page comes from