io_uring/cmd_net.c
Source file repositories/reference/linux-study-clean/io_uring/cmd_net.c
File Facts
- System
- Linux kernel
- Corpus path
io_uring/cmd_net.c- Extension
.c- Size
- 5010 bytes
- Lines
- 193
- Domain
- Kernel Services
- Bucket
- io_uring
- Inferred role
- Kernel Services: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/ioctls.hlinux/io_uring/net.hlinux/errqueue.hnet/sock.huring_cmd.hio_uring.h
Detected Declarations
function io_uring_cmd_get_sock_ioctlfunction io_uring_cmd_getsockoptfunction io_uring_cmd_setsockoptfunction io_process_timestamp_skbfunction io_uring_cmd_timestampfunction scoped_guardfunction io_uring_cmd_getsocknamefunction io_uring_cmd_sockexport io_uring_cmd_sock
Annotated Snippet
skb_queue_walk_safe(q, skb, tmp) {
/* don't support skbs with payload */
if (!skb_has_tx_timestamp(skb, sk) || skb->len)
continue;
__skb_unlink(skb, q);
__skb_queue_tail(&list, skb);
}
}
while (1) {
skb = skb_peek(&list);
if (!skb)
break;
if (!io_process_timestamp_skb(cmd, sk, skb, issue_flags))
break;
__skb_dequeue(&list);
consume_skb(skb);
}
if (!unlikely(skb_queue_empty(&list))) {
scoped_guard(spinlock_irqsave, &q->lock)
skb_queue_splice(&list, q);
}
return -EAGAIN;
}
static int io_uring_cmd_getsockname(struct socket *sock,
struct io_uring_cmd *cmd,
unsigned int issue_flags)
{
const struct io_uring_sqe *sqe = cmd->sqe;
struct sockaddr __user *uaddr;
unsigned int peer;
int __user *ulen;
if (sqe->ioprio || sqe->__pad1 || sqe->len || sqe->rw_flags)
return -EINVAL;
uaddr = u64_to_user_ptr(READ_ONCE(sqe->addr));
ulen = u64_to_user_ptr(READ_ONCE(sqe->addr3));
peer = READ_ONCE(sqe->optlen);
if (peer > 1)
return -EINVAL;
return do_getsockname(sock, peer, uaddr, ulen);
}
int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags)
{
struct socket *sock = cmd->file->private_data;
switch (cmd->cmd_op) {
case SOCKET_URING_OP_SIOCINQ:
return io_uring_cmd_get_sock_ioctl(sock, SIOCINQ);
case SOCKET_URING_OP_SIOCOUTQ:
return io_uring_cmd_get_sock_ioctl(sock, SIOCOUTQ);
case SOCKET_URING_OP_GETSOCKOPT:
return io_uring_cmd_getsockopt(sock, cmd, issue_flags);
case SOCKET_URING_OP_SETSOCKOPT:
return io_uring_cmd_setsockopt(sock, cmd, issue_flags);
case SOCKET_URING_OP_TX_TIMESTAMP:
return io_uring_cmd_timestamp(sock, cmd, issue_flags);
case SOCKET_URING_OP_GETSOCKNAME:
return io_uring_cmd_getsockname(sock, cmd, issue_flags);
default:
return -EOPNOTSUPP;
}
}
EXPORT_SYMBOL_GPL(io_uring_cmd_sock);
Annotation
- Immediate include surface: `asm/ioctls.h`, `linux/io_uring/net.h`, `linux/errqueue.h`, `net/sock.h`, `uring_cmd.h`, `io_uring.h`.
- Detected declarations: `function io_uring_cmd_get_sock_ioctl`, `function io_uring_cmd_getsockopt`, `function io_uring_cmd_setsockopt`, `function io_process_timestamp_skb`, `function io_uring_cmd_timestamp`, `function scoped_guard`, `function io_uring_cmd_getsockname`, `function io_uring_cmd_sock`, `export io_uring_cmd_sock`.
- Atlas domain: Kernel Services / io_uring.
- Implementation status: integration implementation candidate.
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.