xdr_restrict_buflen(9)
β¨ xdr_restrict_buflen π
ok so this is a page from the Kernel API Manual bestie β section 9, kernel land, we're deep in it π«Ά
πΈ NAME πΈ
xdr_restrict_buflen β decrease available buffer space β¨ like literally just shrink the vibe of how much room you've got left
π SYNOPSIS π
int xdr_restrict_buflen (struct xdr_stream *xdr , int newbuflen );
π¦ ARGUMENTS π¦
xdrβ pointer toxdr_streamπ (yes the main character struct, we love her)newbuflenβ the new maximum number of bytes available, a.k.a. your new budget bestie πΈ
π DESCRIPTION π
Okay so what this does is it adjusts our idea of how much space is available in the buffer. That's it. That's the whole thing. A little vibe check on the buffer's capacity β¨
But it's giving conditional, so listen up:
- If we've already used too much space in the buffer β it returns
-1. Yeah. It's over, no cap π - If the available space is already smaller than
newbuflen, it returns0and does nothing. Like it literally does not touch anything, it just says "been there, smaller already" π - Otherwise (the actual slay case), it adjusts
xdr->buf->buflentonewbuflenand makes surexdr->endis set at most offsetnewbuflenfrom the start of the buffer. Iconic. Periodt. π
ngl the-1return is the "you already messed up" signal and the0return is the "no changes needed, we're chill" signal β keep those straight bestie π§
π₯ SEE ALSO π₯
Kernel file ./net/sunrpc/xdr.c β and honestly the entire xdr cinematic universe, here's the whole friend group π«Ά:
xdr_encode_opaque_fixed(9)xdr_encode_opaque(9)xdr_terminate_string(9)xdr_buf_to_bvec(9)xdr_buf_to_sg(9)xdr_buf_to_sg_alloc(9)xdr_inline_pages(9)_shift_data_left_pages(9)_shift_data_right_pages(9)_copy_to_pages(9)_copy_from_pages(9)xdr_buf_pages_zero(9)xdr_shrink_bufhead(9)xdr_shrink_pagelen(9)xdr_stream_pos(9)xdr_page_pos(9)xdr_init_encode(9)xdr_init_encode_pages(9)__xdr_commit_encode(9)xdr_reserve_space(9)xdr_reserve_space_vec(9)xdr_truncate_encode(9)xdr_truncate_decode(9)xdr_write_pages(9)xdr_init_decode(9)xdr_init_decode_pages(9)xdr_finish_decode(9)xdr_inline_decode(9)xdr_read_pages(9)xdr_set_pagelen(9)xdr_enter_page(9)xdr_buf_subsegment(9)xdr_stream_subsegment(9)xdr_stream_move_subsegment(9)xdr_stream_zero(9)xdr_buf_trim(9)xdr_stream_decode_string_dup(9)xdr_stream_decode_opaque_auth(9)xdr_stream_encode_opaque_auth(9)
ok that's the whole page π this beautiful thing lives in ./net/sunrpc and the manual's dated October 2026 β go forth and shrink those buffers responsibly bestie, mwah ππ§β¨
π¦ 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