STRUCT VGETRANDOM_STATE(9)
okay so welcome to the struct vgetrandom_state page, bestie β this is from the Kernel API Manual, section 9, and itβs giving kernel-internals glam π
β¨
β¨ NAME β¨
struct vgetrandom_state β State used by vDSO getrandom().
π¦ SYNOPSIS π¦
hereβs the whole struct, no edits, no cap:
struct vgetrandom_state {
union {
struct {
u8 batch[CHACHA_BLOCK_SIZE * 3 / 2];
u32 key[CHACHA_KEY_SIZE / sizeof(u32)];
};
u8 batch_key[CHACHA_BLOCK_SIZE * 2];
};
u64 generation;
u8 pos;
bool in_use;
};
π Members π
okay bestie, letβs meet the members one by one β they all matter, fr fr π«Ά
{unnamed_union}β anonymous. literally a union with no name, just vibing.{unnamed_struct}β anonymous. same energy for the nested struct.batchβ One and a half ChaCha20 blocks of buffered RNG output. iconic little buffer πkeyβ Key to be used for generating next batch.batch_keyβ Union of the prior two members, which is exactly two full ChaCha20 blocks in size, so thatbatchandkeycan be filled together.generationβ Snapshot ofrng_info->generationin the vDSO data page at the timekeywas generated.posβ Offset intobatchof the next available random byte.in_useβ Reentrancy guard for reusing a state within the same thread due to signal handlers.
π SEE ALSO π
- Kernel file
./include/vdso/getrandom.h __arch_chacha20_blocks_nostack(9),__vdso_getrandom(9)
thatβs the whole vibe check, bestie π«Ά β source/version: ./include/vdso, date: October 2026. stay hydrated, keep your unions anonymous if you want, and never skip the reentrancy guard ππ₯
π¦ 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