1
0
mirror of https://github.com/golang/go synced 2024-10-04 16:21:22 -06:00
go/src/pkg/syscall/syscall_plan9_386.go
Akshat Kumar d2326febd5 syscall, runtime: Plan 9: use nanotime syscall on amd64
Separates the implementation of nanotime on 64-bit
version of Plan 9 from that on the 32-bit version.
The former uses a syscall.

R=rsc, rminnich, ality
CC=golang-dev
https://golang.org/cl/7379051
2013-02-26 01:56:08 +01:00

33 lines
655 B
Go

// Copyright 2009 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.
package syscall
func Getpagesize() int { return 0x1000 }
func nanotime() (nsec int64, err error) {
// TODO(paulzhol):
// avoid reopening a file descriptor for /dev/bintime on each call,
// use lower-level calls to avoid allocation.
var b [8]byte
nsec = -1
fd, err := Open("/dev/bintime", O_RDONLY)
if err != nil {
return
}
defer Close(fd)
if _, err = Pread(fd, b[:], 0); err != nil {
return
}
if nsec, err = DecodeBintime(b[:]); err != nil {
return -1, err
}
return
}