summaryrefslogtreecommitdiff
path: root/src/journal
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-26Use enums to make it obvious what boolean params meanZbigniew Jędrzejewski-Szmek
Suggested-by: Russ Allbery <rra@debian.org>
2013-12-26systemctl: allow globbing in commands which take multiple unit namesZbigniew Jędrzejewski-Szmek
2013-12-26journalctl: make sure -b --foobar cannot be misunderstood as --boot=--foobarLennart Poettering
2013-12-26Revert "journalctl: remove unexpected behavior of journalctl -b"Lennart Poettering
This reverts commit cf5bccc2bb9569030cb04debbc4208aaca0fe5b4. We should fix thinks properly if they aren't perfect, not just break other things...
2013-12-25journalctl: remove unexpected behavior of journalctl -bDave Reisner
This flag shouldn't try and consume the following argument. It should behave like every other flag which takes an optional argument when parsed by getopt_long.
2013-12-24log: log_error() and friends add a newline after each line anyway, so avoid ↵Lennart Poettering
including it in the log strings
2013-12-24util: unify SO_PEERCRED/SO_PEERSEC invocationsLennart Poettering
Introduce new call getpeercred() which internally just uses SO_PEERCRED but checks if the returned data is actually useful due to namespace quirks.
2013-12-22journal: when we shall go down do so cleanlyLennart Poettering
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-21journal: replace readdir_r with readdirFlorian Weimer
This commit also adds error handling for failures during directory reading.
2013-12-21journald/server: replace readdir_r with readdirFlorian Weimer
The available_space function now returns 0 if reading the directory fails. Previously, such errors were silently ignored.
2013-12-21journal/vacuum: replace readdir_r with readdirFlorian Weimer
2013-12-18journalctl,zsh-completion: fix several issues in --help message textJason St. John
-- fix grammar and reword some descriptions for clarity -- add a useful description of what --follow does -- fix the description for --after-cursor -- properly introduce the FSS acronym for "Forward Secure Sealing" in both sections -- clarify the --disk-usage command [zj: perform similar changes to zsh completions] squash! journalctl: fix several issues in --help message text
2013-12-17_noreturn_ --> noreturn for C11 compatShawn Landden
also define noreturn w/o <stdnoreturn.h>
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-17journald: before closing /dev/kmsg let's unregister the event sourceLennart Poettering
2013-12-17journald: close /dev/kmsg again if we cannot make use of itLennart Poettering
2013-12-17journald: downgrade warning message when /dev/kmsg does not existLennart Poettering
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-12-15catalog: fix language detectionZbigniew Jędrzejewski-Szmek
Detection would fail if language was not specified in the filename but a dot appeared somewhere higher in the path.
2013-12-15bus: _printf_ attributes should be on prototypes not function definitions ↵Lennart Poettering
for non-static functions
2013-12-15test-journal-syslog: use streq_ptr since we pass in NULLThomas Hindoe Paaboel Andersen
2013-12-14Add more _printf_'s for format-nonliteralsThomas Hindoe Paaboel Andersen
Clang is a bit more strict wrt format-nonliterals: http://clang.llvm.org/docs/LanguageExtensions.html#format-string-checking Adding these extra printf attributes also makes gcc able to find more problems. E.g. this patch uncovers a format issue in udev-builtin-path_id.c Some parts looked intetional about breaking the format-nonliteral check. I added some supression for warnings there.
2013-12-13event: be more conservative when returning errors from event handler callbacksLennart Poettering
We really should return errors from event handlers if we have a continous problem and don't know any other solution.
2013-12-13event: rework sd-event exit logicLennart Poettering
With this change a failing event source handler will not cause the entire event loop to fail. Instead, we just disable the specific event source, log a message at debug level and go on. This also introduces a new concept of "exit code" which can be stored in the event loop and is returned by sd_event_loop(). We also rename "quit" to "exit" everywhere else. Altogether this should make things more robus and keep errors local while still providing a way to return event loop errors in a clear way.
2013-12-11journal: pipe journalctl help output into a pagerDjalal Harouni
journalctl help output might run off the screen, so be consistent as other systemd tools do and pipe it into a pager.
2013-12-11journald: make sure the stdout/stderr stream fd is removed from epoll before ↵Lennart Poettering
we close it
2013-12-11journald: cache cgroup root path, instead of querying it on every incoming ↵Lennart Poettering
log message
2013-12-11journal: when listing logs of a container make sure we don't accidentally ↵Lennart Poettering
show messages from host too
2013-12-11journald: cache hostname, boot_id and machine_id fields instead of ↵Lennart Poettering
generating them fresh for each log entry
2013-12-11journal: don't go belly up when an stdout/stderr client terminates the ↵Lennart Poettering
connection
2013-12-11journal: add ability to browse journals of running OS containersLennart Poettering
This adds the new library call sd_journal_open_container() and a new "-M" switch to journalctl. Particular care is taken that journalctl's "-b" switch resolves to the current boot ID of the container, not the host.
2013-12-11journald: port to sd-event and enable watchdog supportLennart Poettering
2013-12-10journald: malloc less when streaming messagesZbigniew Jędrzejewski-Szmek
2013-12-10journald: use a bit more cleanup magic!Lennart Poettering
2013-12-10Ensure unit is journaled for short-lived or oneshot processesDan McGee
In the time it takes to process incoming log messages, the process we are logging details for may exit. This means the cgroup data is no longer available from '/proc'. Unfortunately, the way the code was structured before, we never log _SYSTEMD_UNIT if we don't have this cgroup information. Add an else if case that allows the passed in unit_id to be logged even if we couldn't capture cgroup information. This ensures a command like `journalctl -u run-XXX` will return all log messages from a oneshot process.
2013-12-08Fix memory leak in stdout journal streamsDan McGee
Just as 'identifier' is strdup-ed and freed, we need to do the same for unit_id.
2013-12-06Get rid of our reimplementation of basenameZbigniew Jędrzejewski-Szmek
The only problem is that libgen.h #defines basename to point to it's own broken implementation instead of the GNU one. This can be fixed by #undefining basename.
2013-12-03trivial coding style clean upsThomas Hindoe Paaboel Andersen
- Add space between if/for and the opening parentheses - Place the opening brace on same line as the function (not for udev) From the CODING_STYLE Try to use this: void foo() { } instead of this: void foo() { }
2013-12-03journal: fail silently in sd_j_sendv() if journal is unavailableZbigniew Jędrzejewski-Szmek
"syslog(3) and sd_journal_print() may largely be used interchangeably functionality-wise" according to sd_journal_print(3). This socket should be always available except in rare circumstatances, and we don't random applications to fail on logging, so let's do what syslog did. The alternative of forcing all callers to do error handling for this rare case doesn't really have any benefits, since if they can't log there isn't much they can do anyway. https://bugzilla.redhat.com/show_bug.cgi?id=1023041
2013-12-02catalog: determine language from the filenameZbigniew Jędrzejewski-Szmek
2013-12-02Use assert_return in more of the public APIThomas Hindoe Paaboel Andersen
2013-11-27journald: mention how long we needed to flush to /var in the logsLennart Poettering
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: add a test case for flushing messages out of a series of journal ↵Lennart Poettering
files into a single new one
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