user_regset_set_fn(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ user_regset_set_fn(9) ✨

okay so real talk, this is a page from the Kernel API Manual, bestie, and it's about user_regset_set_fn β€” the callback type that lives in &struct user_regset. buckle up, it's shorter than your attention span but every word eats πŸ’…


🌸 NAME 🌸

user_regset_set_fn β€” literally the type of the @set function in &struct user_regset. that's it, that's the name πŸŽ€


✨ SYNOPSIS ✨

typedef int user_regset_set_fn (struct task_struct *target , const
       struct user_regset *regset , unsigned int pos , unsigned int count ,
       const void *kbuf , const void __user *ubuf );

like, look at her. six params, returns an int, absolute main character energy πŸ‘‘


πŸ¦‹ ARGUMENTS πŸ¦‹

  • target β€” the thread being examined. yes, the actual thread, she's the subject of the whole investigation πŸ”
  • regset β€” the regset being examined. the one under the microscope 🧚
  • pos β€” offset into the regset data you're accessing, measured in bytes
  • count β€” how much data you're copying, also in bytes
  • kbuf β€” if it's not NULL, this is a kernel-space pointer to copy from 🫢
  • ubuf β€” if kbuf is NULL, then this is the user-space pointer you copy from

πŸ’– DESCRIPTION πŸ’–

So the vibe here is: store register values. that's the job. that's the whole assignment ✍️

Return 0 on success. and if it fails? the usual failure returns are -EIO or -ENODEV β€” those are the ones that show up most, no cap πŸ’€

the pos and count values are in bytes, but heads up, they must be properly aligned. not optional, not a suggestion, it's giving strict 😭

here's the branch logic so you don't fumble it:

  • if kbuf is non-null, that buffer gets used and ubuf is ignored. sorry ubuf, you're benched πŸ™ˆ
  • if kbuf is NULL, then ubuf gives you a userland pointer to access directly β€” and in that case an -EFAULT return value is possible. so watch for it πŸ‘€
lowkey important: alignment on pos and count is a real requirement, not a vibe check you can skip ⚠️

πŸŽ€ SEE ALSO πŸŽ€

Kernel file ./include/linux/regset.h β€” go read it, it's iconic:


and that's the whole page bestie!! πŸ’œ this one came from ./include/linux, dated October 2026 β€” so yeah, mark your calendar, the kernel source and that date are literally right there at the bottom, slay ⭐🌈

πŸ“¦ where this page comes from