summaryrefslogtreecommitdiff
path: root/src/journal-remote
AgeCommit message (Collapse)Author
2014-11-29journald-remote,journal-upload: Support .d directories in the usual search pathsJosh Triplett
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: yet more log_*_errno + return simplificationsMichal Schmidt
Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
2014-11-28treewide: more log_*_errno + return simplificationsMichal Schmidt
2014-11-28treewide: simplify log_*_errno(r,...) immediately followed by "return r"Michal 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-11-27log: rearrange log function namingLennart Poettering
- Rename log_meta() → log_internal(), to follow naming scheme of most other log functions that are usually invoked through macros, but never directly. - Rename log_info_object() to log_object_info(), simply because the object should be before any other parameters, to follow OO-style programming style.
2014-11-27log: add an "error" parameter to all low-level logging calls and intrdouce ↵Lennart Poettering
log_error_errno() as log calls that take error numbers This change has two benefits: - The format string %m will now resolve to the specified error (or to errno if the specified error is 0. This allows getting rid of a ton of strerror() invocations, a function that is not thread-safe. - The specified error can be passed to the journal in the ERRNO= field. Now of course, we just need somebody to convert all cases of this: log_error("Something happened: %s", strerror(-r)); into thus: log_error_errno(-r, "Something happened: %m");
2014-11-10strv: rework strv_split_quoted() to use unquote_first_word()Lennart Poettering
This should make the unquoting scheme a bit less naive.
2014-11-04sd-event: implicitly set signal event source's descriptions to the signal nameLennart Poettering
2014-11-04sd-event: rename sd_event_source_set_name() to sd_event_source_get_name()Lennart Poettering
To mirror the recent name change of the concept for sd_bus objects, follow the same logic for sd_event_source objects, too.
2014-10-23journal-upload: return proper exit codeZbigniew Jędrzejewski-Szmek
Even when termninated normally, systemd-journal-upload would return something positive which would be interpreted as failure.
2014-10-23shared/log: add log_trace as compile-time optional debuggingZbigniew Jędrzejewski-Szmek
Repetetive messages can be annoying when running with SYSTEMD_LOG_LEVEL=debug, but they are sometimes very useful when debugging problems. Add log_trace which is like log_debug but becomes a noop unless LOG_TRACE is defined during compilation. This makes it easy to enable very verbose logging for a subset of programs when compiling from source.
2014-10-23journal-upload: fix --trust=all optionZbigniew Jędrzejewski-Szmek
2014-10-23journal-upload: avoid calling printf with maximum precisionZbigniew Jędrzejewski-Szmek
Precision of INT_MAX does not work as I expected it to. https://bugzilla.redhat.com/show_bug.cgi?id=1154334
2014-10-23journal-upload: verify state file can be saved before uploadingZbigniew Jędrzejewski-Szmek
Do our best verify that we can actually write the state file before upload commences to avoid duplicate messages on the server.
2014-10-23journal-remote: add --split-mode to helpZbigniew Jędrzejewski-Szmek
2014-10-23journal-remote: better error message on failureZbigniew Jędrzejewski-Szmek
Return a proper code instead of simply NULL for failure.
2014-10-23journal-upload: do not require port to be setZbigniew Jędrzejewski-Szmek
2014-10-23systemd-upload: print paths in help()Zbigniew Jędrzejewski-Szmek
2014-10-23journal-remote: give names to event sourcesZbigniew Jędrzejewski-Szmek
This possibility was recently added, and it makes debugging much nicer.
2014-10-23journal-upload: fix socket activationZbigniew Jędrzejewski-Szmek
2014-10-14journal-remote: fix mem leak on errorZbigniew Jędrzejewski-Szmek
2014-09-29journal-remote: fix handling of non-blocking sourcesZbigniew Jędrzejewski-Szmek
In the conversion to sd-event loop, handling of normal files got broken. We do not want to perform non-blocking reads on them, but simply do read() in a loop. Install a statically-enabled "source" to do that.
2014-09-25journal-remote: fix counting of events writtenZbigniew Jędrzejewski-Szmek
After recent changes the number was always reported as 0, because the accounting was done server_destroy(), called after the message was already printed. But even before this change, the counts were wrong because seqnum start at 0 only for newly created journal files, so when appending to existing files, the calculated count was wrong anyway. Also do some variable renaming for consistency and disable some low-level debug messages.
2014-09-25journal-remote: initialize writer hashmap before useJonathan Liu
https://bugs.freedesktop.org/show_bug.cgi?id=83682 [zj: move the initalization even earlier, before any sockets are looked at.]
2014-09-18journal-remote: check return code of sd_event_defaultAndreas Henriksson
Handle sd_event_default returning error and bail out properly as done in every other caller of this function. Found by coverity. Fixes: CID#1238957
2014-09-18journal-upload: Remove compilation warningPhilippe De Swert
When compiling we see this curl warning popping up: src/journal-remote/journal-upload.c:194:17: warning: call to ‘_curl_easy_setopt_err_error_buffer’ declared with attribute warning: curl_easy_setopt expects a char buffer of CURL_ERROR_SIZE as argument for this option [enabled by default] This patch removes the warning (which occurs twice).
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-08-31journal-remote: fix check if realloc failedThomas Hindoe Paaboel Andersen
2014-08-21notify: send STOPPING=1 from our daemonsLennart Poettering
2014-08-20journal-upload: make sure that 'r' is initializedLukas Nykryn
2014-08-20journal-remote: remove unreachable codeLukas Nykryn
2014-08-20journal-upload: allow the tool to startLennart Poettering
2014-08-20cmdline: for new tools avoid introduce new negative switches, and properly ↵Lennart Poettering
align --help texts Negative switches are a bad un-normalized thing. We alerady have some, but we should try harder to avoid intrdoucing new ones. Hence, instead of adding two switches: --foobar --no-foobar Let's instead use the syntax --foobar --foobar=yes --foobar=no Where the first two are equivalent. The boolean argument is parsed following the usual rules. Change all new negative switches this way. This patch also properly aligns the --help table, so that single char switches always get a column separate of the long switches.
2014-08-11journal-remote: fix parsing of fd command line argumentLennart Poettering
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-08-03journal-remote: rename KEY_FILE to avoid confict with <linux/input.h>Zbigniew Jędrzejewski-Szmek
2014-07-31Properly report invalid quoted stringsZbigniew Jędrzejewski-Szmek
$ systemd-analyze verify trailing-g.service [./trailing-g.service:2] Trailing garbage, ignoring. trailing-g.service lacks ExecStart setting. Refusing. Error: org.freedesktop.systemd1.LoadFailed: Unit trailing-g.service failed to load: Invalid argument. Failed to create trailing-g.service/start: Invalid argument
2014-07-31Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek
String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
2014-07-16Let config_parse open file where applicableZbigniew Jędrzejewski-Szmek
Special care is needed so that we get an error message if the file failed to parse, but not when it is missing. To avoid duplicating the same error check in every caller, add an additional 'warn' boolean to tell config_parse whether a message should be issued. This makes things both shorter and more robust wrt. to error reporting.
2014-07-16journal-remote: remove obsolete variableZbigniew Jędrzejewski-Szmek
2014-07-16journal-remote: fix double typedef and add missing headerZbigniew Jędrzejewski-Szmek
2014-07-15journal-remote: avoid copying input dataZbigniew Jędrzejewski-Szmek
Instead of copying fields into new memory allocations, simply keep pointers into the receive buffer. Data in this buffer is only copied when there is not enough space for new data and a large chunk of the buffer contains old data.
2014-07-15µhttp-util: fix compilation without gnutlsZbigniew Jędrzejewski-Szmek
2014-07-15journal-upload: add config fileZbigniew Jędrzejewski-Szmek
2014-07-15journal-remote: let user specify just the main part of the urlZbigniew Jędrzejewski-Szmek
We can append /upload ourselves.