UFETCH(9)

πŸ“¦ version 11.0, in nixpkgs unstable

πŸ’– UFETCH(9) β€” kernel developer's manual, but make it cute ✨

okay so bestie, welcome to UFETCH(9) πŸ’… this is a section 9 page (kernel developer's manual territory), and it's all about the ufetch family β€” a whole lil squad of functions whose entire job is grabbing one single memory cell's worth of data out of user-space and handing it over to the kernel 🫢


🌸 NAME 🌸

ufetch, ufetch_8, ufetch_16, ufetch_32, ufetch_64, ufetch_char, ufetch_short, ufetch_int, ufetch_long, ufetch_ptr β€” fetch data from user-space, literally their whole personality πŸ’«


πŸŽ€ SYNOPSIS πŸŽ€

#include <sys/systm.h>

int
ufetch_8(const uint8_t *uaddr, uint8_t *valp);

int
ufetch_16(const uint16_t *uaddr, uint16_t *valp);

int
ufetch_32(const uint32_t *uaddr, uint32_t *valp);

int
ufetch_64(const uint64_t *uaddr, uint64_t *valp);

int
ufetch_char(const unsigned char *uaddr, unsigned char *valp);

int
ufetch_short(const unsigned short *uaddr, unsigned short *valp);

int
ufetch_int(const unsigned int *uaddr, unsigned int *valp);

int
ufetch_long(const unsigned long *uaddr, unsigned long *valp);

int
ufetch_ptr(const void **uaddr, void **valp);

like, yes, that's a lot of variants β€” they're all the same vibe, just different widths, iykyk 😌


πŸ¦‹ DESCRIPTION πŸ¦‹

so the ufetch functions are your go-to for fetching the value of a single memory cell from user-space 🎯 like, one cell, no more, no less, main character behavior.

in every single case: the value referenced by the user-space address uaddr gets retrieved, and then it's stored at the kernel memory location referenced by valp. that's the whole plot πŸ’–

⭐ heads up bestie: ufetch_64 is only available on systems employing the LP64 memory model. you can check for that by testing for the presence of the _LP64 C preprocessor macro β€” no cap, that's how you know πŸ”

🧚 RETURN VALUES 🧚

the ufetch functions return 0 on success, and an error number on failure. simple as that, periodt ✨


πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, they're the friend group πŸ’…


and that's the whole page, bestie!! πŸŒˆπŸ’–βœ¨

this lil icon came from the Debian edition of the manual, dated March 18, 2019 β€” shoutout to whoever wrote it, you ate πŸ“πŸŽ€ ngl this page was short and sweet and I'm obsessed πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from