xdr_stream_encode_u32(9)
π« xdr_stream_encode_u32 β it's in the Kernel API Manual, bestie π«
okay so picture this: you're deep in kernel land, ./include/linux/sunrpc/xdr.h is literally right there, and you just need to squash a number into an XDR buffer. That's the whole gig. This little icon does exactly one thing and does it slay. β¨
π NAME π
xdr_stream_encode_u32 β Encode a 32-bit integer</p> π
Like, that's it. That's the function. One job, zero drama.
β¨ SYNOPSIS β¨
ssize_t xdr_stream_encode_u32 (struct xdr_stream *xdr , __u32 n );
Look at her. ssize_t coming back at you, pointer in, integer in. Clean. π
π ARGUMENTS π
xdrβ pointer toxdr_stream. Yeah, the stream. The whole vibe. It's where the encoding happens, so hand her over gently. π«Άnβ integer to encode. That's the__u32bestie, the actual number going in. πΈ
π₯ RETURN π₯
On success, returns length in bytes of XDR buffer consumed β and if the XDR buffer overflows? -EMSGSIZE. π No cap, that's the error, so check your return value, bestie, don't just assume it worked.
lowkey important: successful return = bytes consumed. Failure = -EMSGSIZE. Those are two very different energies. π
π¦ SEE ALSO π¦
Kernel file ./include/linux/sunrpc/xdr.h β and honestly the whole friend group:
xdr_set_scratch_buffer(9)xdr_set_scratch_folio(9)xdr_reset_scratch_buffer(9)xdr_commit_encode(9)xdr_stream_remaining(9)xdr_align_size(9)xdr_pad_size(9)xdr_stream_encode_item_present(9)xdr_stream_encode_item_absent(9)xdr_encode_bool(9)xdr_stream_encode_bool(9)xdr_stream_encode_be32(9)xdr_stream_encode_u64(9)xdr_stream_encode_opaque_inline(9)xdr_stream_encode_opaque_fixed(9)xdr_stream_encode_opaque(9)xdr_stream_encode_uint32_array(9)xdr_item_is_absent(9)xdr_item_is_present(9)xdr_stream_decode_bool(9)xdr_stream_decode_u32(9)xdr_stream_decode_be32(9)xdr_stream_decode_u64(9)xdr_stream_decode_opaque_fixed(9)xdr_stream_decode_opaque_inline(9)xdr_stream_decode_uint32_array(9)
whole encode gang, whole decode gang, all accounted for. iykyk π
mwah, that's the page π§ source lives over in ./include/linux/sunrpc, dated October 2026, and this whole manual moment is filed under xdr_stream_encode_u32(9). go encode something iconic, bestie ππ
π¦ 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