tools/perf/tests/workloads/landlock.c
Source file repositories/reference/linux-study-clean/tools/perf/tests/workloads/landlock.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/workloads/landlock.c- Extension
.c- Size
- 1721 bytes
- Lines
- 67
- 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
linux/compiler.hlinux/types.hunistd.h../tests.h
Detected Declarations
struct landlock_path_beneath_attrstruct landlock_net_port_attrfunction landlock
Annotated Snippet
struct landlock_path_beneath_attr {
__u64 allowed_access;
__s32 parent_fd;
};
#endif
#ifndef LANDLOCK_ACCESS_NET_CONNECT_TCP
#define LANDLOCK_ACCESS_NET_CONNECT_TCP (1ULL << 1)
#define LANDLOCK_RULE_NET_PORT 2
struct landlock_net_port_attr {
__u64 allowed_access;
__u64 port;
};
#endif
static int landlock(int argc __maybe_unused, const char **argv __maybe_unused)
{
int fd = 11, flags = 45;
struct landlock_path_beneath_attr path_beneath_attr = {
.allowed_access = LANDLOCK_ACCESS_FS_READ_FILE,
.parent_fd = 14,
};
struct landlock_net_port_attr net_port_attr = {
.port = 19,
.allowed_access = LANDLOCK_ACCESS_NET_CONNECT_TCP,
};
syscall(__NR_landlock_add_rule, fd, LANDLOCK_RULE_PATH_BENEATH,
&path_beneath_attr, flags);
syscall(__NR_landlock_add_rule, fd, LANDLOCK_RULE_NET_PORT,
&net_port_attr, flags);
return 0;
}
DEFINE_WORKLOAD(landlock);
Annotation
- Immediate include surface: `linux/compiler.h`, `linux/types.h`, `unistd.h`, `../tests.h`.
- Detected declarations: `struct landlock_path_beneath_attr`, `struct landlock_net_port_attr`, `function landlock`.
- 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.