io_uring/register.c
Source file repositories/reference/linux-study-clean/io_uring/register.c
File Facts
- System
- Linux kernel
- Corpus path
io_uring/register.c- Extension
.c- Size
- 26320 bytes
- Lines
- 1039
- Domain
- Kernel Services
- Bucket
- io_uring
- Inferred role
- Kernel Services: syscall or user/kernel boundary
- Status
- core 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.
- Defines or participates in a user/kernel boundary; inspect argument validation, copy_from_user/copy_to_user, credentials, and dispatch target.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/errno.hlinux/syscalls.hlinux/refcount.hlinux/bits.hlinux/fs.hlinux/file.hlinux/slab.hlinux/uaccess.hlinux/nospec.hlinux/compat.hlinux/io_uring.hlinux/io_uring_types.hfiletable.hio_uring.hopdef.htctx.hrsrc.hsqpoll.hregister.hcancel.hkbuf.hnapi.heventfd.hmsg_ring.hmemmap.hzcrx.hquery.hbpf_filter.h
Detected Declarations
syscall io_uring_registerstruct io_ring_ctx_ringsfunction io_uring_registerfunction io_unregister_personalityfunction io_register_personalityfunction io_parse_restrictionsfunction io_register_restrictionsfunction io_register_restrictions_taskfunction io_register_bpf_filter_taskfunction io_register_enable_ringsfunction __io_register_iowq_afffunction io_register_iowq_afffunction io_unregister_iowq_afffunction io_register_iowq_max_workersfunction io_register_clockfunction io_register_free_ringsfunction io_register_resize_ringsfunction io_register_mem_regionfunction __io_uring_registerfunction io_uring_register_send_msg_ringfunction io_uring_register_blind
Annotated Snippet
SYSCALL_DEFINE4(io_uring_register, unsigned int, fd, unsigned int, opcode,
void __user *, arg, unsigned int, nr_args)
{
struct io_ring_ctx *ctx;
long ret = -EBADF;
struct file *file;
bool use_registered_ring;
use_registered_ring = !!(opcode & IORING_REGISTER_USE_REGISTERED_RING);
opcode &= ~IORING_REGISTER_USE_REGISTERED_RING;
if (opcode >= IORING_REGISTER_LAST)
return -EINVAL;
if (fd == -1)
return io_uring_register_blind(opcode, arg, nr_args);
file = io_uring_ctx_get_file(fd, use_registered_ring);
if (IS_ERR(file))
return PTR_ERR(file);
ctx = file->private_data;
mutex_lock(&ctx->uring_lock);
ret = __io_uring_register(ctx, opcode, arg, nr_args);
trace_io_uring_register(ctx, opcode, ctx->file_table.data.nr,
ctx->buf_table.nr, ret);
mutex_unlock(&ctx->uring_lock);
if (!use_registered_ring)
fput(file);
return ret;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/syscalls.h`, `linux/refcount.h`, `linux/bits.h`, `linux/fs.h`, `linux/file.h`, `linux/slab.h`.
- Detected declarations: `syscall io_uring_register`, `struct io_ring_ctx_rings`, `function io_uring_register`, `function io_unregister_personality`, `function io_register_personality`, `function io_parse_restrictions`, `function io_register_restrictions`, `function io_register_restrictions_task`, `function io_register_bpf_filter_task`, `function io_register_enable_rings`.
- Atlas domain: Kernel Services / io_uring.
- Implementation status: core implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.