ERR_PTR(9)
π 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 kernel file
./include/linux/err.hβ that's where she lives π IS_ERR_VALUE(9)INIT_ERR_PTR(9)PTR_ERR(9)IS_ERR(9)IS_ERR_OR_NULL(9)ERR_CAST(9)PTR_ERR_OR_ZERO(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms