trace-cmd: Add option to execute traced process as given user
PATCH v4 1/1 trace-cmd: Add option to execute traced process as given user
A new trace-cmd record option is added: "--user". When it is set with combination of option -F, the traced process is executed in the context of the specified user.
Suggested-by Yordan Karadzhov (VMware) <[email protected]>
Signed-off-by Tzvetomir Stoyanov (VMware) <[email protected]>
---
[
v4 changes:
- Added check for strdup() failure.
- Made input user string argument of change_user() and run_cmd() constant.
v3 changes:
"--user" does not depend on option -F, it works with any command,
specified as trace-cmd argument.
v2 changes:
- Check for errors in change_user(). If an error occurs while changing the user, the message is printed and the traced process is not executed.
]
Documentation/trace-cmd-record.1.txt | 4 +++ tracecmd/trace-record.c | 49 ++++++++++++++++++++++++++-- tracecmd/trace-usage.c | 1 + 3 files changed, 51 insertions(+), 3 deletions(-)
Documentation/trace-cmd-record.1.txt +4 -0
@@ -122,6 +122,10 @@ OPTIONS *--mmap*:: Used with either *-F* or *-P*, save the traced process memory map into the trace.dat file. + +*--user*:: + Execute the specified *command* as given user. + *-C* 'clock':: Set the trace clock to "clock".
tracecmd/trace-record.c +46 -3
109 lines not on this page · raw message
tracecmd/trace-usage.c +1 -0
@@ -58,6 +58,7 @@ static struct usage_help usage_help[] = {" --max-graph-depth limit function_graph depth\n" " --no-filter include trace-cmd threads in the trace\n" " --mmap used with -F or -P, save the traced process memory map into the trace.dat file\n" +" --user execute the specified [command ...] as given user\n" }, { "start",
Signature · 1 line
2.21.0