refactor: finding process and uid should to find with match process or uid rule, reduce memory allocation

This commit is contained in:
Skyxim
2022-06-14 22:50:57 +08:00
parent 277e71b26a
commit be298cfa16
3 changed files with 33 additions and 24 deletions

View File

@ -21,6 +21,7 @@ func (ps *Process) Match(metadata *C.Metadata) bool {
if ps.nameOnly {
return strings.EqualFold(metadata.Process, ps.process)
}
return strings.EqualFold(metadata.ProcessPath, ps.process)
}
@ -32,6 +33,10 @@ func (ps *Process) Payload() string {
return ps.process
}
func (ps *Process) ShouldFindProcess() bool {
return true
}
func NewProcess(process string, adapter string, nameOnly bool) (*Process, error) {
return &Process{
Base: &Base{},