zstd_decompress_dctx(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ zstd_decompress_dctx β€” kernel API manual, but make it make sense

okay so bestie, welcome to zstd_decompress_dctx(9) β€” this is the one from the Kernel API Manual, and it's genuinely the moment you've been waiting for: it decompresses zstd compressed src into dst. that's the whole vibe. compressed goo goes in, real bytes come out, no cap ✨


🌸 NAME 🌸

zstd_decompress_dctx β€” decompress zstd compressed src into dst

like. literally that. it takes the zstd-compressed thing and un-compresses it into the buffer of your dreams πŸŽ€


✨ SYNOPSIS ✨

size_t zstd_decompress_dctx (zstd_dctx *dctx , void *dst , size_t
dst_capacity , const void *src , size_t src_size );

five arguments, one size_t coming back at you. it's giving "small signature, big responsibilities" πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • dctx β€” The decompression context. this is your main character ✨ the little state object that knows how to do the decompressing. you bring the context, it brings the skills.
  • dst β€” The buffer to decompress src into. this is where the freshly-decompressed bytes land. make room, bestie, because it's moving in 🫢
  • dst_capacity β€” The size of the destination buffer. Must be at least as large as the decompressed size. read that again, fr fr β€” it is a must. and if you, the caller, cannot upper bound the decompressed size? then honestly babe, it's better to use the streaming API instead. don't be out here guessing capacities, it's not the look 😭
  • src β€” The zstd compressed data to decompress. and good news: multiple concatenated frames and skippable frames are allowed πŸ”₯ so you can absolutely stack them, it ate.
  • src_size β€” The exact size of the data to decompress. exact. not approximate. not "around there". exact πŸ’€

πŸ‘‘ RETURN πŸ‘‘

you get back the decompressed size, or else an error.

and how do you know which one you got? check it with zstd_is_error, obviously πŸ™ˆ don't just vibe-check the return value and hope.

⚠️ real talk: a size_t can be a perfectly valid-looking number and an error. always run it through zstd_is_error before you trust it with your life.

🌈 SEE ALSO 🌈

everything else in this family, because the kernel zstd API said "we're a package deal" and honestly? iconic πŸ’–

Kernel file ./include/linux/zstd.h and also:


okay that's the whole page, you're officially educated πŸ’…πŸ¦‹

this lil masterpiece lives at ./include/linux and it's dated October 2026, and it's filed under zstd_decompress_dctx(9) β€” go decompress something, bestie, you've got this βœ¨πŸŽ€

πŸ“¦ where this page comes from