diff options
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | shell-completion/zsh/_loginctl | 64 | ||||
-rw-r--r-- | src/journal/test-journal-stream.c | 9 | ||||
-rw-r--r-- | src/libudev/libudev-device.c | 2 |
4 files changed, 66 insertions, 11 deletions
@@ -28,6 +28,8 @@ External: Features: +* man: clarify that "machinectl show" shows different information than "machinectl status" (no cgroup tree, no IP addresses, ...) + * "systemctl daemon-reload" should result in /etc/systemd/system.conf being reloaded by systemd * install: include generator dirs in unit file search paths diff --git a/shell-completion/zsh/_loginctl b/shell-completion/zsh/_loginctl index bd33b66fae..1e2a4db2a0 100644 --- a/shell-completion/zsh/_loginctl +++ b/shell-completion/zsh/_loginctl @@ -1,15 +1,43 @@ #compdef loginctl -_loginctl_all_sessions(){_sys_all_sessions=($(loginctl --no-legend list-sessions | { while read a b; do echo " $a"; done; }) )} -_loginctl_all_users() {_sys_all_users=( $(loginctl --no-legend list-users | { while read a b; do echo " $a"; done; }) )} -_loginctl_all_seats() {_sys_all_seats=( $(loginctl --no-legend list-seats | { while read a b; do echo " $a"; done; }) )} +_loginctl_all_sessions() { + local session description + loginctl --no-legend list-sessions | while read -r session description; do + _sys_all_sessions+=( "$session" ) + _sys_all_sessions_descr+=( "${session}:$description" ) + done +} + +_loginctl_all_users() { + local uid description + loginctl --no-legend list-users | while read -r uid description; do + _sys_all_users+=( "$uid" ) + _sys_all_users_descr+=( "${uid}:$description" ) + done +} +_loginctl_all_seats() { + local seat description + loginctl --no-legend list-seats | while read -r seat description; do + _sys_all_seats+=( "$seat" ) + _sys_all_seats_descr+=( "${seat}:$description" ) + done +} + +local fun # Completion functions for SESSIONS for fun in session-status show-session activate lock-session unlock-session terminate-session kill-session ; do (( $+functions[_loginctl_$fun] )) || _loginctl_$fun() { + local -a _sys_all_sessions{,_descr} + _loginctl_all_sessions - compadd "$@" -a - _sys_all_sessions + for _ignore in $words[2,-1]; do + _sys_all_sessions[(i)$_ignore]=() + _sys_all_sessions_descr[(i)$_ignore:*]=() + done + + _describe -t systemd-sessions session _sys_all_sessions_descr _sys_all_sessions "$@" } done @@ -17,16 +45,34 @@ done for fun in user-status show-user enable-linger disable-linger terminate-user kill-user ; do (( $+functions[_loginctl_$fun] )) || _loginctl_$fun() { - _loginctl_all_users - compadd "$@" -a - _sys_all_users + local -a _sys_all_users{,_descr} + zstyle -a ":completion:${curcontext}:users" users _sys_all_users + + if ! (( $#_sys_all_users )); then + _loginctl_all_users + fi + + for _ignore in $words[2,-1]; do + _sys_all_users[(i)$_ignore]=() + _sys_all_users_descr[(i)$_ignore:*]=() + done + # using the common tag `users' here, not rolling our own `systemd-users' tag + _describe -t users user ${_sys_all_users_descr:+_sys_all_users_descr} _sys_all_users "$@" } done # Completion functions for SEATS (( $+functions[_loginctl_seats] )) || _loginctl_seats() { + local -a _sys_all_seats{,_descr} + _loginctl_all_seats - compadd "$@" -a - _sys_all_seats + for _ignore in $words[2,-1]; do + _sys_all_seats[(i)$_ignore]=() + _sys_all_seats_descr[(i)$_ignore:*]=() + done + + _describe -t systemd-seats seat _sys_all_seats_descr _sys_all_seats "$@" } for fun in seat-status show-seat terminate-seat ; do (( $+functions[_loginctl_$fun] )) || _loginctl_$fun() @@ -36,8 +82,6 @@ done # Completion functions for ATTACH (( $+functions[_loginctl_attach] )) || _loginctl_attach() { - _loginctl_all_seats - _arguments -w -C -S -s \ ':seat:_loginctl_seats' \ '*:device:_files' @@ -78,7 +122,7 @@ done if (( CURRENT == 1 )); then _describe -t commands 'loginctl command' _loginctl_cmds || compadd "$@" else - local curcontext="$curcontext" + local curcontext="$curcontext" _ignore cmd="${${_loginctl_cmds[(r)$words[1]:*]%%:*}}" diff --git a/src/journal/test-journal-stream.c b/src/journal/test-journal-stream.c index e1146c692d..b5ecf2f375 100644 --- a/src/journal/test-journal-stream.c +++ b/src/journal/test-journal-stream.c @@ -80,6 +80,7 @@ int main(int argc, char *argv[]) { char *z; const void *data; size_t l; + dual_timestamp previous_ts = DUAL_TIMESTAMP_NULL; /* journal_file_open requires a valid machine id */ if (access("/etc/machine-id", F_OK) != 0) @@ -101,6 +102,14 @@ int main(int argc, char *argv[]) { dual_timestamp_get(&ts); + if (ts.monotonic <= previous_ts.monotonic) + ts.monotonic = previous_ts.monotonic + 1; + + if (ts.realtime <= previous_ts.realtime) + ts.realtime = previous_ts.realtime + 1; + + previous_ts = ts; + assert_se(asprintf(&p, "NUMBER=%u", i) >= 0); iovec[0].iov_base = p; iovec[0].iov_len = strlen(p); diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c index c27b01db96..9a8d682107 100644 --- a/src/libudev/libudev-device.c +++ b/src/libudev/libudev-device.c @@ -871,7 +871,7 @@ _public_ struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_ udev_list_cleanup(&udev_device->sysattrs); FOREACH_DEVICE_SYSATTR(udev_device->device, sysattr) - udev_list_entry_add(&udev_device->properties, sysattr, NULL); + udev_list_entry_add(&udev_device->sysattrs, sysattr, NULL); udev_device->sysattrs_read = true; } |