fix: relayd: unaligned access in trace_chunk_registry_ht_key_hash
[lttng-tools.git] / extras / zsh-completion / _lttng-sessiond
1 #compdef lttng-sessiond
2 #
3 # Copyright (c) 2015-2023 Philippe Proulx <eeppeliteloop@gmail.com>
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to deal
7 # in the Software without restriction, including without limitation the rights
8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 # copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
11 #
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 # THE SOFTWARE.
22 #
23 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24 #
25 # This is a Zsh completion function for the lttng-sessiond(1) command
26 # (see <https://lttng.org/>), for versions 2.5 to 2.14.
27 #
28 # If you want, at your own risk, the function to work with versions
29 # above 2.14, set `LTTNG_ZSH_COMP_IGNORE_VERSION_LIMIT=1`.
30
31 # Sets the `minor_version` variable to the minor version of LTTng-tools,
32 # or to `0` if not found.
33 __lttng_set_minor_version() {
34 minor_version=0
35
36 local -a match
37
38 if [[ $($words[1] --version) =~ '2\.([[:digit:]]+)' ]]; then
39 minor_version=$match[1]
40 fi
41 }
42
43 # Adds completions for an LTTng kernel probe name.
44 __lttng_complete_probe_modules() {
45 # Find relevant kernel module files
46 local dir="/usr/lib/modules/$(uname -r)/extra"
47
48 if [[ ! -d $dir ]]; then
49 dir="/usr/lib/modules/$(uname -r)/updates"
50
51 if [[ ! -d $dir ]]; then
52 _message "cannot find directory \"$dir\""
53 return 1
54 fi
55 fi
56
57 local -a probe_files=("$dir"/**/lttng-probe-*.(ko|ko.gz|ko.zst)(:t))
58
59 if (($#probe_files == 0)); then
60 _message "no probe modules found in \"$dir\""
61 return 1
62 fi
63
64 # Strip prefix and extension
65 probe_files=(${probe_files#lttng-probe-})
66 probe_files=(${probe_files%.gz})
67 probe_files=(${probe_files%.zst})
68 probe_files=(${probe_files%.ko})
69
70 # Add completions
71 local expl
72
73 compadd "$@" -a - probe_files
74 }
75
76 # Adds completions for the arguments of the `lttng-sessiond` command.
77 __lttng_complete_lttng_sessiond() {
78 local curcontext=$curcontext state state_descr line
79 local -A opt_args
80
81 # LTTng-tools 2.5+
82 local specs=(
83 '(-q --quiet)*'{-v,--verbose}'[increase verbosity]'
84 '(-q --quiet -v --verbose)'{-q,--quiet}'[suppress all messages, including warnings and errors]'
85 '(- : *)'{-V,--version}'[show version and quit]'
86 '(- : *)'{-h,--help}'[show help]'
87 '(-c --client-sock)'{-c+,--client-sock=}'[set the path to the client Unix socket]:client Unix socket path:_files'
88 '(-a --apps-sock)'{-a+,--apps-sock=}'[set the path to the app Unix socket]:app Unix socket path:_files'
89 '--kconsumerd-err-sock=[set the path to the kernel consumer daemon error socket]:kernel consumer daemon error Unix socket path:_files'
90 '--kconsumerd-cmd-sock=[set the path to the kernel consumer daemon command socket]:kernel consumer daemon command Unix socket path:_files'
91 '--ustconsumerd32-err-sock=[set the path to the 32-bit UST consumer daemon error Unix socket]:32-bit UST consumer daemon error Unix socket path:_files'
92 '--ustconsumerd32-cmd-sock=[set the path to the 32-bit UST consumer daemon command Unix socket]:32-bit UST consumer daemon command Unix socket path:_files'
93 '--ustconsumerd64-err-sock=[set the path to the 64-bit UST consumer daemon error Unix socket]:64-bit UST consumer daemon error Unix socket path:_files'
94 '--ustconsumerd64-cmd-sock=[set the path to the 64-bit UST consumer daemon command Unix socket]:64-bit UST consumer daemon command Unix socket path:_files'
95 '--consumerd32-path=[set the path to the 32-bit UST consumer daemon]:32-bit UST consumer daemon path:_files'
96 '--consumerd32-libdir=[set the path to the directory containing 32-bit UST consumer daemon libraries]:32-bit UST consumer daemon libraries directory path:_directories'
97 '--consumerd64-path=[set the path to the 64-bit UST consumer daemon]:64-bit UST consumer daemon path:_files'
98 '--consumerd64-libdir=[set the path to the directory containing 64-bit UST consumer daemon libraries]:64-bit UST consumer daemon libraries directory path:_directories'
99 '(-d --daemonize -b --background)'{-d,--daemonize}'[start as daemon and close file descriptors (console)]'
100 '(-b --background -d --daemonize)'{-b,--background}'[start as daemon, but keep file descriptors (console) open]'
101 '(-g --group)'{-g+,--group=}'[set the Unix tracing group name]:Unix tracing group name:_groups'
102 '(-S --sig-parent)'{-S,--sig-parent}'[send the USR1 signal to the parent process to notify readiness]'
103 '(-p --pidfile)'{-p+,--pidfile=}'[set the path to the PID file]:PID file path:_files'
104 "--verbose-consumer[increase verbosity of consumer daemon]"
105 '(--kmod-probes --extra-kmod-probes)--no-kernel[disable the kernel tracer]'
106 '(-f --config)'{-f+,--config=}'[set the path to the INI daemon configuration file]:configuration file path:_files'
107 '(-l --load)'{-l+,--load=}'[set the path from which to load recording session configurations]:recording session configurations path:_files'
108 '(--no-kernel --kmod-probes)--extra-kmod-probes=[extra kernel probe modules to load]:kernel probe module:_sequence __lttng_complete_probe_modules'
109 )
110
111 # LTTng-tools 2.5 only
112 if ((minor_version == 5)); then
113 specs+=(
114 '--jul-tcp-port=[set the TCP port on which to listen for `java.util.logging` application registration]:JUL application registration TCP port: '
115 )
116 fi
117
118 # LTTng-tools 2.6+
119 if ((minor_version >= 6)); then
120 specs+=(
121 '--agent-tcp-port=[set the TCP port on which to listen for agent application registration]:agent application registration TCP port: '
122 '(--no-kernel --extra-kmod-probes)--kmod-probes=[kernel probe modules to load]:kernel probe module:_sequence __lttng_complete_probe_modules'
123 )
124 fi
125
126 # LTTng-tools 2.13+
127 if ((minor_version >= 13)); then
128 specs+=(
129 '--event-notifier-error-buffer-size-kernel=[set the size of the kernel event notifier error counter buffers]:kernel event notifier error counter buffer size (slots): '
130 '--event-notifier-error-buffer-size-userspace=[set the size of the user space event notifier error counter buffers]:user space event notifier error counter buffer size (slots): '
131 )
132 fi
133
134 _arguments -C -s -w : $specs
135 }
136
137 # First, set the `minor_version` variable to the minor version of
138 # LTTng-tools. Some features depend on a specific version and this
139 # completion function supports many versions from LTTng-tools 2.5.
140 local -i minor_version
141
142 __lttng_set_minor_version
143
144 # Exit now with LTTng-tools < 2.5 or LTTng-tools > 2.14
145 local -r ignore_version_limit=${LTTNG_ZSH_COMP_IGNORE_VERSION_LIMIT:-0}
146
147 if ((minor_version < 5 || (minor_version > 14 && !ignore_version_limit))); then
148 _message "completion not available for LTTng-tools 2.$minor_version; please update the completion files or set \`LTTNG_ZSH_COMP_IGNORE_VERSION_LIMIT=1\`"
149 return 1
150 fi
151
152 # Add completions for lttng-sessiond(1)
153 __lttng_complete_lttng_sessiond "$@"
This page took 0.031394 seconds and 4 git commands to generate.