all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH v2 0/4] Add systemd socket launching support.
@ 2016-03-27 20:39 Matthew Leach
  2016-03-27 20:39 ` [PATCH v2 1/4] Check for libsystemd when building Emacs Matthew Leach
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Matthew Leach @ 2016-03-27 20:39 UTC (permalink / raw)
  To: emacs-devel; +Cc: Matthew Leach

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




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-03-30 16:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-27 20:39 [PATCH v2 0/4] Add systemd socket launching support Matthew Leach
2016-03-27 20:39 ` [PATCH v2 1/4] Check for libsystemd when building Emacs Matthew Leach
2016-03-27 20:39 ` [PATCH v2 2/4] Read the number of sockets passed by systemd Matthew Leach
2016-03-27 20:39 ` [PATCH v2 3/4] Allow network processes to be made with a pre-allocated fd Matthew Leach
2016-03-27 21:18   ` Andreas Schwab
2016-03-28 15:24   ` Eli Zaretskii
2016-03-28 15:45     ` Matthew Leach
2016-03-30 16:29   ` John Wiegley
2016-03-27 20:39 ` [PATCH v2 4/4] When Emacs is passed a socket descriptor, make the server listen on it Matthew Leach

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.