summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKO Myung-Hun <komh78@gmail.com>2021-01-19 01:40:11 +0900
committerBruno Haible <bruno@clisp.org>2021-01-19 19:07:55 +0100
commit70e3c12fb708a02c2326d571e11ae53aef8c45f0 (patch)
tree9e9ddca95d7aa3679e0778b2ea40ea03a608a980 /tests
parent4abfff402935537ca64edbd3b2c719b181560a37 (diff)
downloadgnulib-70e3c12fb708a02c2326d571e11ae53aef8c45f0.tar.gz
zerosize-ptr: Fix compilation on OS/2 kLIBC.
* tests/zerosize-ptr.h [OS/2 kLIBC]: Don't use mmap().
Diffstat (limited to 'tests')
-rw-r--r--tests/zerosize-ptr.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/zerosize-ptr.h b/tests/zerosize-ptr.h
index 45a1729d3e..bfeff50935 100644
--- a/tests/zerosize-ptr.h
+++ b/tests/zerosize-ptr.h
@@ -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;