__put_unaligned_t(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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