summaryrefslogtreecommitdiff
path: root/src/journal/journal-file.c
AgeCommit message (Collapse)Author
2014-01-11journal: fix access to munmapped memory in sd_journal_enumerate_uniqueZbigniew Jędrzejewski-Szmek
sd_j_e_u needs to keep a reference to an object while comparing it with possibly duplicate objects in other files. Because the size of mmap cache is limited, with enough files and object to compare to, at some point the object being compared would be munmapped, resulting in a segmentation fault. Fix this issue by turning keep_always into a reference count that can be increased and decreased. Other callers which set keep_always=true are unmodified: their references are never released but are ignored when the whole file is closed, which happens at some point. keep_always is increased in sd_j_e_u and later on released.
2014-01-05journal: Add missing byte order conversionsGeorge McCollister
Convert entry_array.items[0] to host byte order prior to passing it to chain_cache_put(). [zj: also use le64toh in journal-verify.c] https://bugs.freedesktop.org/show_bug.cgi?id=73194
2013-12-22shared: switch our hash table implementation over to SipHashLennart Poettering
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-17journal-file.c: remove redundant assignment of variableThomas Hindoe Paaboel Andersen
we also do 'last_index = (uint64_t) -1;' at the end of the while loop so there is no reason to also do it here.
2013-12-16journal: fix against (theoretical) undefined behaviorShawn Landden
While all the libc implementations I know return NULL when memchr's size parameter is 0, without accessing any memory, passing NULL to memchr is still invalid: C11 7.24.1p2: Where an argument declared as "size_t n" specifies the length of the array for a function, n can have the value zero on a call to that function. Unless explicitly stated otherwise in the description of a particular function in this subclause, pointer arguments on such a call shall still have valid values, as described in 7.1.4. On such a call, a function that locates a character finds no occurrence, a function that compares two character sequences returns zero, and a function that copies characters copies zero characters. see http://llvm.org/bugs/show_bug.cgi?id=18247
2013-12-16journal-file: protect against alloca(0)Thomas Hindoe Paaboel Andersen
2013-11-27journal: simplify pre-allocation logicLennart Poettering
let's just do a single fallocate() as far as possible, and don't distuingish between allocated space and file size. This way we can save a syscall for each append, which makes quite some benefits.
2013-11-27journal: allow journal_file_copy_entry() to work on non-local filesLennart Poettering
2013-11-27journal: fix iteration when we go backwards from the beginning of an array ↵Lennart Poettering
chain element
2013-11-26journal: optimize bisection logic a bit by caching the last positionLennart Poettering
This way we can do a quick restart limiting a bit how wildly we need to jump around during the bisection process.
2013-11-26journal: make table constLennart Poettering
2013-11-26journal: when appending to journal file, allocate larger blocks at onceLennart Poettering
2013-11-08Remove dead code and unexport some callsLennart Poettering
"make check-api-unused" informs us about code that is not used anymore or that is exported but only used internally. Fix these all over the place.
2013-10-13Never call qsort on potentially NULL arraysZbigniew Jędrzejewski-Szmek
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-10-09journald: replace new+snprintf with asprintfZbigniew Jędrzejewski-Szmek
2013-10-02journald: add missing error checkLennart Poettering
2013-06-18journalctl: properly print headers of empty journalsZbigniew Jędrzejewski-Szmek
2013-06-10journalctl: print monotonic timestamp in --headerZbigniew Jędrzejewski-Szmek
2013-06-10journalctl: print proper IDs with --headerZbigniew Jędrzejewski-Szmek
The same buffer was used for two different IDs, messing up the output.
2013-06-10Use stdint.h macros instead of casts to print uint64_t valuesZbigniew Jędrzejewski-Szmek
Casts are visually heavy, and can obscure unwanted truncations.
2013-05-07journald: be more careful when we try to flush the runtime journal to disk ↵systemd/v203Lennart Poettering
and the disk is close to being full Bump the minimal size of the journal so that we can be sure creating the journal file will always succeed. Previously the minimum size was smaller than a empty jounral file...
2013-05-03journal: as a µ-opt, use sizeof instead of strlenZbigniew Jędrzejewski-Szmek
2013-05-03journal: Set the default keep free value to 15% (up from 5%)Colin Guthrie
As some SSDs are still seeing performance degredation when reaching 85% usage the default value of 5% seems a little low. Set this to 15% by default.
2013-05-02Add __attribute__((const, pure, format)) in various placesZbigniew Jędrzejewski-Szmek
I'm assuming that it's fine if a _const_ or _pure_ function calls assert. It is assumed that the assert won't trigger, and even if it does, it can only trigger on the first call with a given set of parameters, and we don't care if the compiler moves the order of calls.
2013-04-01Always use our own MAX/MIN definitionsCristian Rodríguez
code in src/shared/macro.h only defined MAX/MIN in case they were not defined previously. however the MAX/MIN macros implemented in glibc are not of the "safe" kind but defined as: define MIN(a,b) (((a)<(b))?(a):(b)) define MAX(a,b) (((a)>(b))?(a):(b)) Avoid nasty side effects by using our own versions instead. Also fix the warnings derived from this change. [zj: - modify MAX3 macro to fix warning about _a shadowing _a, - do bootchart/svg.c too, - remove unused MIN3.]
2013-03-25journal: Add sync timer to journal serverOleksii Shevchuk
Add option to force journal sync with fsync. Default timeout is 5min. Interval configured via SyncIntervalSec option at journal.conf. Synced journal files will be marked as OFFLINE. Manual sync can be performed via sending SIGUSR1.
2012-11-21journal: by default do not decompress dat objects larger than 64KLennart Poettering
This introduces a new data threshold setting for sd_journal objects which controls the maximum size of objects to decompress. This is relieves the library from having to decompress full data objects even if a client program is only interested in the initial part of them. This speeds up "systemd-coredumpctl" drastically when invoked without parameters.
2012-10-26journal: special case the trivial cache chain cache entryLennart Poettering
2012-10-26journal: introduce entry array chain cacheLennart Poettering
When traversing entry array chains for a bisection or for retrieving an item by index we previously always started at the beginning of the chain. Since we tend to look at the same chains repeatedly, let's cache where we have been the last time, and maybe we can skip ahead with this the next time. This turns most bisections and index lookups from O(log(n)*log(n)) into O(log(n)). More importantly however, we seek around on disk much less, which is good to reduce buffer cache and seek times on rotational disks.
2012-10-18journal: suggest rotation when fields are not indexedLennart Poettering
2012-10-18journal: add ability to list values a specified field can take in all ↵Lennart Poettering
entries of the journal The new 'unique' API allows listing all unique field values that a field specified by a field name can take in all entries of the journal. This allows answering queries such as "What units logged to the journal?", "What hosts have logged into the journal?", "Which boot IDs have logged into the journal?". Ultimately this allows implementation of tools similar to lastlog based on journal data. Note that listing these field values will not work for journal files created with older journald, as the field values are not indexed in older files.
2012-10-16journal: implement time-based rotation/vacuumingLennart Poettering
This also enables time-based rotation (but not vacuuming) after 1month, so that not more one month of journal is lost at a time per vacuuming.
2012-10-16journal: sort data items of entries by offsetLennart Poettering
This should slightly optimize disk access patterns on rotating disks for simple readers.
2012-09-24journal: set seal even for readonly journalfilesMirco Tischler
journalctl needs to know wether the file has been sealed to be able to do verification.
2012-09-21journal: don't allow journal_file_open() to be called with ret being NULLLennart Poettering
2012-09-13man: fix a bunch of typos in docsThomas Hindoe Paaboel Andersen
https://bugs.freedesktop.org/show_bug.cgi?id=54501
2012-09-13journal: never assert directly on data read from the journalLennart Poettering
2012-09-13journald: don't reposition window if we don't have toLennart Poettering
2012-09-11journal: don't set seal flag if we don't have gcrypt built-inLennart Poettering
2012-09-11journal: don't try to compress without XZMichael Olbrich
otherwise the header contains the HEADER_INCOMPATIBLE_COMPRESSED flag even though the data is not compressed and reading the journal fails.
2012-09-10journald: detect invalid header pointers correctlyLennart Poettering
2012-09-07journal: add call to determine current journal file disk usageLennart Poettering
2012-09-06journald: avoid logging to kmsg in the normal pathsLennart Poettering
2012-08-21journal: be more careful when keeping around mmaps we still needLennart Poettering
2012-08-20journal: make libgcrypt dependency optionalLennart Poettering
2012-08-20journal: use a macro to check for file header flagsLennart Poettering
2012-08-20journal: fix tag ordering checkLennart Poettering
2012-08-18mmap: resize arrays dynamicallyLennart Poettering
2012-08-18journal: even more simple static object testsLennart Poettering
2012-08-18journal: fix verification without keyLennart Poettering