All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>,
	Xen-devel <xen-devel@lists.xenproject.org>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Dave Scott <dave.scott@eu.citrix.com>
Subject: Re: [PATCH for-4.6 4/5] oxenstored: fix systemd socket activation
Date: Thu, 6 Aug 2015 14:50:44 +0100	[thread overview]
Message-ID: <1438869044.9747.158.camel@citrix.com> (raw)
In-Reply-To: <1438868305-30920-5-git-send-email-wei.liu2@citrix.com>

On Thu, 2015-08-06 at 14:38 +0100, Wei Liu wrote:
> Use the correct API sd_listen_fds to determine whether the process is
> started by systemd.
> 
> Change sd_booted to booted_by_systemd to avoid confusion with systemd's
> API.

launched_by_systemd seems like a more conventional name for this.One
doesn't typically "boot" a process.

> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> Cc: Dave Scott <dave.scott@eu.citrix.com>
> 
> For 4.6: without this oxenstored is broken when running on a system with
> systemd but not started by systemd.
> ---
>  tools/ocaml/xenstored/systemd.ml      | 2 +-
>  tools/ocaml/xenstored/systemd.mli     | 4 ++--
>  tools/ocaml/xenstored/systemd_stubs.c | 6 +++---
>  tools/ocaml/xenstored/utils.ml        | 2 +-
>  tools/ocaml/xenstored/xenstored.ml    | 2 +-
>  5 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/ocaml/xenstored/systemd.ml 
> b/tools/ocaml/xenstored/systemd.ml
> index 2aa39ea..6120fd4 100644
> --- a/tools/ocaml/xenstored/systemd.ml
> +++ b/tools/ocaml/xenstored/systemd.ml
> @@ -13,5 +13,5 @@
>   *)
>  
>  external sd_listen_fds: string -> Unix.file_descr = 
> "ocaml_sd_listen_fds"
> -external sd_booted: unit -> bool = "ocaml_sd_booted"
> +external booted_by_systemd: unit -> bool = "ocaml_booted_by_systemd"
>  external sd_notify_ready: unit -> unit = "ocaml_sd_notify_ready"
> diff --git a/tools/ocaml/xenstored/systemd.mli 
> b/tools/ocaml/xenstored/systemd.mli
> index 85c9f2e..293b5bc 100644
> --- a/tools/ocaml/xenstored/systemd.mli
> +++ b/tools/ocaml/xenstored/systemd.mli
> @@ -17,8 +17,8 @@
>   *  us do sanity checks on the expected sockets *)
>  val sd_listen_fds: string -> Unix.file_descr
>  
> -(** Tells us whether or not systemd support was compiled in *)
> -val sd_booted: unit -> bool
> +(** Tells us whether or not the process is booted by systemd *)
> +val booted_by_systemd: unit -> bool
>  
>  (** Tells systemd we're ready *)
>  external sd_notify_ready: unit -> unit = "ocaml_sd_notify_ready"
> diff --git a/tools/ocaml/xenstored/systemd_stubs.c 
> b/tools/ocaml/xenstored/systemd_stubs.c
> index d924ff1..354539e 100644
> --- a/tools/ocaml/xenstored/systemd_stubs.c
> +++ b/tools/ocaml/xenstored/systemd_stubs.c
> @@ -92,14 +92,14 @@ CAMLprim value ocaml_sd_listen_fds(value connect_to)
>  	CAMLreturn(sock_ret);
>  }
>  
> -CAMLprim value ocaml_sd_booted(value ignore)
> +CAMLprim value ocaml_booted_by_systemd(value ignore)
>  {
>  	CAMLparam1(ignore);
>  	CAMLlocal1(ret);
>  
>  	ret = Val_false;
>  
> -	if (sd_booted())
> +	if (sd_listen_fds(0) > 0)
>  		ret = Val_true;
>  
>  	CAMLreturn(ret);
> @@ -129,7 +129,7 @@ CAMLprim value ocaml_sd_listen_fds(value connect_to)
>  	CAMLreturn(sock_ret);
>  }
>  
> -CAMLprim value ocaml_sd_booted(value ignore)
> +CAMLprim value ocaml_booted_by_systemd(value ignore)
>  {
>  	CAMLparam1(ignore);
>  	CAMLlocal1(ret);
> diff --git a/tools/ocaml/xenstored/utils.ml 
> b/tools/ocaml/xenstored/utils.ml
> index 61321c6..fad15b3 100644
> --- a/tools/ocaml/xenstored/utils.ml
> +++ b/tools/ocaml/xenstored/utils.ml
> @@ -84,7 +84,7 @@ let create_regular_unix_socket name =
>          sock
>  
>  let create_unix_socket name =
> -        if Systemd.sd_booted() then
> +        if Systemd.booted_by_systemd() then
>                  Systemd.sd_listen_fds name
>          else
>                  create_regular_unix_socket name
> diff --git a/tools/ocaml/xenstored/xenstored.ml 
> b/tools/ocaml/xenstored/xenstored.ml
> index bfe689b..409223d 100644
> --- a/tools/ocaml/xenstored/xenstored.ml
> +++ b/tools/ocaml/xenstored/xenstored.ml
> @@ -431,7 +431,7 @@ let _ =
>  	while not !quit
>  	do
>  		try
> -                        if Systemd.sd_booted() then
> +                        if Systemd.booted_by_systemd() then
>                                  Systemd.sd_notify_ready ();
>  			main_loop ()
>  		with exc ->

  reply	other threads:[~2015-08-06 13:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-06 13:38 [PATCH for-4.6 0/5] Patches for c/oxenstored Wei Liu
2015-08-06 13:38 ` [PATCH for-4.6 1/5] cxenstored: fix systemd socket activation Wei Liu
2015-08-06 13:38 ` [PATCH for-4.6 2/5] cxenstored: document a bunch of short options in help string Wei Liu
2015-08-06 15:54   ` Ian Campbell
2015-08-06 13:38 ` [PATCH for-4.6 3/5] cxenstored: remove dead option Wei Liu
2015-08-06 13:49   ` Ian Campbell
2015-08-06 13:52     ` Wei Liu
2015-08-06 13:38 ` [PATCH for-4.6 4/5] oxenstored: fix systemd socket activation Wei Liu
2015-08-06 13:50   ` Ian Campbell [this message]
2015-08-06 16:02     ` Ian Campbell
2015-08-06 15:58   ` Dave Scott
2015-08-06 13:38 ` [PATCH for-4.6 5/5] oxenstored: move sd_notify_ready out of main loop Wei Liu
2015-08-06 16:00   ` Dave Scott

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=1438869044.9747.158.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=dave.scott@eu.citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=wei.liu2@citrix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.