summaryrefslogtreecommitdiff
path: root/src/journal/coredumpctl.c
AgeCommit message (Collapse)Author
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering
string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
2015-10-24util-lib: get_current_dir_name() can return errors other than ENOMEMLennart Poettering
get_current_dir_name() can return a variety of errors, not just ENOMEM, hence don't blindly turn its errors to ENOMEM, but return correct errors in path_make_absolute_cwd(). This trickles down into a couple of other functions, some of which receive unrelated minor fixes too with this commit.
2015-09-29util: introduce common version() implementation and use it everywhereLennart Poettering
This also allows us to drop build.h from a ton of files, hence do so. Since we touched the #includes of those files, let's order them properly according to CODING_STYLE.
2015-09-22cgtop: underline table headerLennart Poettering
Let's underline the header line of the table shown by cgtop, how it is customary for tables. In order to do this, let's introduce new ANSI underline macros, and clean up the existing ones as side effect.
2015-09-09tree-wide: make use of log_error_errno() return value in more casesLennart Poettering
The previous coccinelle semantic patch that improved usage of log_error_errno()'s return value, only looked for log_error_errno() invocations with a single parameter after the error parameter. Update the patch to handle arbitrary numbers of additional arguments.
2015-09-09tree-wide: make use of log_error_errno() return valueLennart Poettering
Turns this: r = -errno; log_error_errno(errno, "foo"); into this: r = log_error_errno(errno, "foo"); and this: r = log_error_errno(errno, "foo"); return r; into this: return log_error_errno(errno, "foo");
2015-08-25coredumpctl: Add --directory option for reading alternate journalStef Walter
In the Cockpit integration tests we hang onton the journal files for a failed test and would like to inspect them using coredumpctl. This commit adds the ability to specify an alternate directory for coredumpctl to read the journal from.
2015-07-31tree-wide: introduce mfree()David Herrmann
Pretty trivial helper which wraps free() but returns NULL, so we can simplify this: free(foobar); foobar = NULL; to this: foobar = mfree(foobar);
2015-06-10tree-wide: whenever we fork off a foreign child process reset signal ↵Lennart Poettering
mask/handlers Also, when the child is potentially long-running make sure to set a death signal. Also, ignore the result of the reset operations explicitly by casting them to (void).
2015-05-29util: split out signal-util.[ch] from util.[ch]Lennart Poettering
No functional changes.
2015-04-11shared: add terminal-util.[ch]Ronny Chevalier
2015-04-10shared: add process-util.[ch]Ronny Chevalier
2015-03-13tree-wide: there is no ENOTSUP on linuxDavid Herrmann
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
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-01-06tree-wide: remove unnecessary LOG_PRIZbigniew Jędrzejewski-Szmek
LOG_DEBUG is already a log level, there is no need to use LOG_PRI which is for filtering out the facility.
2015-01-05journalctl: static variables immediately configured via command line ↵Lennart Poettering
arguments should be prefixed with "arg_"
2015-01-05journal: install sigbus handler for journal tools tooLennart Poettering
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.
2014-11-28treewide: another round of simplificationsMichal Schmidt
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 Schmidt
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: more log_*_errno + return simplificationsMichal Schmidt
2014-11-28treewide: more log_*_errno() conversions, multiline callsMichal Schmidt
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 Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
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 Schmidt
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-09-11journal: do not dereference already freed patternsPhilippe De Swert
In case set_consume goes wrong, the pattern name has already been freed. So we do not try to print it in the logs, assuming the pattern addition print will be printed just before the failure anyway. Found with coverity. Fixes: CID#1237798
2014-08-03Unify parse_argv styleZbigniew Jędrzejewski-Szmek
getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
2014-07-31Always prefer our headers to system headersZbigniew Jędrzejewski-Szmek
In practice this shouldn't make much difference, but sometimes our headers might be newer, and we want to test them.
2014-07-18Small modernizationsZbigniew Jędrzejewski-Szmek
2014-07-06coredumpctl: show a useful error on permission problemsZbigniew Jędrzejewski-Szmek
2014-07-06journal: add LZ4 as optional compressorZbigniew Jędrzejewski-Szmek
Add liblz4 as an optional dependency when requested with --enable-lz4, and use it in preference to liblzma for journal blob and coredump compression. To retain backwards compatibility, XZ is used to decompress old blobs. Things will function correctly only with lz4-119. Based on the benchmarks found on the web, lz4 seems to be the best choice for "quick" compressors atm. For pkg-config status, see http://code.google.com/p/lz4/issues/detail?id=135.
2014-06-27coredumpctl: fix potential deref of null pointerThomas Hindoe Paaboel Andersen
2014-06-26coredumpctl: remove unused variableThomas Hindoe Paaboel Andersen
2014-06-26coredumpctl: fix HAVE_XZ checkDaniel Mack
2014-06-26coredumpctl: fix build with !HAVE_XZDaniel Mack
Fixes the following build error: CCLD coredumpctl src/journal/coredumpctl.o: In function `save_core': /src/systemd-master/src/journal/coredumpctl.c:656: undefined reference to `decompress_stream' collect2: error: ld returned 1 exit status make[2]: *** [coredumpctl] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2
2014-06-26coredump+coredumpctl: add COREDUMP_FILENAME, use in coredumpctlZbigniew Jędrzejewski-Szmek
2014-06-23coredump: never write more than the configured processing size limit to diskLennart Poettering
2014-06-23coredumpctl: show comm name next to PIDLennart Poettering
2014-06-23coredumpctl: include timestamp information in "coredumpctl info" outputLennart Poettering
2014-06-23coredump: also escape spaces in comm fields when formatting file namesLennart Poettering
2014-06-19coredumpctl: add missing entries to --helpLennart Poettering
2014-06-19coredumpctl: fix columns sizing for timestampLennart Poettering
2014-06-19coredumpctl: introduce new -1 switch for showing a single, most recent entry ↵Lennart Poettering
only "coredumpctl info -1" is now incredibly useful for showing the most recent stacktrace.
2014-06-19coredump: include stacktrace of coredumps in the log messageLennart Poettering
elfutils' libdw is maintained, can read DWARF debug data and appears to be the library of choice for generating backtraces today.
2014-06-19coredump: add 3 more metadata fields to coredump entriesLennart Poettering
2014-06-19coredump: add new "info" verb to coredumpctl showing detailed information ↵Lennart Poettering
about a coredump
2014-06-19coredump: make sure coredumpctl can handle externally stored coredumpsLennart Poettering
2014-03-18util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering
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.
2014-01-28always use the same code for creating temporary filesLennart Poettering
Let's unify our code here, and also always specifiy O_CLOEXEC.
2014-01-15Revert "Revert "coredumpctl: in case of error free pattern after print""Lukas Nykryn
In the case of the error set_consume will free the pointer 'pattern' which is later used in log_error. Either we should stop priniting that or use simple set_put and free pattern manually. This reverts commit ece6b8fd5bbc1fee16f652e680e3033f2f3efc4a.
2014-01-14Revert "coredumpctl: in case of error free pattern after print"Zbigniew Jędrzejewski-Szmek
This reverts commit cf50a55277ee432e1217ad894afcbd9a664ff96c. set_consume frees on error.