summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Symonds <dsymonds@golang.org>2009-06-03 03:25:34 -0700
committerDavid Symonds <dsymonds@golang.org>2009-06-03 03:25:34 -0700
commit7a210d5c0a36df701c0c05b5bbf7296a83b3a99f (patch)
tree4881b78388ec48cdfb6e7c81311af7a15d03e0e1
parentb337a565d72307239e5b79d28ffc7a44f45ff007 (diff)
downloadgolang-7a210d5c0a36df701c0c05b5bbf7296a83b3a99f.tar.gz
Define os.PageSize and syscall.PageSize.
R=rsc APPROVED=rsc DELTA=13 (13 added, 0 deleted, 0 changed) OCL=29429 CL=29819
-rw-r--r--src/lib/os/types.go5
-rw-r--r--src/lib/syscall/syscall_darwin_amd64.go4
-rw-r--r--src/lib/syscall/syscall_linux_amd64.go4
3 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/os/types.go b/src/lib/os/types.go
index 73363f453..b5db86660 100644
--- a/src/lib/os/types.go
+++ b/src/lib/os/types.go
@@ -9,6 +9,11 @@ import "syscall"
// An operating-system independent representation of Unix data structures.
// OS-specific routines in this directory convert the OS-local versions to these.
+// Getpagesize returns the underlying system's memory page size.
+func Getpagesize() int{
+ return syscall.Getpagesize()
+}
+
// A Dir describes a file and is returned by Stat, Fstat, and Lstat
type Dir struct {
Dev uint64; // device number of file system holding file.
diff --git a/src/lib/syscall/syscall_darwin_amd64.go b/src/lib/syscall/syscall_darwin_amd64.go
index 31e91cda3..862023223 100644
--- a/src/lib/syscall/syscall_darwin_amd64.go
+++ b/src/lib/syscall/syscall_darwin_amd64.go
@@ -6,6 +6,10 @@ package syscall
import "syscall"
+func Getpagesize() int {
+ return 4096
+}
+
func TimespecToNsec(ts Timespec) int64 {
return int64(ts.Sec)*1e9 + int64(ts.Nsec);
}
diff --git a/src/lib/syscall/syscall_linux_amd64.go b/src/lib/syscall/syscall_linux_amd64.go
index 8b3404d3e..24426405b 100644
--- a/src/lib/syscall/syscall_linux_amd64.go
+++ b/src/lib/syscall/syscall_linux_amd64.go
@@ -6,6 +6,10 @@ package syscall
import "syscall"
+func Getpagesize() int {
+ return 4096
+}
+
func TimespecToNsec(ts Timespec) int64 {
return int64(ts.Sec)*1e9 + int64(ts.Nsec);
}