tools/verification/rv/src/rv.c
Source file repositories/reference/linux-study-clean/tools/verification/rv/src/rv.c
File Facts
- System
- Linux kernel
- Corpus path
tools/verification/rv/src/rv.c- Extension
.c- Size
- 4154 bytes
- Lines
- 202
- 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.
Dependency Surface
stdlib.hsignal.hunistd.htrace.hutils.hin_kernel.h
Detected Declarations
function stop_rvfunction should_stopfunction rv_listfunction rv_monfunction usagefunction main
Annotated Snippet
if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
print_help = 1;
retval = 0;
} else if (argv[1][0] == '-') {
/* assume invalid option */
print_help = 1;
retval = 1;
} else
container = argv[1];
} else if (argc > 2) {
/* more than 2 is always usage */
print_help = 1;
retval = 1;
}
if (print_help) {
fprintf(stderr, "rv version %s\n", VERSION);
for (i = 0; usage[i]; i++)
fprintf(stderr, "%s\n", usage[i]);
exit(retval);
}
ikm_list_monitors(container);
exit(0);
}
/*
* rv_mon - try to run a monitor passed as argument
*/
static void rv_mon(int argc, char **argv)
{
char *monitor_name;
int i, run = 0;
static const char *const usage[] = {
"",
" usage: rv mon [-h] monitor [monitor options]",
"",
" run a monitor",
"",
" -h/--help: print this menu",
"",
" monitor [monitor options]: the monitor, passing",
" the arguments to the [monitor options]",
NULL,
};
/* requires at least one argument */
if (argc == 1) {
fprintf(stderr, "rv version %s\n", VERSION);
for (i = 0; usage[i]; i++)
fprintf(stderr, "%s\n", usage[i]);
exit(1);
} else if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
fprintf(stderr, "rv version %s\n", VERSION);
for (i = 0; usage[i]; i++)
fprintf(stderr, "%s\n", usage[i]);
exit(0);
}
monitor_name = argv[1];
/*
* Call all possible monitor implementations, looking
* for the [monitor].
*/
run += ikm_run_monitor(monitor_name, argc-1, &argv[1]);
if (!run)
err_msg("rv: monitor %s does not exist\n", monitor_name);
exit(!run);
}
static void usage(int exit_val, const char *fmt, ...)
{
char message[1024];
va_list ap;
int i;
static const char *const usage[] = {
"",
" usage: rv command [-h] [command_options]",
"",
" -h/--help: print this menu",
"",
" command: run one of the following command:",
" list: list all available monitors",
Annotation
- Immediate include surface: `stdlib.h`, `signal.h`, `unistd.h`, `trace.h`, `utils.h`, `in_kernel.h`.
- Detected declarations: `function stop_rv`, `function should_stop`, `function rv_list`, `function rv_mon`, `function usage`, `function main`.
- 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.