From: Ian Jackson Subject: Re: [PATCH v4 05/15] oxenstored: add support for systemd active sockets Date: Mon, 12 May 2014 14:57:15 +0100 Message-ID: <21360.54075.770574.313423@mariner.uk.xensource.com> References: <1398820328-15132-1-git-send-email-mcgrof@do-not-panic.com> <1398820328-15132-6-git-send-email-mcgrof@do-not-panic.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Wjqjl-0000bV-Vu for xen-devel@lists.xenproject.org; Mon, 12 May 2014 13:57:50 +0000 In-Reply-To: <1398820328-15132-6-git-send-email-mcgrof@do-not-panic.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Luis R. Rodriguez" Cc: David Scott , Stefano Stabellini , "Luis R. Rodriguez" , Vincent Hanquez , xen-devel@lists.xenproject.org, Ian Campbell List-Id: xen-devel@lists.xenproject.org Luis R. Rodriguez writes ("[PATCH v4 05/15] oxenstored: add support for systemd active sockets"): ... > +/* Conforms to what we should send sd_is_socket_unix() */ > +struct xen_systemd_active_socket { > + int fd; > + int type; > + int listening; > + const char *path; > + size_t length; > +}; This is quite a lot of extraneous stuff, AFAICT. For example, we always set listening to 0. Why is this array not const ? > +/* > + * 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. > + */ This doesn't seem very convincing to me. > +CAMLprim value ocaml_sd_listen_fds(value connect_to) > +{ > + CAMLparam1(connect_to); > + CAMLlocal1(sock_ret); > + int n, r; > + struct xen_systemd_active_socket *active_socket; > + > + active_socket = get_xen_active_socket((const char *) String_val(connect_to)); > + if (!active_socket) > + caml_failwith("ocaml_sd_listen_fds() got invalid request"); The sole purpose of this is to convert the string to an entry in the the table ? I.e., essentially, just the table index ? > +/* > + * If xenstored was built to depend on systemd libraries > + * we assume you want all the bells and whistles with > + * systemd. > + */ This is not correct. A distro might want to use the same binary for both systemd and non-systemd installations. You need to use a runtime test. Thanks, Ian.