[PATCH v2] os: Add -displayfd option

Jon TURNEY jon.turney at dronecode.org.uk
Wed Apr 4 08:27:39 PDT 2012


On 03/04/2012 22:25, Chase Douglas wrote:
> This option specifies a file descriptor in the launching process.  X
> will scan for an available display number and write that number back to
> the launching process, at the same time as SIGUSR1 generation.  This
> means display managers don't need to guess at available display numbers.
> As a consequence, if X fails to start when using -displayfd, it's not
> because the display was in use, so there's no point in retrying the X
> launch on a higher display number.
> 
> Signed-off-by: Adam Jackson <ajax-H+wXaHxf7aLQT0dZR+AlfA at public.gmane.org>
> Signed-off-by: Chase Douglas <chase.douglas-Z7WLFzj8eWMS+FvcfC7Uqw at public.gmane.org>
> Reviewed-by: Julien Cristau <jcristau-8fiUuRrzOP0dnm+yROfE0A at public.gmane.org>
> Tested-by: Julien Cristau <jcristau-8fiUuRrzOP0dnm+yROfE0A at public.gmane.org>
> ---

Very much in favour of adding this.

> +    else { /* -displayfd */
> +        Bool found = 0;
> +        for (i = 0; i < 65535 - X_TCP_PORT; i++) {
> +            if (TryCreateSocket(i, &partial) && !partial) {
> +                found = 1;
> +                break;
> +            }
> +            else
> +                CloseWellKnownConnections();
>          }
> -        else {
> -            ListenTransFds = malloc(ListenTransCount * sizeof(int));
> +        if (!found)
> +            FatalError("Failed to find a socket to listen on");
> +        sprintf(dynamic_display, "%d\n", i);
> +        display = dynamic_display;

Would you mind changing this so it doesn't inconsistently add a trailing '\n'
to display if -displayfd was used. (This is difficulty for XWin as we
subsequently use the value of display to point our helper clients at the right
display)




More information about the xorg-devel mailing list