__genl_sk_priv_get(9)
π
__genl_sk_priv_get β Kernel API Manual, bestie edition β¨
okay so picture this: we're deep in the kernel, in <pink>Kernel API Manual</pink> land, and there's this little function called __genl_sk_priv_get that's about to become your new hyperfixation. no cap. let's get into it π«Ά
β¨ NAME β¨
__genl_sk_priv_get β Get family private pointer for socket, if exists π
like, it goes and fetches the private pointer for a socket. if it exists. that "if exists" is doing a lot of heavy lifting, jsyk.
π¦ SYNOPSIS π¦
void * __genl_sk_priv_get (struct genl_family *family , struct sock *sk );
that's it. that's the whole vibe check. one return value, two args, zero drama. πΈ
π ARGUMENTS π
familyβ the family. literally just the family. astruct genl_family *, the Generic netlink family we're digging around in πskβ the socket. astruct sock *. the socket whose private stuff we're looking up π§
π DESCRIPTION π
so here's the tea β: this function looks up a private memory for a Generic netlink family and the socket you specified. that's the whole job. family + socket β private memory. mwah. π
β οΈ but bestie, listen β the caller should make sure this is called in an RCU read locked section. that's not optional. that's not a suggestion. that's the rule. don't be the person who forgets the RCU read lock, i'm begging ππ
β RETURN β
okay so what do you get back? three possible situations, and you need to know all of them:
- a valid pointer on success β slay β¨
- otherwise, a negative error value encoded by
ERR_PTRπ NULLin case priv does not exist π«
so like, check your return value properly. NULL is a real answer, not an error, and the error is a negative value wrapped up in ERR_PTR. two different things. don't conflate them, i'm on my knees π
π₯ SEE ALSO π₯
- Kernel file
./net/netlink/genetlink.cπ genl_sk_priv_get(9)genl_register_family(9)genl_unregister_family(9)genlmsg_put(9)
iykyk β go read the source, it's giving main character energy π
and that's a wrap, bestie πβ¨ this icon of a page came to you from the kernel source at ./net/netlink, dated October 2026, and it's literally the __genl_sk_priv_get(9) page, no cap. go forth and lock your RCU sections ππ¦
π¦ 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