summaryrefslogtreecommitdiff
path: root/src/journal
Commit message (Collapse)AuthorAge
* tree-wide: there is no ENOTSUP on linuxDavid Herrmann2015-03-13
| | | | Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
* Introduce loop_read_exact helperZbigniew Jędrzejewski-Szmek2015-03-09
| | | | | | | | Usually when using loop_read(), we want to read the full buffer. Add a helper that mirrors loop_write(), and returns 0 when full buffer was read, and an error otherwise. Use -ENODATA for the short read, to distinguish it from a read error.
* journalctl: unlink without checking with access firstZbigniew Jędrzejewski-Szmek2015-03-09
| | | | | | | It is more elegant to do this in one step. Coverity complains about the TOCTOU difference, but it is not an actual problem (CID #1237777).
* journal: fix return codeZbigniew Jędrzejewski-Szmek2015-03-09
| | | | | | | Introduced in fa6ac76083b8ff. Might be related to CID #1261724, but I don't know if coverity can recurse this deep.
* journal-file: update format string to remove castZbigniew Jędrzejewski-Szmek2015-03-09
|
* journal: align comments to make them more legibleZbigniew Jędrzejewski-Szmek2015-03-09
|
* sd-journal: return error when we cannot open a fileZbigniew Jędrzejewski-Szmek2015-03-08
| | | | | Lack of this caused journalctl not to display a hint about missing groups properly when the user lacks permissions.
* journalctl: update hint now that we set ACL everywhereZbigniew Jędrzejewski-Szmek2015-03-08
|
* Do not advertise .d snippets over main config fileZbigniew Jędrzejewski-Szmek2015-03-03
| | | | | | | | | | For daemons which have a main configuration file, there's little reason for the administrator to use configuration snippets. They are useful for packagers which need to override settings, but we shouldn't advertise that as the main way of configuring those services. https://bugs.freedesktop.org/show_bug.cgi?id=89397
* journal: fix Inappropriate ioctl for device on ext4Cristian Rodríguez2015-03-02
| | | | | | | | | | | Logs constantly show systemd-journald[395]: Failed to set file attributes: Inappropriate ioctl for device This is because ext4 does not support FS_NOCOW_FL. [zj: fold into one conditional as suggested on the ML and fix (preexisting) r/errno confusion in error message.]
* journal: make skipping of exhausted journal files effective againMichal Schmidt2015-02-25
| | | | | | | | | | | | | | | | | | | | Commit 668c965af "journal: skipping of exhausted journal files is bad if direction changed" fixed a correctness issue, but it also significantly limited the cases where the optimization that skips exhausted journal files could apply. As a result, some journalctl queries are much slower in v219 than in v218. (e.g. queries where a "--since" cutoff should have quickly eliminated older journal files from consideration, but didn't.) If already in the initial iteration find_location_with_matches() finds no entry, the journal file's location is not updated. This is fine, except that: - We must update at least f->last_direction. The optimization relies on it. Let's separate that from journal_file_save_location() and update it immediately after the direction checks. - The optimization was conditional on "f->current_offset > 0", but it would always be 0 in this scenario. This check is unnecessary for the optimization.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* include <poll.h> instead of <sys/poll.h>Thomas Hindoe Paaboel Andersen2015-02-12
| | | | | | include-what-you-use automatically does this and it makes finding unnecessary harder to spot. The only content of poll.h is a include of sys/poll.h so should be harmless.
* Add missing includes in header filesThomas Hindoe Paaboel Andersen2015-02-12
| | | | | This fixes various issues found by globally reordering the include sections of all .c files.
* journald: don't specify inline in local functionsLennart Poettering2015-02-10
| | | | | | | | Leave it to the compiler to figure out whether it shall inline stuff or not. Only place where using static inline is OK to use is in in header files, really.
* journald: fix some xsprrintf() buffer size falloutLennart Poettering2015-02-03
|
* util: rework strappenda(), and rename it strjoina()Lennart Poettering2015-02-03
| | | | | | After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
* Add a snprinf wrapper which checks that the buffer was big enoughZbigniew Jędrzejewski-Szmek2015-02-01
| | | | | | | | | | If we scale our buffer to be wide enough for the format string, we should expect that the calculation was correct. char_array_0() invocations are removed, since snprintf nul-terminates the output in any case. A similar wrapper is used for strftime calls, but only in timedatectl.c.
* coredump: drop caps while we are processing the coredumpLennart Poettering2015-01-29
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=87354
* Revert "journal: do not check for number of files"Lennart Poettering2015-01-29
| | | | | | | | | | This reverts commit b914ea8d379b446c4c9fac4ba181771676ef38cd. We really need to put a limit on all our resources, everywhere, and in particular if we operate on external data. Hence, let's reintroduce the limit, but bump it substantially, so that it is guaranteed to be higher than any realistic RLIMIT_NOFILE setting.
* tests: use assert_se instead of assertRonny Chevalier2015-01-22
| | | | Otherwise they can be optimized away with -DNDEBUG
* tmpfiles: add 'a' type to set ACLsZbigniew Jędrzejewski-Szmek2015-01-22
|
* Assorted format fixesZbigniew Jędrzejewski-Szmek2015-01-22
| | | | | Types used for pids and uids in various interfaces are unpredictable. Too bad.
* Fix some format strings for enums, they are signedZbigniew Jędrzejewski-Szmek2015-01-22
|
* import: introduce new mini-daemon systemd-importd, and make machinectl a ↵Lennart Poettering2015-01-22
| | | | | | | | | | | | | | client to it The old "systemd-import" binary is now an internal tool. We still use it as asynchronous backend for systemd-importd. Since the import tool might require some IO and CPU resources (due to qcow2 explosion, and decompression), and because we might want to run it with more minimal priviliges we still keep it around as the worker binary to execute as child process of importd. machinectl now has verbs for pulling down images, cancelling them and listing them.
* journal: Fix syslog forwarding without CAP_SYS_ADMINChristian Seiler2015-01-21
| | | | | | | | | | | | | | In case CAP_SYS_ADMIN is missing (like in containers), one cannot fake pid in struct ucred (uid/gid are fine if CAP_SETUID/CAP_SETGID are present). Ensure that journald will try again to forward the messages to syslog without faking the SCM_CREDENTIALS pid (which isn't guaranteed to succeed anyway, since it also does the same thing if the process has already exited). With this patch, journald will no longer silently discard messages that are supposed to be sent to syslog in these situations. https://bugs.debian.org/775067
* journalctl: trim --help to fit in 80 columnsZbigniew Jędrzejewski-Szmek2015-01-19
| | | | | | | Terminals tend to be 80 columns wide by default, and the help text is only supposed to be a terse reminder anyway. https://bugzilla.redhat.com/show_bug.cgi?id=1183771
* Move DEFINE_TRIVIAL_CLEANUP_FUNC to macro.hZbigniew Jędrzejewski-Szmek2015-01-18
| | | | | This remove the need for various header files to include the (relatively heavyweight) util.h.
* remove unneeded libgen.h includesCristian Rodríguez2015-01-17
|
* journald: allow zero length datagrams againLennart Poettering2015-01-13
| | | | | | This undoes a small part of 13790add4bf648fed816361794d8277a75253410 which was erroneously added, given that zero length datagrams are OK, and hence zero length reads on a SOCK_DGRAM be no means mean EOF.
* journal: do not check for number of filesZbigniew Jędrzejewski-Szmek2015-01-09
| | | | | | | Now that we bump rlimit, we do not really know how many files we can open. Remove the check. https://bugzilla.redhat.com/show_bug.cgi?id=1179980
* journal: bump RLIMIT_NOFILE when journal files to 16K (if possible)Lennart Poettering2015-01-08
| | | | | | | | | | | When there are a lot of split out journal files, we might run out of fds quicker then we want. Hence: bump RLIMIT_NOFILE to 16K if possible. Do these even for journalctl. On Fedora the soft RLIMIT_NOFILE is at 1K, the hard at 4K by default for normal user processes, this code hence bumps this up for users to 4K. https://bugzilla.redhat.com/show_bug.cgi?id=1179980
* util: make it easy to initialize the crtime from the current time in ↵Lennart Poettering2015-01-08
| | | | fd_setcrtime()
* journald: turn off COW for journal files on btrfsLennart Poettering2015-01-08
| | | | | | | | | | | | | | btrfs' COW logic results in heavily fragment journal files, which is detrimental for perfomance. Hence, turn off COW for journal files as we create them. Turning off COW comes at the cost of data integrity guarantees, but this should be acceptable, given that we do our own checksumming, and generally have a pretty conservative write pattern. Also see discussion on linux-btrfs: http://www.spinics.net/lists/linux-btrfs/msg41001.html
* journal: consider file deletion errors a reason for rotationLennart Poettering2015-01-06
|
* journald: whenever we rotate a file, btrfs defrag itLennart Poettering2015-01-06
| | | | | | | Our write pattern is quite awful for CoW file systems (btrfs...), as we keep updating file parts in the beginning of the file. This results in fragmented journal files. Hence: when rotating files, defragment them, since at that point we know that no further write accesses will be made.
* tree-wide: remove unnecessary LOG_PRIZbigniew Jędrzejewski-Szmek2015-01-06
| | | | | LOG_DEBUG is already a log level, there is no need to use LOG_PRI which is for filtering out the facility.
* journald: allow restarting journald without losing stream connectionsLennart Poettering2015-01-06
| | | | | | Making use of the fd storage capability of the previous commit, allow restarting journald by serilizing stream state to /run, and pushing open fds to PID 1.
* journald: reuse IOVEC_TOTAL_SIZE() macros where possibleLennart Poettering2015-01-05
|
* journald: when we detect the journal file we are about to write to has been ↵Lennart Poettering2015-01-05
| | | | | | deleted, rotate https://bugzilla.redhat.com/show_bug.cgi?id=1171719
* journald: add some additional checks before we divide by values read from ↵Lennart Poettering2015-01-05
| | | | | | | | journal file headers Since the file headers might be replaced by zeroed pages now due to sigbus we should make sure we don't end up dividing by zero because we don't check values read from journal file headers for changes.
* journalctl: static variables immediately configured via command line ↵Lennart Poettering2015-01-05
| | | | arguments should be prefixed with "arg_"
* journal: install sigbus handler for journal tools tooLennart Poettering2015-01-05
| | | | | | | | | | | | | This makes them robust regarding truncation. Ideally, we'd export this as an API, but given how messy SIGBUS handling is, and the uncertain ownership logic of signal handlers we should not do this (unless libc one day invents a scheme how to sanely install SIGBUS handlers for specific memory areas only). However, for now we can still make all our own tools robust. Note that external tools will only have read-access to the journal anyway, where SIGBUS is much more unlikely, given that only writes are subject to disk full problems.
* journald: constify all thingsLennart Poettering2015-01-05
|
* journald: prefix exported calls with "server_", unexport unnecessary callsLennart Poettering2015-01-05
|
* journald: process SIGBUS for the memory maps we set upLennart Poettering2015-01-05
| | | | | | | | | | | | | | Even though we use fallocate() it appears that file systems like btrfs will trigger SIGBUS on certain low-disk-space situation. We should handle that, hence catch the signal, add it to a list of invalidated pages, and replace the page with an empty memory area. After each write check if SIGBUS was triggered, and consider the write invalid if it was. This should make journald a lot more robust with file systems where fallocate() is not reliable, for example all CoW file systems (btrfs...), where changing written data can fail with disk full errors. https://bugzilla.redhat.com/show_bug.cgi?id=1045810
* tree-wide: spelling fixesVeres Lajos2014-12-30
| | | | | | | https://github.com/vlajos/misspell_fixer https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa Thanks to Torstein Husebo <torstein@huseboe.net>.
* journald: always allocate space for object fieldsZbigniew Jędrzejewski-Szmek2014-12-26
| | | | | If OBJECT_PID= came as the last field, we would not reallocate the iovec to bigger size, and fail the assertion later on in dispatch_message_real().
* journald: fix off by one in native transportZbigniew Jędrzejewski-Szmek2014-12-26
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1177184
* util: make creation time xattr logic more genericLennart Poettering2014-12-24
|