xdr_stream_d...e_string_dup(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… xdr_stream_decode_string_dup(9) β€” the Kernel API Manual, bestie edition πŸŽ€

okay so real talk: this is a page from the Kernel API Manual, and it's about one very specific little function that decodes a variable-length string and duplicates it for you. she's giving "short but iconic." let's get into it πŸ’–


✨ NAME ✨

xdr_stream_decode_string_dup β€” Decode and duplicate variable length string

that's it. that's the whole vibe. she decodes, she duplicates, she leaves. main character energy fr fr πŸ¦‹


🌸 SYNOPSIS 🌸

ssize_t xdr_stream_decode_string_dup (struct xdr_stream *xdr , char
**str , size_t maxlen , gfp_t gfp_flags );

look at her go 😭 four whole params, returns a ssize_t, no notes.


πŸŽ€ ARGUMENTS πŸŽ€

okay so every single one of these matters, don't skip:

  • xdr β€” pointer to xdr_stream. this is your stream, your source, your whole situation.
  • str β€” location to store pointer to string. this is where the pointer to the string gets parked, bestie 🫢
  • maxlen β€” maximum acceptable string length. like a bouncer at the club, but for string length. anything longer is not getting in 🚫
  • gfp_flags β€” GFP mask to use. yes, she allocates. we'll get to that. πŸ‘€

πŸ”₯ DESCRIPTION πŸ”₯

bestie. the description section on this page is literally just the return values. no cap, that's what's on the page, so that's what you get:

Return values: on success, returns length of NUL-terminated string stored in *ptr.

and then the little list of ways it can go wrong, because of course there's a list:

  • -EBADMSG on XDR buffer overflow
  • -EMSGSIZE if the size of the string would exceed maxlen
  • -ENOMEM on memory allocation failure
ngl that -ENOMEM is the one that lives in my head rent free. remember that gfp_flags param? yeah. that's her whole job β€” she's doing an allocation in there, and if it fails you're getting -ENOMEM back, periodt. πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

she comes with a whole friend group. kernel file ./net/sunrpc/xdr.c, and then literally everyone she knows:

that's forty (40) pages. collectively they ate and left absolutely no crumbs. πŸ’…βœ¨ iykyk.


and that's the page!! 🌈 this little gem lives under ./net/sunrpc and the version tag on it is from October 2026 πŸ—“οΈ β€” so mark your calendars, bestie, and go read xdr.c if you wanna see her in her natural habitat πŸ§šπŸ’œ

mwah πŸ’‹ go decode something.

πŸ“¦ where this page comes from