]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: Madvise and Mprotect for Linux.
authorAlbert Strasheim <fullung@gmail.com>
Thu, 21 Apr 2011 14:23:11 +0000 (10:23 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 21 Apr 2011 14:23:11 +0000 (10:23 -0400)
R=rsc
CC=golang-dev
https://golang.org/cl/4369047

src/pkg/syscall/syscall_linux.go
src/pkg/syscall/zsyscall_linux_386.go
src/pkg/syscall/zsyscall_linux_amd64.go
src/pkg/syscall/zsyscall_linux_arm.go

index 2b221bd60ad822fdadf91d404c7877e481b22c6d..e5f1e78d43daec4b1ed780eed095bc705c964973 100644 (file)
@@ -814,6 +814,9 @@ func Munmap(b []byte) (errno int) {
        return mapper.Munmap(b)
 }
 
+//sys  Madvise(b []byte, advice int) (errno int) 
+//sys  Mprotect(b []byte, prot int) (errno int) 
+
 /*
  * Unimplemented
  */
@@ -868,7 +871,6 @@ func Munmap(b []byte) (errno int) {
 // LookupDcookie
 // Lremovexattr
 // Lsetxattr
-// Madvise
 // Mbind
 // MigratePages
 // Mincore
index 83f3bade1363d3552a85a7479ce475929c534137..855e10e824fa7f3c3f23aec2bdf9cb4af236756d 100644 (file)
@@ -773,6 +773,34 @@ func munmap(addr uintptr, length uintptr) (errno int) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
+func Madvise(b []byte, advice int) (errno int) {
+       var _p0 unsafe.Pointer
+       if len(b) > 0 {
+               _p0 = unsafe.Pointer(&b[0])
+       } else {
+               _p0 = unsafe.Pointer(&_zero)
+       }
+       _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice))
+       errno = int(e1)
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func Mprotect(b []byte, prot int) (errno int) {
+       var _p0 unsafe.Pointer
+       if len(b) > 0 {
+               _p0 = unsafe.Pointer(&b[0])
+       } else {
+               _p0 = unsafe.Pointer(&_zero)
+       }
+       _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot))
+       errno = int(e1)
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Chown(path string, uid int, gid int) (errno int) {
        _, _, e1 := Syscall(SYS_CHOWN32, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(uid), uintptr(gid))
        errno = int(e1)
index c054349c6301cfd23f252c630b025d992d44df57..322be7e1d128a9c380bb3a583504dc46b90b5ead 100644 (file)
@@ -773,6 +773,34 @@ func munmap(addr uintptr, length uintptr) (errno int) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
+func Madvise(b []byte, advice int) (errno int) {
+       var _p0 unsafe.Pointer
+       if len(b) > 0 {
+               _p0 = unsafe.Pointer(&b[0])
+       } else {
+               _p0 = unsafe.Pointer(&_zero)
+       }
+       _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice))
+       errno = int(e1)
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func Mprotect(b []byte, prot int) (errno int) {
+       var _p0 unsafe.Pointer
+       if len(b) > 0 {
+               _p0 = unsafe.Pointer(&b[0])
+       } else {
+               _p0 = unsafe.Pointer(&_zero)
+       }
+       _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot))
+       errno = int(e1)
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func Chown(path string, uid int, gid int) (errno int) {
        _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(uid), uintptr(gid))
        errno = int(e1)
index 49d164a3c8316893e65fa065490b7db9bd6c2a4a..43b84d98c5d1ce56c4ae72b6834d78b0c2100de1 100644 (file)
@@ -773,6 +773,34 @@ func munmap(addr uintptr, length uintptr) (errno int) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
+func Madvise(b []byte, advice int) (errno int) {
+       var _p0 unsafe.Pointer
+       if len(b) > 0 {
+               _p0 = unsafe.Pointer(&b[0])
+       } else {
+               _p0 = unsafe.Pointer(&_zero)
+       }
+       _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice))
+       errno = int(e1)
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
+func Mprotect(b []byte, prot int) (errno int) {
+       var _p0 unsafe.Pointer
+       if len(b) > 0 {
+               _p0 = unsafe.Pointer(&b[0])
+       } else {
+               _p0 = unsafe.Pointer(&_zero)
+       }
+       _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot))
+       errno = int(e1)
+       return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
 func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, errno int) {
        r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
        fd = int(r0)