[PATCH 3/3] Introduce WAYLAND_SERVER_SOCKET_DIR to change socket directory without changing XDG_RUNTIME_DIR. This might be useful to change socket directory in case wl_display_add_socket_auto is used. For example this will change the socket path for weston without using any command line argument. This envvar is ignored when WAYLAND_SERVER_SOCKET is set to an absolute path.
Lyude
thatslyude at gmail.com
Fri Mar 6 12:29:15 PST 2015
Just a nit-pick here, generally it's a good idea to keep the subject
line short, and have the majority of the description in the body of the
patch. Saw this while I was going through my e-mails and figured I might
as well point that out :).
Cheers,
Lyude
On Tue, 2015-03-03 at 13:49 +0100, Davide Bettio wrote:
> Signed-off-by: Davide Bettio <davide.bettio at ispirata.com>
> ---
> src/wayland-server.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/src/wayland-server.c b/src/wayland-server.c
> index 05e9c07..2922e41 100644
> --- a/src/wayland-server.c
> +++ b/src/wayland-server.c
> @@ -1093,9 +1093,12 @@ wl_socket_init_for_display_name(struct wl_socket *s, const char *name)
> int name_size;
> const char *runtime_dir;
>
> - runtime_dir = getenv("XDG_RUNTIME_DIR");
> + runtime_dir = getenv("WAYLAND_SERVER_SOCKET_DIR");
> if (!runtime_dir) {
> - wl_log("error: XDG_RUNTIME_DIR not set in the environment\n");
> + runtime_dir = getenv("XDG_RUNTIME_DIR");
> + }
> + if (!runtime_dir) {
> + wl_log("error: XDG_RUNTIME_DIR or WAYLAND_SERVER_SOCKET_DIR not set in the environment\n");
>
> /* to prevent programs reporting
> * "failed to add socket: Success" */
> @@ -1220,14 +1223,14 @@ wl_display_add_socket_auto(struct wl_display *display)
> * and WAYLAND_DISPLAY env variable for the socket name. If WAYLAND_DISPLAY and
> * WAYLAND_SERVER_SOCKET are not set, then default wayland-0 is used.
> *
> - * The Unix socket will be created in the directory pointed to by environment
> - * variable XDG_RUNTIME_DIR. If XDG_RUNTIME_DIR is not set, then this function
> - * fails and returns -1.
> + * The Unix socket will be created in the directory pointed to by either environment
> + * variable WAYLAND_SERVER_SOCKET_DIR or XDG_RUNTIME_DIR. If the none of the is set,
> + * then this function fails and returns -1.
> *
> - * The length of socket path, i.e., the path set in XDG_RUNTIME_DIR and the
> + * The length of socket path, e.g., the path set in XDG_RUNTIME_DIR and the
> * socket name, must not exceed the maxium length of a Unix socket path.
> * The function also fails if the user do not have write permission in the
> - * XDG_RUNTIME_DIR path or if the socket name is already in use.
> + * wayland socket path or if the socket name is already in use.
> *
> * \memberof wl_display
> */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20150306/33e6b473/attachment.sig>
More information about the wayland-devel
mailing list