This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

kernel patch for "Can't open display"




To all that receive the "Can't open display" message for your X clients.  
If this is not related to the DISPLAY variable, and other obvious 
problems, then this kernel patch may help you.  I just hacked this 
together last night, so YMMV, but for the brave you can download a new 
cygwin1.dll from my site at:

http://zambezi.cs.ucdavis.edu/~mark/cygwin1.dll

Copy this cygwin1.dll into /bin for the latest release of cygwin.  It 
works for me, but no assurances about your results.  Here is a 
description of the problem.  This description pertains to the 
winsup/cygwin portion of the cygwin kernel.

Inside of the client code for X applications, you will find a fcntl 
F_SETFD.  By default the fhandle_socket.cc file for the kernel passes 
this to fhandle.cc.  Inside of fhandle.cc the F_SETFD gets passed to 
"set_close_on_exec(...)".  This then calls set_inheritence(..), which has 
this ominous line in it:

.
.
/* FIXME: This won't work with sockets */
	{
	ForceCloseHandle2(h, name);
 	.
 	.

Anyway, needless to say, the problem has to do with the duplicate handle 
not being valid for subsequent socket calls.

A "fix" that I implemented is to disable the close_on_exec support for 
sockets only.  Inside of fhandler_socket.cc , edit the fcntl(..) function 
and add this to the switch statement:


	case    F_SETFD:
		{
		// the default handler is broken for now
		// should send -1 but have to lie to vtwm so send 0
		res = 0;
		break;
		}

After I did this, X starts up great and everything is fine except I miss 
my KDE ;-)

Of course, your mileage may vary, and I advise that this bug be sent to 
the real developers of the cygwin kernel so they can fix it properly.  
This should be considered a temporary work around!


-Mark Oskin



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]