kernel_getsockname(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… kernel_getsockname(9) β€” the Kernel API Manual, bestie edition πŸŽ€

okay so you're in the kernel, you've got a struct socket *, and you need to know where it's actually bound. that's the whole vibe of this page. welcome 🫢


✨ SYNOPSIS ✨

int kernel_getsockname (struct socket *sock , struct sockaddr *addr );

like, look at her. two args, one int return, no notes. πŸ’…


🌸 ARGUMENTS 🌸

  • sock β€” the socket. your main character. the one we're asking about πŸ’–
  • addr β€” the address holder, i.e. the lil container that's gonna get filled up with the bound address ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically: this fills the addr pointer with the address that the socket is bound to. that's it. that's the function, no cap πŸ’€

and then it returns the length of the address in bytes, or an error code if something went sideways 😭

bestie the return value is doing double duty here β€” length in bytes on the good path, error code on the bad path. pls check it, don't just ignore it πŸ™ˆ

kernel-space only, for the record 🧚 that's literally in the NAME section: get the address which the socket is bound (kernel space) β€” that's the one-line summary and yes it's iconic 🌈


⭐ SEE ALSO ⭐

the whole extended friend group, in order, no gatekeeping:

iykyk, this is the entire socket-girlies roster πŸ‘‘ and kernel_getpeername(9) is literally her sister function β€” one asks "who am I bound as", the other asks "who's on the other end" πŸ“


and that's the page!! mwah πŸ’‹ this one comes from ./net and is dated October 2026 β€” so yeah, mark your calendars bestie, love you, go read kernel_getpeername(9) next πŸ§šβ€β™€οΈπŸ’œ

slay πŸŽ€

πŸ“¦ where this page comes from