STORE(9)

πŸ’– STORE πŸ’–

okay bestie, welcome to STORE(9) β€” that's section 9 of the Kernel Developer's Manual, so you already know this is kernel-dev territory, not your lil' userland playground. no cap. ✨


✨ NAME ✨

store, subyte, suword β€” the whole squad that stores data to user-space. 🫢


🌸 SYNOPSIS 🌸

#include <sys/types.h>
#include <sys/time.h>
#include <sys/systm.h>

int
subyte(volatile void *base, int byte);

int
suword(volatile void *base, long word);

int
suword16(volatile void *base, int word);

int
suword32(volatile void *base, int32_t word);

int
suword64(volatile void *base, int64_t word);

#include <sys/resourcevar.h>
not me noticing that last #include <sys/resourcevar.h> just vibing at the bottom of the synopsis πŸ’€ yeah bestie, that's exactly how it's written, we keep it.

πŸŽ€ DESCRIPTION πŸŽ€

so the store functions exist to copy small amounts of data over to user-space. tiny little transfers, main character energy, no drama. ✨

if the write actually goes through, it's performed atomically β€” the way that it just lands, all at once, no half-sends. πŸ‘‘

but β€” and this is the important part, bestie, lowkey do not skip this β€” the data written must be naturally aligned. that's the rule. respect it. πŸ™ˆ

here's the whole roster and what each one does:

  • subyte() β€” stores a byte of data to the user-space address base. one lil' byte, iconic.
  • suword() β€” stores a word of data to the user-space address base.
  • suword16() β€” stores 16 bits of data to the user-space address base. half a word, still slaying.
  • suword32() β€” stores 32 bits of data to the user-space address base.
  • suword64() β€” stores 64 bits of data to the user-space address base. the big one. absolute unit. πŸ’…

⭐ RETURN VALUES ⭐

the store functions are so simple about it:

  • 0 β€” success πŸŽ‰ (ate, no crumbs)
  • -1 β€” failure 😭 (it's giving "did not work")

πŸ¦‹ SEE ALSO πŸ¦‹

the little sibling pages, fr fr β€” if store is the "put it there", these are the rest of the family. go read them, bestie. πŸ“šβœ¨

and that's the whole vibe, babe. this lil' page lives in the Debian corner of the kernel dev manual, dated April 17, 2018, filed under STORE(9). 🩷 thank u for coming to my ted talk, now go align your data properly. periodt. πŸ‘‘πŸ’–

πŸ“¦ where this page comes from