From: "Luis R. Rodriguez" <mcgrof@suse.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: xen-devel@lists.xenproject.org,
"Luis R. Rodriguez" <mcgrof@do-not-panic.com>
Subject: Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
Date: Wed, 21 May 2014 19:29:13 +0200 [thread overview]
Message-ID: <20140521172913.GW13289@wotan.suse.de> (raw)
In-Reply-To: <1400690371.11409.6.camel@kazak.uk.xensource.com>
On Wed, May 21, 2014 at 05:39:31PM +0100, Ian Campbell wrote:
> On Wed, 2014-05-21 at 18:24 +0200, Luis R. Rodriguez wrote:
> > On Wed, May 21, 2014 at 03:35:19PM +0100, Ian Campbell wrote:
> > > On Tue, 2014-05-20 at 05:31 -0700, Luis R. Rodriguez wrote:
> > > > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> > > >
> > > > This adds support for systemd into libxenstore.so to enable usage
> > > > through cxenstored and oxenstored. The way we provide support for
> > > > systemd is to *not* compile systemd with -lsystemd-daemon but instead
> > > > to look for libsystemd-daemon.so at run time if the binary was compiled
> > > > with support for systemd.
> > >
> > > This is not what either Ian or I intended to suggest. It is perfectly
> > > fine for the binary to be dynamically linked against -lsystemd-daemon in
> > > the normal way (and for the resulting binary packages to depend on the
> > > libsystemd-daemon package etc) if the headers etc are present at compile
> > > time.
> > >
> > > What we were after was for the actual use of systemd to be runtime not
> > > compile time. IOW it is fine for xenstored to require the library to be
> > > installed, but not that systemd be the init which is in use.
> >
> > In order to work dynamically *and* automatically at run time, that is
> > to let the binary figure out what is best, the dynamic linker was the
> > best choice. The reason is that we have to consider a binary that
> > can run on systems that do not have the systemd libraries present,
>
> This is not a requirement. If the systemd libraries were present at
> build time then it is acceptable to require them at runtime even if
> systemd is not actually in use. (Of course other than he
> "is_systemd_being_used" function nothing in the library really ought to
> get called in this case)
It was not clear that this was not a requirement and hence the use of
dlopen() and dlsym(). Now that that work is done though up to you guys
to decide what you want, this option works now, I've tested it, so
just let me know.
I believe the existing use integration provides the most flexibility.
> > or that have them but didn't use sytemd as the init process.
>
> That case must work but if it required dlopen then something is horribly
> broken somewhere.
If a requirement was not to produce binaries to work on non systemd systems
then yes, otherwise no.
> > This solution
> > covers all those cases.
> >
> > > > diff --git a/tools/xenstore/xs_systemd.c b/tools/xenstore/xs_systemd.c
> > > > new file mode 100644
> > > > index 0000000..814e0fc
> > > > --- /dev/null
> > > > +++ b/tools/xenstore/xs_systemd.c
> > >
> > > > +
> > > > +/*
> > > > + * We list stdin, stdout and stderr simply for documentation purposes
> > > > + * and to help our array size fit the number of expected sockets we
> > > > + * as sd_listen_fds() will return 5 for example if you set the socket
> > > > + * service with 2 sockets.
> > >
> > > Please can we get rid of this list (which is bad enough in itself but
> > > the three spurious entries are ludicrous)
> > >
> > > and just
> > > #define SOCKET_RW_INDEX SD_LISTEN_FDS_START
> > > #define SOCKET_RO_INDEX SDL_LISTEN_FDS_START + 1
> > > etc and use those for lookups, as I described in
> > > <1399971222.11314.27.camel@kazak.uk.xensource.com>?
> >
> > Did you see the mode? Its an example of how different preferences can
> > be tucked away under it, but we can always statically peg associations.
>
> I have no idea what you are trying to ask/say here...
There are seval uses of the structure I defined, one is the making it
easier to call sd_is_socket_unix() with already prepared data, the other
use case is to chmod() the socket on the path given that while systemd
service unit files does support specifying permissions on the sockets
its a wide set permission setting, so changes between permissions must
be handled manually right now. See the use of chmod on xs_claim_active_socket()
Its another example of the use of the structure format I laid out instead
of defines.
> > The purpose of the list was also to allow a switch on the type to
> > alternate on sd_is_socket_*() calls but of course if we're not growing
> > the xenstore implementation this means we only have to deal with one
> > type and can use that statically.
>
> ...or here.
>
> If socket activation is enabled then both of the things we are passed
> should be unix domain sockets
It doesn't matter, systemd documentation recommends for a sanity check
on the type of socket given back to us by systemd, and hance the use
of sd_is_socket_unix().
> so I don't understand why you would need
> to "alternate" on anything there either.
What I mean by alternating on different sd_is_socket_*() calls is if we were to
grow xenstored with different type of sockets and make the code a bit more
dynamic. In such case we'd just throw a switch on the active_socket->type and
call the appropriate sd_is_socket_*().
> And if a new thing were added
> to the list then its index would imply that it was whatever type it must
> be, because you'd have written it in the spec.
Even so you are still recommended to call sd_is_socket_*() for the type of
expected socket. What I did tries to make the code easier to grow and
manage.
> > Up to you, just consider the above and let me know.
>
> The list should go.
OK...
Luis
next prev parent reply other threads:[~2014-05-21 17:29 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-20 12:31 [PATCH v5 00/14] xen: add systemd support Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 01/14] xenstored: enable usage of config.h on both xenstored and oxenstored Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 02/14] libxenstore.so: add support for systemd Luis R. Rodriguez
2014-05-21 14:35 ` Ian Campbell
2014-05-21 14:56 ` Ian Campbell
2014-05-21 16:32 ` Luis R. Rodriguez
2014-05-21 16:48 ` Ian Campbell
2014-05-21 17:15 ` Luis R. Rodriguez
2014-05-22 9:36 ` Ian Campbell
2014-05-22 9:59 ` Luis R. Rodriguez
2014-05-21 16:24 ` Luis R. Rodriguez
2014-05-21 16:39 ` Ian Campbell
2014-05-21 17:29 ` Luis R. Rodriguez [this message]
2014-05-22 9:39 ` Ian Campbell
2014-05-22 10:01 ` Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 03/14] cxenstored: add support for systemd active sockets Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 04/14] oxenstored: " Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 05/14] oxenstored: force FD_CLOEXEC with Unix.set_close_on_exec on LSB init Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 06/14] tools/xendomains: make xl the default Luis R. Rodriguez
2014-05-21 15:05 ` Ian Campbell
2014-05-21 17:29 ` Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 07/14] tools/xendomains: do space cleanups Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 08/14] tools/xendomains: move to libexec and use a smaller init helper Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 09/14] autoconf: xen: force a refresh with autoconf Luis R. Rodriguez
2014-05-21 15:07 ` Ian Campbell
2014-05-21 17:35 ` Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 10/14] autoconf: update m4/pkg.m4 Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place Luis R. Rodriguez
2014-05-20 13:37 ` Jan Beulich
[not found] ` <537B76D1020000780001422C@suse.com>
2014-05-20 17:54 ` Luis R. Rodriguez
2014-05-21 7:32 ` Jan Beulich
2014-05-21 8:03 ` Luis R. Rodriguez
2014-05-21 8:11 ` Jan Beulich
2014-05-21 8:27 ` Luis R. Rodriguez
2014-05-21 10:33 ` Ian Campbell
2014-05-21 13:54 ` Jan Beulich
2014-05-21 15:14 ` Ian Campbell
2014-05-21 15:20 ` Jan Beulich
2014-05-21 15:26 ` Ian Campbell
2014-05-21 21:54 ` Luis R. Rodriguez
2014-05-22 9:46 ` Ian Campbell
2014-05-20 12:31 ` [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference Luis R. Rodriguez
2014-05-21 15:44 ` Ian Campbell
2014-05-21 23:02 ` Luis R. Rodriguez
2014-05-22 10:05 ` Ian Campbell
2014-05-23 23:20 ` Luis R. Rodriguez
2014-05-28 9:30 ` Ian Campbell
2014-05-29 16:09 ` Don Koch
2014-05-29 23:29 ` Luis R. Rodriguez
[not found] ` <20140529232918.GG26450@wotan.suse.de>
2014-06-01 6:15 ` [systemd-devel] " Lennart Poettering
[not found] ` <20140601061547.GC16257@tango.0pointer.de>
2014-06-05 0:31 ` Luis R. Rodriguez
[not found] ` <20140605003103.GB22052@wotan.suse.de>
2014-06-05 2:52 ` Cameron Norman
2014-06-05 11:22 ` Lennart Poettering
[not found] ` <20140605112213.GA17673@tango.0pointer.de>
2014-06-05 18:01 ` Luis R. Rodriguez
[not found] ` <20140605180137.GD22052@wotan.suse.de>
2014-06-05 19:24 ` Lennart Poettering
[not found] ` <20140605192421.GA6248@tango.0pointer.de>
2014-06-05 19:26 ` Andrew Lutomirski
[not found] ` <CALZWFR+LQ3XK4RQ335CNqjr8zucWw4GieKwZS3N5m0w4yJXuBA@mail.gmail.com>
2014-06-10 1:15 ` Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 13/14] xencommons: move module list into a generic place Luis R. Rodriguez
2014-05-20 13:40 ` Jan Beulich
[not found] ` <537B776D020000780001425E@suse.com>
2014-05-20 18:03 ` Luis R. Rodriguez
2014-05-20 12:31 ` [PATCH v5 14/14] systemd: add xen systemd service and module files Luis R. Rodriguez
2014-05-20 12:48 ` Luis R. Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140521172913.GW13289@wotan.suse.de \
--to=mcgrof@suse.com \
--cc=Ian.Campbell@citrix.com \
--cc=mcgrof@do-not-panic.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).