oxenstored: add support for systemd active sockets
authorLuis R. Rodriguez <mcgrof@suse.com>
Thu, 17 Jul 2014 23:28:14 +0000 (16:28 -0700)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 24 Jul 2014 15:23:20 +0000 (16:23 +0100)
commitc9c1373347d67e8c68725aa7d6d298ca53bea98a
tree650ea2f862fb470d4dc6e50d821c2ac1404cdddc
parent5e82217e34c38f07d286bd57029db47e6590350f
oxenstored: add support for systemd active sockets

This adds systemd socket activation support for the Ocaml xenstored.
Ocaml lacks systemd library support so we provide our own C helpers
as is done with other functionality lacking on Ocaml.

Active sockets enables oxenstored to be loaded only if required by a system
onto which Xen is installed on. Socket activation is handled by
systemd, once a port for a service which claims a socket is used
systemd will start the required services for it, on demand. For more
details on socket activation refer to Lennart's socket-activation
post regarding this [0].

An important difference with socket activation is that systemd will set
FD_CLOEXEC for us on the socket before giving it to us, we'll sprinkly
the Unix.set_close_on_exec for LSB init next as a separate commit.

Right now this code adds a no-op for this functionality, leaving the
enablement to be done later once systemd is properly hooked into
the build system. The socket activation is ordered in aligment with
the socket activation order passed on to systemd.

[0] http://0pointer.de/blog/projects/socket-activation2.html

Cc: David Scott <dave.scott@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Vincent Hanquez <Vincent.Hanquez@eu.citrix.com>
Acked-by: Dave Scott <Dave.Scott@citrix.com>
Acked-by: Anil Madhavapeddy <anil@recoil.org>
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
tools/ocaml/xenstored/Makefile
tools/ocaml/xenstored/systemd.ml [new file with mode: 0644]
tools/ocaml/xenstored/systemd.mli [new file with mode: 0644]
tools/ocaml/xenstored/systemd_stubs.c [new file with mode: 0644]
tools/ocaml/xenstored/utils.ml
tools/ocaml/xenstored/xenstored.ml