tools/perf/util/bpf-filter.l
Source file repositories/reference/linux-study-clean/tools/perf/util/bpf-filter.l
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/bpf-filter.l- Extension
.l- Size
- 5550 bytes
- Lines
- 180
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
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.
Dependency Surface
stdio.hstdlib.hlinux/perf_event.hbpf-filter.hbpf-filter-bison.h
Detected Declarations
function samplefunction sample_partfunction sample_pathfunction operatorfunction valuefunction constantfunction path_or_error
Annotated Snippet
%option prefix="perf_bpf_filter_"
%option noyywrap
%{
#include <stdio.h>
#include <stdlib.h>
#include <linux/perf_event.h>
#include "bpf-filter.h"
#include "bpf-filter-bison.h"
extern int perf_bpf_filter_needs_path;
static int sample(enum perf_bpf_filter_term term)
{
perf_bpf_filter_needs_path = 0;
perf_bpf_filter_lval.sample.term = term;
perf_bpf_filter_lval.sample.part = 0;
return BFT_SAMPLE;
}
static int sample_part(enum perf_bpf_filter_term term, int part)
{
perf_bpf_filter_needs_path = 0;
perf_bpf_filter_lval.sample.term = term;
perf_bpf_filter_lval.sample.part = part;
return BFT_SAMPLE;
}
static int sample_path(enum perf_bpf_filter_term term)
{
perf_bpf_filter_needs_path = 1;
perf_bpf_filter_lval.sample.term = term;
perf_bpf_filter_lval.sample.part = 0;
return BFT_SAMPLE_PATH;
}
static int operator(enum perf_bpf_filter_op op)
{
perf_bpf_filter_lval.op = op;
return BFT_OP;
}
static int value(int base)
{
long num;
errno = 0;
num = strtoul(perf_bpf_filter_text, NULL, base);
if (errno)
return BFT_ERROR;
perf_bpf_filter_lval.num = num;
return BFT_NUM;
}
static int constant(int val)
{
perf_bpf_filter_lval.num = val;
return BFT_NUM;
}
static int path_or_error(void)
{
if (!perf_bpf_filter_needs_path) {
printf("perf_bpf_filter: Error: Unexpected item: %s\n",
perf_bpf_filter_text);
return BFT_ERROR;
}
perf_bpf_filter_lval.path = perf_bpf_filter_text;
Annotation
- Immediate include surface: `stdio.h`, `stdlib.h`, `linux/perf_event.h`, `bpf-filter.h`, `bpf-filter-bison.h`.
- Detected declarations: `function sample`, `function sample_part`, `function sample_path`, `function operator`, `function value`, `function constant`, `function path_or_error`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
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.