tools/testing/selftests/bpf/progs/sock_addr_kern.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/sock_addr_kern.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/sock_addr_kern.c- Extension
.c- Size
- 1156 bytes
- Lines
- 66
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
vmlinux.hbpf/bpf_helpers.h../test_kmods/bpf_testmod_kfunc.h
Detected Declarations
function init_sockfunction close_sockfunction kernel_connectfunction kernel_bindfunction kernel_listenfunction kernel_sendmsgfunction sock_sendmsgfunction kernel_getsocknamefunction kernel_getpeername
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2024 Google LLC */
#include <vmlinux.h>
#include <bpf/bpf_helpers.h>
#include "../test_kmods/bpf_testmod_kfunc.h"
SEC("syscall")
int init_sock(struct init_sock_args *args)
{
bpf_kfunc_init_sock(args);
return 0;
}
SEC("syscall")
int close_sock(void *ctx)
{
bpf_kfunc_close_sock();
return 0;
}
SEC("syscall")
int kernel_connect(struct addr_args *args)
{
return bpf_kfunc_call_kernel_connect(args);
}
SEC("syscall")
int kernel_bind(struct addr_args *args)
{
return bpf_kfunc_call_kernel_bind(args);
}
SEC("syscall")
int kernel_listen(struct addr_args *args)
{
return bpf_kfunc_call_kernel_listen();
}
SEC("syscall")
int kernel_sendmsg(struct sendmsg_args *args)
{
return bpf_kfunc_call_kernel_sendmsg(args);
}
SEC("syscall")
int sock_sendmsg(struct sendmsg_args *args)
{
return bpf_kfunc_call_sock_sendmsg(args);
}
SEC("syscall")
int kernel_getsockname(struct addr_args *args)
{
return bpf_kfunc_call_kernel_getsockname(args);
}
SEC("syscall")
int kernel_getpeername(struct addr_args *args)
{
return bpf_kfunc_call_kernel_getpeername(args);
}
char _license[] SEC("license") = "GPL";
Annotation
- Immediate include surface: `vmlinux.h`, `bpf/bpf_helpers.h`, `../test_kmods/bpf_testmod_kfunc.h`.
- Detected declarations: `function init_sock`, `function close_sock`, `function kernel_connect`, `function kernel_bind`, `function kernel_listen`, `function kernel_sendmsg`, `function sock_sendmsg`, `function kernel_getsockname`, `function kernel_getpeername`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source 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.