g_log_writer_is_journald() works out whether the process’ stderr or
stdout are redirected to journald. While the default writer function
uses this in conjunction with g_log_writer_journald(), that does not
always have to be the case — other writer functions might want to always
write to the journal, and never write to stderr (for example).
Consequently, automatically open the journal socket in
writer_journald(), rather than is_journald().
https://bugzilla.gnome.org/show_bug.cgi?id=769507
The C spec leaves conditional evaluation inside a macro expansion as
undefined behaviour. This means we cannot use constructs like:
GOBJECT_IF_DEBUG(OBJECTS, {
...
#ifdef BLAH
...
#endif
...});
Because compilers are entirely justified to ignore the conditional, or,
like in the case of MSVC, error out.
https://bugzilla.gnome.org/show_bug.cgi?id=769504
GDatagramBased allows connection-oriented and connection-less sockets,
but does not allow stream-based sockets (because it’s datagram-based).
So it supports SCTP and UDP, but not TCP.
Clarify that in the documentation, and people sometimes confuse
connection-oriented with stream-based, due to the prevalence of TCP.
This is causing trouble with flatpaks because the org.gnome.Platform
runtime does not bundle libmount, while the org.gnome.Sdk does it.
As this probably requires a change in the freedesktop.org Yocto base,
we disable this support by default for now as a temporary measure
until it can be properly reviewed by someone who knows those bits
better, probably Alex Larsson.
https://bugzilla.gnome.org/show_bug.cgi?id=769284
Use mnt_context_get_mtab instead of using mnt_context_get_table(), since
that's the recommended way of accessing mtab/mountinfo information, and
also because that way the (struct libmnt_table *) will get automatically
deallocated when calling mnt_free_context()
https://bugzilla.gnome.org/show_bug.cgi?id=769238
journald is a part of systemd which is Linux-only at this time, so only
compile the journald items on Linux only, and just return FALSE for
g_log_writer_is_journald() and G_LOG_WRITER_UNHANDLED for
g_log_writer_journald() on non-Linux.
https://bugzilla.gnome.org/show_bug.cgi?id=744456
Talk to the journal ourselves using sendmsg() instead of linking
against libsystemd for sd_journal_sendv(). At the same time, we
can also avoid excessive copying.
The motivation for dropping the dependency is that we can
then use structured logging e.g. in a flatpak sandbox where
libsystemd may not be present in the runtime.
The code here is inspired by similar code in libvirt.
Currently the docs for GChecksumType are simpy annotated
with 'Since 2.16' which is when GChecksumType was first
introduced. No mention is made of the fact that the
G_CHECKSUM_SHA512 constant was only added much later
in 2.36.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
https://bugzilla.gnome.org/show_bug.cgi?id=769027
It turns out that the current approach of parsing g_log_structured
varargs is unworkable, because vprintf is not guaranteed to advance
the passed-in va_list. So, we have to reshuffle the argument list
a bit; I've come up with this approach:
g_log_structured (domain, level,
key-value pairs...
"MESSAGE", format,
printf arguments);
This requires a "MESSAGE" key to always be present, and it requires
the "MESSAGE"-format pair to be last, but it avoids an extra NULL
as marker after the key-value pairs. And it can be parsed with a
single pass over the va_list, without any va_copy.
Since we have G_LOG_USE_STRUCTURED, the separate ...structured()
convenience macros are pretty pointless, and I have dropped them
for now.