analyze: extend the dump command to accept patterns

The new function DumpPatterns() can be used to limit (drastically) the size of
the data returned by PID1. Hence the optimization of serializing data into a
file descriptor should be less relevant than having the possibility to limit
the data when communicating with the service manager remotely.

NB: when passing patterns, the dump command omits the version of the manager as
well as the features and the timestamps.
This commit is contained in:
Franck Bui
2022-10-13 07:47:42 +09:00
committed by Yu Watanabe
parent 17f6406bf2
commit d1d8786c5b
13 changed files with 155 additions and 50 deletions
+9 -1
View File
@@ -60,9 +60,10 @@ _systemd_analyze() {
)
local -A VERBS=(
[STANDALONE]='time blame plot dump unit-paths exit-status calendar timestamp timespan'
[STANDALONE]='time blame plot unit-paths exit-status calendar timestamp timespan'
[CRITICAL_CHAIN]='critical-chain'
[DOT]='dot'
[DUMP]='dump'
[VERIFY]='verify'
[SECCOMP_FILTER]='syscall-filter'
[CAT_CONFIG]='cat-config'
@@ -125,6 +126,13 @@ _systemd_analyze() {
comps='--help --version --system --user --global --from-pattern --to-pattern --order --require'
fi
elif __contains_word "$verb" ${VERBS[DUMP]}; then
if [[ $cur = -* ]]; then
comps='--help --version --system --user --no-pager'
else
comps=$( __get_units_all )
fi
elif __contains_word "$verb" ${VERBS[SECCOMP_FILTER]}; then
if [[ $cur = -* ]]; then
comps='--help --version --no-pager'