mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 11:37:46 +00:00
syscall.Getpagesize(): add test, implement for Linux and Windows
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
//go:build windows || darwin || (linux && !baremetal)
|
||||
// +build windows darwin linux,!baremetal
|
||||
|
||||
package os_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetpagesize(t *testing.T) {
|
||||
pagesize := os.Getpagesize()
|
||||
if pagesize == 0x1000 || pagesize == 0x4000 || pagesize == 0x10000 {
|
||||
return
|
||||
}
|
||||
t.Errorf("os.Getpagesize() returns strange value %d", pagesize)
|
||||
}
|
||||
@@ -7,6 +7,11 @@
|
||||
|
||||
package os
|
||||
|
||||
import "syscall"
|
||||
|
||||
// Getpagesize returns the underlying system's memory page size.
|
||||
func Getpagesize() int { return syscall.Getpagesize() }
|
||||
|
||||
func (fs *fileStat) Name() string { return fs.name }
|
||||
func (fs *fileStat) IsDir() bool { return fs.Mode().IsDir() }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user