[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 0/4] Add systemd socket launching support.

From: Matthew Leach
Subject: [PATCH v2 0/4] Add systemd socket launching support.
Date: Sun, 27 Mar 2016 21:39:39 +0100

Hi all,

systemd has the ability to create a socket, launch a daemon upon
connection to that socket and hand over the socket to the new process
to handle.  In Emacs' case, we can delay the start of the Emacs daemon
until emacsclient is called upon a socket.

These patches can be tested by creating minimal systemd setup.  First,
create two systemd unit files:



ExecStart=/path/to/emacs --daemon

Once these files have been created, execute:

# systemctl daemon-reload
# systemctl start enacs.socket

The socket will now be created, and when a connection is made, the
Emacs daemon will be started:

# emacsclient -s /home/foobar/test.socket -t

Feedback & comments welcome!


Changes since v1
* Call sd_listen_fds with a paramter of 1 to remove the state that
  systemd sets up.
* Check the socket's validity when passed from systemd.
* Remove lisp functions to simplify the API.
* Change the name of the paramter passed to make_network_process to
  ':usepassedsocket' to keep things more generic.

Matthew Leach (4):
  Check for libsystemd when building Emacs.
  Read the number of sockets passed by systemd.
  Allow network processes to be made with a pre-allocated fd.
  When Emacs is passed a socket descriptor, make the server listen on

 configure.ac    | 13 +++++++++++++
 lisp/server.el  |  1 +
 src/Makefile.in |  6 +++++-
 src/emacs.c     | 25 +++++++++++++++++++++++++
 src/process.c   | 36 +++++++++++++++++++++++++++++-------
 5 files changed, 73 insertions(+), 8 deletions(-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]