|
The attached patch allows to use gpsd together with socket activation
in systemd. The idea is that systemd listens to the control socket
and TCP sockets and, as soon as someone connects to them, starts gpsd
and passes the file descriptors over (without accept()ing itself).
Sockets are in the following order: fd 3 is the control socket,
followed by up to two TCP sockets (for IPv4 and IPv6). If no socket
passing happens, behaviour of gpsd should be the same as before.
For using this new feature, one could use the following config *skeleton*:
-> File /etc/systemd/system/gpsd.socket:
[Socket]
ListenStream=/var/run/gpsd.sock
ListenStream=127.0.0.1:2947
-> File /etc/systemd/system/gpsd.service:
[Unit]
Requires=gpsd.spcket
[Service]
type=simple
ExecStart=/usr/bin/gpsd -N
What has been tested:
- gpsd compiles fine with both systemd=true/false
- Socket activation on the TCP socket works (gpsd is started, version string
is sent)
What has not been tested:
- Socket activation on the control socket works
Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
|