tools/verification/rv/src/in_kernel.c
Source file repositories/reference/linux-study-clean/tools/verification/rv/src/in_kernel.c
File Facts
- System
- Linux kernel
- Corpus path
tools/verification/rv/src/in_kernel.c- Extension
.c- Size
- 19381 bytes
- Lines
- 854
- 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
getopt.hstdlib.hstdio.hstring.herrno.hunistd.hdirent.htrace.hutils.hrv.h
Detected Declarations
function __ikm_read_enablefunction __ikm_find_monitor_namefunction ikm_read_enablefunction ikm_write_enablefunction ikm_enablefunction ikm_disablefunction ikm_fill_monitor_definitionfunction ikm_write_reactorfunction ikm_has_idfunction ikm_list_monitorsfunction ikm_print_headerfunction ikm_event_handlerfunction ikm_error_handlerfunction ikm_enable_trace_eventsfunction ikm_enable_trace_containerfunction ikm_destroy_trace_instancefunction ikm_usage_print_reactorsfunction ikm_usagefunction parse_argumentsfunction ikm_run_monitor
Annotated Snippet
if (colon) {
out_name[colon - line] = '/';
} else {
/* If there are children, they are on the next line. */
line = strsep(&cursor, "\n");
if (line && !strncmp(line, monitor_name, len) && line[len] == ':')
config_is_container = 1;
}
found = 1;
break;
}
free(available_monitors);
return found;
}
/*
* ikm_read_enable - reads monitor's enable status
*
* Returns the current status, or -1 on error.
*/
static int ikm_read_enable(char *monitor_name)
{
int enabled;
enabled = __ikm_read_enable(monitor_name);
if (enabled < 0) {
err_msg("ikm: fail read enabled: %d\n", enabled);
return -1;
}
debug_msg("ikm: read enabled: %d\n", enabled);
return enabled;
}
/*
* ikm_write_enable - write to the monitor's enable file
*
* Return the number of bytes written, -1 on error.
*/
static int ikm_write_enable(char *monitor_name, char *enable_disable)
{
char path[MAX_PATH];
int retval;
debug_msg("ikm: writing enabled: %s\n", enable_disable);
snprintf(path, MAX_PATH, "rv/monitors/%s/enable", monitor_name);
retval = tracefs_instance_file_write(NULL, path, enable_disable);
if (retval < strlen(enable_disable)) {
err_msg("ikm: writing enabled: %s\n", enable_disable);
return -1;
}
return retval;
}
/*
* ikm_enable - enable a monitor
*
* Returns -1 on failure. Success otherwise.
*/
static int ikm_enable(char *monitor_name)
{
return ikm_write_enable(monitor_name, "1");
}
/*
* ikm_disable - disable a monitor
*
* Returns -1 on failure. Success otherwise.
*/
static int ikm_disable(char *monitor_name)
{
return ikm_write_enable(monitor_name, "0");
}
/*
* ikm_read_desc - read monitors' description
*
* Return a dynamically allocated string with the monitor's
* description, NULL otherwise.
*/
static char *ikm_read_desc(char *monitor_name)
{
char path[MAX_PATH];
char *desc;
Annotation
- Immediate include surface: `getopt.h`, `stdlib.h`, `stdio.h`, `string.h`, `errno.h`, `unistd.h`, `dirent.h`, `trace.h`.
- Detected declarations: `function __ikm_read_enable`, `function __ikm_find_monitor_name`, `function ikm_read_enable`, `function ikm_write_enable`, `function ikm_enable`, `function ikm_disable`, `function ikm_fill_monitor_definition`, `function ikm_write_reactor`, `function ikm_has_id`, `function ikm_list_monitors`.
- 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.