mirror of
https://github.com/golang/go
synced 2024-11-19 16:24:45 -07:00
276a52de55
Currently the physical page size assumed by the runtime is hard-coded. On Linux the runtime at least fetches the OS page size during init and sanity checks against the hard-coded value, but they may still differ. On other OSes we wouldn't even notice. Add support on all OSes to fetch the actual OS physical page size during runtime init and lift the sanity check of PhysPageSize from the Linux init code to general malloc init. Currently this is the only use of the retrieved page size, but we'll add more shortly. Updates #12480 and #10180. Change-Id: I065f2834bc97c71d3208edc17fd990ec9058b6da Reviewed-on: https://go-review.googlesource.com/25050 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
22 lines
482 B
Go
22 lines
482 B
Go
// Copyright 2016 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
|
|
|
// Export guts for testing.
|
|
|
|
package runtime
|
|
|
|
var Mmap = mmap
|
|
var Munmap = munmap
|
|
|
|
const ENOMEM = _ENOMEM
|
|
const MAP_ANON = _MAP_ANON
|
|
const MAP_PRIVATE = _MAP_PRIVATE
|
|
const MAP_FIXED = _MAP_FIXED
|
|
|
|
func GetPhysPageSize() uintptr {
|
|
return physPageSize
|
|
}
|