This seems to work everywhere we tried, so I went ahead and committed that change. Thanks Pete!

-sam

On Apr 4, 2006, at 12:15 PM, Pete Wyckoff wrote:

[EMAIL PROTECTED] wrote on Tue, 04 Apr 2006 11:32 -0500:
Hm...actually I didn't notice before but the use of __WORDSIZE or
BITS_PER_LONG will break on darwin (which doesn't define either).
Previously, I fixed this by defining SIZEOF_LONG_INT and
SIZEOF_VOID_P in pvfs2-config.h, but the PVFS_sys_attr_s struct now
includes padding and that struct is defined in pvfs2-sysint.h, which
is an external header.

Posix defines intptr_t as an int that can hold a pointer, hence you
can get your word size out of that.   Then this should work and uses
only constants that POSIX requires in <stdint.h>:

    #if INTPTR_MIN == INT32_MIN
        32-bit
    #else
        not 32-bit
    #endif

Appears visually to be okay on darwin, x86, and x86_64.  But I've
never tried it in real life.  Too bad there appears to be no direct
wordsize in posix anywhere.


Another approach would be with unions:

    struct PVFS_sys_attr_s {
        ...
        union {
            char _s[8];
            char *link_target;
        };
        ...
    }

But I haven't tried that either.  On ancient gcc you need to give
the union a name then "#define link_target _u.link_target", e.g.

                    -- Pete


_______________________________________________
Pvfs2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

Reply via email to