]> Savannah Git Hosting - gnulib.git/commitdiff
zerosize-ptr: Fix compilation on OS/2 kLIBC.
authorKO Myung-Hun <komh78@gmail.com>
Mon, 18 Jan 2021 16:40:11 +0000 (01:40 +0900)
committerBruno Haible <bruno@clisp.org>
Tue, 19 Jan 2021 18:07:55 +0000 (19:07 +0100)
* tests/zerosize-ptr.h [OS/2 kLIBC]: Don't use mmap().

ChangeLog
tests/zerosize-ptr.h

index 83d724cfbed6a5c5197bc4b62aae0af93ff9304b..357c231be860ebe547108b6d640cc1cb74bd3033 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2021-01-19  KO Myung-Hun  <komh78@gmail.com>
+
+       zerosize-ptr: Fix compilation on OS/2 kLIBC.
+       * tests/zerosize-ptr.h [OS/2 kLIBC]: Don't use mmap().
+
 2021-01-19  KO Myung-Hun  <komh78@gmail.com>
 
        stddef: Fix compilation for max_align_t on OS/2 kLIBC.
index 45a1729d3e57c418cc850c8a8ce68720b01d0bde..bfeff50935390083965607d7797545ab49597457 100644 (file)
@@ -36,8 +36,9 @@
 /* Test whether mmap() and mprotect() are available.
    We don't use HAVE_MMAP, because AC_FUNC_MMAP would not define it on HP-UX.
    HAVE_MPROTECT is not enough, because mingw does not have mmap() but has an
-   mprotect() function in libgcc.a.  */
-#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
+   mprotect() function in libgcc.a.
+   And OS/2 kLIBC has <sys/mman.h> and mprotect(), but not mmap().  */
+#if HAVE_SYS_MMAN_H && HAVE_MPROTECT && !defined __KLIBC__
 # include <fcntl.h>
 # include <unistd.h>
 # include <sys/types.h>
@@ -58,7 +59,7 @@ zerosize_ptr (void)
 {
 /* Use mmap and mprotect when they exist.  Don't test HAVE_MMAP, because it is
    not defined on HP-UX 11 (since it does not support MAP_FIXED).  */
-#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
+#if HAVE_SYS_MMAN_H && HAVE_MPROTECT && !defined __KLIBC__
 # if HAVE_MAP_ANONYMOUS
   const int flags = MAP_ANONYMOUS | MAP_PRIVATE;
   const int fd = -1;