STRUCT DMA_BUF_IMPORT_SYNC_FILE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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.h struct dma_buf_sync(9)
  • struct dma_buf_export_sync_file(9)

go read those next, iykyk πŸ“š


⭐ real talk: flags isn't a free-for-all. it's DMA_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