io_uring/net.c
Source file repositories/reference/linux-study-clean/io_uring/net.c
File Facts
- System
- Linux kernel
- Corpus path
io_uring/net.c- Extension
.c- Size
- 51947 bytes
- Lines
- 1978
- Domain
- Kernel Services
- Bucket
- io_uring
- Inferred role
- Kernel Services: implementation source
- Status
- source implementation candidate
Why This File Exists
Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/errno.hlinux/file.hlinux/slab.hlinux/net.hlinux/un.hlinux/compat.hnet/compat.hlinux/io_uring.huapi/linux/io_uring.hfiletable.hio_uring.hkbuf.halloc_cache.hnet.hnotif.hrsrc.hzcrx.h
Detected Declarations
struct io_shutdownstruct io_acceptstruct io_socketstruct io_connectstruct io_bindstruct io_listenstruct io_sr_msgstruct io_recvzcstruct io_recvmsg_multishot_hdrenum sr_retry_flagsfunction io_shutdown_prepfunction io_shutdownfunction io_net_retryfunction io_netmsg_iovec_freefunction io_netmsg_recyclefunction io_mshot_prep_retryfunction io_net_import_vecfunction io_compat_msg_copy_hdrfunction io_copy_msghdr_from_userfunction io_msg_copy_hdrfunction io_sendmsg_recvmsg_cleanupfunction io_send_setupfunction io_sendmsg_setupfunction io_sendmsg_prepfunction io_req_msg_cleanupfunction io_bundle_nbufsfunction io_net_kbuf_recylefunction io_send_finishfunction io_sendmsgfunction io_send_select_bufferfunction io_sendfunction io_recvmsg_mshot_prepfunction io_recvmsg_copy_hdrfunction io_recvmsg_prep_setupfunction io_recvmsg_prepfunction againfunction io_req_post_cqefunction io_recvmsg_prep_multishotfunction io_recvmsg_multishotfunction io_recvmsgfunction io_recv_buf_selectfunction io_recvfunction io_recvzc_prepfunction io_recvzcfunction io_send_zc_cleanupfunction io_send_zc_prepfunction io_sg_from_iter_iovecfunction io_sg_from_iter
Annotated Snippet
struct io_shutdown {
struct file *file;
int how;
};
struct io_accept {
struct file *file;
struct sockaddr __user *addr;
int __user *addr_len;
int flags;
int iou_flags;
u32 file_slot;
unsigned long nofile;
};
struct io_socket {
struct file *file;
int domain;
int type;
int protocol;
int flags;
u32 file_slot;
unsigned long nofile;
};
struct io_connect {
struct file *file;
struct sockaddr __user *addr;
int addr_len;
bool in_progress;
bool seen_econnaborted;
};
struct io_bind {
struct file *file;
int addr_len;
};
struct io_listen {
struct file *file;
int backlog;
};
struct io_sr_msg {
struct file *file;
union {
struct compat_msghdr __user *umsg_compat;
struct user_msghdr __user *umsg;
void __user *buf;
};
int len;
unsigned done_io;
unsigned msg_flags;
unsigned nr_multishot_loops;
u16 flags;
/* initialised and used only by !msg send variants */
u16 buf_group;
/* per-invocation mshot limit */
unsigned mshot_len;
/* overall mshot byte limit */
unsigned mshot_total_len;
void __user *msg_control;
/* used only for send zerocopy */
struct io_kiocb *notif;
};
/*
* The UAPI flags are the lower 8 bits, as that's all sqe->ioprio will hold
* anyway. Use the upper 8 bits for internal uses.
*/
enum sr_retry_flags {
IORING_RECV_RETRY = (1U << 15),
IORING_RECV_PARTIAL_MAP = (1U << 14),
IORING_RECV_MSHOT_CAP = (1U << 13),
IORING_RECV_MSHOT_LIM = (1U << 12),
IORING_RECV_MSHOT_DONE = (1U << 11),
IORING_RECV_RETRY_CLEAR = IORING_RECV_RETRY | IORING_RECV_PARTIAL_MAP,
IORING_RECV_NO_RETRY = IORING_RECV_RETRY | IORING_RECV_PARTIAL_MAP |
IORING_RECV_MSHOT_CAP | IORING_RECV_MSHOT_DONE,
};
/*
* Number of times we'll try and do receives if there's more data. If we
* exceed this limit, then add us to the back of the queue and retry from
* there. This helps fairness between flooding clients.
*/
#define MULTISHOT_MAX_RETRY 32
struct io_recvzc {
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/file.h`, `linux/slab.h`, `linux/net.h`, `linux/un.h`, `linux/compat.h`, `net/compat.h`.
- Detected declarations: `struct io_shutdown`, `struct io_accept`, `struct io_socket`, `struct io_connect`, `struct io_bind`, `struct io_listen`, `struct io_sr_msg`, `struct io_recvzc`, `struct io_recvmsg_multishot_hdr`, `enum sr_retry_flags`.
- Atlas domain: Kernel Services / io_uring.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.