summaryrefslogtreecommitdiff
path: root/src/journal
AgeCommit message (Collapse)Author
2015-05-29util: split out signal-util.[ch] from util.[ch]Lennart Poettering
No functional changes.
2015-05-20journald: handle more gracefully when bind() fails on audit socketsLennart Poettering
2015-05-19journalctl: unify how we free boot id lists a bitLennart Poettering
Instead of use LIST_FOREACH_SAFE, just use the same, seperate destructor everywhere.
2015-05-19journalctl: clean up how we log errorsLennart Poettering
All functions should either log the errors they run into, or only return them in which case the caller should log them. Make sure this rule is followed, so that each error is logged precisely once, and neither never, nor more than once.
2015-05-19journalctl: rename boot_id_t to BootIdLennart Poettering
So far we tried to reserve the _t suffix to types we use like a value in contrast to types we use as objects, hence let's do this in journalctl too.
2015-05-19journalctl: lstat() should suffice if we call canonicalize_file_name() firstLennart Poettering
2015-05-19journalctl: free all command line argument objectsLennart Poettering
let's try to be valgrind clean
2015-05-19journalctl: only have a single exit path from main()Lennart Poettering
That way we can be sure we execute the destructors properly, and can be valgrind-clean.
2015-05-19journalctl: Improve boot ID lookupJan Janssen
This method should greatly improve offset based lookup, by simply jumping from one boot to the next boot. It starts at the journal head to get the a boot ID, makes a _BOOT_ID match and then comes from the opposite journal direction (tail) to get to the end that boot. After flushing the matches and advancing the journal from that exact position, we arrive at the start of next boot. Rinse and repeat. This is faster than the old method of aggregating the full boot listing just so we can jump to a specific boot, which can be a real pain on big journals just for a mere "-b -1" case. As an additional benefit --list-boots should improve slightly too, because it does less seeking. Note that there can be a change in boot order with this lookup method because it will use the order of boots in the journal, not the realtime stamp stored in them. That's arguably better, though. Another deficiency is that it will get confused with boots interleaving in the journal, therefore, it will refuse operation in --merge, --file and --directory mode. https://bugs.freedesktop.org/show_bug.cgi?id=72601
2015-05-18util: split all hostname related calls into hostname-util.cLennart Poettering
2015-05-15coredump: make sure we vacuum by defaultLennart Poettering
Only if both keep_free and max_use are actually 0 we can shortcut things and avoid vacuuming. If either are positive or -1 we need to execute the vacuuming. http://lists.freedesktop.org/archives/systemd-devel/2015-April/031382.html
2015-05-13journal: fix size commentPeter Lemenkov
Looks like sizeof(struct Header) is 240 not 224
2015-05-05Add audit type generated files to gitignoreZbigniew Jędrzejewski-Szmek
They are not currently used, but the Makefile rules don't know that. It's easier to ignore them, then to special-case creation rules.
2015-05-05core: rework unit name validation and manipulation logicLennart Poettering
A variety of changes: - Make sure all our calls distuingish OOM from other errors if OOM is not the only error possible. - Be much stricter when parsing escaped paths, do not accept trailing or leading escaped slashes. - Change unit validation to take a bit mask for allowing plain names, instance names or template names or an combination thereof. - Refuse manipulating invalid unit name
2015-04-24shared/utmp-wtmp: add parameter for origin tty and callback userdataDaniel Mack
Instead of looking up the tty from STDIN, let utmp_wall() take an argument to specify an origin tty for the wall message. Only if that argument is NULL do the STDIN lookup. Also add an void *userdata argument that is handed back to the callback function.
2015-04-23journal: use audit event names instead of numbersZbigniew Jędrzejewski-Szmek
<audit-1400> is replaced by AVC, etc. A fallback mechanism is provided for unlisted event types. Occasionally new types are added to the kernel, but not too often. Add a simple "test", which simply prints the mapping.
2015-04-23journal: add int↔audit type name mappingZbigniew Jędrzejewski-Szmek
2015-04-22journalctl: rework code that checks whether we have access to /var/log/journalLennart Poettering
- fix some memory leaks on error conditions - handle all error cases properly, and log about failures - move HAVE_ACL and no-HAVE_ACL code closer to each other
2015-04-22journal: don't force FS_NOCOW_FL on new journal files, but warn if it is missingLennart Poettering
This way users have the freedom to set or unset the FS_NOCOW_FL flag on their journal files by setting it on the journal directory. Since our default tmpfiles configuration now sets this flag on the directory the flag is set by default on new files, however people can opt-out of this by masking the tmpfiles file for it.
2015-04-12journal: use (void) to silence coverityZbigniew Jędrzejewski-Szmek
This shouldn't really fail and anyway not much we can do about it. CID #996292, #996294, #996295.
2015-04-11shared: add terminal-util.[ch]Ronny Chevalier
2015-04-11shared: add random-util.[ch]Ronny Chevalier
2015-04-10shared: add process-util.[ch]Ronny Chevalier
2015-04-10shared: add formats-util.hRonny Chevalier
2015-04-09test-journal-flush: fix memleakRonny Chevalier
2015-04-08util: merge change_attr_fd() and chattr_fd()Lennart Poettering
2015-04-07util: rework cunescape(), improve error handlingLennart Poettering
Change cunescape() to return a normal error code, so that we can distuingish OOM errors from parse errors. This also adds a flags parameter to control whether "relaxed" or normal parsing shall be done. If set no parse failures are generated, and the only reason why cunescape() can fail is OOM.
2015-04-06util: rework rm_rf() logicLennart Poettering
- Move to its own file rm-rf.c - Change parameters into a single flags parameter - Remove "honour sticky" logic, it's unused these days
2015-03-27fix gcc warnings about uninitialized variablesHarald Hoyer
like: src/shared/install.c: In function ‘unit_file_lookup_state’: src/shared/install.c:1861:16: warning: ‘r’ may be used uninitialized in this function [-Wmaybe-uninitialized] return r < 0 ? r : state; ^ src/shared/install.c:1796:13: note: ‘r’ was declared here int r; ^
2015-03-14journald: add syslog fields for audit messagesZbigniew Jędrzejewski-Szmek
Audit messages would be displayed as "unknown[1]". Also specify AUTH as facility... This seems to be the closest match (/* security/authorization messages */).
2015-03-13tree-wide: there is no ENOTSUP on linuxDavid Herrmann
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
2015-03-09Introduce loop_read_exact helperZbigniew Jędrzejewski-Szmek
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.
2015-03-09journalctl: unlink without checking with access firstZbigniew Jędrzejewski-Szmek
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).
2015-03-09journal: fix return codeZbigniew Jędrzejewski-Szmek
Introduced in fa6ac76083b8ff. Might be related to CID #1261724, but I don't know if coverity can recurse this deep.
2015-03-09journal-file: update format string to remove castZbigniew Jędrzejewski-Szmek
2015-03-09journal: align comments to make them more legibleZbigniew Jędrzejewski-Szmek
2015-03-08sd-journal: return error when we cannot open a fileZbigniew Jędrzejewski-Szmek
Lack of this caused journalctl not to display a hint about missing groups properly when the user lacks permissions.
2015-03-08journalctl: update hint now that we set ACL everywhereZbigniew Jędrzejewski-Szmek
2015-03-03Do not advertise .d snippets over main config fileZbigniew Jędrzejewski-Szmek
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
2015-03-02journal: fix Inappropriate ioctl for device on ext4Cristian Rodríguez
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.]
2015-02-25journal: make skipping of exhausted journal files effective againMichal Schmidt
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.
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
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.
2015-02-12include <poll.h> instead of <sys/poll.h>Thomas Hindoe Paaboel Andersen
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.
2015-02-12Add missing includes in header filesThomas Hindoe Paaboel Andersen
This fixes various issues found by globally reordering the include sections of all .c files.
2015-02-10journald: don't specify inline in local functionsLennart Poettering
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.
2015-02-03journald: fix some xsprrintf() buffer size falloutLennart Poettering
2015-02-03util: rework strappenda(), and rename it strjoina()Lennart Poettering
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.
2015-02-01Add a snprinf wrapper which checks that the buffer was big enoughZbigniew Jędrzejewski-Szmek
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.
2015-01-29coredump: drop caps while we are processing the coredumpLennart Poettering
https://bugs.freedesktop.org/show_bug.cgi?id=87354
2015-01-29Revert "journal: do not check for number of files"Lennart Poettering
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.