mirror of https://github.com/golang/go.git
runtime: make mmap return 0 instead of -1 on aix/ppc64
Most of the platforms are returning 0 instead of -1 when mmap syscalls is failing. This patch corrects it for AIX in order to fix TestMmapErrorSign and to improve AIX compatibility. Change-Id: I1dad88d0e69163ad55c504b2b4a997892fd876cd Reviewed-on: https://go-review.googlesource.com/c/go/+/174297 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
fbc6a97222
commit
d5014ec05b
|
|
@ -436,8 +436,11 @@ func pipe(fd *int32) int32 {
|
|||
// by the assembly routine as 0.
|
||||
// The err result is an OS error code such as ENOMEM.
|
||||
//go:nosplit
|
||||
func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) (p unsafe.Pointer, err int) {
|
||||
func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) (unsafe.Pointer, int) {
|
||||
r, err0 := syscall6(&libc_mmap, uintptr(addr), uintptr(n), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(off))
|
||||
if r == ^uintptr(0) {
|
||||
return nil, int(err0)
|
||||
}
|
||||
return unsafe.Pointer(r), int(err0)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue