Rename symbolyze.New -> symbolze.NewScanner

This commit is contained in:
Özgür Kesim 2020-01-16 00:13:03 +01:00
parent 80e5782a45
commit edd9212e89
2 changed files with 6 additions and 6 deletions

View File

@ -26,7 +26,7 @@ func main() {
fmt.Printf("Created eBPF map (FD: %d)\n", mapFD) fmt.Printf("Created eBPF map (FD: %d)\n", mapFD)
scanner := symbolyze.New(*symbol, *glob) scanner := symbolyze.NewScanner(*symbol, *glob)
scanner.OnFound(mapFD.Set) scanner.OnFound(mapFD.Set)
if *debug { if *debug {
scanner.DebugOn() scanner.DebugOn()

View File

@ -15,8 +15,8 @@ import (
// ELF-files matching a certain pattern. The pattern is described in // ELF-files matching a certain pattern. The pattern is described in
// fileapth.Match(). // fileapth.Match().
// //
// Once a Scanner is created with New(), it should be populated with Observer // Once a Scanner is created with NewScanner(), it should be populated with
// functions using OnFound(). Optionally, the scanner can be put into // Observer functions using OnFound(). Optionally, the scanner can be put into
// debugging mode by a call to DebugOn() prior to a call to Run(). // debugging mode by a call to DebugOn() prior to a call to Run().
// //
// A call to Scanner.Run() then starts the engine and it will scan all pids in // A call to Scanner.Run() then starts the engine and it will scan all pids in
@ -48,11 +48,11 @@ type logger = *log.Logger
// They have to be thread-safe. // They have to be thread-safe.
type Observer func(pid int, offset uint64) error type Observer func(pid int, offset uint64) error
// New returns a new Scanner that scans all running processes for the given // NewScanner returns a new Scanner that scans all running processes for the
// symbol name in all memory-mapped files matching the given pathglob. // given symbol name in all memory-mapped files matching the given pathglob.
// To be useful, one or more Observer functions should be registerd with // To be useful, one or more Observer functions should be registerd with
// Scanner.OnFound(). The scanning starts with a call of Scanner.Run(). // Scanner.OnFound(). The scanning starts with a call of Scanner.Run().
func New(symbol, pathglob string) *Scanner { func NewScanner(symbol, pathglob string) *Scanner {
return &Scanner{ return &Scanner{
symbol: symbol, symbol: symbol,
pathglob: pathglob, pathglob: pathglob,