zstd_decompress_dctx(9)
π 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 decompresssrcinto. 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: asize_tcan be a perfectly valid-looking number and an error. always run it throughzstd_is_errorbefore 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:
zstd_compress_bound(9)zstd_is_error(9)zstd_get_error_code(9)zstd_get_error_name(9)zstd_min_clevel(9)zstd_max_clevel(9)zstd_default_clevel(9)zstd_get_params(9)zstd_get_cparams(9)zstd_cctx_set_param(9)zstd_cctx_workspace_bound(9)zstd_cctx_workspace_bound_with_ext_seq_prod(9)zstd_init_cctx(9)zstd_compress_cctx(9)zstd_create_cctx_advanced(9)zstd_free_cctx(9)zstd_create_cdict_byreference(9)zstd_free_cdict(9)zstd_compress_using_cdict(9)zstd_dctx_workspace_bound(9)zstd_init_dctx(9)zstd_create_ddict_byreference(9)zstd_free_ddict(9)zstd_create_dctx_advanced(9)zstd_free_dctx(9)zstd_decompress_using_ddict(9)zstd_cstream_workspace_bound(9)zstd_cstream_workspace_bound_with_ext_seq_prod(9)zstd_init_cstream(9)zstd_reset_cstream(9)zstd_compress_stream(9)zstd_flush_stream(9)zstd_end_stream(9)zstd_dstream_workspace_bound(9)zstd_init_dstream(9)zstd_reset_dstream(9)zstd_decompress_stream(9)zstd_find_frame_compressed_size(9)zstd_get_frame_header(9)zstd_compress_sequences_and_literals(9)
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
- 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