[systemd-devel] [PATCH 00/18] journal fixes and enhancements, please review

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Fri Jun 7 21:22:32 PDT 2013


Hi,
this is a small series with journal cleanups, enhancements,
and bugfixes:

Patches marked with (*) are the ones worth looking at.
The last one is (hopefully) a fix for the production of
journals which cause journalctl to loop. It doesn't fix
the problem of looping on such journals, but should halt
their production.

cleanup:
  journal: simplify match_free_if_empty
ability to peruse just system or your own journals:
  journal: add ability to filter by current user                         (*)
  journalctl: add --system/--user flags                                  (*)
µ-opt:
  journal: loop less in MATCH_AND_TERM conditionals
output fix:
  journalctl: no color for --reboot-- when not on tty
unit file parsing fix:
  Properly check for overflow in offsets
cleanup:
  Use stdint.h macros instead of casts to print uint64_t values
journalctl fix:
  journalctl: print proper IDs with --header
journalctl enhancement:
  journalctl: print monotonic timestamp in --header
test which shows that journalctl --header could use some TLC:
  tests: add test for empty journal files
ability to open specific journal files: 
  journal: add sd_journal_open_files                                     (*)
  journalctl: allow the user to specify the file(s) to use
restoration of the location cache:
  journal: remember last direction of search and keep offset cache       (*)
cleanup:
  journal: change direction tests to use the same convention (cp </> np)
more tests and a fix (I hope) for journalctl looping behaviour:
  tests: add testcase for skipping-entries-on-direction-change-bug (Marius Vollmer)
  tests: add testcase for duplicate seqnums
  journal: letting (interleaved) seqnums go                              (*)

Regarding sd_journal_open_files, this was proposed before
([RFC PATCH 1/3] journal: add sd_journal_add_file), and Lennart
said:

> I'd be open to adding a more "static" API for this however,
> i.e. sd_journal_open_files(sd_journal **ret, char **files, int flags)
> or so, which takes a string list of file names, and doesn't allow
> dynamic addition (or removal) of files to interleave...

I think the API is nice and clean. I only changed char** to const char**.
Waiting for modifications to specified journal files also works nicely,
with minimal code changes and negligible overhead for the common case
of listening to whole directory.

 Makefile-man.am                             |  15 ++
 Makefile.am                                 |   9 +
 TODO                                        |   5 +-
 man/journalctl.xml                          |  46 ++++-
 man/sd_journal_open.xml                     |  59 +++++-
 shell-completion/bash/journalctl            |   1 +
 shell-completion/systemd-zsh-completion.zsh |   2 +
 src/core/execute.c                          |   2 +-
 src/journal/journal-authenticate.c          |  10 +-
 src/journal/journal-file.c                  | 105 +++++-----
 src/journal/journal-file.h                  |  18 +-
 src/journal/journal-gatewayd.c              |  14 +-
 src/journal/journal-internal.h              |   1 +
 src/journal/journal-qrcode.c                |   6 +-
 src/journal/journal-verify.c                |  94 ++++-----
 src/journal/journalctl.c                    |  60 +++++-
 src/journal/journald-kmsg.c                 |   3 +-
 src/journal/journald-server.c               |  24 +--
 src/journal/libsystemd-journal.sym          |   5 +
 src/journal/sd-journal.c                    | 273 +++++++++++++++++--------
 src/journal/test-journal-interleaving.c     | 299 ++++++++++++++++++++++++++++
 src/journal/test-journal-verify.c           |   4 +-
 src/journal/test-journal.c                  |  60 +++++-
 src/libudev/libudev-hwdb.c                  |  10 +-
 src/login/logind-session.c                  |  59 ++----
 src/python-systemd/_reader.c                |   1 +
 src/shared/list.h                           |   7 +
 src/shared/logs-show.c                      |  11 +-
 src/shared/util.c                           |  52 ++++-
 src/shared/util.h                           |   1 +
 src/systemd/sd-journal.h                    |   5 +-
 src/test/test-util.c                        |  39 ++++
 32 files changed, 972 insertions(+), 328 deletions(-)
 create mode 100644 src/journal/test-journal-interleaving.c

-- 
1.8.2.562.g931e949



More information about the systemd-devel mailing list