summaryrefslogtreecommitdiffstats
path: root/src/global.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/global.go')
-rw-r--r--src/global.go40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/global.go b/src/global.go
index c3001ab..3ddbc79 100644
--- a/src/global.go
+++ b/src/global.go
@@ -5,23 +5,35 @@ import (
5 "time" 5 "time"
6) 6)
7 7
8type eventType int
9
10const (
11 NEWPID eventType = iota
12 PIDEXIT
13 FILEOPEN
14 FILEWRITE
15 TYPENUM
16)
17
8type Event struct { 18type Event struct {
9 timestamp time.Time 19 tag eventType
10 pid, ppid int 20 timestamp time.Time
11 syscall int 21 pid, ppid int
12 exit_code uint64 22 syscall int
13 argc int 23 exit_code uint64
14 argv []string 24 argc int
15 cwd string 25 argv []string
26 cwd string
27 syscallParam [4]uint64
28 pathName string
16} 29}
17 30
18type process struct { 31func (et eventType) String() string {
19 timestamp time.Time 32 names := []string{"newPid", "pidExit", "open", "write", "typeNum"}
20 pid, ppid int 33 if et < NEWPID || et > TYPENUM {
21 argv []string 34 return "Unknown"
22 cwd string 35 }
23 rootfs string 36 return names[et]
24 children []int
25} 37}
26 38
27var wg sync.WaitGroup // 掌管协程 39var wg sync.WaitGroup // 掌管协程