mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: wrap nanotime, walltime, and write
In preparation for general faketime support, this renames the existing nanotime, walltime, and write functions to nanotime1, walltime1, and write1 and wraps them with trivial Go functions. This will let us inject different implementations on all platforms when faketime is enabled. Updates #30439. Change-Id: Ice5ccc513a32a6d89ea051638676d3ee05b00418 Reviewed-on: https://go-review.googlesource.com/c/go/+/192738 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
6719d889e1
commit
4af3c17f8c
43 changed files with 164 additions and 133 deletions
|
|
@ -393,11 +393,11 @@ func munmap(addr unsafe.Pointer, n uintptr) {
|
|||
sysvicall2(&libc_munmap, uintptr(addr), uintptr(n))
|
||||
}
|
||||
|
||||
func nanotime1()
|
||||
func nanotime2()
|
||||
|
||||
//go:nosplit
|
||||
func nanotime() int64 {
|
||||
return int64(sysvicall0((*libcFunc)(unsafe.Pointer(funcPC(nanotime1)))))
|
||||
func nanotime1() int64 {
|
||||
return int64(sysvicall0((*libcFunc)(unsafe.Pointer(funcPC(nanotime2)))))
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
|
|
@ -499,7 +499,7 @@ func usleep(µs uint32) {
|
|||
}
|
||||
|
||||
//go:nosplit
|
||||
func write(fd uintptr, buf unsafe.Pointer, nbyte int32) int32 {
|
||||
func write1(fd uintptr, buf unsafe.Pointer, nbyte int32) int32 {
|
||||
return int32(sysvicall3(&libc_write, uintptr(fd), uintptr(buf), uintptr(nbyte)))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue