STRUCT DMA_BUF_IMPORT_SYNC_FILE(9)
π struct dma_buf_import_sync_file(9) β from the Kernel API Manual, bestie β¨
okay so picture this: it's a kernel API manual page, it lives in ./include/uapi/linux, and it's here to explain one (1) struct that lets you shove a sync_file into a dma-buf. that's the whole vibe. let's get into it π«Ά
πΈ NAME πΈ
struct dma_buf_import_sync_file β literally just "Insert a sync_file into a dma-buf". that's the assignment and it ate π
β¨ SYNOPSIS β¨
here's the struct in all its glory, copied exactly, no cap:
struct dma_buf_import_sync_file {
__u32 flags;
__s32 fd;
};
two members. that's it. small struct, big main character energy π
π Members π
flagsβ the read/write flags, aka the personality of the whole operation π
it must be DMA_BUF_SYNC_READ, DMA_BUF_SYNC_WRITE, or both. no third option, bestie, don't try it π
so if DMA_BUF_SYNC_READ is set and DMA_BUF_SYNC_WRITE is not set, this inserts the sync_file as a read-only fence. translation: any subsequent implicitly synchronized writes to this dma-buf will wait on this fence, but reads will not. reads are just gonna go do their thing, unbothered β¨
and if DMA_BUF_SYNC_WRITE is set, this inserts the sync_file as a write fence. now all subsequent implicitly synchronized access to this dma-buf will wait on this fence. everyone's waiting. nobody's moving until the fence says so π
fdβ the sync file descriptor π¦
π Description π
so here's the lore π: userspace can perform a DMA_BUF_IOCTL_IMPORT_SYNC_FILE to insert a sync_file into a dma-buf, and the whole reason is implicit synchronization with other dma-buf consumers. it's a matchmaking service for sync paradigms, fr fr π
this is what lets clients using explicitly synchronized APIs β think Vulkan β inter-op with dma-buf consumers that expect implicit synchronization, like OpenGL or most media drivers/video. iconic crossover event, honestly π₯
π SEE ALSO π
- Kernel file
./include/uapi/linux/dma-buf.hstruct dma_buf_sync(9) struct dma_buf_export_sync_file(9)
go read those next, iykyk π
β real talk:flagsisn't a free-for-all. it'sDMA_BUF_SYNC_READ,DMA_BUF_SYNC_WRITE, or both β that's the rule, periodt.
and that's the page!! π§ source/version: ./include/uapi/linux, dated October 2026, and the footer name is struct dma_...rt_sync_file(9) (yes it's truncated, no we're not fixing it, it's giving mysterious π). mwah, go sync something ππΈ
π¦ 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