summaryrefslogtreecommitdiff
path: root/src/journal/catalog.c
AgeCommit message (Collapse)AuthorFilesLines
2015-03-27fix gcc warnings about uninitialized variablesHarald Hoyer1-1/+1
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-02-23remove unused includesThomas Hindoe Paaboel Andersen1-1/+0
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-01-17remove unneeded libgen.h includesCristian Rodríguez1-1/+0
2014-11-28treewide: another round of simplificationsMichal Schmidt1-4/+2
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt1-4/+4
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: simplify log_*_errno(r,...) immediately followed by "return r"Michal Schmidt1-9/+5
2014-11-28treewide: more log_*_errno() conversions, multiline callsMichal Schmidt1-4/+4
Basically: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \ $f; done Plus manual indentation fixups.
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt1-3/+3
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt1-3/+3
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt1-3/+8
It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
2014-04-12journal: properly detect language specified in lineZbigniew Jędrzejewski-Szmek1-19/+34
... it turns out that the duplicates in our own catalog were not real duplicates, but translations.
2014-04-12journal: cleanup up error handling in update_catalog()Zbigniew Jędrzejewski-Szmek1-12/+13
- Negative/positive errno mixup caused duplicates not to be detected properly. Now we get a warning about some duplicate entries in our own catalogs... - Errors in update_catalog would be ignored, but they should not be. Notes: Backport: bugfix
2014-03-18util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering1-4/+4
safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
2013-12-22shared: switch our hash table implementation over to SipHashLennart Poettering1-20/+14
SipHash appears to be the new gold standard for hashing smaller strings for hashtables these days, so let's make use of it.
2013-12-15catalog: fix language detectionZbigniew Jędrzejewski-Szmek1-2/+2
Detection would fail if language was not specified in the filename but a dot appeared somewhere higher in the path.
2013-12-02catalog: determine language from the filenameZbigniew Jędrzejewski-Szmek1-8/+49
2013-10-13Never call qsort on potentially NULL arraysZbigniew Jędrzejewski-Szmek1-1/+1
This extends 62678ded 'efi: never call qsort on potentially NULL arrays' to all other places where qsort is used and it is not obvious that the count is non-zero.
2013-04-18move _cleanup_ attribute in front of the typeHarald Hoyer1-2/+2
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-13fileio: in envfiles, do not skip lines following empty linesZbigniew Jędrzejewski-Szmek1-1/+1
https://bugs.freedesktop.org/show_bug.cgi?id=63477
2013-03-28catalog: open up catalog internalsZbigniew Jędrzejewski-Szmek1-88/+100
In order to write tests for the catalog functions, they are made non-static and start taking a 'database' parameter, which is the name of a file with the preprocessed catalog entries. This makes it possible to make test-catalog part of the normal test suite, since it now only operates on files in /tmp. Some more tests are added.
2013-03-28catalog: make sure strings are terminatedZbigniew Jędrzejewski-Szmek1-11/+15
Coverity complains: systemd-199/src/journal/catalog.c:126: buffer_size_warning: Calling strncpy with a maximum size argument of 32 bytes on destination array "i->language" of size 32 bytes might leave the destination string unterminated. ...and unfortunately it was right. The string was defined as a fixed-size string in some parts of the code, and used a null-terminated string in others (e.g. in log statements). There's no point in conserving one byte, so just define the max language tag length to 31 bytes, and use null terminated strings everywhere. Also, wrap some lines, zero-fill less bytes, use '\0' instead of just 0 to be more explicit that this is one byte.
2013-03-27catalog: fix error codes handling in catalog_list_itemsLukas Nykryn1-2/+2
Previously r was set to zero and so if(r<0) was never true.
2013-03-27log: fix error codes handling in catalog_list_itemsLukas Nykryn1-2/+2
It does not make sense to print error code from previous loop.
2013-03-19journalct: beef up entry listingZbigniew Jędrzejewski-Szmek1-6/+52
The ability to dump catalog entries in full and by id is added.
2013-02-08shared: conf-files - add root parameterKay Sievers1-1/+1
2012-11-16journal: use $(localstatedir)/lib/systemd/catalog for the catalogZbigniew Jędrzejewski-Szmek1-2/+1
The path doesn't change in the standard configuration. Also, give full path to the journalctl binary in the hook, since it might be installed outside of $PATH. Also, add uninstall hook to remove the binary catalog.
2012-11-16journal, shared: fix warnings during compilation on 32 bitsZbigniew Jędrzejewski-Szmek1-1/+1
Some filesystem magics are too big to fit in 31 bits, and are wrapped to negative. f_type is an int on 32 bits, so it is signed, and we get a warning on comparison.
2012-11-16journal: catalog - silent output, it's usually only called by package managementKay Sievers1-1/+1
2012-11-16journalctl: better error messages for --update-catalogZbigniew Jędrzejewski-Szmek1-10/+22
Also add informational message about catalog size.
2012-11-16journal: extend catalog header to 64bit for all fields, just to be safe and ↵Lennart Poettering1-22/+20
follow the rest of the file formats
2012-11-15journal: implement message catalogLennart Poettering1-0/+584
The message catalog can be used to attach short help texts to log lines, keyed by their MESSAGE_ID= fields. This is useful to help the administrator understand the context and cause of a message, find possible solutions and find further related documentation. Since this is keyed off MESSAGE_ID= this will only work for native journal messages. The message catalog supports i18n, and is useful to augment english language system messages with explanations in the local language. This commit only includes short explanatory messages for a few example message IDs, we'll add more complete documentation for the relevant systemd messages later on.