go.sys/unix: use "use" in syscall interface

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/144980043
This commit is contained in:
Rob Pike
2014-09-16 13:36:53 -07:00
parent c83757ae5b
commit c1f6f8bcc5
23 changed files with 773 additions and 96 deletions
+7
View File
@@ -21,6 +21,8 @@
// holds a value of type syscall.Errno.
package unix
import "unsafe"
// ByteSliceFromString returns a NUL-terminated slice of bytes
// containing the text of s. If s contains a NUL byte at any
// location, it returns (nil, EINVAL).
@@ -65,3 +67,8 @@ func (ts *Timespec) Nano() int64 {
func (tv *Timeval) Nano() int64 {
return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
}
// use is a no-op, but the compiler cannot see that it is.
// Calling use(p) ensures that p is kept live until that point.
//go:noescape
func use(p unsafe.Pointer)