[libvirt] [PATCH 7/9] Add systemd journal support

Eric Blake eblake at redhat.com
Fri Sep 28 12:31:58 UTC 2012


On 09/28/2012 02:08 AM, Daniel P. Berrange wrote:

>>> +static int virLogAddOutputToJournald(int priority)
>>> +{
>>> +    if ((journalfd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0)
>>> +        return -1;
>>> +    if (virSetInherit(journalfd, false) < 0) {
>>
>> Why not use SOCK_DGRAM | SOCK_CLOEXEC in the socket() call?
> 
> It wasn't clear to me whether GNULIB provides compat for
> SOCK_CLOEXEC or not. Even though we're only Linux, older
> glibc won't provide that

I looked; gnulib guarantees SOCK_CLOEXEC for accept4(), but has not yet
ported it to socket().  I guess we stick with two calls for now.

> 
>>> @@ -1114,6 +1285,12 @@ virLogParseOutputs(const char *outputs)
>>>                  count++;
>>>              VIR_FREE(name);
>>>              VIR_FREE(abspath);
>>> +        } else if (STREQLEN(cur, "journald", 8)) {
>>> +            cur += 8;
>>> +#if HAVE_SYSLOG_H
>>
>> Do we really want to silently parse and ignore 'journald' on systems
>> that lack syslog.h?
> 
> I just followed the same pattern that we used with the
> syslog parsing.

Reading patch 8/9 makes me concur - there, we try a log style, then if
is it silently ignored, virLogGetNbOutputs() returns 0, so we try the
next log style.  This is fine after all.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120928/d730c02a/attachment-0001.sig>


More information about the libvir-list mailing list