Commit b8ca6dd5 authored by Tobias Klauser's avatar Tobias Klauser Committed by Ian Lance Taylor

unix: add Msync function on Solaris

Add the Msync function on solaris/amd64.

Change-Id: Idde0f9e693f924fef471acb42afb84e83c4cee76
Reviewed-on: https://go-review.googlesource.com/64370Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 062cd7e4
......@@ -612,6 +612,7 @@ func IoctlGetTermio(fd int, req uint) (*Termio, error) {
//sys Mlock(b []byte) (err error)
//sys Mlockall(flags int) (err error)
//sys Mprotect(b []byte, prot int) (err error)
//sys Msync(b []byte, flags int) (err error)
//sys Munlock(b []byte) (err error)
//sys Munlockall() (err error)
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
......
......@@ -75,6 +75,7 @@ import (
//go:cgo_import_dynamic libc_mlock mlock "libc.so"
//go:cgo_import_dynamic libc_mlockall mlockall "libc.so"
//go:cgo_import_dynamic libc_mprotect mprotect "libc.so"
//go:cgo_import_dynamic libc_msync msync "libc.so"
//go:cgo_import_dynamic libc_munlock munlock "libc.so"
//go:cgo_import_dynamic libc_munlockall munlockall "libc.so"
//go:cgo_import_dynamic libc_nanosleep nanosleep "libc.so"
......@@ -195,6 +196,7 @@ import (
//go:linkname procMlock libc_mlock
//go:linkname procMlockall libc_mlockall
//go:linkname procMprotect libc_mprotect
//go:linkname procMsync libc_msync
//go:linkname procMunlock libc_munlock
//go:linkname procMunlockall libc_munlockall
//go:linkname procNanosleep libc_nanosleep
......@@ -316,6 +318,7 @@ var (
procMlock,
procMlockall,
procMprotect,
procMsync,
procMunlock,
procMunlockall,
procNanosleep,
......@@ -1017,6 +1020,18 @@ func Mprotect(b []byte, prot int) (err error) {
return
}
func Msync(b []byte, flags int) (err error) {
var _p0 *byte
if len(b) > 0 {
_p0 = &b[0]
}
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procMsync)), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(flags), 0, 0, 0)
if e1 != 0 {
err = e1
}
return
}
func Munlock(b []byte) (err error) {
var _p0 *byte
if len(b) > 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment