forked from jsonn/pkgsrc
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align previous patch with upstream trunk. Functionally, fix remains t…
…he same.
- Loading branch information
fhajny
committed
May 19, 2017
1 parent
fc40209
commit d26605e
Showing
2 changed files
with
21 additions
and
11 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 |
---|---|---|
@@ -1,25 +1,35 @@ | ||
$NetBSD: patch-src_runtime_mem__bsd.go,v 1.1 2017/05/02 17:15:31 fhajny Exp $ | ||
$NetBSD: patch-src_runtime_mem__bsd.go,v 1.2 2017/05/19 18:50:41 fhajny Exp $ | ||
|
||
Improve handling of low-memory situations on Illumos. | ||
https://github.com/joyent/pkgsrc/pull/493 | ||
runtime: mmap(2) on Solaris & Illumos can return EAGAIN | ||
https://github.com/golang/go/commit/13cdd814ea0e8ef165ab54802f9f102b8b690df7 | ||
|
||
--- src/runtime/mem_bsd.go.orig 2017-04-28 12:14:22.000000000 -0700 | ||
+++ src/runtime/mem_bsd.go 2017-04-28 12:14:31.000000000 -0700 | ||
@@ -76,7 +76,7 @@ | ||
This patch should be removed when we update to 1.9. | ||
|
||
--- src/runtime/mem_bsd.go.orig 2017-04-07 16:54:08.000000000 +0000 | ||
+++ src/runtime/mem_bsd.go | ||
@@ -59,6 +59,7 @@ func sysReserve(v unsafe.Pointer, n uint | ||
return p | ||
} | ||
|
||
+const _sunosEAGAIN = 11 | ||
const _ENOMEM = 12 | ||
|
||
func sysMap(v unsafe.Pointer, n uintptr, reserved bool, sysStat *uint64) { | ||
@@ -76,7 +77,7 @@ func sysMap(v unsafe.Pointer, n uintptr, | ||
flags |= _MAP_FIXED | ||
} | ||
p := mmap(v, n, _PROT_READ|_PROT_WRITE, flags, -1, 0) | ||
- if uintptr(p) == _ENOMEM { | ||
+ if uintptr(p) == _ENOMEM || (GOOS == "solaris" && uintptr(p) == _EAGAIN) { | ||
+ if uintptr(p) == _ENOMEM || (GOOS == "solaris" && uintptr(p) == _sunosEAGAIN) { | ||
throw("runtime: out of memory") | ||
} | ||
if p != v { | ||
@@ -87,7 +87,7 @@ | ||
@@ -87,7 +88,7 @@ func sysMap(v unsafe.Pointer, n uintptr, | ||
} | ||
|
||
p := mmap(v, n, _PROT_READ|_PROT_WRITE, _MAP_ANON|_MAP_FIXED|_MAP_PRIVATE, -1, 0) | ||
- if uintptr(p) == _ENOMEM { | ||
+ if uintptr(p) == _ENOMEM || (GOOS == "solaris" && uintptr(p) == _EAGAIN) { | ||
+ if uintptr(p) == _ENOMEM || (GOOS == "solaris" && uintptr(p) == _sunosEAGAIN) { | ||
throw("runtime: out of memory") | ||
} | ||
if p != v { |