[PATCH 1/5] server: Create socket path prior the socket

Benjamin Franzke benjaminfranzke at googlemail.com
Thu Feb 28 12:42:01 PST 2013


2013/2/28 Kristian Høgsberg <hoegsberg at gmail.com>:
> On Wed, Feb 27, 2013 at 12:10:16PM +0100, Benjamin Franzke wrote:
>> This is just in preparation for systemd socket activation
>> since we need to know the path before creating/acquiring the socket.
>
> Hey Benjamin,
>
> The patches look good and are fairly non-intrusive, but I'm not sure
> when weston would be socket activated?

Well, actually socket-activating it is more a toy-thing..
(although its quite cool to have weston come up by just launching
weston-terminal,
and have both immediately open..)

But I thought this is good for parallel startup..
So for a session we can just start the compositor-service and a
client service in parallel, without the client needing some
magic sleep or polling to wait until the compositor created the socket..
I think this will be extremely useful for nested session compositors..

>
> Kristian
>
>> ---
>>  src/wayland-server.c | 13 ++++++-------
>>  1 file changed, 6 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/wayland-server.c b/src/wayland-server.c
>> index dae7177..fb07a01 100644
>> --- a/src/wayland-server.c
>> +++ b/src/wayland-server.c
>> @@ -1314,12 +1314,6 @@ wl_display_add_socket(struct wl_display *display, const char *name)
>>       if (s == NULL)
>>               return -1;
>>
>> -     s->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0);
>> -     if (s->fd < 0) {
>> -             free(s);
>> -             return -1;
>> -     }
>> -
>>       if (name == NULL)
>>               name = getenv("WAYLAND_DISPLAY");
>>       if (name == NULL)
>> @@ -1334,7 +1328,6 @@ wl_display_add_socket(struct wl_display *display, const char *name)
>>       if (name_size > (int)sizeof s->addr.sun_path) {
>>               wl_log("error: socket path \"%s/%s\" plus null terminator"
>>                      " exceeds 108 bytes\n", runtime_dir, name);
>> -             close(s->fd);
>>               free(s);
>>               /* to prevent programs reporting
>>                * "failed to add socket: Success" */
>> @@ -1342,6 +1335,12 @@ wl_display_add_socket(struct wl_display *display, const char *name)
>>               return -1;
>>       };
>>
>> +     s->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0);
>> +     if (s->fd < 0) {
>> +             free(s);
>> +             return -1;
>> +     }
>> +
>>       wl_log("using socket %s\n", s->addr.sun_path);
>>
>>       s->fd_lock = get_socket_lock(s);
>> --
>> 1.7.12.4
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list