[comp.windows.x] XPending fails on SCO

jtsillas@bubba.ma30.bull.com (James Tsillas) (02/12/91)

I am in the process of building GNU Emacs to use the X11 facilities
on SCO Unix. Testing showed that things worked well if the server and client
were both running on the same machine but a remote server would fail with the
error:
	Fatal X-windows I/O error: Invalid argument

Using gdb, I tracked the failure to a call to XPending (XXdisplay) in 
x11term.h. Is anyone aware of any problems with interrupt driven I/O
using SCO or with SCO's implementation of Xlib? The same code runs without
complication on a number of platforms.

Thanks,
jim.


--
 == James Tsillas                    Bull HN Information Systems Inc. ==
 == (508) 294-2937                   300 Concord Road   826A          ==
 == jtsillas@bubba.ma30.bull.com     Billerica, MA 01821              ==
 ==                                                                   ==
 == The opinions expressed above are solely my own and do not reflect ==
 == those of my employer.                                             ==
		    -== no solicitations please ==-

jcc@adesign.uucp (Jean-Christophe Collet) (02/13/91)

>I am in the process of building GNU Emacs to use the X11 facilities
>on SCO Unix. Testing showed that things worked well if the server and client
>were both running on the same machine but a remote server would fail with the
>error:
>	Fatal X-windows I/O error: Invalid argument
>
>Using gdb, I tracked the failure to a call to XPending (XXdisplay) in 
>x11term.h. Is anyone aware of any problems with interrupt driven I/O
>using SCO or with SCO's implementation of Xlib? The same code runs without
>complication on a number of platforms.

Well I figured out this one recently. The answer is in x11term.c, function
x_init_1() [around line 1900] :

static void
x_init_1 ()
{
#ifdef F_SETOWN
        extern int old_fcntl_owner;
#endif

        dup2 (ConnectionNumber(XXdisplay), 0);
        close (ConnectionNumber(XXdisplay));
        ConnectionNumber(XXdisplay) = 0;        /* Looks a little strange?
                                                 * check the def of the macro;
                                                 * it is a genuine lvalue */
...
}

Those two F*G lines after the dup2 are changing the internal Display structure
(fd field to be precise).
This is a kludge that doesn't work when the fd was the result of a t_open()
[tli call]. And SCO uses tli for TCP/IP connections.

Solution : Comment out the two lines (the close and the assignation). This
worked for me.

Beware : I don't know what version of SCO you're using (poor guy, I just hate
when I have to work with such a shitty OS), but the XPending() function
was buggy in the SCO Xlib I tried to work with some time ago. I don't know
if it has been fixed in recent releases...

My advice : SCO, just say NO!

But if you HAVE to go with it, get Thomas Roell's X386 : It's X11R4, it uses
shared libs, etc... and it's free. Also, V 1.1 should support local connection
with SCO's client, that means you still may run xdt and Cie.

Hope this help!

-- Jean-Christophe (aka "Jessie")
------------------------------------------------------------------------------
jcc@axis-design.fr	| "An artificial intelligence is better than none!"
..!inria!axis-design!jcc| "Artificial intelligence matches natural stupidity!"
Collet Jean-Christophe	| "Objets inanimes avez-vous donc une ame ?"
------------------------------------------------------------------------------
Axis Design			|
119, rue de Flandres		|
75019 Paris			|    <this space left intentionaly blank>
France				|
Tel: +33 (1) 40 35 20 20	|
------------------------------------------------------------------------------