linux/net/socket.c
Imported from
_research/manual-study-linux/file-notes/linux__net__socket.c.md.
File Notes: net/socket.c
Status: reviewed.
Purpose: socket syscall and protocol dispatch entrypoint.
Review target: socket lifecycle, protocol registration, operation dispatch, and AI-observable network policy hooks.
Evidence
sock_alloc_file()at line 525 wraps a socket in a file object.sock_map_fd()at line 553 installs that file into a descriptor table.sockfd_lookup()at line 601 converts descriptors back into sockets.sock_alloc()at line 680 allocates socket objects;__sock_release()line 701 andsock_release()line 736 tear them down.sock_sendmsg()at line 801 andsock_recvmsg()at line 1144 dispatch I/O.__sock_create()at line 1580 constructs protocol-backed sockets.__sys_socket()at line 1788 andSYSCALL_DEFINE3(socket)at line 1805 are user entry points.- Bind/listen/accept/connect paths appear around lines 1912-2118.
Design Notes
Sockets use the same handle membrane as files while routing behavior to protocol operation tables. A Rust design should distinguish descriptor handles, socket state, protocol traits, and namespace/credential context.