[openib-general] Data structure size mismatch

Roland Dreier rolandd at cisco.com
Mon Nov 14 07:49:14 PST 2005


    Pradeep> I am seeking suggestions with respect to the
    Pradeep> 32-bit/64-bit issues. Is the macro
    Pradeep> test_thread_flag(TIF_32BIT), to ascertain if we are in
    Pradeep> the kernel in the context of a 32-bit app or not, generic
    Pradeep> enought that it will work across all the 64-bit platforms
    Pradeep> of interest. It should work for
    Pradeep> ppc64/sparc64/x86_64/parisc. Is that good enough?

What are you trying to do?  It would be best to make your ABI the same
for both 32-bit and 64-bit kernels, so no compatibility code is
required.  Failing that, just hook into the existing compatibility
support (ie compat_ioctl and friends).

    Pradeep> Also, do I use __LP64__ to find out if this is a 64-bit
    Pradeep> kernel? My research has revealed that this macro will
    Pradeep> work for gcc versions greater than 3.4.  Now, Sles9sp2
    Pradeep> uses gcc 3.3.3 and so will not work on Sles9sp2. However,
    Pradeep> RHEL4U2 uses gcc version 3.4.4. So, even though one may
    Pradeep> be using the same kernel version, it will work on one
    Pradeep> distro and not the other. How does one address such
    Pradeep> issues?

BITS_PER_LONG should be sufficient I think.  But again, what are you
trying to do?  It would be better to write your code so that it
doesn't matter whether it is being built for a 32-bit kernel or a
64-bit kernel.

 - R.



More information about the general mailing list