Source file src/crypto/internal/entropy/scratch/scratch_linux.go
1 // Copyright 2026 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package scratch 6 7 import "syscall" 8 9 func mmap(n int) ([]byte, error) { 10 // MAP_POPULATE faults in all the pages at once, which is much faster than 11 // faulting them in one at a time as they are first accessed. 12 return syscall.Mmap(-1, 0, n, syscall.PROT_READ|syscall.PROT_WRITE, 13 syscall.MAP_ANON|syscall.MAP_PRIVATE|syscall.MAP_POPULATE) 14 } 15 16 func munmap(b []byte) { 17 syscall.Munmap(b) 18 } 19