diff options
author | Wim <wim@42.be> | 2022-03-19 22:04:13 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2022-03-20 14:57:48 +0100 |
commit | 2623a412c42a81104b97ae8c81a5f66760fee4b6 (patch) | |
tree | 502c6d4473baac3792d14fda51dbb56179f19424 /vendor/modernc.org/memory/mmap_unix.go | |
parent | d64eed49bc6f2e8a01f922727795eea158cbc56d (diff) | |
download | matterbridge-msglm-2623a412c42a81104b97ae8c81a5f66760fee4b6.tar.gz matterbridge-msglm-2623a412c42a81104b97ae8c81a5f66760fee4b6.tar.bz2 matterbridge-msglm-2623a412c42a81104b97ae8c81a5f66760fee4b6.zip |
Update vendor (whatsapp)
Diffstat (limited to 'vendor/modernc.org/memory/mmap_unix.go')
-rw-r--r-- | vendor/modernc.org/memory/mmap_unix.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/vendor/modernc.org/memory/mmap_unix.go b/vendor/modernc.org/memory/mmap_unix.go index 8fee87e6..d076ad03 100644 --- a/vendor/modernc.org/memory/mmap_unix.go +++ b/vendor/modernc.org/memory/mmap_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE-MMAP-GO file. +//go:build darwin || dragonfly || freebsd || linux || openbsd || solaris || netbsd // +build darwin dragonfly freebsd linux openbsd solaris netbsd // Modifications (c) 2017 The Memory Authors. @@ -11,7 +12,6 @@ package memory // import "modernc.org/memory" import ( "os" "syscall" - "unsafe" ) const pageSizeLog = 20 @@ -33,13 +33,17 @@ func unmap(addr uintptr, size int) error { // pageSize aligned. func mmap(size int) (uintptr, int, error) { size = roundup(size, osPageSize) - b, err := syscall.Mmap(-1, 0, size+pageSize, syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_SHARED|syscall.MAP_ANON) + // The actual mmap syscall varies by architecture. mmapSyscall provides same + // functionality as the unexported funtion syscall.mmap and is declared in + // mmap_*_*.go and mmap_fallback.go. To add support for a new architecture, + // check function mmap in src/syscall/syscall_*_*.go or + // src/syscall/zsyscall_*_*.go in Go's source code. + p, err := mmapSyscall(0, uintptr(size+pageSize), syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_PRIVATE|syscall.MAP_ANON, -1, 0) if err != nil { return 0, 0, err } - n := len(b) - p := uintptr(unsafe.Pointer(&b[0])) + n := size + pageSize if p&uintptr(osPageMask) != 0 { panic("internal error") } |