proc_get_long(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… proc_get_long(9) β€” the Kernel API Manual, but make it make sense πŸŽ€

okay so bestie, we're in the Kernel API Manual today and this page is literally about proc_get_long β€” a little function that reads an ASCII formatted integer out of a user buffer. it's giving "parser but make it kernel" ✨ iykyk.


🌸 NAME 🌸

proc_get_long β€” reads an ASCII formatted integer from a user buffer πŸ’–

no cap, that's the whole vibe. it goes and gets you a long. from ASCII. out of a user buffer. slay.


✨ SYNOPSIS ✨

int proc_get_long (char **buf , size_t *size , unsigned long *val , bool
*neg , const char *perm_tr , unsigned perm_tr_len , char *tr );

that's seven arguments bestie, count 'em, i'll wait 🫢 (it's seven.)


πŸ¦‹ ARGUMENTS πŸ¦‹

okay so here's the cast of characters, main character energy incoming πŸ‘‘

  • buf β€” a kernel buffer. that's the thing we're reading out of, periodt.
  • size β€” size of the kernel buffer. like how much room there is to look at πŸ”₯
  • val β€” this is where the number will be stored. the whole point of the function honestly, the icon, the moment πŸ’…
  • neg β€” set to TRUE if number is negative. so if you see a little minus sign, this flag gets its glow-up 😭
  • perm_tr β€” a vector which contains the allowed trailers. trailers as in trailing characters, not as in movie previews, keep up 🎬
  • perm_tr_len β€” size of the perm_tr vector. every vector needs its length bestie, it's called ✨consistency✨
  • tr β€” pointer to store the trailer character. so the trailing character has somewhere to live 🏠

πŸ’€ RETURN πŸ’€

here's what you get back, no surprises, we keep it honest:

  • 0 on success β€” and buf and size are updated with the amount of bytes read. πŸ“– also! if tr is non-NULL and a trailing character exists (meaning size is non-zero after returning from this function), then tr is updated with the trailing character πŸ’–
  • -EINVAL on failure. rip. that's the "you gave me nonsense" error πŸ™ˆ
ngl, the size is non-zero after returning bit is the sneaky important part β€” that's how you know a trailer actually got captured, so don't skip the vibe check on it πŸ‘€

🌈 SEE ALSO 🌈

here's the whole friend group, the entire group chat, all linked from the kernel file ./kernel/sysctl.c 🧚 β€” like genuinely, this list ate and left no crumbs:

like?? look at them all, highkey iconic πŸ˜­πŸ’œ


and that's the page babes πŸŽ€ β€” brought to you by the fine folks in ./kernel, dated October 2026, back when this doc was born. mwah πŸ’‹ go read the source, i'm obsessed with you πŸ¦‹

πŸ“¦ where this page comes from