ERR_PTR(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– ERR_PTR(9) πŸ’–

okay so welcome to the Kernel API Manual, bestie β€” today's episode is all about ERR_PTR(9), and honestly it's a little icon. let's get into it πŸŽ€


✨ NAME ✨

ERR_PTR β€” creates an error pointer. that's it, that's the whole job, and she does it flawlessly πŸ’…


🌸 SYNOPSIS 🌸

void * ERR_PTR (long error );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • error β€” a negative error code. that's the vibe check: it's gotta be negative, no cap 🫢

⭐ DESCRIPTION ⭐

so what she does is she encodes error into a pointer value. like, the number goes inside the pointer. sneaky but gorgeous πŸ’œ

and here's the part where you mind your business: users should consider the result opaque and not assume anything about how the error is encoded. do not go poking at the internals, bestie, it's giving "trust the process" 😭

πŸ”₯ RETURN πŸ”₯

a pointer with the error encoded within its value. slay ✨


🌈 SEE ALSO 🌈

the whole friend group honestly, go read them all, iykyk πŸ‘‘


and that's the page!! brought to you by ./include/linux, dated October 2026 β€” mwah, ily, go write some beautiful error pointers πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from