Cleanup of the comments
This commit is contained in:
parent
3672fd455b
commit
de5bcf9913
@ -44,14 +44,14 @@ type Scanner struct {
|
||||
// Scanner without exporting it.
|
||||
type logger = *log.Logger
|
||||
|
||||
// An Observer is a callback that can be registerd with Scanner.OnFound. It
|
||||
// An Observer is a callback that can be registered with Scanner.OnFound. It
|
||||
// will be called with a pid and an offset. Observers are called concurrently.
|
||||
// They have to be thread-safe.
|
||||
type Observer func(pid int, offset uint64) error
|
||||
|
||||
// NewScanner returns a new Scanner that scans all running processes for the
|
||||
// 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 registered with
|
||||
// Scanner.OnFound(). The scanning starts with a call of Scanner.Run().
|
||||
func NewScanner(symbol, pathglob string) *Scanner {
|
||||
return &Scanner{
|
||||
@ -67,8 +67,8 @@ func NewScanner(symbol, pathglob string) *Scanner {
|
||||
}
|
||||
}
|
||||
|
||||
// Debug sets the scanner into debugging mode. It must called only once before
|
||||
// a call to Scanner.Run().
|
||||
// Debug sets the scanner into debugging mode. It must be called only once
|
||||
// before a call to Scanner.Run().
|
||||
func (S *Scanner) DebugOn() {
|
||||
// Use the embedded *log.Logger for debugging.
|
||||
S.debugf = S.Printf
|
||||
@ -77,15 +77,15 @@ func (S *Scanner) DebugOn() {
|
||||
}
|
||||
|
||||
// setErrorf puts the Scanner into an error state with the given error
|
||||
// statement. It also logs the error.
|
||||
// statement. It also logs the error. setErrorf is not thread-safe.
|
||||
func (S *Scanner) setErrorf(format string, a ...interface{}) {
|
||||
S.err = fmt.Errorf(format, a...)
|
||||
S.Printf(format, a...)
|
||||
}
|
||||
|
||||
// OnFound puts an Observer function into the interal queue. The functions are
|
||||
// called in sequence in their own goroutine whenever the scanner finds the
|
||||
// symbol in the a running program. That implies that an Observer has to be
|
||||
// OnFound puts an Observer function into the internal queue. The functions
|
||||
// are called in sequence in their own goroutine whenever the scanner finds the
|
||||
// symbol in a running program. That implies that an Observer has to be
|
||||
// thread-safe. Errors from the observers will be logged.
|
||||
//
|
||||
// Calling OnFound is not thread-safe.
|
||||
@ -94,10 +94,10 @@ func (S *Scanner) OnFound(fun Observer) {
|
||||
return
|
||||
}
|
||||
|
||||
// Run starts the scanning process. It scans the maps file all processes in
|
||||
// /proc for pathnames that match the provided pathglob and that are ELF
|
||||
// executables or shared libraries. It searches for the provided symbol in
|
||||
// those files and calls the registered Observer functions concurrently with
|
||||
// Run starts the scanning process. It scans the entries of all /proc/NNN/maps
|
||||
// files for pathnames that match the provided path-glob and are executables or
|
||||
// shared libraries in ELF formmat. It searches for the provided symbol in
|
||||
// those files and calls the registered Observer functions, concurrently, with
|
||||
// the pid and offset of the symbol.
|
||||
//
|
||||
// Run will return an error if it couldn't read the proc filesystem. Otherwise
|
||||
|
Loading…
Reference in New Issue
Block a user