Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ksh supports multiple sources of heap memory. Completely disable the use of sbrk() as a memory source in favor of mmap(). This allows compilation on aarch64 (and presumably riscv64). Approved by: cy Differential Revision: https://reviews.freebsd.org/D37312
- Loading branch information
1 parent
1b29ddc
commit f9809df
Showing
2 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- src/lib/libast/vmalloc/vmbest.c.orig | ||
+++ src/lib/libast/vmalloc/vmbest.c | ||
@@ -1169,6 +1169,7 @@ | ||
} | ||
#endif /* _mem_win32 */ | ||
|
||
+#undef _mem_sbrk | ||
#if _mem_sbrk /* getting space via brk/sbrk - not concurrent-ready */ | ||
static Void_t* sbrkmem(Void_t* caddr, size_t csize, size_t nsize) | ||
{ | ||
@@ -1265,10 +1266,13 @@ | ||
} | ||
} | ||
else if(nsize == 0) | ||
- { Vmuchar_t *addr = (Vmuchar_t*)sbrk(0); | ||
+ { | ||
+#if 0 | ||
+ Vmuchar_t *addr = (Vmuchar_t*)sbrk(0); | ||
if(addr < (Vmuchar_t*)caddr ) /* in sbrk space */ | ||
return NIL(Void_t*); | ||
else | ||
+#endif | ||
{ (void)munmap(caddr, csize); | ||
return caddr; | ||
} |