Re: Where is syscall.msync()?

207 views
Skip to first unread message

Kevin Gillette

unread,
Jul 20, 2012, 9:00:56 AM7/20/12
to golan...@googlegroups.com
In case it got overlooked, you can, in the meantime, call syscall.Syscall(syscall.SYS_MSYNC, ...)

On Wednesday, July 18, 2012 7:43:51 PM UTC-6, Rio wrote:
How do you call msync() for an mmap()-ed []byte then? 

Rio

unread,
Jul 23, 2012, 8:31:09 PM7/23/12
to golan...@googlegroups.com
This is what I got after learning about syscall.Syscall


func msync(b []byte, flag int) (err error) {
    var _p0 unsafe.Pointer
    if len(b) > 0 {
        _p0 = unsafe.Pointer(&b[0])
    } else {
        _p0 = unsafe.Pointer(&_zero)
    }
    _, _, e1 := syscall.Syscall(syscall.SYS_MSYNC,
        uintptr(_p0), uintptr(len(b)), uintptr(flag))
    if e1 != 0 {
        err = e1
    }
    return
}

Basically I followed the pattern in syscall.Madvise. I've no idea if I did it correctly. Any thought on this?

Jesse McNelis

unread,
Jul 23, 2012, 8:35:36 PM7/23/12
to m...@riobard.com, golan...@googlegroups.com
On Thu, Jul 19, 2012 at 11:43 AM, <m...@riobard.com> wrote:
> How do you call msync() for an mmap()-ed []byte then?

Perhaps this might be helpful.
http://labix.org/gommap

--
=====================
http://jessta.id.au
Reply all
Reply to author
Forward
0 new messages