-
Notifications
You must be signed in to change notification settings - Fork 0
/
proc_unix.go
71 lines (54 loc) · 1.68 KB
/
proc_unix.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//go:build linux || darwin
// +build linux darwin
package procmem
/*
UNIX Process Handler
*/
type process struct {
pid int
}
func NewProcess(pid int) Process {
return &process{
pid: pid,
}
}
func (p *process) Read(dst []byte, address uintptr, size uint64) (n int, err error) {
return Read(p.pid, dst, address, size)
}
func (p *process) ReadUint32(address uintptr) (uint32, error) {
return ReadUint32(p.pid, address)
}
func (p *process) ReadUint64(address uintptr) (uint64, error) {
return ReadUint64(p.pid, address)
}
func (p *process) ReadFloat32(address uintptr) (float32, error) {
return ReadFloat32(p.pid, address)
}
func (p *process) ReadFloat64(address uintptr) (float64, error) {
return ReadFloat64(p.pid, address)
}
func (p *process) ReadString(address uintptr, size uint64) (string, error) {
return ReadString(p.pid, address, size)
}
func (p *process) ReadGoString(address uintptr, size uint64) (string, error) {
return ReadGoString(p.pid, address, size)
}
func (p *process) Write(address uintptr, data []byte) error {
return Write(p.pid, address, data)
}
func (p *process) WriteUint32(address uintptr, value uint32) error {
return WriteUint32(p.pid, address, value)
}
func (p *process) WriteUint64(address uintptr, value uint64) error {
return WriteUint64(p.pid, address, value)
}
func (p *process) WriteString(address uintptr, value string) error {
return WriteString(p.pid, address, value)
}
func (p *process) WriteFloat32(address uintptr, value float32) error {
return WriteFloat32(p.pid, address, value)
}
func (p *process) WriteFloat64(address uintptr, value float64) error {
return WriteFloat64(p.pid, address, value)
}
func (p *process) Close() error { return nil }