github.com/eh-steve/goloader@v0.0.0-20240111193454-90ff3cfdae39/mmap/zsyscall_solaris.go (about) 1 //go:build solaris 2 // +build solaris 3 4 package mmap 5 6 import ( 7 "syscall" 8 "unsafe" 9 ) 10 11 type libcFunc uintptr 12 13 //go:linkname libc_mmap libc_mmap 14 //go:linkname libc_munmap libc_munmap 15 16 var libc_mmap, 17 libc_munmap libcFunc 18 19 func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) 20 21 func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { 22 r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc_mmap)), 6, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) 23 ret = uintptr(r0) 24 if e1 != 0 { 25 err = errnoErr(e1) 26 } 27 return 28 } 29 30 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT 31 32 func munmap(addr uintptr, length uintptr) (err error) { 33 _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc_munmap)), 2, uintptr(addr), uintptr(length), 0, 0, 0, 0) 34 if e1 != 0 { 35 err = errnoErr(e1) 36 } 37 return 38 }