Commit graph

208 commits

Author SHA1 Message Date
Lennart Poettering d816a5fcea analyze: drop spurious newline 2019-11-13 12:58:15 +01:00
Lennart Poettering 985c18802d analyze: add --base-time= to specify base time for 'calendar' verb 2019-11-13 12:57:17 +01:00
Yu Watanabe a969d60645 tree-wide: drop locale.h when locale-util.h is included 2019-11-04 00:30:32 +09:00
Lennart Poettering 81610e9609 analyze: fix minor memleak 2019-10-30 15:50:37 +01:00
Lennart Poettering ea334dc328 analyze: sort list of unknown syscalls kernel implements 2019-10-30 15:50:06 +01:00
Mike Gilbert 417b82e1c3 analyze: declare dump_exit_status outside of HAVE_SECCOMP block
Fixes: 76ed04d936
Closes: https://github.com/systemd/systemd/issues/13230
2019-07-31 09:43:03 +09:00
Lennart Poettering 5756bff6f1
Merge pull request #13119 from keszybz/unit-loading-2
Rework unit loading to take into account all aliases
2019-07-30 17:55:37 +02:00
Zbigniew Jędrzejewski-Szmek 91e0ee5f16 pid1: drop unit caches only based on mtime
v2:
- do not watch mtime of transient and generated dirs

  We'd reload the map after every transient unit we created, which we don't
  need to do, since we create those units ourselves and know their fragment
  path.
2019-07-30 14:01:46 +02:00
Zbigniew Jędrzejewski-Szmek e67cd21d7d analyze: add "unit-files" to dump the unit fragment map
I'm not convinced that this is useful enough to be included... But it is
certainly nice when debugging.
2019-07-30 14:01:46 +02:00
Lennart Poettering d68d0366dc analyze: clarify that 'exit-status' optionally takes arguments 2019-07-29 19:44:24 +02:00
Lennart Poettering d8e17e7356 analyze: right-align exit status column 2019-07-29 19:22:34 +02:00
Lennart Poettering 5238d9a83a analyze: rename "exit-codes" to "exit-status"
waitid(2) and the libc function signature calls this "exit status", and
uses "exit code" for something different. Let's stick to the same
nomenclature hence.
2019-07-29 19:22:22 +02:00
Lennart Poettering 563067ad26 analyze: always use "int" to display exit status values
That's what it actually is, hence let's use that and cast when the type
is bigger.
2019-07-29 19:14:09 +02:00
Lennart Poettering 1d7458fbb1
Merge pull request #13207 from keszybz/symbolic-exit-code-names
Symbolic exit code names
2019-07-29 18:58:06 +02:00
Lennart Poettering 49139a5d92 analyze: dot(1) man page link should be urlified
I mean, let's not miss out on this excellent opportunity to use
hyperlinks on terminals.

(Unfortunately not see unless you invoke 'systemd-analyze --no-pager
--help', because 'less' is so much stuck in the past :-(.)
2019-07-29 16:08:18 +02:00
Zbigniew Jędrzejewski-Szmek 76ed04d936 analyze: add exit-codes verb 2019-07-29 15:54:53 +02:00
Zbigniew Jędrzejewski-Szmek 4252171a94 tree-wide: use lowercase table headers
https://github.com/systemd/systemd/pull/13062#discussion_r303847484
> the formatter uppercases them anyway, and this way the JSON output of the
> formatter is nicer as it uses the table header fields 1:1 for the json
> output.
2019-07-16 14:29:04 +02:00
Zbigniew Jędrzejewski-Szmek 08f105df24 analyze: fix formatting of timestamps with 0 µs
There is a rule that "%.0d" formats 0 as "". There is no such rule for
"%0d" and 0 :(. The output had an extra 0 if usec was 0.
2019-07-15 19:11:16 +02:00
Yu Watanabe af2d6d477c analyze: format output of 'systemd-analyze timestamp' by using Table 2019-07-16 01:14:20 +09:00
Yu Watanabe 7503c6e80e analyze: format output of 'systemd-analyze timespan' by using Table 2019-07-16 01:07:31 +09:00
Yu Watanabe 9c712cf285 analyze: format output of 'systemd-analyze calendar' by using Table 2019-07-16 00:46:10 +09:00
Yu Watanabe d8bfdbe1fa analyze: format output of 'systemd-analyze blame' by using Table 2019-07-16 00:19:59 +09:00
Zbigniew Jędrzejewski-Szmek 1f65fd4926 basic/time-util: add helper function to check if timestamp is set
No functional change.
2019-07-04 19:12:47 +02:00
Zbigniew Jędrzejewski-Szmek edfea9fe0d analyze: add 'condition' verb
We didn't have a straightforward way to parse and evaluate those strings.
Prompted by #12881.
2019-06-27 10:54:37 +02:00
Zbigniew Jędrzejewski-Szmek ea62aa24ae analyze: also print unix time in "timestamp" 2019-05-21 09:56:41 +02:00
Zbigniew Jędrzejewski-Szmek c269607f9b analyze: give a hint about calendar/timestamp/timespan use
This should help clear up the confusion in
https://bugzilla.redhat.com/show_bug.cgi?id=1711065.
2019-05-21 09:56:41 +02:00
Zbigniew Jędrzejewski-Szmek 2cae4711f3 analyze: add 'timestamp' verb
We had 'calendar' and 'timespan', but the third one was missing.
Also consistently order the verbs as calendar/timestamp/timespan in help.

The output from 'timespan' is highlighted more.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1711065.
2019-05-17 10:09:32 +02:00
Zbigniew Jędrzejewski-Szmek b99f4d484b analyze: drop redundant call to calendar_spec_normalize()
calendar_spec_from_string() already does that.
2019-05-16 23:14:41 +02:00
Yu Watanabe 80a8a7fb20 analyze: fix help message 2019-05-15 15:09:45 +02:00
Zbigniew Jędrzejewski-Szmek 1a04395959 Enable log colors for most of tools in /usr/bin
When emitting the calendarspec warning we want to see some color.
Follow-up for 04220fda5c.

Exceptions:
- systemctl, because it has a lot hand-crafted coloring
- tmpfiles, sysusers, stdio-bridge, etc, because they are also used in
  services and I'm not sure if this wouldn't mess up something.
2019-05-08 09:50:21 +02:00
Sebastian Jennen 1ace223ca7 code style format: clang-format applied to src/a*/*
[zj: this is a subset of changes generated by clang-format, just the ones
  I think improve readability or consistency.]

This is a part of https://github.com/systemd/systemd/pull/11811.
2019-04-12 17:26:33 +02:00
Lennart Poettering 196f306795 analyze: check both possible mount points of tracefs
Let's try the new one first, the old one second.
2019-03-29 14:57:37 +01:00
Zbigniew Jędrzejewski-Szmek ca78ad1de9 headers: remove unneeded includes from util.h
This means we need to include many more headers in various files that simply
included util.h before, but it seems cleaner to do it this way.
2019-03-27 11:53:12 +01:00
Zbigniew Jędrzejewski-Szmek 2fffb93b32 analyze: reword explanation in critical-chain header
Let's try to make it a bit clearer.
2019-03-15 10:17:46 +01:00
Lennart Poettering d8b4d14df4 util: split out nulstr related stuff to nulstr-util.[ch] 2019-03-14 13:25:52 +01:00
Lennart Poettering 760877e90c util: split out sorting related calls to new sort-util.[ch] 2019-03-13 12:16:43 +01:00
Zbigniew Jędrzejewski-Szmek deed4d50a2 analyze: add color highlighting when printing calendar elapses
With multiple iterations, I found it hard to pick out the interesting bits in
the column of text. I tried plain highlighting first, but it doesn't seem
enough. But blue/yellow makes it easy to jump to the right iteration.
2019-02-22 09:32:17 +01:00
Zbigniew Jędrzejewski-Szmek 84653d99fa analyze: split out loop innards into a separate function
This was intended to be just a refactoring, but it also fixes a minor bug:
after printing "never", we would skip subsequent expressions:

$ systemd-analyze calendar --iterations=20 @0 @1
systemd-analyze calendar --iterations=20 @0 @1
  Original form: @0
Normalized form: 1970-01-01 00:00:00 UTC
    Next elapse: never

(the second expression was skipped).
2019-02-22 09:32:17 +01:00
Lennart Poettering f2ccf8320a analyze: optionally, show more than one elapse time for calendar expressions 2019-02-22 09:10:54 +01:00
Zbigniew Jędrzejewski-Szmek f1d9d36ac5 analyze: generalize cat-config to apply to tmpfiles, presets, hwdb.d, etc.
Fixes #10256.

What works:

systemd-analyze cat-config systemd/system-preset
systemd-analyze cat-config systemd/user-preset
systemd-analyze cat-config tmpfiles.d
systemd-analyze cat-config sysusers.d
systemd-analyze cat-config systemd/sleep.conf
systemd-analyze cat-config systemd/user.conf
systemd-analyze cat-config systemd/system.conf
systemd-analyze cat-config udev/udev.conf
(and other .conf files)
systemd-analyze cat-config udev/rules.d
systemd-analyze cat-config environment.d
systemd-analyze cat-config environment

Directories may be specified with the trailing dash or not.

The caveat is that for user configuration, systemd and other tools also look
at ~/.config/. It would be nice to support this, but this patch doesn't.
"cat-config --user" is rejected, and we may allow it in the future and then
extend the search path with directories under ~/.config.

What doesn't work (and probably shouldn't because those files cannot be
meaningfully concatenated):

systemd-analyze cat-config systemd/system  (.service, .slice, .socket, ...)
systemd-analyze cat-config systemd/user
systemd-analyze cat-config systemd/network (.network, .link, and .dnssd)

The hardcoding of information about paths in this manner is a bit ugly, but
OTOH, it is not too onerous, and at least we have one place where all the
schemes are "documented" through code. It'll make us think twice before adding
yet another slightly different scheme.
2019-02-18 10:29:33 +01:00
Zbigniew Jędrzejewski-Szmek c2953e0808 analyze: use SYNTHETIC_ERRNO 2019-02-18 10:29:33 +01:00
Zbigniew Jędrzejewski-Szmek 681bd2c524 meson: generate version tag from git
$ build/systemctl --version
systemd 239-3555-g6178cbb5b5
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid
$ git tag v240 -m 'v240'
$ ninja -C build
ninja: Entering directory `build'
[76/76] Linking target fuzz-unit-file.
$ build/systemctl --version
systemd 240
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid

This is very useful during development, because a precise version string is
embedded in the build product and displayed during boot, so we don't have to
guess answers for questions like "did I just boot the latest version or the one
from before?".

This change creates an overhead for "noop" builds. On my laptop, 'ninja -C
build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid
this, but I think that <1 s is still acceptable.

Fixes #7183.

PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the
more dynamically changing version string.

Why save to a file? It would be easy to generate the version tag using
run_command(), but we want to go through a file so that stuff gets rebuilt when
this file changes. If we just defined an variable in meson, ninja wouldn't know
it needs to rebuild things.
2018-12-21 13:43:20 +01:00
Lennart Poettering 9a6f746fb6 locale-util: prefix special glyph enum values with SPECIAL_GLYPH_
This has been irritating me for quite a while: let's prefix these enum
values with a common prefix, like we do for almost all other enums.

No change in behaviour, just some renaming.
2018-12-14 08:22:54 +01:00
Lennart Poettering ec16f3b6dd analyze: add new security verb 2018-11-30 16:48:09 +01:00
Lennart Poettering 2987225ce6 analyze: use strv_skip() where appropriate 2018-11-30 16:46:09 +01:00
Lennart Poettering 0ed3da7c8c analyze: remove unnecessary negation of bus_error_message() error number parameter 2018-11-30 16:46:09 +01:00
Lennart Poettering 90bea7448d analyze: fix include order 2018-11-30 16:46:09 +01:00
Michal Koutný d3340e6f95 analyze: Fix build without seccomp (#10899) 2018-11-24 02:40:32 +09:00
Zbigniew Jędrzejewski-Szmek baaa35ad70 coccinelle: make use of SYNTHETIC_ERRNO
Ideally, coccinelle would strip unnecessary braces too. But I do not see any
option in coccinelle for this, so instead, I edited the patch text using
search&replace to remove the braces. Unfortunately this is not fully automatic,
in particular it didn't deal well with if-else-if-else blocks and ifdefs, so
there is an increased likelikehood be some bugs in such spots.

I also removed part of the patch that coccinelle generated for udev, where we
returns -1 for failure. This should be fixed independently.
2018-11-22 10:54:38 +01:00
Zbigniew Jędrzejewski-Szmek 294bf0c34a Split out pretty-print.c and move pager.c and main-func.h to shared/
This is high-level functionality, and fits better in shared/ (which is for
our executables), than in basic/ (which is also for libraries).
2018-11-20 18:40:02 +01:00