- /* check for unix socket */
- if (0 == strncmp(path, "unix:", 5))
- fd = api_ws_socket_unix(path + 5, server);
- else
- fd = api_ws_socket_inet(path, server);
-
- if (fd >= 0) {
- fcntl(fd, F_SETFD, FD_CLOEXEC);
- fcntl(fd, F_SETFL, O_NONBLOCK);
- if (server) {
+ /* check for systemd socket */
+ if (0 == strncmp(path, "sd:", 3))
+ fd = sd_fds_for(path + 3);
+ else {
+ /* check for unix socket */
+ if (0 == strncmp(path, "unix:", 5))
+ /* unix socket */
+ fd = api_ws_socket_unix(path + 5, server);
+ else
+ /* inet socket */
+ fd = api_ws_socket_inet(path, server);
+
+ if (fd >= 0 && server) {