[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/7] zerosize-ptr: Fix compilation on OS/2 kLIBC
From: |
KO Myung-Hun |
Subject: |
[PATCH 5/7] zerosize-ptr: Fix compilation on OS/2 kLIBC |
Date: |
Tue, 19 Jan 2021 01:40:11 +0900 |
OS/2 kLIBC has <sys/mman.h> and mprotect() but not mmap(). As a result,
it's not enough to test with HAVE_SYS_MMAN_H and HAVE_MPROTECT. It's
necessary to test with HAVE_MMAP on OS/2 kLIBC.
* tests/zerosize-ptr.h [OS/2 kLIBC]: Test with HAVE_MMAP, too.
(zerosize_ptr) [OS/2 kLIBC]: Likewise.
---
tests/zerosize-ptr.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/zerosize-ptr.h b/tests/zerosize-ptr.h
index 45a1729d3..b8e3a9e06 100644
--- a/tests/zerosize-ptr.h
+++ b/tests/zerosize-ptr.h
@@ -37,7 +37,7 @@
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
+#if HAVE_SYS_MMAN_H && HAVE_MPROTECT && (!defined __KLIBC__ || HAVE_MMAP)
# include <fcntl.h>
# include <unistd.h>
# include <sys/types.h>
@@ -58,7 +58,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__ || HAVE_MMAP)
# if HAVE_MAP_ANONYMOUS
const int flags = MAP_ANONYMOUS | MAP_PRIVATE;
const int fd = -1;
--
2.22.0
- [PATCH 1/7] spawn: Use special invocation for <spawn.h> on OS/2 kLIBC, KO Myung-Hun, 2021/01/18
- [PATCH 2/7] yield: Fix linkage to threadlib on OS/2 kLIBC, KO Myung-Hun, 2021/01/18
- [PATCH 4/7] stdlib: putenv() needs a cast on OS/2 kLIBC, KO Myung-Hun, 2021/01/18
- [PATCH 5/7] zerosize-ptr: Fix compilation on OS/2 kLIBC,
KO Myung-Hun <=
- [PATCH 6/7] dirent: Redefine dirfd macro as a rpl function always, KO Myung-Hun, 2021/01/18
- [PATCH 3/7] stddef: Fix compilation for max_align_t on OS/2 kLIBC, KO Myung-Hun, 2021/01/18
- [PATCH 7/7] spawn-pipe: Fix SIGSEGV on OS/2 kLIBC, KO Myung-Hun, 2021/01/18
- Re: [PATCH 1/7] spawn: Use special invocation for <spawn.h> on OS/2 kLIBC, Bruno Haible, 2021/01/19