net/kcm/kcmproc.c
Source file repositories/reference/linux-study-clean/net/kcm/kcmproc.c
File Facts
- System
- Linux kernel
- Corpus path
net/kcm/kcmproc.c- Extension
.c- Size
- 8873 bytes
- Lines
- 388
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/in.hlinux/inet.hlinux/list.hlinux/module.hlinux/net.hlinux/proc_fs.hlinux/rculist.hlinux/seq_file.hlinux/socket.hnet/inet_sock.hnet/kcm.hnet/net_namespace.hnet/netns/generic.hnet/tcp.h
Detected Declarations
struct kcm_proc_mux_statefunction list_for_each_entry_rcufunction kcm_seq_stopfunction kcm_format_mux_headerfunction kcm_format_sockfunction kcm_format_psockfunction kcm_format_muxfunction kcm_seq_showfunction kcm_stats_seq_showfunction list_for_each_entryfunction list_for_each_entryfunction kcm_proc_init_netfunction kcm_proc_exit_netfunction kcm_proc_initfunction kcm_proc_exit
Annotated Snippet
struct kcm_proc_mux_state {
struct seq_net_private p;
int idx;
};
static void kcm_format_mux_header(struct seq_file *seq)
{
struct net *net = seq_file_net(seq);
struct kcm_net *knet = net_generic(net, kcm_net_id);
seq_printf(seq,
"*** KCM statistics (%d MUX) ****\n",
knet->count);
seq_printf(seq,
"%-14s %-10s %-16s %-10s %-16s %-8s %-8s %-8s %-8s %s",
"Object",
"RX-Msgs",
"RX-Bytes",
"TX-Msgs",
"TX-Bytes",
"Recv-Q",
"Rmem",
"Send-Q",
"Smem",
"Status");
/* XXX: pdsts header stuff here */
seq_puts(seq, "\n");
}
static void kcm_format_sock(struct kcm_sock *kcm, struct seq_file *seq,
int i, int *len)
{
seq_printf(seq,
" kcm-%-7u %-10llu %-16llu %-10llu %-16llu %-8d %-8d %-8d %-8s ",
kcm->index,
kcm->stats.rx_msgs,
kcm->stats.rx_bytes,
kcm->stats.tx_msgs,
kcm->stats.tx_bytes,
kcm->sk.sk_receive_queue.qlen,
sk_rmem_alloc_get(&kcm->sk),
kcm->sk.sk_write_queue.qlen,
"-");
if (kcm->tx_psock)
seq_printf(seq, "Psck-%u ", kcm->tx_psock->index);
if (kcm->tx_wait)
seq_puts(seq, "TxWait ");
if (kcm->tx_wait_more)
seq_puts(seq, "WMore ");
if (kcm->rx_wait)
seq_puts(seq, "RxWait ");
seq_puts(seq, "\n");
}
static void kcm_format_psock(struct kcm_psock *psock, struct seq_file *seq,
int i, int *len)
{
seq_printf(seq,
" psock-%-5u %-10llu %-16llu %-10llu %-16llu %-8d %-8d %-8d %-8d ",
psock->index,
psock->strp.stats.msgs,
psock->strp.stats.bytes,
psock->stats.tx_msgs,
psock->stats.tx_bytes,
psock->sk->sk_receive_queue.qlen,
atomic_read(&psock->sk->sk_rmem_alloc),
psock->sk->sk_write_queue.qlen,
refcount_read(&psock->sk->sk_wmem_alloc));
if (psock->done)
seq_puts(seq, "Done ");
if (psock->tx_stopped)
seq_puts(seq, "TxStop ");
if (psock->strp.stopped)
seq_puts(seq, "RxStop ");
if (psock->tx_kcm)
seq_printf(seq, "Rsvd-%d ", psock->tx_kcm->index);
if (!psock->strp.paused && !psock->ready_rx_msg) {
if (psock->sk->sk_receive_queue.qlen) {
Annotation
- Immediate include surface: `linux/in.h`, `linux/inet.h`, `linux/list.h`, `linux/module.h`, `linux/net.h`, `linux/proc_fs.h`, `linux/rculist.h`, `linux/seq_file.h`.
- Detected declarations: `struct kcm_proc_mux_state`, `function list_for_each_entry_rcu`, `function kcm_seq_stop`, `function kcm_format_mux_header`, `function kcm_format_sock`, `function kcm_format_psock`, `function kcm_format_mux`, `function kcm_seq_show`, `function kcm_stats_seq_show`, `function list_for_each_entry`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- 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.