mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-31 22:36:44 -04:00
unix: add ProcessVMReadv and ProcessVMWritev on linux
These are Linux-specific system calls for efficiently reading and writing memory in foreign processes. A new RemoteIovec type is added for use in these wrappers, as Iovec's Base field is a pointer, and creating invalid pointers is invalid in Go. Change-Id: I329501ab7b4df9d0aebe289369d3a5f77120af02 GitHub-Last-Rev: 262aabed02cc1f604e85fa1b4be1b874c57bd666 GitHub-Pull-Request: golang/sys#74 Reviewed-on: https://go-review.googlesource.com/c/sys/+/243497 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Ian Lance Taylor
parent
ddb9806d33
commit
cb9d2d5c56
@@ -2122,6 +2122,18 @@ func Klogset(typ int, arg int) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoteIovec is Iovec with the pointer replaced with an integer.
|
||||
// It is used for ProcessVMReadv and ProcessVMWritev, where the pointer
|
||||
// refers to a location in a different process' address space, which
|
||||
// would confuse the Go garbage collector.
|
||||
type RemoteIovec struct {
|
||||
Base uintptr
|
||||
Len int
|
||||
}
|
||||
|
||||
//sys ProcessVMReadv(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_READV
|
||||
//sys ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_WRITEV
|
||||
|
||||
/*
|
||||
* Unimplemented
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user