[pulseaudio-discuss] [PATCH 4/8] socket-server: Add support for systemd socket activation.

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Fri Oct 24 01:35:28 PDT 2014


On Sat, 2014-10-18 at 20:43 +0200, Colin Guthrie wrote:
> --- a/src/pulsecore/socket-server.c
> +++ b/src/pulsecore/socket-server.c
>  pa_socket_server* pa_socket_server_new_unix(pa_mainloop_api *m, const char *filename) {
> -    int fd = -1;
> +    int n, fd = -1;
> +    bool activated = false;
>      struct sockaddr_un sa;
>      pa_socket_server *s;
>  
>      pa_assert(m);
>      pa_assert(filename);
>  
> -    if ((fd = pa_socket_cloexec(PF_UNIX, SOCK_STREAM, 0)) < 0) {
> -        pa_log("socket(): %s", pa_cstrerror(errno));
> -        goto fail;
> +#ifdef HAVE_SYSTEMD_DAEMON
> +    n = sd_listen_fds(0);
> +    if (n > 0) {
> +        int i;
> +        for (i = 0; i < n; ++i) {
> +            if (sd_is_socket_unix(SD_LISTEN_FDS_START + i, SOCK_STREAM, 1, filename, 0) > 0) {
> +                fd = SD_LISTEN_FDS_START + i;
> +                activated = true;
> +                pa_log_info("socket(): Found socket activation socket for '%s' \\o/", filename);

Why does the log message start with "socket():"?

-- 
Tanu



More information about the pulseaudio-discuss mailing list