summaryrefslogtreecommitdiff
path: root/src/journal/journal-send.c
AgeCommit message (Collapse)Author
2014-06-19journal-send.c: use automatic cleanupZbigniew Jędrzejewski-Szmek
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-28Get rid of write_safeZbigniew Jędrzejewski-Szmek
Current glibc implementation is safe. Kernel does this atomically, and write is actually implemented through writev. So if write is async-signal-safe, than writev pretty much must be too.
2014-01-27journal: guarantee async-signal-safety in sd_journald_sendvZbigniew Jędrzejewski-Szmek
signal(7) provides a list of functions which may be called from a signal handler. Other functions, which only call those functions and don't access global memory and are reentrant are also safe. sd_j_sendv was mostly OK, but would call mkostemp and writev in a fallback path, which are unsafe. Being able to call sd_j_sendv in a async-signal-safe way is important because it allows it be used in signal handlers. Safety is achieved by replacing mkostemp with open(O_TMPFILE) and an open-coded writev replacement which uses write. Unfortunately, O_TMPFILE is only available on kernels >= 3.11. When O_TMPFILE is unavailable, an open-coded mkostemp is used. https://bugzilla.gnome.org/show_bug.cgi?id=722889
2014-01-27Replace mkostemp+unlink with open(O_TMPFILE)Zbigniew Jędrzejewski-Szmek
This will only work on Linux >= 3.11, and probably not on all filesystems. Fallback code is provided.
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-02Use assert_return in more of the public APIThomas Hindoe Paaboel Andersen
2013-10-16macro: clean up usage of gcc attributesLennart Poettering
Always use our own macros, and name all our own macros the same style.
2013-08-22remove hasprefix(), use startswith()Shawn Landden
2013-06-20Add hasprefix macro to check prefixes of fixed lengthZbigniew Jędrzejewski-Szmek
2013-06-13journal: use initialization instead of zeroingZbigniew Jędrzejewski-Szmek
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-02util: add a bit of syntactic sugar for saving/restoring errnoLennart Poettering
2012-11-25journal: fix warning about pointer arithmeticZbigniew Jędrzejewski-Szmek
../src/journal/journal-send.c: In function 'sd_journal_sendv': ../src/journal/journal-send.c:250:73: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
2012-11-20journal-send: always send SYSLOG_IDENTIFIER, if we have itLennart Poettering
https://bugzilla.redhat.com/show_bug.cgi?id=872193
2012-11-20journal-send: unify a bit of codeLennart Poettering
2012-10-03journal-send: simplificationLennart Poettering
2012-09-24journal: also use new VA_FORMAT_ADVANCE() macro in sd_journal_send()Lennart Poettering
2012-09-05journalctl: rework JSON output modeLennart Poettering
This splits the JSON output mode into different modes: json and json-pretty. The former printing one entry per line, the latter showing JSON objects nicely indented and in multiple lines to make it easier to read for humans.
2012-08-01journal: add sd_journal_perror() to APILennart Poettering
2012-06-22journal: fix sd_journal_stream_fd()Lennart Poettering
2012-04-12journal: fix missing variable initializationLennart Poettering
2012-04-12relicense to LGPLv2.1 (with exceptions)Lennart Poettering
We finally got the OK from all contributors with non-trivial commits to relicense systemd from GPL2+ to LGPL2.1+. Some udev bits continue to be GPL2+ for now, but we are looking into relicensing them too, to allow free copy/paste of all code within systemd. The bits that used to be MIT continue to be MIT. The big benefit of the relicensing is that closed source code may now link against libsystemd-login.so and friends.
2012-04-02journal: implicitly add code location to all messages logged with the native ↵Lennart Poettering
interface This logic can be turned off by defining SD_JOURNAL_SUPPRESS_LOCATION before including sd-journal.h. This also saves/restores errno in all logging functions, in order to be useful as logging calls without side-effects. This also adds a couple of __unlikely__ around the early checks in the logging calls, in order to minimize the runtime impact.
2012-01-27log: increase socket buffers for logging by defaultLennart Poettering
2012-01-18journal: when sending journal data via file, place it in /dev/shm, to allow ↵Lennart Poettering
early boot operation, even if it sucks
2012-01-14journal: if the data to be sent is larger than the maximum datagram size ↵Lennart Poettering
resort to passing a temporary fd over native protocol
2012-01-12log: make internal log api log directly to the journalLennart Poettering
2012-01-05journal: rename syslog tag to identifier since that's what we call it on the ↵Lennart Poettering
server side.
2012-01-05sd-journal: close reading side of sd_journal_stream_fd() file descriptorsLennart Poettering
2012-01-05journal: move sockets into their own subdirLennart Poettering
2012-01-05journald: add configuration file options to forward all logged data to kmsg, ↵Lennart Poettering
console, syslog
2012-01-03journal: add _public_ to all sd-journal calls, and add parameter checksLennart Poettering
2011-12-23journal: implement stdout transportLennart Poettering
2011-12-17journal: introduce mandatory sd_journal_printf() priority parameterLennart Poettering
2011-12-17journal: add native protocol to journald, and client side API to send ↵Lennart Poettering
journal messages