Hi,

On 11/29/2013 05:37 AM, Peter Hutterer wrote:
On Thu, Nov 28, 2013 at 04:21:14PM +0100, Hans de Goede wrote:
From: Łukasz Stelmach <[email protected]>

Receive file descriptors of open sockets from systemd instead of
creating them.

---
  Xtrans.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 81 insertions(+), 1 deletion(-)

diff --git a/Xtrans.c b/Xtrans.c
index e478422..1fd8933 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -48,6 +48,9 @@ from The Open Group.
   */

  #include <ctype.h>
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif

  /*
   * The transport table contains a definition for every transport (protocol)
@@ -1051,6 +1054,79 @@ complete_network_count (void)
  }


+static int
+receive_listening_fds(char* port, XtransConnInfo* temp_ciptrs, int* count_ret)
+
+{
+#ifdef HAVE_SYSTEMD
+    XtransConnInfo     ciptr;
+    int  systemd_listen_fds, i;
+
+    systemd_listen_fds = sd_listen_fds(1);
+    if (systemd_listen_fds < 0)
+    {
+        prmsg (1, "receive_listening_fds:"
+               "sd_listen_fds failed, error %d\n", systemd_listen_fds);
+       return -1;

there's a space/tab mix in the indentation here, but aside from that: print
maybe print strerror() which is more informative (the return value is a neg
errno)

Both fixed, v5 (I'm starting the numbering where Łukasz stopped) is on its way.

Regards,

Hans
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to