#include <binary-io.h>
#endif
+#ifdef HAVE_LIBSYSTEMD
+# include <systemd/sd-daemon.h>
+# include <sys/socket.h>
+#endif
+
#ifdef HAVE_WINDOW_SYSTEM
#include TERM_HEADER
#endif /* HAVE_WINDOW_SYSTEM */
exit (1);
}
+#ifdef HAVE_LIBSYSTEMD
+ /* Read the number of sockets passed through by systemd. */
+ int systemd_socket = sd_listen_fds (1);
+
+ if (systemd_socket > 1)
+ fprintf (stderr,
+ ("\n"
+ "Warning: systemd passed more than one socket to Emacs.\n"
+ "Try 'Accept=false' in the Emacs socket unit file.\n"));
+ else if (systemd_socket == 1
+ && (0 < sd_is_socket (SD_LISTEN_FDS_START,
+ AF_UNSPEC, SOCK_STREAM, 1)))
+ set_external_socket_descriptor (SD_LISTEN_FDS_START);
+#endif /* HAVE_LIBSYSTEMD */
+
#ifndef DAEMON_MUST_EXEC
#ifdef USE_GTK
fprintf (stderr, "\nWarning: due to a long standing Gtk+ bug\nhttp://bugzilla.gnome.org/show_bug.cgi?id=85715\n\