tools/tracing/rtla/src/actions.c
Source file repositories/reference/linux-study-clean/tools/tracing/rtla/src/actions.c
File Facts
- System
- Linux kernel
- Corpus path
tools/tracing/rtla/src/actions.c- Extension
.c- Size
- 6022 bytes
- Lines
- 287
- 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
stdlib.hstring.hsignal.hunistd.hactions.htrace.hutils.h
Detected Declarations
function actions_initfunction actions_destroyfunction for_each_actionfunction actions_newfunction actions_add_trace_outputfunction actions_add_signalfunction actions_add_shellfunction actions_add_continuefunction actions_parsefunction actions_performfunction for_each_action
Annotated Snippet
while (token != NULL) {
arg_value = extract_arg(token, "num");
if (arg_value) {
if (strtoi(arg_value, &signal))
return -1;
} else {
arg_value = extract_arg(token, "pid");
if (arg_value) {
if (strncmp_static(arg_value, "parent") == 0)
pid = -1;
else if (strtoi(arg_value, &pid))
return -1;
} else {
/* Invalid argument */
return -1;
}
}
token = strtok(NULL, ",");
}
if (!signal || !pid)
/* Missing argument */
return -1;
actions_add_signal(self, signal, pid);
break;
case ACTION_SHELL:
if (token == NULL)
return -1;
arg_value = extract_arg(token, "command");
if (!arg_value)
return -1;
actions_add_shell(self, arg_value);
break;
case ACTION_CONTINUE:
/* Takes no argument */
if (token != NULL)
return -1;
actions_add_continue(self);
break;
default:
return -1;
}
return 0;
}
/*
* actions_perform - perform all actions
*/
int
actions_perform(struct actions *self)
{
int pid, retval;
const struct action *action;
self->continue_flag = false;
for_each_action(self, action) {
switch (action->type) {
case ACTION_TRACE_OUTPUT:
retval = save_trace_to_file(self->trace_output_inst, action->trace_output);
if (retval) {
err_msg("Error saving trace\n");
return retval;
}
break;
case ACTION_SIGNAL:
if (action->pid == -1)
pid = getppid();
else
pid = action->pid;
retval = kill(pid, action->signal);
if (retval) {
err_msg("Error sending signal\n");
return retval;
}
break;
case ACTION_SHELL:
retval = system(action->command);
if (retval)
return retval;
break;
case ACTION_CONTINUE:
self->continue_flag = true;
return 0;
default:
break;
}
Annotation
- Immediate include surface: `stdlib.h`, `string.h`, `signal.h`, `unistd.h`, `actions.h`, `trace.h`, `utils.h`.
- Detected declarations: `function actions_init`, `function actions_destroy`, `function for_each_action`, `function actions_new`, `function actions_add_trace_output`, `function actions_add_signal`, `function actions_add_shell`, `function actions_add_continue`, `function actions_parse`, `function actions_perform`.
- 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.