mirror of
https://github.com/golang/go
synced 2024-11-25 07:07:57 -07:00
syscall: move bsd mmap syscall
The mmap system call varies across BSDs. Move mmap and munmap into the operating system dependent files. This will be needed to add syscall support for OpenBSD. R=rsc CC=golang-dev https://golang.org/cl/4822056
This commit is contained in:
parent
f6fab25582
commit
68fea34be3
@ -612,9 +612,6 @@ func Futimes(fd int, tv []Timeval) (errno int) {
|
|||||||
// Msync(addr *byte, len int, flags int) (errno int)
|
// Msync(addr *byte, len int, flags int) (errno int)
|
||||||
// Ptrace(req int, pid int, addr uintptr, data int) (ret uintptr, errno int)
|
// Ptrace(req int, pid int, addr uintptr, data int) (ret uintptr, errno int)
|
||||||
|
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, errno int)
|
|
||||||
//sys munmap(addr uintptr, length uintptr) (errno int)
|
|
||||||
|
|
||||||
var mapper = &mmapper{
|
var mapper = &mmapper{
|
||||||
active: make(map[*byte][]byte),
|
active: make(map[*byte][]byte),
|
||||||
mmap: mmap,
|
mmap: mmap,
|
||||||
|
@ -166,6 +166,8 @@ func Kill(pid int, signum int) (errno int) { return kill(pid, signum, 1) }
|
|||||||
//sys Unlink(path string) (errno int)
|
//sys Unlink(path string) (errno int)
|
||||||
//sys Unmount(path string, flags int) (errno int)
|
//sys Unmount(path string, flags int) (errno int)
|
||||||
//sys Write(fd int, p []byte) (n int, errno int)
|
//sys Write(fd int, p []byte) (n int, errno int)
|
||||||
|
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, errno int)
|
||||||
|
//sys munmap(addr uintptr, length uintptr) (errno int)
|
||||||
//sys read(fd int, buf *byte, nbuf int) (n int, errno int)
|
//sys read(fd int, buf *byte, nbuf int) (n int, errno int)
|
||||||
//sys write(fd int, buf *byte, nbuf int) (n int, errno int)
|
//sys write(fd int, buf *byte, nbuf int) (n int, errno int)
|
||||||
|
|
||||||
|
@ -155,6 +155,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno
|
|||||||
//sys Unlink(path string) (errno int)
|
//sys Unlink(path string) (errno int)
|
||||||
//sys Unmount(path string, flags int) (errno int)
|
//sys Unmount(path string, flags int) (errno int)
|
||||||
//sys Write(fd int, p []byte) (n int, errno int)
|
//sys Write(fd int, p []byte) (n int, errno int)
|
||||||
|
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, errno int)
|
||||||
|
//sys munmap(addr uintptr, length uintptr) (errno int)
|
||||||
//sys read(fd int, buf *byte, nbuf int) (n int, errno int)
|
//sys read(fd int, buf *byte, nbuf int) (n int, errno int)
|
||||||
//sys write(fd int, buf *byte, nbuf int) (n int, errno int)
|
//sys write(fd int, buf *byte, nbuf int) (n int, errno int)
|
||||||
|
|
||||||
|
@ -209,23 +209,6 @@ func fcntl(fd int, cmd int, arg int) (val int, errno int) {
|
|||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, errno int) {
|
|
||||||
r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0)
|
|
||||||
ret = uintptr(r0)
|
|
||||||
errno = int(e1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func munmap(addr uintptr, length uintptr) (errno int) {
|
|
||||||
_, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
|
|
||||||
errno = int(e1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (errno int) {
|
func ptrace(request int, pid int, addr uintptr, data uintptr) (errno int) {
|
||||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||||
errno = int(e1)
|
errno = int(e1)
|
||||||
@ -950,6 +933,23 @@ func Write(fd int, p []byte) (n int, errno int) {
|
|||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, errno int) {
|
||||||
|
r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0)
|
||||||
|
ret = uintptr(r0)
|
||||||
|
errno = int(e1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func munmap(addr uintptr, length uintptr) (errno int) {
|
||||||
|
_, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
|
||||||
|
errno = int(e1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func read(fd int, buf *byte, nbuf int) (n int, errno int) {
|
func read(fd int, buf *byte, nbuf int) (n int, errno int) {
|
||||||
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
|
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
|
@ -209,23 +209,6 @@ func fcntl(fd int, cmd int, arg int) (val int, errno int) {
|
|||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, errno int) {
|
|
||||||
r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos))
|
|
||||||
ret = uintptr(r0)
|
|
||||||
errno = int(e1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func munmap(addr uintptr, length uintptr) (errno int) {
|
|
||||||
_, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
|
|
||||||
errno = int(e1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (errno int) {
|
func ptrace(request int, pid int, addr uintptr, data uintptr) (errno int) {
|
||||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||||
errno = int(e1)
|
errno = int(e1)
|
||||||
@ -950,6 +933,23 @@ func Write(fd int, p []byte) (n int, errno int) {
|
|||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, errno int) {
|
||||||
|
r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos))
|
||||||
|
ret = uintptr(r0)
|
||||||
|
errno = int(e1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func munmap(addr uintptr, length uintptr) (errno int) {
|
||||||
|
_, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
|
||||||
|
errno = int(e1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func read(fd int, buf *byte, nbuf int) (n int, errno int) {
|
func read(fd int, buf *byte, nbuf int) (n int, errno int) {
|
||||||
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
|
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
|
@ -209,23 +209,6 @@ func fcntl(fd int, cmd int, arg int) (val int, errno int) {
|
|||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, errno int) {
|
|
||||||
r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0)
|
|
||||||
ret = uintptr(r0)
|
|
||||||
errno = int(e1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func munmap(addr uintptr, length uintptr) (errno int) {
|
|
||||||
_, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
|
|
||||||
errno = int(e1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func pipe() (r int, w int, errno int) {
|
func pipe() (r int, w int, errno int) {
|
||||||
r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
|
r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
|
||||||
r = int(r0)
|
r = int(r0)
|
||||||
@ -942,6 +925,23 @@ func Write(fd int, p []byte) (n int, errno int) {
|
|||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, errno int) {
|
||||||
|
r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0)
|
||||||
|
ret = uintptr(r0)
|
||||||
|
errno = int(e1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func munmap(addr uintptr, length uintptr) (errno int) {
|
||||||
|
_, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
|
||||||
|
errno = int(e1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func read(fd int, buf *byte, nbuf int) (n int, errno int) {
|
func read(fd int, buf *byte, nbuf int) (n int, errno int) {
|
||||||
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
|
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
|
@ -209,23 +209,6 @@ func fcntl(fd int, cmd int, arg int) (val int, errno int) {
|
|||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, errno int) {
|
|
||||||
r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos))
|
|
||||||
ret = uintptr(r0)
|
|
||||||
errno = int(e1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func munmap(addr uintptr, length uintptr) (errno int) {
|
|
||||||
_, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
|
|
||||||
errno = int(e1)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func pipe() (r int, w int, errno int) {
|
func pipe() (r int, w int, errno int) {
|
||||||
r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
|
r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0)
|
||||||
r = int(r0)
|
r = int(r0)
|
||||||
@ -942,6 +925,23 @@ func Write(fd int, p []byte) (n int, errno int) {
|
|||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, errno int) {
|
||||||
|
r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos))
|
||||||
|
ret = uintptr(r0)
|
||||||
|
errno = int(e1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func munmap(addr uintptr, length uintptr) (errno int) {
|
||||||
|
_, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
|
||||||
|
errno = int(e1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func read(fd int, buf *byte, nbuf int) (n int, errno int) {
|
func read(fd int, buf *byte, nbuf int) (n int, errno int) {
|
||||||
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
|
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
|
Loading…
Reference in New Issue
Block a user