[PATCH v2] Workaround conflict between Solaris <sys/list.h> & Xorg "list.h" definitions

Alan Coopersmith alan.coopersmith at oracle.com
Fri Dec 23 15:23:48 PST 2011

<sys/ipc_impl.h> includes the Solaris <sys/list.h> but doesn't use any
definitions from it unless _KERNEL is defined for building a kernel module,
so we can simply fake its header guard to skip its inclusion in Xext/shm.c

<sys/proc.h> also includes it, but we don't actually need anything from
that header to be included, so we can just move it into the skip on Solaris
list in xf86_OSlib.h

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

Changed since v1:
 - Added explanations of what & why this is being done
 - Removed list_t typedefs in shm.c, since we don't actually need them

While I appreciate Jamey's feedback on making this cleaner, the only cleaner
thing I can see to do is break the Xorg list API by renaming it to avoid
conflicts with OS-provided list API's, and I didn't want to do that
unilaterally for just this one issue.

The xf86_OSlib.h change does suggest that a cleanup to consider for the
next merge window would be to drop the SVR3 and non-Solaris SVR4 support,
now that the SCO ports have gone defunct.  (SCO & Solaris were the only
SysV variants supported since the current X.Org took over, and the SCO
port was abandoned several years ago and mostly removed from the X server
last year.)

 Xext/shm.c                         |    4 ++++
 hw/xfree86/os-support/xf86_OSlib.h |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/Xext/shm.c b/Xext/shm.c
index 7ca027a..bd5253c 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -58,6 +58,10 @@ in this Software without prior written authorization from The Open Group.
 /* Needed for Solaris cross-zone shared memory extension */
 #ifdef HAVE_SHMCTL64
+/* Workaround conflicts between Solaris <sys/list.h> & Xorg "list.h" */
+#define _SYS_LIST_H
 #include <sys/ipc_impl.h>
 #define SHMSTAT(id, buf)	shmctl64(id, IPC_STAT64, buf)
 #define SHMSTAT_TYPE 		struct shmid_ds64
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h
index 0a5861f..45500db 100644
--- a/hw/xfree86/os-support/xf86_OSlib.h
+++ b/hw/xfree86/os-support/xf86_OSlib.h
@@ -98,8 +98,8 @@
 #  if !(defined (sun) && defined (SVR4))
 #    include <sys/immu.h>
 #    include <sys/region.h>
+#    include <sys/proc.h>
 #  endif
-#  include <sys/proc.h>
 #  include <sys/tss.h>
 #  include <sys/sysi86.h>
 #  if defined(SVR4) && !defined(sun)

More information about the xorg-devel mailing list