Documentation ¶
Overview ¶
Package libspector provides query functions for finding installed libraries and libraries used by active processes.
This functionality is implemented by running various platform-native commands, concurrency safety is not implemented.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoPackage = errors.New("no package provided")
Functions ¶
func IsParseError ¶
Types ¶
type Library ¶
type Library interface { // Path returns the absolute path of the library on the filesystem. Path() string // Ctime returns the last ctime of the library on the filesystem. Ctime() (time.Time, error) // Outdated returns whether Process was started earlier than the Ctime time of this library. Outdated(Process) bool // Distribution package manager's dependency that owns this library. Package() (Package, error) }
Library is a file representing a dynamically linked library or shared object.
func FindLibrary ¶
FindLibrary uses `dpkg -S` to find libraries with the given path substring.
type Package ¶
type Package interface { // Name of the package. Name() string // Version of the package installed. Version() string }
Package that is managed by the distribution's package manager.
type ParseError ¶
func (*ParseError) Error ¶
func (err *ParseError) Error() string
type Process ¶
type Process interface { // PID returns the process ID. PID() int // Started returns the time when the process was started, if it's still running. Started() (time.Time, error) // Find libraries used by this process Libraries() ([]Library, error) // Command line used to start the process CommandArgs() (string, error) CommandName() (string, error) }
Process is a currently-running process.
func AllProcesses ¶
func FindProcess ¶
FindProcess uses `pgrep` to find all processes that match a command.
func ProcessByPID ¶
type Query ¶
type Query interface { // AllProcesses returns all the running processes on the system. AllProcesses() ([]Process, error) // FindProcess finds all running processes that match the command substring. FindProcess(command string) ([]Process, error) // FindLibrary finds all the installed libraries that match the path substring. FindLibrary(path string) ([]Library, error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.