__put_unaligned_t(9)
π NAME π
__put_unaligned_t β bestie, this is the one that writes an unaligned value to memory β¨
So this is a kernel API manual page (that's the <blue>9</blue> situation, iykyk), and honestly? It's giving "tiny function, big responsibilities" π
πΈ SYNOPSIS πΈ
__put_unaligned_t (type , val , ptr );
Periodt. That's the whole vibe check. Three arguments, no cap π
π¦ ARGUMENTS π¦
typeβ the type of the value you're storing. Like, what kind of little guy is going in there πvalβ the actual value being stored. The main character, fr fr βptrβ the pointer you're storing to. The address. The destination. The whole point π―
β¨ DESCRIPTION β¨
Okay so here's the tea β β this thing uses memcpy to pull off an unaligned, type-sized store, and the reason it does that is lowkey iconic: it avoids the undefined behavior you'd get from sketchy approaches like type punning, which would need -fno-strict-aliasing just to be correct π Not the vibe. We don't do that here.
So memcpy is the safe path, and the void* cast? That one's doing quiet queen work β it silences ubsan warnings π«Ά Literally the cast is just standing there being a hero and nobody claps.
No undefined behavior, no warnings, no drama. Slay π β¨
Ngl, "avoids undefined behavior" is the entire personality of this function and honestly? Respect. π₯
π§ SEE ALSO π§
- Kernel file
./tools/include/vdso/unaligned.hβ go read it, it's the source of truth π __get_unaligned_t(9)β the read counterpart, its other half, its soulmate π₯Ίπ
ππ Cute sign-off time ππ
This little love letter lives in ./tools/include/vdso, dated October 2026, and its name is β say it with me β __put_unaligned_t(9). Bye bestie, go write some unaligned values safely ππ¦β¨
π¦ 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