sock_create_lite(9)
π sock_create_lite π
okay so bestie, welcome to the Kernel API Manual, and today's main character is sock_create_lite(9) β yes she's a function, yes she makes a socket, and yes she's a little bit of a lite version (the name is literally telling you something, keep reading π).
β¨ NAME β¨
sock_create_lite β creates a socket π«Ά
β¨ SYNOPSIS β¨
int sock_create_lite (int family , int type , int protocol , struct
socket **res );
like. four args. all int except the last one which is a double-pointer to a struct socket because we're doing the assign-it-for-you thing π
β¨ ARGUMENTS β¨
familyβ the protocol family, aka the vibe of the address world you're living in (AF_INET, ...)typeβ the communication type, aka how this socket talks (SOCK_STREAM, ...)protocolβ the protocol, and honestly you can pass0a lot of the time (0, ...)resβ the new socket π this is where the freshly made socket gets dropped off
β¨ DESCRIPTION β¨
okay so here's the tea π: sock_create_lite creates a brand-new socket and assigns it to res, passing through LSM on the way. very demure, very security-conscious.
But β and this is the important part, don't skip it β the new socket's initialization is not complete. like, she's not finished getting ready. for the rest of the story you gotta look at kernel_accept.
she returns 0 or an error. that's it, that's the contract. on failure, res is set to NULL (so like, don't go dereferencing it, bestie π).
also, fun fact: this function internally uses GFP_KERNEL β¨
ngl the "initialization is not complete" bit is the one you actually have to remember. a lite socket is lite for a reason β check kernel_accept before you assume she's fully cooked π₯
β¨ SEE ALSO β¨
the whole group chat, fr fr β go read these next:
move_addr_to_kernel(9)move_addr_to_user(9)sock_read_xattr(9)sock_alloc_file(9)sock_from_file(9)sockfd_lookup(9)sock_alloc(9)sock_release(9)sock_sendmsg(9)kernel_sendmsg(9)sock_recvmsg(9)kernel_recvmsg(9)__sock_create(9)sock_create(9)sock_create_kern(9)sock_register(9)sock_unregister(9)kernel_bind(9)kernel_listen(9)kernel_accept(9)kernel_connect(9)kernel_getsockname(9)kernel_getpeername(9)kernel_sock_shutdown(9)kernel_sock_ip_overhead(9)
and the kernel file she actually lives in: ./net/socket.c π
k that's the whole page, ily, go write some kernel code responsibly π
shoutout to the ./net source and the October 2026 date stamp β that's the footer energy, periodt. πβ
π¦ 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