CygwinX at MS Terminalserver?

Jon TURNEY jon.turney@dronecode.org.uk
Mon Sep 20 14:21:00 GMT 2010


On 27/08/2010 16:52, Jon TURNEY wrote:
> On 16/08/2010 07:35, Steffen Sledz wrote:
>> Am 13.08.2010 13:09, schrieb Jon TURNEY:
>>>> Now testuser0002 tries to start another server in parallel.
>>>> This gives this error:
>>>>
>>>> /usr/bin/startxwin: Resource temporarily unavailable (errno 11): Another X
>>>> server instance is running on DISPLAY :0
>>>
>>> This is expected. As I said, each X server instance must
>>> have a unique display number.
>>>
>>> This can't possibly work any other way. If two users both
>>> have an X server with display number 0, to which server should
>>> a client started with DISPLAY=:0.0 connect?
>>
>> That's clear. I thought (or hoped) that starting X server using the "XWin
>> Server" menu item automatically searches for an unused display number and
>> uses it. I think that would be a good default behaviour.
>
> I agree it would be useful, and it is on the todo list [1], but there's a
> non-trivial problem to solve first:
>
> How is the display number which the server has allocated communicated to other
> processes, so that the users clients appear on the right display?

The fedora -displayfd patch seems to have moved and now lives at [1]

I've built an Xserver including an updated and modified version of this patch 
and uploaded it at [2].  Perhaps you could give that a try and see if it works 
for your purposes?

"-displayfd fd
specifies  a file descriptor in the launching process.  Rather than specify a 
display number, the X server will attempt to listen on successively higher 
display numbers, and upon finding a  free one, will write the display number 
back on this file descriptor as a newline-terminated string.  The -pn option 
is ignored when using -displayfd."

> If you start the X server first and then launch everything from the traymenu,
> everything would works fine, as the X server places a correct DISPLAY variable
> into the environment inherited by the child process.
>
> But if you start the X server via xinit/startx/startxwin, the display number
> needs to be communicated back to xinit, so that the correct display number is
> used for clients which are subsequently started by xinit.

I've also patched xinit/startxwin so they transparently handle the -displayfd 
X server option, uploaded at [3],[4]. They handle the -displayfd option 
specially to modify the fd number passed to the Xserver so they can read it's 
output and set the display number correctly for clients which xinit/startxwin 
starts, then write that display number to the originally specified fd.

(Patch to follow. Note that this patch probably won't apply to a stock 
xinit-1.2.1 as it's based on top of the patch which adds startxwin)

> Fedora ships with a patch [2] which adds the -displayfd option, which
> allocates a display number and writes it to the specified fd. But to be useful
> to us, xinit would needs some code to use that flag (under some circumstances)
> and read that display number and use it for the clients it creates.
>
> There's also the case where the user explicitly sets DISPLAY programmatically
> or manually before starting clients. I think with some suitable shell
> scripting, -displayfd probably can be used for that also.

Something along the lines of adding '-displayfd 3 3>~/.display' to the Xserver 
invocation, and then 'export DISPLAY=:`cat ~/.display`' to ~/.bashrc might be 
sufficient.

> [1] http://x.cygwin.com/devel/todo.html
> [2]
> http://cvs.fedoraproject.org/viewvc/devel/xorg-x11-server/xserver-1.6.0-displayfd.patch

[1] http://pkgs.fedoraproject.org/gitweb/?p=xorg-x11-server.git;a=tree
[2] ftp://cygwin.com/pub/cygwinx/XWin.20100916-git-df5773ea3927d9c1.exe.bz2
[3] ftp://cygwin.com/pub/cygwinx/startxwin.exe
[4] ftp://cygwin.com/pub/cygwinx/xinit.exe

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/



More information about the Cygwin-xfree mailing list