Porting NX: 64bit problems

Ulrich Sibiller ulrich.sibiller at gmail.com
Mon Aug 31 15:09:29 PDT 2015


Hello,

I am currently trying to port the (old) code of NoMachine NX to
modular X. The code as released by NoMachine and maintained t the x2go
project [1]  is mostly based on the Xorg 6.9 tree. My first goal is to
port that code to Xorg 7.0 as 6.9 and 7.0 share the same code (after
that updating step by step to the current Xorg is planned).

While I have succeeded in doing this for a 32bit environment I am
struggling on the 64bit version.

The problem is that the xserver (nxagent) has a different size than
libX11 for some data types. This can been seen especially in the xkb
area. The code calls libX11's XKBGetKeyboard() [2] to receive an
XkbDescPtr. XkbDescRec points to an XkbNamesRec, structure which
consists of several Atoms and Atom is 64bit in libX11 but 32bit in
nxagent. Accessing that data leads to wrong values at best and crashes
at worse. The reason for this is the _XSERVER64 define which is set
within the xserver but not within libX11.

I can work around this to some degree by undefining _XSERVER64 in the
server code (but I see crashes when freeing stuff later in the xkb
parts of the server because there the datatype size also differs from
the one in libX11).

The 6.9 based NX code solves this by always compiling _everything_
including libX11 with _XSERVER64 defined. I do not want to do this
because I want to keep as close as possible to the upstream Xorg code
which defines _XSERVER64 only for the server code.

So I am looking for some advice how to solve this in a clean fashion.
Is there a document describing how to cleanly use libX11 calls from a
server? Is there some kind of best practice? Code examples? Does
anybody have some
glue code that takes care of datatype conversion for that purpose?

Thank you,

Uli



[1] http://code.x2go.org/gitweb?p=nx-libs.git;a=summary
[2] http://code.x2go.org/gitweb?p=nx-libs.git;a=blob;f=nx-X11/programs/Xserver/hw/nxagent/Keyboard.c;h=e3b58b6c72e03a1143b6294cb5812ebcc40fce4b;hb=HEAD#l954


More information about the xorg-devel mailing list