net/sctp/proc.c
Source file repositories/reference/linux-study-clean/net/sctp/proc.c
File Facts
- System
- Linux kernel
- Corpus path
net/sctp/proc.c- Extension
.c- Size
- 11179 bytes
- Lines
- 400
- 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/types.hlinux/seq_file.hlinux/init.hlinux/export.hnet/sctp/sctp.hnet/ip.h
Detected Declarations
struct sctp_ht_iterfunction sctp_snmp_seq_showfunction sctp_seq_dump_local_addrsfunction sctp_seq_dump_remote_addrsfunction sctp_eps_seq_stopfunction sctp_eps_seq_showfunction sctp_transport_seq_stopfunction sctp_assocs_seq_showfunction sctp_remaddr_seq_showfunction list_for_each_entry_rcufunction sctp_proc_init
Annotated Snippet
struct sctp_ht_iter {
struct seq_net_private p;
struct rhashtable_iter hti;
};
static void *sctp_transport_seq_start(struct seq_file *seq, loff_t *pos)
{
struct sctp_ht_iter *iter = seq->private;
sctp_transport_walk_start(&iter->hti);
return sctp_transport_get_idx(seq_file_net(seq), &iter->hti, *pos);
}
static void sctp_transport_seq_stop(struct seq_file *seq, void *v)
{
struct sctp_ht_iter *iter = seq->private;
if (v && v != SEQ_START_TOKEN) {
struct sctp_transport *transport = v;
sctp_transport_put(transport);
}
sctp_transport_walk_stop(&iter->hti);
}
static void *sctp_transport_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct sctp_ht_iter *iter = seq->private;
if (v && v != SEQ_START_TOKEN) {
struct sctp_transport *transport = v;
sctp_transport_put(transport);
}
++*pos;
return sctp_transport_get_next(seq_file_net(seq), &iter->hti);
}
/* Display sctp associations (/proc/net/sctp/assocs). */
static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
{
struct sctp_transport *transport;
struct sctp_association *assoc;
struct sctp_ep_common *epb;
struct sock *sk;
if (v == SEQ_START_TOKEN) {
seq_printf(seq, " ASSOC SOCK STY SST ST HBKT "
"ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT "
"RPORT LADDRS <-> RADDRS "
"HBINT INS OUTS MAXRT T1X T2X RTXC "
"wmema wmemq sndbuf rcvbuf\n");
return 0;
}
transport = (struct sctp_transport *)v;
assoc = transport->asoc;
epb = &assoc->base;
sk = epb->sk;
seq_printf(seq,
"%8pK %8pK %-3d %-3d %-2d %-4d "
"%4d %8d %8d %7u %5llu %-5d %5d ",
assoc, sk, sctp_sk(sk)->type, sk->sk_state,
assoc->state, 0,
assoc->assoc_id,
assoc->sndbuf_used,
atomic_read(&assoc->rmem_alloc),
from_kuid_munged(seq_user_ns(seq), sk_uid(sk)),
sock_i_ino(sk),
epb->bind_addr.port,
assoc->peer.port);
seq_printf(seq, " ");
sctp_seq_dump_local_addrs(seq, epb);
seq_printf(seq, "<-> ");
sctp_seq_dump_remote_addrs(seq, assoc);
seq_printf(seq, "\t%8lu %5d %5d %4d %4d %4d %8d "
"%8d %8d %8d %8d",
assoc->hbinterval, assoc->stream.incnt,
assoc->stream.outcnt, assoc->max_retrans,
assoc->init_retries, assoc->shutdown_retries,
assoc->rtx_data_chunks,
refcount_read(&sk->sk_wmem_alloc),
READ_ONCE(sk->sk_wmem_queued),
sk->sk_sndbuf,
sk->sk_rcvbuf);
Annotation
- Immediate include surface: `linux/types.h`, `linux/seq_file.h`, `linux/init.h`, `linux/export.h`, `net/sctp/sctp.h`, `net/ip.h`.
- Detected declarations: `struct sctp_ht_iter`, `function sctp_snmp_seq_show`, `function sctp_seq_dump_local_addrs`, `function sctp_seq_dump_remote_addrs`, `function sctp_eps_seq_stop`, `function sctp_eps_seq_show`, `function sctp_transport_seq_stop`, `function sctp_assocs_seq_show`, `function sctp_remaddr_seq_show`, `function list_for_each_entry_rcu`.
- 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.