dma_buf_get(9)
π
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 thestruct dma_bufyou 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms