[PATCH 0/7] libxshmfence improvements

Keith Packard keithp at keithp.com
Wed Nov 20 11:55:54 PST 2013


> Keith, can you please fix the xshmfence API to use either 'void *' or
> an opaque 'struct xshmfence *' instead of 'int32_t *' before we have
> to live with this design mistake forever?

I spent this morning cleaning up libxshmfence; it should now work on
non-Linux systems that support process shared pthread mutexes and
condition variables.

I tested it on Linux, but we can't use it there because the pthread
structures cannot be shared between 32-bit and 64-bit processes.

 [PATCH 1/7] Change fence memory type from 'int32_t' to 'struct xshmfence'

Creates an opaque struct type (instead of just using void) so that we
get some typechecking from the compiler.

 [PATCH 2/7] Locate directory for shared memory files at configure

This uses the same configure fragment that the X server uses to find
a suitable directory for shared memory files

 [PATCH 3/7] Use O_TMPFILE if available

Use the new O_TMPFILE where available.

 [PATCH 4/7] Add test program

Oh, no, actual testing! 

 [PATCH 5/7] Split out futex implementation from general API
 [PATCH 6/7] Provide pthread-based alternative implementation

These refactor the source code and add the pthread variant to the
library.

 [PATCH 7/7] Set symbol visibility attribute to hide internal symbols

Now that the library has multiple files, make sure the shared library
exposes only the public API.

Comments, testing and review are welcome, as always.

This does *not* change the ABI, although the switch from int32_t to
struct xshmfence will cause C compiler warnings. I've added a #define
to xshmfence.h so that programs can tell if they have the new API or
not.

-keith


More information about the xorg-devel mailing list