On Fri, 28 May 2021 at 21:27, Ted Toth <txtoth@xxxxxxxxx> wrote:
When a socket service runs is there a way to determine the socket
state? If the socket file contains:
Accept=true
does systemd call accept with the socket before execing the service in
which case I don't have to call accept?
Yes, with Accept=yes (similar to inetd’s “nowait”) systemd itself will accept connections and will start a separate instance of your templated service per connection.
With Accept=no you get the listening socket instead and a single non-templated service handles everything.
Is there a way to
differentiate a socket with Accept set to true versus one without
Accept or with it set to false? I've read the sd_is_socket man page
but it's not clear to me if it can answer the question I posed.
Normally a service would just expect to be given one or the other... But I think you can use this getsockopt(SO_ACCEPTCONN) to check:
You could also just try calling accept() on it, I guess...
Ted
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Mantas Mikulėnas
_______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel