Use sysconf/getpagesize/page.h to determine page size on Linux,
Marcus Holland-Moritz [Sun, 12 Aug 2007 13:16:52 +0000 (15:16 +0200)]
in that order.

Subject: Re: [PATCH] Various Gentoo Patches
Message-Id: <20070812131652.16ca5444@r2d2>

p4raw-id: //depot/perl@31702

ext/IPC/SysV/SysV.xs

index d2b1ecb..1126711 100644 (file)
@@ -3,9 +3,6 @@
 #include "XSUB.h"
 
 #include <sys/types.h>
-#ifdef __linux__
-#   include <asm/page.h>
-#endif
 #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM)
 #ifndef HAS_SEM
 #   include <sys/ipc.h>
 #      ifndef HAS_SHMAT_PROTOTYPE
            extern Shmat_t shmat (int, char *, int);
 #      endif
-#      if defined(__sparc__) && (defined(__NetBSD__) || defined(__OpenBSD__))
+#      if defined(HAS_SYSCONF) && defined(_SC_PAGESIZE)
+#          undef  SHMLBA /* not static: determined at boot time */
+#          define SHMLBA sysconf(_SC_PAGESIZE)
+#      elif defined(HAS_GETPAGESIZE)
 #          undef  SHMLBA /* not static: determined at boot time */
 #          define SHMLBA getpagesize()
+#      elif defined(__linux__)
+#          include <asm/page.h>          
 #      endif
 #   endif
 #endif