mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
syscall: add Mmap, Munmap on Linux, FreeBSD, OS X
* tweak mksyscall*.pl to be more gofmt-compatible. * add mkall.sh -syscalls option. * add sys/mman.h constants on OS X R=r, eds, niemeyer CC=golang-dev https://golang.org/cl/4369044
This commit is contained in:
parent
c45a08e5ba
commit
48ae1f2d9b
22 changed files with 343 additions and 16 deletions
|
|
@ -98,6 +98,16 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, errno int)
|
|||
//sysnb Gettimeofday(tv *Timeval) (errno int)
|
||||
//sysnb Time(t *Time_t) (tt Time_t, errno int)
|
||||
|
||||
//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, errno int)
|
||||
|
||||
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, errno int) {
|
||||
page := uintptr(offset / 4096)
|
||||
if offset != int64(page)*4096 {
|
||||
return 0, EINVAL
|
||||
}
|
||||
return mmap2(addr, length, prot, flags, fd, page)
|
||||
}
|
||||
|
||||
// TODO(kaib): add support for tracing
|
||||
func (r *PtraceRegs) PC() uint64 { return 0 }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue