xdr_restrict_buflen(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 to xdr_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 returns 0 and 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->buflen to newbuflen and makes sure xdr->end is set at most offset newbuflen from the start of the buffer. Iconic. Periodt. πŸ’…
ngl the -1 return is the "you already messed up" signal and the 0 return 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 🫢:


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