[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:
emacs.socket
============
[Socket]
ListenStream=/home/foobar/test.socket
[Install]
WantedBy=sockets.target
emacs.service
=============
[Service]
Type=forking
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!
Thanks,
Matt
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
it.
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(-)
--
2.7.4
- [PATCH v2 0/4] Add systemd socket launching support.,
Matthew Leach <=